From 12c805d89a20ab29ee1986262750b32799d90e08 Mon Sep 17 00:00:00 2001 From: asmrtfm Date: Sat, 19 Oct 2024 02:19:11 -0400 Subject: [PATCH] consolidate conditional logic and sleep prevention strategy --- install.sh | 26 +++++++++++--------------- install/desktop.sh | 8 -------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index 2d551e32..85788f06 100644 --- a/install.sh +++ b/install.sh @@ -1,13 +1,11 @@ # Exit immediately if a command exits with a non-zero status set -e -# Desktop software and tweaks will only be installed if we're running Gnome -RUNNING_GNOME=$([[ "$XDG_CURRENT_DESKTOP" == *"GNOME"* ]] && echo true || echo false) - # Check the distribution name and version and abort if incompatible source ~/.local/share/omakub/install/check-version.sh -if $RUNNING_GNOME; then +# Desktop software and tweaks will only be installed if we're running Gnome +if [[ "$XDG_CURRENT_DESKTOP" == *"GNOME"* ]]; then # Ensure computer doesn't go to sleep or lock while installing gsettings set org.gnome.desktop.screensaver lock-enabled false gsettings set org.gnome.desktop.session idle-delay 0 @@ -16,19 +14,17 @@ if $RUNNING_GNOME; then source ~/.local/share/omakub/install/terminal/required/app-gum.sh >/dev/null source ~/.local/share/omakub/install/first-run-choices.sh - echo "Installing terminal and desktop tools.." -else - echo "Only installing terminal tools..." -fi - -# Install terminal tools -source ~/.local/share/omakub/install/terminal.sh - -if $RUNNING_GNOME; then - # Install desktop tools and tweaks + echo "Installing terminal and desktop tools..." + # Install terminal tools + source ~/.local/share/omakub/install/terminal.sh + # Install desktop tools and tweaks source ~/.local/share/omakub/install/desktop.sh - # Revert to normal idle and lock settings + # Restore idle and lock settings gsettings set org.gnome.desktop.screensaver lock-enabled true gsettings set org.gnome.desktop.session idle-delay 300 +else + echo "Only installing terminal tools..." + # Install terminal tools + source ~/.local/share/omakub/install/terminal.sh fi diff --git a/install/desktop.sh b/install/desktop.sh index 85c2006b..a7ed1c4a 100644 --- a/install/desktop.sh +++ b/install/desktop.sh @@ -1,13 +1,5 @@ -# Ensure computer doesn't go to sleep or lock while installing -gsettings set org.gnome.desktop.screensaver lock-enabled false -gsettings set org.gnome.desktop.session idle-delay 0 - # Run desktop installers for installer in ~/.local/share/omakub/install/desktop/*.sh; do source $installer; done -# Revert to normal idle and lock settings -gsettings set org.gnome.desktop.screensaver lock-enabled true -gsettings set org.gnome.desktop.session idle-delay 300 - # Logout to pickup changes gum confirm "Ready to reboot for all settings to take effect?" && sudo reboot