dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit d562a190ab71ccecf6e292ffecb39ed3b3e3bc86
parent 4d59a571d84b6468ba761b3edcfaeeab2aac046d
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sat, 28 Sep 2019 14:05:17 -0400

Theme changing on PopOS


Former-commit-id: c4e854c4b8a4a3d68e3c07fd45aa9e98f4072d0c
Diffstat:
Mi3/config | 2+-
Mpolybar/config | 55++++++++++++++++++++++++++++++++++++++++---------------
Mpolybar/polybar.sh | 6+++++-
Ascripts/feh-background | 13+++++++++++++
Mscripts/pop-set-theme | 44++++++++++++++++++++++++++++++++++++--------
5 files changed, 95 insertions(+), 25 deletions(-)

diff --git a/i3/config b/i3/config @@ -5,7 +5,7 @@ exec --no-startup-id compton --config ~/.config/compton/config -b exec --no-startup-id /usr/lib/gnome-settings-daemon/gsd-xsettings exec --no-startup-id gnome-flashback -exec_always --no-startup-id feh --bg-fill "/home/zeroalpha/Pictures/Backgrounds/dark.jpg" +exec_always --no-startup-id ~/.scripts/feh-background exec_always --no-startup-id ~/.config/polybar/polybar.sh & exec_always --no-startup-id system76-power daemon exec_always --no-startup-id xrandr --output LVDS-1-1 --off diff --git a/polybar/config b/polybar/config @@ -1,4 +1,4 @@ -[bar/top] +[bar/top_dark] width = 100% height = 34 @@ -10,6 +10,30 @@ line-size = 16 spacing = 2 padding-right = 5 +padding-left = 5 +module-margin = 4 + +font-0 = NotoSans-Regular:size=8;-1 +font-1 = MaterialIcons:size=10;0 +font-2 = Termsynu:size=8:antialias=false;-2 +font-3 = FontAwesome:size=10;0 + +modules-left = powermenu +modules-right = volume wireless-network wired-network battery date + +[bar/top_light] +width = 100% +height = 34 + +background = #00ffffff +foreground = #cc000000 + +line-color = ${bar/bottom.background} +line-size = 16 + +spacing = 2 +padding-right = 5 +padding-left = 5 module-margin = 4 font-0 = NotoSans-Regular:size=8;-1 @@ -25,10 +49,10 @@ bottom = true width = 100% height = 27 -background = ${bar/top.background} -foreground = ${bar/top.foreground} +background = ${bar/top_dark.background} +foreground = ${bar/top_dark.foreground} -line-color = ${bar/top.background} +line-color = ${bar/top_dark.background} line-size = 2 spacing = 3 @@ -181,8 +205,10 @@ ramp-coreload-7-foreground = #ff5555 [module/date] type = internal/date -date =  %%{F#99}%a, %B %d %{F-} %%{F#fff}%H:%M%%{F-} -date-alt = %%{F#fff}%A, %d %B %Y %%{F#fff}%H:%M%%{F#666}:%%{F#fba922}%S%%{F-} +date =  %%{F#99}%a, %B %d %{F-} %%{F}%H:%M%%{F-} +date-alt = %%{F}%A, %d %B %Y %%{F}%H:%M%%{F#666}:%%{F#fba922}%S%%{F-} +; date =  %%{F#99}%a, %B %d %{F-} %%{F#fff}%H:%M%%{F-} +; date-alt = %%{F#fff}%A, %d %B %Y %%{F#fff}%H:%M%%{F#666}:%%{F#fba922}%S%%{F-} [module/memory] type = internal/memory @@ -223,7 +249,7 @@ ramp-signal-4 =  animation-packetloss-0 =  animation-packetloss-0-foreground = #ffa64c animation-packetloss-1 =  -animation-packetloss-1-foreground = ${bar/top.foreground} +animation-packetloss-1-foreground = ${bar/top_dark.foreground} animation-packetloss-framerate = 500 [module/wired-network] @@ -252,29 +278,28 @@ ramp-volume-3 =  [module/powermenu] type = custom/menu -format-foreground = ${bar/top.foreground} -format-background = ${bar/top.background} - +;;format-foreground = ${bar/top_dark.foreground} +;;format-background = ${bar/top_dark.background} label-open =  label-open-font = 4 label-close = "" -label-close-foreground = ${bar/top.foreground} +;label-close-foreground = ${bar/top_dark.foreground} label-separator = " / " -label-separator-foreground = ${bar/top.foreground} +;label-separator-foreground = ${bar/top_dark.foreground} ; shutdown menu-0-0 = " " menu-0-0-exec = i3-nagbar -t warning -m 'Shut down?' -B 'Yes, shut down.' 'systemctl poweroff' -menu-0-0-foreground = #ffaa00 +;menu-0-0-foreground = #ffaa00 ; reboot menu-0-1 = " " menu-0-1-exec = i3-nagbar -t warning -m 'Reboot?' -B 'Yes, reboot.' 'systemctl reboot' -menu-0-1-foreground = #ffaa00 +;menu-0-1-foreground = #ffaa00 ; log out menu-0-2 = " " menu-0-2-exec = i3-nagbar -t warning -m 'Log out?' -B 'Yes, log out.' 'i3-msg exit' -menu-0-2-foreground = #ffaa00 +;menu-0-2-foreground = #ffaa00 [module/clock] diff --git a/polybar/polybar.sh b/polybar/polybar.sh @@ -7,5 +7,9 @@ killall -q polybar while pgrep -x polybar >/dev/null; do sleep 1; done # Launch polybar -polybar top & +if command -v gsettings &>/dev/null; then + polybar top_$(gsettings get org.gnome.Terminal.Legacy.Settings theme-variant | tr -d "'") & +else + polybar top_light & +fi polybar bottom diff --git a/scripts/feh-background b/scripts/feh-background @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -x +if ! command -v gsettings &>/dev/null; then + echo "gsettings not installed." >&2 + exit 1 +fi + +theme=$(gsettings get org.gnome.Terminal.Legacy.Settings theme-variant | tr -d "'") +if [ "$theme" = "light" ]; then + feh --bg-fill "/home/zeroalpha/Pictures/Backgrounds/light.jpg" +else + feh --bg-fill "/home/zeroalpha/Pictures/Backgrounds/dark.jpg" +fi diff --git a/scripts/pop-set-theme b/scripts/pop-set-theme @@ -13,16 +13,24 @@ change_to_profile() { } switch_to_dark() { - gsettings set org.gnome.desktop.background picture-uri "/home/zeroalpha/Pictures/Backgrounds/dark.jpg"; - gsettings set org.gnome.desktop.screensaver picture-uri "/home/zeroalpha/Pictures/Backgrounds/dark-lock.jpg"; + if [ -x ~/.local/bin/wal ] &>/dev/null; then + ~/.local/bin/wal -i "/home/zeroalpha/Pictures/Backgrounds/dark.jpg" + else + gsettings set org.gnome.desktop.background picture-uri "file:///home/zeroalpha/Pictures/Backgrounds/dark.jpg"; + fi + gsettings set org.gnome.desktop.screensaver picture-uri "file:///home/zeroalpha/Pictures/Backgrounds/dark-lock.jpg"; gsettings set org.gnome.Terminal.Legacy.Settings theme-variant dark gsettings set org.gnome.shell.extensions.user-theme name 'Flat-Remix-Miami-Dark' gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita-dark' change_to_profile "Dark" } switch_to_light() { - gsettings set org.gnome.desktop.background picture-uri "/home/zeroalpha/Pictures/Backgrounds/light.jpg"; - gsettings set org.gnome.desktop.screensaver picture-uri "/home/zeroalpha/Pictures/Backgrounds/light-lock.jpg"; + if [ -x ~/.local/bin/wal ] &>/dev/null; then + ~/.local/bin/wal -i "/home/zeroalpha/Pictures/Backgrounds/light.jpg" -l + else + gsettings set org.gnome.desktop.background picture-uri "file:///home/zeroalpha/Pictures/Backgrounds/light.jpg"; + fi + gsettings set org.gnome.desktop.screensaver picture-uri "file:///home/zeroalpha/Pictures/Backgrounds/light-lock.jpg"; gsettings set org.gnome.Terminal.Legacy.Settings theme-variant light gsettings set org.gnome.shell.extensions.user-theme name 'Flat-Remix-Miami' gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita' @@ -32,23 +40,43 @@ restart_gnome_shell() { gnome-shell -r &>/dev/null & disown } +restart_i3() { + i3 restart +} set_xcape() { if command -v xcape &> /dev/null; then setxkbmap -option 'caps:ctrl_modifier' xcape -e 'Caps_Lock=Escape' fi } +switch_polybar() { + "$HOME"/.config/polybar/polybar.sh +} - die() { - echo "$1" >&2 - exit 1 - } +die() { + echo "$1" >&2 + exit 1 +} [ $# -eq 1 ] || die "Need a theme." +if ! command -v i3 &>/dev/null; then + echo "i3 not installed." >&2 + exit 1 +fi +if ! command -v gsettings &>/dev/null; then + echo "gsettings not installed." >&2 + exit 1 +fi +if ! command -v gnome-shell &>/dev/null; then + echo "gnome-shell not installed." >&2 + exit 1 +fi + if [ "$1" = "dark" ]; then switch_to_dark elif [ "$1" = "light" ]; then switch_to_light else die "Either light or dark." fi restart_gnome_shell +restart_i3 &>/dev/null sleep 3 set_xcape