[bugfix] fix some symlink issues
This commit is contained in:
parent
17c510b88c
commit
39b8219a26
|
@ -25,4 +25,4 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/zathura ~/.config/zathura
|
||||
lnsf $DIR/config/zathura $XDG_CONFIG_HOME/zathura
|
||||
|
|
0
bak/config/polybar/launch.sh
Normal file → Executable file
0
bak/config/polybar/launch.sh
Normal file → Executable file
0
bak/config/sxhkd/launch.sh
Normal file → Executable file
0
bak/config/sxhkd/launch.sh
Normal file → Executable file
|
@ -16,7 +16,8 @@ case "$PM" in
|
|||
if [ "$DISTRIB_RELEASE" = "18.04" ] && [ "$(uname -m)" = 'x86_64' ]; then
|
||||
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
|
||||
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
|
||||
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
|
||||
sudo apt-key adv --fetch-keys \
|
||||
https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
|
||||
sudo add-apt-repository "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
|
||||
sudo apt-get update
|
||||
sudo apt-get -y install cuda
|
||||
|
@ -28,7 +29,8 @@ case "$PM" in
|
|||
fi
|
||||
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
|
||||
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
|
||||
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
|
||||
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | \
|
||||
sudo tee /etc/apt/sources.list.d/nvidia-docker.list
|
||||
sudo apt update
|
||||
sudo apt install -y nvidia-docker2
|
||||
;;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/home/klesh/dotfiles/dunst/config
|
|
@ -14,4 +14,5 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config ~/.config/dunst
|
||||
lnsf $DIR/config/dunstrc $XDG_CONFIG_HOME/dunst/dunstrc
|
||||
lnsf $DIR/config/launch.sh $XDG_CONFIG_HOME/dunst/launch.sh
|
||||
|
|
27
env.sh
27
env.sh
|
@ -5,6 +5,7 @@ ROOT=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))
|
|||
PM=n/a
|
||||
DEFAULT_SHELL=$(getent passwd $USER | cut -d: -f7)
|
||||
FISH=$(which fish)
|
||||
XDG_CONFIG_HOME=${XDG_CONFIG_HOME-"$HOME/.config"}
|
||||
|
||||
if which pacman > /dev/null; then
|
||||
PM=pacman
|
||||
|
@ -29,14 +30,17 @@ in-china () {
|
|||
}
|
||||
|
||||
lnsf () {
|
||||
[ "$#" -ne 2 ] && echo "lnsf <src> <symlink>"
|
||||
[ ! -L "$2" ] && rm -rf $2
|
||||
SYM_DIR=$(dirname $2)
|
||||
if [ -n "$SYM_DIR" ]; then
|
||||
[ ! -d "$SYM_DIR" ] && rm -rf "$SYM_DIR"
|
||||
mkdir -p "$SYM_DIR"
|
||||
[ "$#" -ne 2 ] && echo "lnsf <target> <symlink>" && return -1
|
||||
local TARGET=$(readlink -f $1)
|
||||
local SYMLNK=$2
|
||||
[ -z "$TARGET" ] && echo "$1 not exists" && return -1
|
||||
local SYMDIR=$(dirname $SYMLNK)
|
||||
if [ -n "$SYMDIR" ] && [ -L $SYMDIR ]; then
|
||||
rm -rf $SYMDIR
|
||||
mkdir -p $SYMDIR
|
||||
fi
|
||||
ln -sf $1 $2
|
||||
[ ! -L $SYMLNK ] && rm -rf $SYMLNK
|
||||
ln -sf $TARGET $SYMLNK
|
||||
}
|
||||
|
||||
fish-is-default-shell () {
|
||||
|
@ -47,6 +51,14 @@ has-bluetooth () {
|
|||
dmesg | grep -i bluetooth
|
||||
}
|
||||
|
||||
eqv () {
|
||||
local VERSION_PATH=$1
|
||||
local VERSION=$2
|
||||
[ ! -f $VERSION_PATH ] && return -1
|
||||
local VERSION2=$(cat "$VERSION_PATH")
|
||||
[ "$VERSION" = "$VERSION2" ]
|
||||
}
|
||||
|
||||
|
||||
# install basic common utilities
|
||||
case "$PM" in
|
||||
|
@ -69,3 +81,4 @@ case "$PM" in
|
|||
man sudo
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
set -gx EDITOR vim
|
||||
#!/usr/bin/env fish
|
||||
|
||||
set -gx EDITOR nvim
|
||||
set -gx PGDATA /usr/local/var/postgres
|
||||
set -gx LESS "-SRXF"
|
||||
set -gx LS_COLORS 'ow=34;42;40'
|
||||
|
|
|
@ -24,11 +24,10 @@ if ! fish-is-default-shell; then
|
|||
fi
|
||||
|
||||
# symlink config
|
||||
[ -L ~/.config/fish ] && rm -rf ~/.config/fish
|
||||
[ -L $XDG_CONFIG_HOME/fish ] && rm -rf $XDG_CONFIG_HOME/fish
|
||||
|
||||
lnsf $DIR/config/config.fish ~/.config/fish/config.fish
|
||||
lnsf $DIR/config/functions/fish_prompt.fish ~/.config/fish/functions/fish_prompt.fish
|
||||
lnsf $DIR/config/functions/fish_right_prompt.fish ~/.config/fish/functions/fish_right_prompt.fish
|
||||
lnsf $DIR/config/functions/fisher.fish ~/.config/fish/functions/fisher.fish
|
||||
lnsf $DIR/config/config.fish $XDG_CONFIG_HOME/fish/config.fish
|
||||
lnsf $DIR/config/functions/fish_prompt.fish $XDG_CONFIG_HOME/fish/functions/fish_prompt.fish
|
||||
lnsf $DIR/config/functions/fish_right_prompt.fish $XDG_CONFIG_HOME/fish/functions/fish_right_prompt.fish
|
||||
lnsf $DIR/config/functions/fisher.fish $XDG_CONFIG_HOME/fish/functions/fisher.fish
|
||||
|
||||
source ~/.config/fish/config.fish
|
||||
|
|
|
@ -11,7 +11,7 @@ case "$PM" in
|
|||
fonts-cascadia-code \
|
||||
ttf-dejavu \
|
||||
fonts-urw-base35 \
|
||||
fonts-noto-cjk \
|
||||
fonts-wqy-microhei \
|
||||
gucharmap
|
||||
# network manager
|
||||
sudo apt install \
|
||||
|
@ -31,7 +31,7 @@ case "$PM" in
|
|||
freetype2 \
|
||||
ttf-cascadia-code \
|
||||
ttf-dejavu \
|
||||
noto-fonts-cjk \
|
||||
wqy-microhei \
|
||||
gucharmap
|
||||
# clipboard
|
||||
sudo pacman -S --needed \
|
||||
|
|
|
@ -16,5 +16,5 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# configuration
|
||||
lnsf $DIR/config/gtk-3.0/settings.ini ~/.config/gtk-3.0/settings.ini
|
||||
lnsf $DIR/config/qt5ct/qt5ct.conf ~/.config/qt5ct/qt5ct.conf
|
||||
lnsf $DIR/config/gtk-3.0/settings.ini $XDG_CONFIG_HOME/gtk-3.0/settings.ini
|
||||
lnsf $DIR/config/qt5ct/qt5ct.conf $XDG_CONFIG_HOME/qt5ct/qt5ct.conf
|
||||
|
|
|
@ -19,5 +19,5 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/init.vim ~/.config/nvim/init.vim
|
||||
lnsf $DIR/config/init.vim $XDG_CONFIG_HOME/nvim/init.vim
|
||||
lnsf $DIR/config/init.vim ~/.vimrc
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/home/klesh/dotfiles/picom/config
|
|
@ -20,14 +20,23 @@ case "$PM" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# build and install picom-next
|
||||
curl 'https://github.com/yshui/picom/archive/next.zip' -sLo /tmp/picom-next.zip
|
||||
unzip /tmp/picom-next.zip -d /tmp
|
||||
pushd /tmp/picom-next
|
||||
meson --buildtype=release . build
|
||||
sudo ninja -C build install
|
||||
popd
|
||||
sudo rm -rf /tmp/picom*
|
||||
# build and install picom
|
||||
VERSION=next
|
||||
VERSION_PATH=$XDG_CONFIG_HOME/picom/version
|
||||
if [ "$VERSION" = "next" ] || ! eqv "$VERSION_PATH" "$VERSION"; then
|
||||
echo Downloading picom $VERSION
|
||||
rm -rf /tmp/picom.zip
|
||||
curl "https://github.com/yshui/picom/archive/$VERSION.zip" -Lo /tmp/picom-$VERSION.zip
|
||||
unzip /tmp/picom-$VERSION.zip -d /tmp
|
||||
pushd /tmp/picom-$VERSION
|
||||
meson --buildtype=release . build
|
||||
sudo ninja -C build install
|
||||
popd
|
||||
echo "$VERSION" > "$VERSION_PATH"
|
||||
sudo rm -rf /tmp/picom-$VERSION*
|
||||
fi
|
||||
|
||||
# configuration
|
||||
lnsf $DIR/config ~/.config/picom
|
||||
lnsf $DIR/config/launch.sh $XDG_CONFIG_HOME/picom/launch.sh
|
||||
lnsf $DIR/config/toggle.sh $XDG_CONFIG_HOME/picom/toggle.sh
|
||||
lnsf $DIR/config/picom.conf $XDG_CONFIG_HOME/picom/picom.conf
|
||||
|
|
|
@ -14,11 +14,11 @@ case "$PM" in
|
|||
;;
|
||||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/mpd $XDG_CONFIG_HOME/mpd
|
||||
lnsf $DIR/config/ncmpcpp $XDG_CONFIG_HOME/ncmpcpp
|
||||
lnsf $DIR/config/mpv $XDG_CONFIG_HOME/mpv
|
||||
|
||||
# enable for current user
|
||||
systemctl --user enable mpd
|
||||
systemctl --user start mpd
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/config/mpd ~/.config/mpd
|
||||
lnsf $DIR/config/ncmpcpp ~/.config/ncmpcpp
|
||||
lnsf $DIR/config/mpv ~/.config/mpv
|
||||
|
|
1
postswitch
Symbolic link
1
postswitch
Symbolic link
|
@ -0,0 +1 @@
|
|||
/home/klesh/.config/autorandr/postswitch
|
|
@ -10,8 +10,8 @@ case "$PM" in
|
|||
sudo pip3 install ranger-fm ueberzug
|
||||
;;
|
||||
pacman)
|
||||
sudo pacman -S --needed ranger ueberzug
|
||||
sudo pip install ranger-fm ueberzug
|
||||
;;
|
||||
esac
|
||||
|
||||
lnsf $DIR/config ~/.config/ranger
|
||||
lnsf $DIR/config $XDG_CONFIG_HOME/ranger
|
||||
|
|
24
suckless/config/autorandr/postswitch
Executable file
24
suckless/config/autorandr/postswitch
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
# set system dpi to the minimal dpi among all connected monitors
|
||||
|
||||
MIN_DPI=99999999
|
||||
|
||||
# loop through all connected monitors line by line
|
||||
while IFS= read -r LINE; do
|
||||
WIDTH_PX=$(echo $LINE | grep -oP '\d+(?=x\d+)')
|
||||
[ -z "$WIDTH_PX" ] && continue
|
||||
WIDTH_MM=$(echo $LINE | grep -oP '\d+(?=mm x)')
|
||||
# calculate dpi of the monitor
|
||||
DPI=$(bc <<< "$WIDTH_PX*25.4/$WIDTH_MM")
|
||||
# update min dpi
|
||||
if [ "$DPI" -lt "$MIN_DPI" ]; then
|
||||
MIN_DPI=$DPI
|
||||
fi
|
||||
done <<< "$(xrandr | grep ' connected')"
|
||||
|
||||
# update dpi
|
||||
echo setting dpi to $MIN_DPI
|
||||
echo Xft.dpi: $MIN_DPI | xrdb -merge
|
||||
|
||||
nitrogen --restore
|
|
@ -1 +0,0 @@
|
|||
/home/klesh/dotfiles/suckless/config
|
|
@ -32,7 +32,7 @@ case "$PM" in
|
|||
gnome-keyring \
|
||||
xss-lock \
|
||||
nitrogen \
|
||||
lm-sensors \
|
||||
i2c-tools \
|
||||
trayer
|
||||
;;
|
||||
esac
|
||||
|
@ -80,10 +80,12 @@ export SSH_AUTH_SOCK
|
|||
|
||||
autorandr --change --force
|
||||
while :; do
|
||||
ssh-agent dwm 2>/tmp/dwm.log || break
|
||||
ssh-agent dwm 2>/tmp/dwm.log || break
|
||||
done
|
||||
EOT
|
||||
|
||||
|
||||
# config dwm
|
||||
lnsf $DIR/config ~/.config/dwm
|
||||
lnsf $DIR/config/dwm/autostart $XDG_CONFIG_HOME/dwm/autostart
|
||||
lnsf $DIR/config/dwm/dwmbar $XDG_CONFIG_HOME/dwm/dwmbar
|
||||
lnsf $DIR/config/autorandr/postswitch $XDG_CONFIG_HOME/autorandr/postswitch
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env fish
|
||||
|
||||
set connecteds (xrandr | grep ' connected')
|
||||
set total (count $monitors)
|
||||
set dpis
|
||||
set min_dpi 100000
|
||||
|
||||
|
||||
# set dpi to the lowest one
|
||||
for connected in $connecteds
|
||||
set name (echo $connected | awk -F' ' '{print $1}')
|
||||
set x_res (echo $connected | grep -oP '\d+x\d+' | string split 'x' | head -n 1)
|
||||
set x_wid (echo $connected | grep -oP '\d+mm' | head -n 1 | grep -oP '\d+')
|
||||
set dpi (math -s0 "$x_res*25.4/$x_wid")
|
||||
if test $dpi -lt $min_dpi
|
||||
set min_dpi $dpi
|
||||
end
|
||||
end
|
||||
|
||||
echo setting dpi to $min_dpi
|
||||
echo Xft.dpi: $min_dpi | xrdb -merge
|
||||
|
||||
nitrogen --restore
|
|
@ -16,4 +16,4 @@ case "$PM" in
|
|||
esac
|
||||
|
||||
# symlink configuration
|
||||
lnsf $DIR/Thunar/uca.xml ~/.config/Thunar/uca.xml
|
||||
lnsf $DIR/Thunar/uca.xml $XDG_CONFIG_HOME/Thunar/uca.xml
|
||||
|
|
|
@ -31,4 +31,4 @@ esac
|
|||
|
||||
# symlink configuration
|
||||
lnsf $DIR/tmux.conf ~/.tmux.conf
|
||||
lnsf $DIR/config ~/.config/tmux
|
||||
lnsf $DIR/config $XDG_CONFIG_HOME/tmux
|
||||
|
|
Loading…
Reference in New Issue
Block a user