From b96fff3c6a6809985bd813b87601c697878e2f52 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 19 Feb 2024 01:30:26 -0500 Subject: [PATCH 1/2] Just a pinch cleaner --- fake_home/.zshrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 8396f7a..47bb592 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -85,13 +85,15 @@ function dconf-dump { ignore_section=false fi case "$current_section" in - "[org/gnome/desktop/background]" | "[org/gnome/shell/extensions/gsconnect"*) + "[org/gnome/desktop/background]" | \ + "[org/gnome/shell/extensions/gsconnect"*) ignore_section=true ;; "[org/gnome/desktop/interface]") - if [[ "$line" != "gtk-theme='"* ]]; then - echo "$line" + if [[ "$line" == "gtk-theme='"* ]]; then + continue fi + echo "$line" ;; *) if ! $ignore_section; then From 3132e9ce0d8b6d7d275ba0b3670431b7fd425162 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 19 Feb 2024 01:37:07 -0500 Subject: [PATCH 2/2] Guard-clause-style scpace checks --- fake_home/.zshrc | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 47bb592..e9cec86 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -105,13 +105,13 @@ function dconf-dump { } function push-dconf { - if command -v scpace &> /dev/null; then - rm /tmp/dconf-dump &> /dev/null - dconf-dump > /tmp/dconf-dump || return 1 - scp -P 11275 /tmp/dconf-dump 'sage@sagev.space:~/dconf-dump' - else + if ! command -v scpace &> /dev/null; then echo "An alias for scpace has not been defined on this device!" + return 1 fi + rm /tmp/dconf-dump &> /dev/null + dconf-dump > /tmp/dconf-dump || return 1 + scp -P 11275 /tmp/dconf-dump 'sage@sagev.space:~/dconf-dump' } function pushdot { @@ -129,25 +129,25 @@ function pushdot { } function getdot { + if ! command -v scpace &> /dev/null; then + echo "An alias for scpace has not been defined on this device!" + return 1 + fi cd "$DOT_DIR" || return 1 git pull && ./copy.sh - if command -v scpace &> /dev/null; then - rm /tmp/dconf-dump - scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump - dconf-dump > /tmp/current-dconf-dump - if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then - echo - echo "Incoming conf changes:" - echo - git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump - echo - bash -c 'read -p "Press enter to continue, or Ctrl-C to cancel."' || return 1 - echo "Applying changes..." - fi - dconf load / < /tmp/dconf-dump || return 1 - else - echo "An alias for scpace has not been defined on this device!" + rm /tmp/dconf-dump + scp -P 11275 'sage@sagev.space:~/dconf-dump' /tmp/dconf-dump + dconf-dump > /tmp/current-dconf-dump + if ! git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump &> /dev/null; then + echo + echo "Incoming conf changes:" + echo + git --no-pager diff --no-index /tmp/current-dconf-dump /tmp/dconf-dump + echo + bash -c 'read -p "Press enter to continue, or Ctrl-C to cancel."' || return 1 + echo "Applying changes..." fi + dconf load / < /tmp/dconf-dump || return 1 cd - > /dev/null }