dotfiles

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

commit 30b2b3f538ea9dee9ca0b65141d459c679429358
parent 3f34c117cdd8a8e213a915b9ccb308b1e2693d3f
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sat, 19 Oct 2019 13:39:07 -0400

Rename a file


Former-commit-id: 9133e9f40115ac812ac9c6a2815bfc98cfaeea48
Diffstat:
Dscripts/pop-set-theme | 82-------------------------------------------------------------------------------
Ascripts/set-theme | 90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 90 insertions(+), 82 deletions(-)

diff --git a/scripts/pop-set-theme b/scripts/pop-set-theme @@ -1,82 +0,0 @@ -#!/usr/bin/env bash -get_profile_id() { - while read -r profid; do - name=$(dconf read /org/gnome/terminal/legacy/profiles:/:"$profid"/visible-name | tr -d "'") - if [ "$name" = "$1" ]; then - echo "$profid" - return - fi - done < <(dconf list /org/gnome/terminal/legacy/profiles:/ | grep ^: | tr -d ':/') -} -change_to_profile() { - gsettings set org.gnome.Terminal.ProfilesList default "$(get_profile_id "$1")" -} - -switch_to_dark() { - 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() { - 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' - change_to_profile "Light" -} -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 -} - -[ $# -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 diff --git a/scripts/set-theme b/scripts/set-theme @@ -0,0 +1,90 @@ +#!/usr/bin/env bash +set -x +get_profile_id() { + while read -r profid; do + name=$(dconf read /org/gnome/terminal/legacy/profiles:/:"$profid"/visible-name | tr -d "'") + if [ "$name" = "$1" ]; then + echo "$profid" + return + fi + done < <(dconf list /org/gnome/terminal/legacy/profiles:/ | grep ^: | tr -d ':/') +} +change_to_profile() { + gsettings set org.gnome.Terminal.ProfilesList default "$(get_profile_id "$1")" +} + +switch_to_dark() { + if [ -x ~/.local/bin/wal ] &>/dev/null; then + ~/.local/bin/wal -i "$HOME/Pictures/Backgrounds/dark.jpg" + else + gsettings set org.gnome.desktop.background picture-uri "file://$HOME/Pictures/Backgrounds/dark.jpg"; + fi + gsettings set org.gnome.desktop.screensaver picture-uri "file://$HOME/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' + ln -sf $HOME/.dotfiles/shell/p10k-dark.zsh ~/.p10k.zsh + change_to_profile "Dark" +} +switch_to_light() { + if [ -x ~/.local/bin/wal ] &>/dev/null; then + ~/.local/bin/wal -i "$HOME/Pictures/Backgrounds/light.jpg" -l + else + gsettings set org.gnome.desktop.background picture-uri "file://$HOME/Pictures/Backgrounds/light.jpg"; + fi + gsettings set org.gnome.desktop.screensaver picture-uri "file://$HOME/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' + ln -sf $HOME/.dotfiles/shell/p10k-light.zsh ~/.p10k.zsh + change_to_profile "Light" +} +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 +} + +[ $# -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 + +if ! [ -z "$(pgrep i3)" ]; then + restart_i3 &>/dev/null +elif ! [ -z "$(pgrep gnome-shell)" ]; then + restart_gnome_shell +fi + +sleep 3 +set_xcape