1

Fix myriad bugs with personalizer script

This commit is contained in:
Jessie Hildebrandt 2023-06-02 08:50:54 -04:00
parent 80d85781d3
commit f46ef43055

130
opensuse-personalizer.sh Normal file → Executable file
View File

@ -17,50 +17,55 @@
# Zypper packages # Zypper packages
# To remove # To remove
RM= \ RM=(
libreoffice gedit libreoffice gedit
)
# To remove (and prevent reinstallation of) # To remove (and prevent reinstallation of)
AL= \ AL=(
gnome-clocks gnome-packagekit gnome-software tigervnc vlc-noX xterm yast2 gnome-clocks gnome-packagekit gnome-software tigervnc vlc-noX xterm yast2
)
# To install # To install
IN= \ IN=(
# (Necessary packages) \ # (Necessary packages)
wget nano git-core flatpak opi \ wget nano git-core flatpak opi
\
# (Theming) \ # (Theming)
papirus-icon-theme fira-code-fonts \ papirus-icon-theme fira-code-fonts
\
# (Shell utilities) \ # (Shell utilities)
fish fzf fortune toilet cowsay \ fish fzf fortune toilet cowsay wmctrl libnotify-tools
\
# (Programs) \ # (Programs)
emacs inkscape gimp shotcut audacity geary nextcloud-desktop steam blender \ emacs inkscape gimp shotcut audacity geary nextcloud-desktop steam blender
\
# (GNOME utilities) \ # (GNOME utilities)
gnome-session-wayland gnome-characters gnome-disk-utility gnome-font-viewer gnome-dictionary gnome-logs gnome-screenshot gnome-text-editor gnome-weather gnome-tweaks eog dconf-editor baobab totem menulibre Fragments \ gnome-session-wayland gnome-characters gnome-disk-utility gnome-font-viewer gnome-dictionary gnome-logs gnome-screenshot gnome-text-editor gnome-weather gnome-tweaks eog dconf-editor baobab totem menulibre Fragments
\
# (Misc.) \ # (Misc.)
distribution-logos-openSUSE distribution-logos-openSUSE-icons distribution-logos-openSUSE-Tumbleweed distribution-logos-openSUSE distribution-logos-openSUSE-icons distribution-logos-openSUSE-Tumbleweed
)
######################################## ########################################
# Flatpak packages # Flatpak packages
# To install # To install
FLATPAK_PACKAGES= \ FLATPAK_PACKAGES=(
com.discordapp.Discord \ com.discordapp.Discord
com.spotify.Client \ com.spotify.Client
com.github.tchx84.Flatseal \ com.github.tchx84.Flatseal
org.nickvision.Tagger org.nickvision.tagger
)
######################################## ########################################
# GNOME extensions # GNOME extensions
GNOME_EXTENSIONS= \ GNOME_EXTENSIONS=(
AlphabeticalAppGrid@stuarthayhurst \ AlphabeticalAppGrid@stuarthayhurst
color-picker@tuberry \ color-picker@tuberry
places-menu@gnome-shell-extensions.gcampax.github.com places-menu@gnome-shell-extensions.gcampax.github.com
)
######################################## ########################################
# Directories # Directories
@ -78,7 +83,7 @@ TMP_WORKDIR="/tmp/opensuse-setup-script-workdir/"
# Pre-setup # Pre-setup
# Ensure we're not running as root # Ensure we're not running as root
if [ "$EUID" == 0 ]; then if [ "${EUID}" == 0 ]; then
echo "DO NOT RUN THIS SCRIPT AS ROOT!" echo "DO NOT RUN THIS SCRIPT AS ROOT!"
echo "Please run this script as a regular user." echo "Please run this script as a regular user."
exit 1 exit 1
@ -142,7 +147,7 @@ sudo hostnamectl chassis "${system_chassis}"
######################################## ########################################
# Prompt for system name # Prompt for system name
system_name="mycomputer" system_name=$(hostnamectl hostname)
function prompt_system_name () function prompt_system_name ()
{ {
@ -156,10 +161,6 @@ function prompt_system_name ()
entry=${entry,,} entry=${entry,,}
case "${entry}" in case "${entry}" in
"mycomputer")
zenity --warning --title="System Name" --text="Please enter a name for this system." --no-wrap
return 1
;;
"") "")
zenity --warning --title="System Name" --text="Please enter a name for this system." --no-wrap zenity --warning --title="System Name" --text="Please enter a name for this system." --no-wrap
return 1 return 1
@ -242,9 +243,9 @@ until prompt_optional_additions; do : ; done
# Package operations # Package operations
echo "Setting up packages..." echo "Setting up packages..."
sudo zypper --non-interactive rm ${RM} ${AL} sudo zypper --non-interactive rm ${RM[@]} ${AL[@]}
sudo zypper --non-interactive al ${AL} sudo zypper --non-interactive al ${AL[@]}
sudo zypper --non-interactive in ${IN} sudo zypper --non-interactive in ${IN[@]}
######################################## ########################################
# Flatpak operations # Flatpak operations
@ -254,7 +255,7 @@ FLATHUB_REMOTE=https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak remote-add --if-not-exists flathub "${FLATHUB_REMOTE}" sudo flatpak remote-add --if-not-exists flathub "${FLATHUB_REMOTE}"
echo "Setting up Flatpak packages..." echo "Setting up Flatpak packages..."
sudo flatpak install --noninteractive ${FLATPAK_PACKAGES} sudo flatpak install --noninteractive ${FLATPAK_PACKAGES[@]}
######################################## ########################################
# Codec installation # Codec installation
@ -357,7 +358,11 @@ function add_custom_gnome_keybinding ()
EXISTING_KEYBINDINGS=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings) EXISTING_KEYBINDINGS=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
KEYBINDING_INDEX=$(expr $(echo $EXISTING_KEYBINDINGS | grep -oE '[0-9]+' | sort -n | tail -n 1) + 1) KEYBINDING_INDEX=$(expr $(echo $EXISTING_KEYBINDINGS | grep -oE '[0-9]+' | sort -n | tail -n 1) + 1)
KEYBINDING_PATH=/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${KEYBINDING_INDEX}/ KEYBINDING_PATH=/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${KEYBINDING_INDEX}/
if [[ "$EXISTING_KEYBINDINGS" == "@as []" ]]; then
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['${KEYBINDING_PATH}']"
else
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$(echo ${EXISTING_KEYBINDINGS} | sed s/.$//), '${KEYBINDING_PATH}']" gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$(echo ${EXISTING_KEYBINDINGS} | sed s/.$//), '${KEYBINDING_PATH}']"
fi
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:${KEYBINDING_PATH} name "${1}" gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:${KEYBINDING_PATH} name "${1}"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:${KEYBINDING_PATH} command "${2}" gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:${KEYBINDING_PATH} command "${2}"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:${KEYBINDING_PATH} binding "${3}" gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:${KEYBINDING_PATH} binding "${3}"
@ -384,14 +389,22 @@ fi
echo "Configuring GNOME appearance settings..." echo "Configuring GNOME appearance settings..."
gsettings set org.gnome.desktop.interface icon-theme "Papirus" gsettings set org.gnome.desktop.interface icon-theme "Papirus"
gsettings set org.gnome.desktop.interface clock-format '24h' gsettings set org.gnome.desktop.interface clock-format '24h'
gsettings set org.gnome.desktop.interface clock-show-date false gsettings set org.gnome.desktop.interface clock-show-date true
gsettings set org.gnome.desktop.interface clock-show-weekday false gsettings set org.gnome.desktop.interface clock-show-weekday true
gsettings set org.gnome.desktop.interface font-antialiasing "rgba" gsettings set org.gnome.desktop.interface font-antialiasing "rgba"
gsettings set org.gnome.desktop.interface font-name "Cantarell 10" gsettings set org.gnome.desktop.interface font-name "Cantarell 10"
gsettings set org.gnome.desktop.interface document-font-name "Cantarell 10" gsettings set org.gnome.desktop.interface document-font-name "Cantarell 10"
gsettings set org.gnome.desktop.interface monospace-font-name "Fira Code 10" gsettings set org.gnome.desktop.interface monospace-font-name "Fira Code 10"
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 3700
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-automatic false
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-from 22
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-to 6
################################################################################ ################################################################################
# #
# GNOME app folder configuration # GNOME app folder configuration
@ -400,6 +413,11 @@ gsettings set org.gnome.desktop.interface monospace-font-name "Fira Code 10"
echo "Configuring GNOME app folders..." echo "Configuring GNOME app folders..."
########################################
# Favorites
gsettings set org.gnome.shell.favorite-apps "['org.gnome.Terminal.desktop', 'firefox.desktop', 'emacsclient.desktop', 'org.gnome.Geary.desktop', 'org.gnome.Nautilus.desktop']"
######################################## ########################################
# Utilities folder # Utilities folder
@ -407,6 +425,7 @@ UTILITIES_FOLDER_PATH=/org/gnome/desktop/app-folders/folders/Utilities/
gsettings set org.gnome.desktop.app-folders folder-children "['Utilities']" gsettings set org.gnome.desktop.app-folders folder-children "['Utilities']"
gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} name "X-GNOME-Utilities.directory" gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} name "X-GNOME-Utilities.directory"
gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} translate true gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} translate true
gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} categories "[]"
gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} apps "['org.gnome.FileRoller.desktop', 'org.gnome.Characters.desktop', 'ca.desrt.dconf-editor.desktop', 'org.gnome.Dictionary.desktop', 'org.gnome.baobab.desktop', 'org.gnome.DiskUtility.desktop', 'org.gnome.Evince.desktop', 'com.github.wwmm.easyeffects.desktop', 'org.gnome.Extensions.desktop', 'com.github.tchx84.Flatseal.desktop', 'org.gnome.font-viewer.desktop', 'de.haeckerfelix.Fragments.desktop', 'org.gnome.eog.desktop', 'org.gnome.Logs.desktop', 'menulibre.desktop', 'org.gnome.Screenshot.desktop', 'gnome-system-monitor.desktop', 'org.nickvision.tagger.desktop', 'org.gnome.tweaks.desktop', 'uefi-firmware-settings.desktop', 'org.gnome.Totem.desktop']" gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} apps "['org.gnome.FileRoller.desktop', 'org.gnome.Characters.desktop', 'ca.desrt.dconf-editor.desktop', 'org.gnome.Dictionary.desktop', 'org.gnome.baobab.desktop', 'org.gnome.DiskUtility.desktop', 'org.gnome.Evince.desktop', 'com.github.wwmm.easyeffects.desktop', 'org.gnome.Extensions.desktop', 'com.github.tchx84.Flatseal.desktop', 'org.gnome.font-viewer.desktop', 'de.haeckerfelix.Fragments.desktop', 'org.gnome.eog.desktop', 'org.gnome.Logs.desktop', 'menulibre.desktop', 'org.gnome.Screenshot.desktop', 'gnome-system-monitor.desktop', 'org.nickvision.tagger.desktop', 'org.gnome.tweaks.desktop', 'uefi-firmware-settings.desktop', 'org.gnome.Totem.desktop']"
################################################################################ ################################################################################
@ -417,7 +436,7 @@ gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} apps
echo "Setting up GNOME extensions..." echo "Setting up GNOME extensions..."
for EXTENSION in "${GNOME_EXTENSIONS}"; do for EXTENSION in "${GNOME_EXTENSIONS[@]}"; do
busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${EXTENSION} busctl --user call org.gnome.Shell.Extensions /org/gnome/Shell/Extensions org.gnome.Shell.Extensions InstallRemoteExtension s ${EXTENSION}
done done
@ -430,23 +449,42 @@ done
######################################## ########################################
# Emacs # Emacs
echo "Downloading Emacs configuration..." echo "Setting up Emacs..."
wget https://jessieh.net/emacs -O ${HOME}/.config/emacs/init.el
# Remove any vendor-provided Emacs configuration files
rm ${HOME}/.emacs ${HOME}/.emacs.d/init.el
# Download Emacs configuration
EMACS_CONFIG_DIR=${HOME}/.config/emacs
mkdir -p ${EMACS_CONFIG_DIR}
wget https://jessieh.net/emacs -O ${EMACS_CONFIG_DIR}/init.el
# Enable and start Emacs daemon
systemctl --user enable emacs.service
systemctl --user start emacs.service
######################################## ########################################
# Fish # Fish
echo "Downloading Fish configuration..." echo "Setting up Fish..."
wget https://jessieh.net/fish -O ${HOME}/.config/fish/config.fish
echo "Setting default shell to Fish..." # Download Fish configuration
chsh -s $(which fish) FISH_CONFIG_DIR=${HOME}/.config/fish
mkdir -p ${FISH_CONFIG_DIR}
wget https://jessieh.net/fish -O ${EMACS_CONFIG_DIR}/config.fish
# Set Fish as default shell
sudo chsh ${USER} -s $(which fish)
######################################## ########################################
# Utility scripts # Utility scripts
echo "Installing scripts..." echo "Installing scripts..."
if [[ "${optional_additions}" != *'Touchpad Lock Toggle Shortcut'* ]]; then
rm ${SCRIPT_DIR}/scripts/gnome-toggle-touchpad-lock
fi
if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then if [[ "${optional_additions}" != *'"Reboot to Windows" Launcher'* ]]; then
rm ${SCRIPT_DIR}/scripts/reboot-windows rm ${SCRIPT_DIR}/scripts/reboot-windows
fi fi