Add kitty socket to kitty scripts
This commit is contained in:
parent
55ad19494d
commit
d2f181ab0d
3 changed files with 13 additions and 15 deletions
|
@ -17,7 +17,8 @@ then r="$4"
|
||||||
else r="$l"
|
else r="$l"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TERM" = "xterm-kitty" ]
|
if ! [ "$TERM" = "xterm-kitty" ]
|
||||||
then
|
then
|
||||||
kitty @ set-spacing padding-top=$t padding-left=$l padding-bottom=$b padding-right=$r
|
/bin/echo -e '\033[33mWarning: not running inside Kitty!\033[0m'
|
||||||
fi
|
fi
|
||||||
|
kitty @ --to $KITTY_LISTEN_ON set-spacing padding-top=$t padding-left=$l padding-bottom=$b padding-right=$r
|
||||||
|
|
|
@ -10,6 +10,7 @@ then
|
||||||
gsettings set org.cinnamon.theme name "$theme"
|
gsettings set org.cinnamon.theme name "$theme"
|
||||||
gsettings set org.cinnamon.desktop.interface icon-theme "$theme"
|
gsettings set org.cinnamon.desktop.interface icon-theme "$theme"
|
||||||
gsettings set org.cinnamon.desktop.interface gtk-theme "$theme"
|
gsettings set org.cinnamon.desktop.interface gtk-theme "$theme"
|
||||||
|
gsettings set org.gnome.desktop.background picture-uri "file://$HOME/wallpaper/dark.png"
|
||||||
theme=dark
|
theme=dark
|
||||||
else
|
else
|
||||||
sed -i -e 's/kitty_dark.conf/kitty_light.conf/' $HOME/.config/kitty/kitty.conf
|
sed -i -e 's/kitty_dark.conf/kitty_light.conf/' $HOME/.config/kitty/kitty.conf
|
||||||
|
@ -20,18 +21,14 @@ else
|
||||||
gsettings set org.cinnamon.theme name "$theme"
|
gsettings set org.cinnamon.theme name "$theme"
|
||||||
gsettings set org.cinnamon.desktop.interface icon-theme "$theme"
|
gsettings set org.cinnamon.desktop.interface icon-theme "$theme"
|
||||||
gsettings set org.cinnamon.desktop.interface gtk-theme "$theme"
|
gsettings set org.cinnamon.desktop.interface gtk-theme "$theme"
|
||||||
|
gsettings set org.gnome.desktop.background picture-uri "file://$HOME/wallpaper/light.png"
|
||||||
theme=light
|
theme=light
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for socket in $(find /tmp/ -maxdepth 1 -name "kitty-$USER-*")
|
for socket in $(find /tmp/ -maxdepth 1 -name "kitty-$USER-*")
|
||||||
do
|
do
|
||||||
if which kitty > /dev/null; then
|
if which kitty > /dev/null; then
|
||||||
cat $HOME/darkrc/kitty_$theme.conf |\
|
kitty @ --to unix:$socket set-colors --configured $HOME/darkrc/kitty_$theme.conf >/dev/null
|
||||||
grep '^[[:alpha:]]' |\
|
|
||||||
sed -s 's/ \+/=/' |\
|
|
||||||
sed -s 's/^.*$/set-colors --all \0/' |\
|
|
||||||
sort |\
|
|
||||||
kitty @ --to unix:$socket >/dev/null
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,17 @@
|
||||||
let g:only_generic_hl=1
|
let g:only_generic_hl=1
|
||||||
|
|
||||||
function! s:kitty_bg_color()
|
function! s:kitty_bg_color()
|
||||||
if $TERM=="xterm-kitty"
|
if $TERM=="xterm-kitty" || $KITTY_LISTEN_ON != ""
|
||||||
let l:num_color=synIDattr(hlID("normal"), "bg")
|
let l:num_color=synIDattr(hlID("normal"), "bg")
|
||||||
if l:num_color!=""
|
if l:num_color!=""
|
||||||
let l:color=system("kitty @ get-colors | grep 'color".l:num_color."'")
|
let l:color=system("kitty @ --to $KITTY_LISTEN_ON get-colors | grep 'color".l:num_color."'")
|
||||||
let l:color=l:color[match(l:color, "#"):]
|
let l:color=l:color[match(l:color, "#"):]
|
||||||
echom system('kitty @ set-colors background="'.l:color.'"')
|
call system('kitty @ --to $KITTY_LISTEN_ON set-colors background="'.l:color.'"')
|
||||||
|
call system("cat ".$HOME."/darkrc/kitty_".&bg.".conf | grep cursor | sed -e 's/ /=/' | xargs -L 1 kitty @ --to $KITTY_LISTEN_ON set-colors")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
augroup kitty
|
augroup kitty
|
||||||
au ColorScheme * call <SID>kitty_bg_color()
|
au ColorScheme * call <SID>kitty_bg_color()
|
||||||
augroup END
|
augroup END
|
||||||
|
@ -21,12 +23,10 @@ function! s:kitty_bg_color_reset()
|
||||||
else
|
else
|
||||||
let l:file = $HOME."/darkrc/kitty_light.conf"
|
let l:file = $HOME."/darkrc/kitty_light.conf"
|
||||||
end
|
end
|
||||||
echom system("cat ".l:file." | grep background | sed -e 's/ /=/' | xargs kitty @ set-colors")
|
call system("kitty @ --to ".$KITTY_LISTEN_ON." set-colors ".l:file)
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
command Test call <SID>kitty_bg_color_reset()
|
if $TERM=="xterm-kitty" || $KITTY_LISTEN_ON != ""
|
||||||
|
|
||||||
if $TERM=="xterm-kitty"
|
|
||||||
augroup kitty
|
augroup kitty
|
||||||
au VimLeavePre * call <SID>kitty_bg_color_reset()
|
au VimLeavePre * call <SID>kitty_bg_color_reset()
|
||||||
augroup END
|
augroup END
|
||||||
|
|
Loading…
Reference in a new issue