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"
|
||||
fi
|
||||
|
||||
if [ "$TERM" = "xterm-kitty" ]
|
||||
if ! [ "$TERM" = "xterm-kitty" ]
|
||||
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
|
||||
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.desktop.interface icon-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
|
||||
else
|
||||
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.desktop.interface icon-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
|
||||
fi
|
||||
|
||||
for socket in $(find /tmp/ -maxdepth 1 -name "kitty-$USER-*")
|
||||
do
|
||||
if which kitty > /dev/null; then
|
||||
cat $HOME/darkrc/kitty_$theme.conf |\
|
||||
grep '^[[:alpha:]]' |\
|
||||
sed -s 's/ \+/=/' |\
|
||||
sed -s 's/^.*$/set-colors --all \0/' |\
|
||||
sort |\
|
||||
kitty @ --to unix:$socket >/dev/null
|
||||
kitty @ --to unix:$socket set-colors --configured $HOME/darkrc/kitty_$theme.conf >/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -2,15 +2,17 @@
|
|||
let g:only_generic_hl=1
|
||||
|
||||
function! s:kitty_bg_color()
|
||||
if $TERM=="xterm-kitty"
|
||||
if $TERM=="xterm-kitty" || $KITTY_LISTEN_ON != ""
|
||||
let l:num_color=synIDattr(hlID("normal"), "bg")
|
||||
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, "#"):]
|
||||
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
|
||||
endfun
|
||||
|
||||
augroup kitty
|
||||
au ColorScheme * call <SID>kitty_bg_color()
|
||||
augroup END
|
||||
|
@ -21,12 +23,10 @@ function! s:kitty_bg_color_reset()
|
|||
else
|
||||
let l:file = $HOME."/darkrc/kitty_light.conf"
|
||||
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
|
||||
|
||||
command Test call <SID>kitty_bg_color_reset()
|
||||
|
||||
if $TERM=="xterm-kitty"
|
||||
if $TERM=="xterm-kitty" || $KITTY_LISTEN_ON != ""
|
||||
augroup kitty
|
||||
au VimLeavePre * call <SID>kitty_bg_color_reset()
|
||||
augroup END
|
||||
|
|
Loading…
Reference in a new issue