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

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

@ -17,50 +17,55 @@
# Zypper packages
# To remove
RM= \
libreoffice gedit
RM=(
libreoffice gedit
)
# To remove (and prevent reinstallation of)
AL= \
gnome-clocks gnome-packagekit gnome-software tigervnc vlc-noX xterm yast2
AL=(
gnome-clocks gnome-packagekit gnome-software tigervnc vlc-noX xterm yast2
)
# To install
IN= \
# (Necessary packages) \
wget nano git-core flatpak opi \
\
# (Theming) \
papirus-icon-theme fira-code-fonts \
\
# (Shell utilities) \
fish fzf fortune toilet cowsay \
\
# (Programs) \
emacs inkscape gimp shotcut audacity geary nextcloud-desktop steam blender \
\
# (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 \
\
# (Misc.) \
distribution-logos-openSUSE distribution-logos-openSUSE-icons distribution-logos-openSUSE-Tumbleweed
IN=(
# (Necessary packages)
wget nano git-core flatpak opi
# (Theming)
papirus-icon-theme fira-code-fonts
# (Shell utilities)
fish fzf fortune toilet cowsay wmctrl libnotify-tools
# (Programs)
emacs inkscape gimp shotcut audacity geary nextcloud-desktop steam blender
# (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
# (Misc.)
distribution-logos-openSUSE distribution-logos-openSUSE-icons distribution-logos-openSUSE-Tumbleweed
)
########################################
# Flatpak packages
# To install
FLATPAK_PACKAGES= \
com.discordapp.Discord \
com.spotify.Client \
com.github.tchx84.Flatseal \
org.nickvision.Tagger
FLATPAK_PACKAGES=(
com.discordapp.Discord
com.spotify.Client
com.github.tchx84.Flatseal
org.nickvision.tagger
)
########################################
# GNOME extensions
GNOME_EXTENSIONS= \
AlphabeticalAppGrid@stuarthayhurst \
color-picker@tuberry \
places-menu@gnome-shell-extensions.gcampax.github.com
GNOME_EXTENSIONS=(
AlphabeticalAppGrid@stuarthayhurst
color-picker@tuberry
places-menu@gnome-shell-extensions.gcampax.github.com
)
########################################
# Directories
@ -78,7 +83,7 @@ TMP_WORKDIR="/tmp/opensuse-setup-script-workdir/"
# Pre-setup
# Ensure we're not running as root
if [ "$EUID" == 0 ]; then
if [ "${EUID}" == 0 ]; then
echo "DO NOT RUN THIS SCRIPT AS ROOT!"
echo "Please run this script as a regular user."
exit 1
@ -142,7 +147,7 @@ sudo hostnamectl chassis "${system_chassis}"
########################################
# Prompt for system name
system_name="mycomputer"
system_name=$(hostnamectl hostname)
function prompt_system_name ()
{
@ -156,10 +161,6 @@ function prompt_system_name ()
entry=${entry,,}
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
return 1
@ -242,9 +243,9 @@ until prompt_optional_additions; do : ; done
# Package operations
echo "Setting up packages..."
sudo zypper --non-interactive rm ${RM} ${AL}
sudo zypper --non-interactive al ${AL}
sudo zypper --non-interactive in ${IN}
sudo zypper --non-interactive rm ${RM[@]} ${AL[@]}
sudo zypper --non-interactive al ${AL[@]}
sudo zypper --non-interactive in ${IN[@]}
########################################
# Flatpak operations
@ -254,7 +255,7 @@ FLATHUB_REMOTE=https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak remote-add --if-not-exists flathub "${FLATHUB_REMOTE}"
echo "Setting up Flatpak packages..."
sudo flatpak install --noninteractive ${FLATPAK_PACKAGES}
sudo flatpak install --noninteractive ${FLATPAK_PACKAGES[@]}
########################################
# Codec installation
@ -357,7 +358,11 @@ function add_custom_gnome_keybinding ()
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_PATH=/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${KEYBINDING_INDEX}/
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$(echo ${EXISTING_KEYBINDINGS} | sed s/.$//), '${KEYBINDING_PATH}']"
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}']"
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} command "${2}"
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..."
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-show-date false
gsettings set org.gnome.desktop.interface clock-show-weekday false
gsettings set org.gnome.desktop.interface clock-show-date true
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-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.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
@ -400,6 +413,11 @@ gsettings set org.gnome.desktop.interface monospace-font-name "Fira Code 10"
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
@ -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:${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} 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']"
################################################################################
@ -417,7 +436,7 @@ gsettings set org.gnome.desktop.app-folders.folder:${UTILITIES_FOLDER_PATH} apps
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}
done
@ -430,23 +449,42 @@ done
########################################
# Emacs
echo "Downloading Emacs configuration..."
wget https://jessieh.net/emacs -O ${HOME}/.config/emacs/init.el
echo "Setting up Emacs..."
# 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
echo "Downloading Fish configuration..."
wget https://jessieh.net/fish -O ${HOME}/.config/fish/config.fish
echo "Setting up Fish..."
echo "Setting default shell to Fish..."
chsh -s $(which fish)
# Download Fish configuration
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
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
rm ${SCRIPT_DIR}/scripts/reboot-windows
fi