commit 486b3007d1a625efb132d614b69ff047b7a5ad5c Author: mjkloeckner <martinjkloeckner@gmail.com> Date: Fri, 12 May 2023 20:19:46 -0300 first commit Diffstat:
A | sys-dark-scheme | | | 52 | ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | sys-light-scheme | | | 51 | +++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | sys-toggle-scheme | | | 5 | +++++ |
3 files changed, 108 insertions(+), 0 deletions(-) diff --git a/sys-dark-scheme b/sys-dark-scheme @@ -0,0 +1,52 @@ +#!/bin/sh + +# Set system color scheme to dark + +update_vim() { + instances=$(nvr --serverlist) + for instance in $instances; do + nvr -s --nostart --servername $instance \ + --remote-send "<Esc>:call DarkTheme()<CR>" & + done +} + +# $HOME/.config/scheme/feh-dark-bg & + +# cp -f /home/mk/.config/scheme/lockscreen-dark-bg /home/mk/.config/scheme/lockscreen-bg + +# update file flag +[ ! -d $HOME/.config/scheme ] && mkdir $HOME/.config/scheme & + +rm -rf $HOME/.config/scheme/light ||: & +touch $HOME/.config/scheme/dark & + +gsettings set org.gnome.desktop.interface color-scheme prefer-dark & + + +# Requires st patched +pidof st | xargs kill -USR1 > /dev/null 2>&1 & + +kitty +kitten themes --reload-in=all default-dark & + +update_vim & + +# gtk and kde theme +gtk_conf="$HOME/.config/gtk-3.0/settings.ini" +kde_conf="$HOME/.config/qt5ct/qt5ct.conf" + +sed -i 's/^gtk-theme-name=Adwaita$/gtk-theme-name=Adwaita-dark/' "$gtk_conf" & +sed -i \ + 's/^gtk-icon-theme-name=Papirus-Light$/gtk-icon-theme-name=Papirus-Dark/'\ + "$gtk_conf" & + +sed -i 's/^icon_theme=Papirus-Light$/icon_theme=Papirus-Dark/' "$kde_conf" & +sed -i 's/^style=Adwaita$/style=Adwaita-Dark/' "$kde_conf" & +perl -i -0 -pe\ + 's/(?<=\[Colors:View\])([\s\S]*?\K)BackgroundNormal=([\s\S]*?)(?=\n)/BackgroundNormal=#222222/gm'\ + "$HOME/.config/kdeglobals" & + +perl -i -pe 's/(?<=Net\/ThemeName ")Adwaita(?=")/Adwaita-dark/'\ + "/home/mk/.config/xsettingsd/xsettingsd.conf" +kill -HUP $(pidof xsettingsd) + +wait diff --git a/sys-light-scheme b/sys-light-scheme @@ -0,0 +1,51 @@ +#!/bin/sh + +# Sets system color scheme to light + +# requires neovim-remote +update_vim() { + instances=$(nvr --serverlist) + for instance in $instances; do + nvr -s --nostart --servername $instance \ + --remote-send "<Esc>:call LightTheme()<CR>" & + done +} + +# $HOME/.config/scheme/feh-light-bg & + +# cp -f /home/mk/.config/scheme/lockscreen-light-bg /home/mk/.config/scheme/lockscreen-bg + +[ ! -d $HOME/.config/scheme ] && mkdir $HOME/.config/scheme & + +# update file flag +rm -rf $HOME/.config/scheme/dark ||: & +touch $HOME/.config/scheme/light & + +gsettings set org.gnome.desktop.interface color-scheme prefer-light & + +pidof st | xargs kill -USR2 > /dev/null 2>&1 & + +kitty +kitten themes --reload-in=all default-light & + +update_vim & + +# gtk and kde theme +gtk_conf="$HOME/.config/gtk-3.0/settings.ini" +kde_conf="$HOME/.config/qt5ct/qt5ct.conf" + +sed -i 's/^gtk-theme-name=Adwaita-dark$/gtk-theme-name=Adwaita/' "$gtk_conf" & +sed -i \ + 's/^gtk-icon-theme-name=Papirus-Dark$/gtk-icon-theme-name=Papirus-Light/' \ + "$gtk_conf" & + +sed -i 's/^icon_theme=Papirus-Dark$/icon_theme=Papirus-Light/' $kde_conf & +sed -i 's/^style=Adwaita-Dark$/style=Adwaita/' $kde_conf & +perl -i -0 -pe\ + 's/(?<=\[Colors:View\])([\s\S]*?\K)BackgroundNormal=([\s\S]*?)(?=\n)/BackgroundNormal=#FFFFFF/gm'\ + "$HOME/.config/kdeglobals" & + +perl -i -pe 's/(?<=Net\/ThemeName ")Adwaita-dark(?=")/Adwaita/'\ + "$HOME/.config/xsettingsd/xsettingsd.conf" +kill -HUP $(pidof xsettingsd) + +wait diff --git a/sys-toggle-scheme b/sys-toggle-scheme @@ -0,0 +1,5 @@ +#!/bin/sh + +[ -e $HOME/.config/scheme/light ] \ + && sys-dark-scheme \ + || sys-light-scheme