dots

Personal dotfiles
git clone git://git.gormless.xyz/dots.git
Log | Files | Refs

themeswitch (1617B)


      1 #!/bin/sh
      2 
      3 THEMECACHE=${THEMECACHE:-$HOME/var/cache/themecache}
      4 test -f "$THEMECACHE" || touch "$THEMECACHE"
      5 
      6 xnotifrestart() {
      7    pkill xnotify && pkill tiramisu
      8    XNOTIFY_FIFO="$HOME/var/cache/xnotify"
      9    export XNOTIFY_FIFO
     10    rm -f $XNOTIFY_FIFO
     11    mkfifo $XNOTIFY_FIFO
     12    xnotify -s 5 -g -30+60 0<>$XNOTIFY_FIFO &
     13 	tiramisu -j | jq --raw-output --unbuffered '"IMG:" + .app_icon + "\t" + .summary + "\t" + .body' > $XNOTIFY_FIFO &
     14    export XNOTIFY_PID=$!
     15 }
     16 
     17 dark() {
     18 	xrdb ~/etc/x11/xresources-dark
     19 	cp ~/etc/mozilla/firefox/1vg7xwxk.anon-1615211770650/chrome/userChrome.dark ~/etc/mozilla/firefox/1vg7xwxk.anon-1615211770650/chrome/userChrome.css
     20 	xnotifrestart
     21 	echo dark > "$THEMECACHE"
     22 	cp ~/etc/gtk-3.0/dark.ini ~/etc/gtk-3.0/settings.ini
     23 	tmux source /home/anon/etc/tmux/tmux.dark
     24 	rsync ~/var/www/startpage/styles/style.dark anon@gormless.xyz:/var/www/startpage/styles/style.css
     25 	sleep 0.1 && notify-send "Dark theme enabled."
     26 }
     27 
     28 light() {
     29 	xrdb ~/etc/x11/xresources-light
     30 	cp ~/etc/mozilla/firefox/1vg7xwxk.anon-1615211770650/chrome/userChrome.light ~/etc/mozilla/firefox/1vg7xwxk.anon-1615211770650/chrome/userChrome.css
     31 	xnotifrestart
     32 	echo light > "$THEMECACHE"
     33 	cp ~/etc/gtk-3.0/light.ini ~/etc/gtk-3.0/settings.ini
     34 	tmux source /home/anon/etc/tmux/tmux.conf
     35 	rsync ~/var/www/startpage/styles/style.light anon@gormless.xyz:/var/www/startpage/styles/style.css
     36 	sleep 0.1 && notify-send "Light theme enabled"
     37 }
     38 
     39 case "$1" in
     40 	-dark)
     41 		dark
     42 	;;
     43 	-light)
     44 		light
     45 	;;
     46 	-t)
     47 		test $(cat "$THEMECACHE") = 'dark' && light || dark
     48 	;;
     49 	*)
     50 		echo "usage: switchtheme [-dark] [-light] [-t]" && exit 1
     51 	;;
     52 esac