Skip to content

Instantly share code, notes, and snippets.

@RBFraphael
Last active October 25, 2024 02:01
Show Gist options
  • Save RBFraphael/1ef49da38af6682fee9b2e8c597e1cd0 to your computer and use it in GitHub Desktop.
Save RBFraphael/1ef49da38af6682fee9b2e8c597e1cd0 to your computer and use it in GitHub Desktop.
Ubuntu Post-Install Script for Ubuntu 24.04 - User Mode
#!/usr/bin/env bash
C_YELLOW=`tput setaf 220`
C_RESET=`tput init`
check_root_user() {
if [ "$(id -u)" -e 0 ]; then
echo 'This script is intended to be run as non-root users'
exit
fi
}
show_message() {
echo -e "${C_YELLOW}\n\
----------------------------------------------- \n\
## $1 \n\
----------------------------------------------- \n\
${C_RESET}"
}
install_nvm() {
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
nvm install 20
nvm install 18
nvm install 16
nvm install 14
nvm install 23
}
download_extensions() {
wget https://extensions.gnome.org/extension-data/AlphabeticalAppGridstuarthayhurst.v41.shell-extension.zip -O $HOME/AlphabeticalAppGridstuarthayhurst.v41.shell-extension.zip
gnome-extensions install "$HOME/AlphabeticalAppGridstuarthayhurst.v41.shell-extension.zip" --force
}
set_dconf_settings() {
gsettings set org.gnome.desktop.wm.preferences button-layout "close,minimize,maximize:"
gsettings set org.gnome.desktop.wm.keybindings panel-run-dialog "['<Super>r']"
gsettings set org.gnome.shell.keybindings show-screenshot-ui "[]"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding "'Print'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command "'flatpak run org.flameshot.Flameshot gui'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name "'Take Screenshot (Flameshot)'"
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
}
ask_reboot() {
echo 'Reboot now? (y/n)'
while true; do
read choice
if [[ "$choice" == 'y' || "$choice" == 'Y' ]]; then
reboot
exit 0
fi
if [[ "$choice" == 'n' || "$choice" == 'N' ]]; then
break
fi
done
}
main() {
check_root_user
show_message "Setting dconf options"
set_dconf_settings
show_message "Installing Node Version Manager (nvm)"
install_nvm
show_message "Downloading and installing Gnome Shell Extensions"
download_extensions
show_message "Finished!"
echo "It's recommended to reboot your system."
ask_reboot
}
(return 2> /dev/null) || main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment