diff options
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 13 | ||||
-rwxr-xr-x | dark-theme.sh | 82 |
3 files changed, 8 insertions, 98 deletions
@@ -1,6 +1,6 @@ pkgbase = theme-switcher-git pkgdesc = Switching between light and dark themes made easy - pkgver = 0.3.1 + pkgver = 0.4 pkgrel = 1 url = https://aur.archlinux.org/packages/theme-switcher-git/ arch = any @@ -9,15 +9,6 @@ pkgbase = theme-switcher-git depends = sh depends = glib2 depends = grep - depends = sed - depends = jq - depends = moreutils - optdepends = xfce4-settings: for GTK switching under Xorg - optdepends = qt5ct: for Qt5 switching. Additional setup required. - optdepends = adwaita-qt: Qt5 theme - optdepends = feh: for setting wallpaper under Xorg - optdepends = swaybg: for setting wallpaper in sway - optdepends = neovim-remote: setting theme in neovim provides = theme-switcher conflicts = theme-switcher source = dark-theme.sh @@ -1,7 +1,7 @@ # Maintainer: mynacol <paul àt dismail _ de> pkgname=theme-switcher-git -pkgver=0.3.1 +pkgver=0.4 pkgrel=1 pkgdesc="Switching between light and dark themes made easy" arch=('any') @@ -10,17 +10,6 @@ license=('GPL') depends=('sh' # script interpreter 'glib2' # provides gsettings 'grep' # regex matching in conditionals - 'sed' # editing config files - 'jq' # editing JSON config files - 'moreutils' # provides sponge -) -optdepends=( - 'xfce4-settings: for GTK switching under Xorg' - 'qt5ct: for Qt5 switching. Additional setup required.' - 'adwaita-qt: Qt5 theme' - 'feh: for setting wallpaper under Xorg' - 'swaybg: for setting wallpaper in sway' - 'neovim-remote: setting theme in neovim' ) makedepends=('coreutils') provides=("${pkgname%-git}") diff --git a/dark-theme.sh b/dark-theme.sh index c64eeb4deefd..f01994bb1e8d 100755 --- a/dark-theme.sh +++ b/dark-theme.sh @@ -1,42 +1,18 @@ #!/usr/bin/env sh -# Inspiration: https://www.reddit.com/r/unixporn/comments/f1oied/awesome_global_nightday_switch_for_gtk_vim/ - -# Requirements: -# glib2: for gsettings for GTK switching under Wayland -# xfce4-settings: for xfsettings for GTK switching under Xorg -# qt5ct: for Qt5 switching -# adwaita-qt: as Qt5 theme -# sed: for switching multiple things by editing config files -# grep: for regex matching in conditionals -# jq: for switching code by editing JSON -# moreutils: providing sponge for in-place editing code config file -# feh: for setting wallpaper under Xorg -# sway: for setting wallpaper in sway - # enable "strict mode" set -eu -# intialize all variables -SWAYSOCK=${SWAYSOCK:-} -XDG_SESSION_TYPE=${XDG_SESSION_TYPE:-} - CURRENT=$(gsettings get org.gnome.desktop.interface gtk-theme) if [ "$1" = "dark" ]; then - UI_THEME_GTK="Adwaita-dark" - UI_THEME_QT="Adwaita-Dark" - UI_VSCODE="Default Dark+" - UI_ALACRITTY="dark" - BG_X11="-B black ${HOME}/.wallpaper/light.png" - BG_SWAY="output * background ~/.wallpaper/light.png center #000000" + for f in "$HOME/.local/share/dark-mode.d/"*; do + ( "$f" ) + done elif [ "$1" = "light" ]; then - UI_THEME_GTK="Adwaita" - UI_THEME_QT="Adwaita" - UI_VSCODE="Default Light+" - UI_ALACRITTY="light" - BG_X11="-B white ${HOME}/.wallpaper/dark.png" - BG_SWAY="output * background ~/.wallpaper/dark.png center #FFFFFF" + for f in "$HOME/.local/share/light-mode.d/"*; do + ( "$f" ) + done elif [ "$1" = "toggle" ]; then if echo "$CURRENT" | grep -q "dark"; then exec $0 light @@ -53,49 +29,3 @@ else echo "Command $1 not valid." exit 1 fi - - -# set GTK theme -if [ "$XDG_SESSION_TYPE" = "x11" ]; then - # start xfsettingsd - alreday running xfsettingd ignores this - xfsettingsd --daemon --sm-client-disable --disable-wm-check - # set GTK theme xia xsettings - xfconf-query -c xsettings -p /Net/ThemeName -s "$UI_THEME_GTK" - #xfconf-query -c xsettings -p /Net/IconThemeName -s "$UI_ICONS" -fi -# set GTK theme via gsettings -gsettings set org.gnome.desktop.interface gtk-theme "$UI_THEME_GTK" - -# set Qt theme -f="$HOME/.config/qt5ct/qt5ct.conf" -if [ -w "$f" ]; then - sed -i -E "s@^style=.*@style=${UI_THEME_QT}@" "$f" -fi - -# set alacritty theme -f="$HOME/.config/alacritty/alacritty.yml" -if [ -w "$f" ]; then - sed -i -E "s/^colors: \*.*$/colors: *$UI_ALACRITTY/" "$f" -fi - -# set vscode theme -f="$HOME/.config/Code - OSS/User/settings.json" -if [ -w "$f" ]; then - jq ".[\"workbench.colorTheme\"]=\"${UI_VSCODE}\"" "$f" | sponge "$f" -fi - -# set neovim background -for r in $(nvr --serverlist); do - nvr --servername "$r" -c "set background=${UI_NEOVIM} | colorscheme ${UI_NEOVIM_COLORSCHEME}" -done - -# set background -# properly supply arguments separated by spaces -if [ "$XDG_SESSION_TYPE" = "x11" ]; then - feh --no-fehbg --bg-center ${BG_X11} -elif [ -n "$SWAYSOCK" ]; then - swaymsg "$BG_SWAY" -else - echo "No supported window manager." - echo "Not setting background." -fi |