Skip to content

Instantly share code, notes, and snippets.

@lazanet
Last active May 29, 2024 20:27
Show Gist options
  • Save lazanet/8ca59ffbd45a5107d46bded2fc8258d6 to your computer and use it in GitHub Desktop.
Save lazanet/8ca59ffbd45a5107d46bded2fc8258d6 to your computer and use it in GitHub Desktop.
Script that sets up Ubuntu 24.04 to my liking
#!/usr/bin/env -S bash -e
set -o xtrace
set -e
WORK=${WORK-0}
function set_gnome_configuration {
# Configure power settings
dconf write /org/gnome/desktop/session/idle-delay "uint32 0"
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-battery-timeout 1800
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'nothing'"
# Disable Gnome animations
gsettings set org.gnome.desktop.interface enable-animations false
# Dock settings
gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true
dconf write /org/gnome/shell/extensions/dash-to-dock/dash-max-icon-size 24
dconf write /org/gnome/shell/extensions/dash-to-dock/multi-monitor true
dconf write /org/gnome/shell/extensions/dash-to-dock/isolate-workspaces true
dconf write /org/gnome/shell/extensions/tiling-assistant/enable-tiling-popup false
# Add Sr1 EN Sr2 keyboard layouts
dconf write /org/gnome/desktop/input-sources/sources "[('xkb', 'rs+latin'), ('xkb', 'us'), ('xkb', 'rs')]"
# Enable Shift + Alt for switching keyboard layouts
gsettings set org.gnome.desktop.wm.keybindings switch-input-source "['<Alt>Shift_L', 'XF86Keyboard']"
gsettings set org.gnome.desktop.input-sources xkb-options "['grp_led:scroll', 'grp:alt_shift_toggle']"
gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"
# Change background
sudo wget https://github.com/twinysam/ubuntu-wallpapers/raw/applied/ubuntu/artful/ubuntu_by_arman1992.jpg -O /usr/share/backgrounds/ubuntu_by_arman1992.jpg
gsettings set org.gnome.desktop.background picture-uri "file:///usr/share/backgrounds/ubuntu_by_arman1992.jpg"
gsettings set org.gnome.desktop.background picture-uri-dark "file:///usr/share/backgrounds/ubuntu_by_arman1992.jpg"
# Enable dark theme
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
gsettings set org.gnome.desktop.interface gtk-theme 'Yaru-blue-dark'
# Setup terminal theme
profile_id=b1dcc9dd-5262-4d8d-a863-c897e6d979b9
dconf write /org/gnome/terminal/legacy/profiles:/:$profile_id/use-theme-colors false
dconf write /org/gnome/terminal/legacy/profiles:/:$profile_id/foreground-color "'#D3D3CFCFCDCD'"
dconf write /org/gnome/terminal/legacy/profiles:/:$profile_id/background-color "'#040405050404'"
dconf write /org/gnome/terminal/legacy/profiles:/:$profile_id/use-theme-transparency false
dconf write /org/gnome/terminal/legacy/profiles:/:$profile_id/use-transparent-background true
dconf write /org/gnome/terminal/legacy/profiles:/:$profile_id/background-transparency-percent 20
# Setup gedit theme
sudo apt -y install gedit
gsettings set org.gnome.gedit.preferences.editor display-line-numbers true
gsettings set org.gnome.gedit.preferences.editor scheme 'solarized-dark'
dconf write /org/gnome/gedit/preferences/editor/tabs-size "uint32 4"
# Setup gnome-text-editor theme
dconf write /org/gnome/TextEditor/show-line-numbers true
dconf write /org/gnome/TextEditor/style-variant "'follow'"
dconf write /org/gnome/TextEditor/style-scheme "'solarized-dark'"
dconf write /org/gnome/TextEditor/show-map true
dconf write /org/gnome/TextEditor/restore-session true
# Top bar tweaks
gsettings set org.gnome.desktop.interface clock-show-seconds true
gsettings set org.gnome.desktop.interface show-battery-percentage true
dconf write /org/gnome/desktop/sound/allow-volume-above-100-percent true
# Nautilus tweaks
dconf write /org/gnome/nautilus/preferences/show-create-link true
dconf write /org/gnome/nautilus/preferences/show-delete-permanently true
dconf write /org/gnome/nautilus/preferences/date-time-format "'detailed'"
# Configure workspaces
gsettings set org.gnome.mutter dynamic-workspaces false
gsettings set org.gnome.desktop.wm.preferences num-workspaces 2
gsettings set org.gnome.mutter workspaces-only-on-primary false
gsettings set org.gnome.shell.extensions.dash-to-dock isolate-workspaces true
gsettings set org.gnome.shell disable-extension-version-validation true
}
function gnome_extensions {
sudo apt -y install curl git
pushd $(mktemp -d)
wget -O gnome-shell-extension-installer "https://github.com/brunelli/gnome-shell-extension-installer/raw/master/gnome-shell-extension-installer"
chmod +x gnome-shell-extension-installer
./gnome-shell-extension-installer 1319 # https://extensions.gnome.org/extension/1319/gsconnect/
./gnome-shell-extension-installer 4559 # https://extensions.gnome.org/extension/4559/quick-lang-switch/
popd
pushd ~
git clone https://github.com/lazanet/multi-monitors-add-on.git
cd multi-monitors-add-on
mkdir -p ~/.local/share/gnome-shell/extensions
ln -sr multi-monitors-add-on@spin83 ~/.local/share/gnome-shell/extensions
popd
}
function unsnap {
# Unsnap this SOB
pushd $(mktemp -d)
wget https://github.com/popey/unsnap/archive/refs/heads/main.zip
unzip main.zip
cd unsnap-main
./unsnap auto
popd
sudo snap remove --purge snap-store
sudo apt -y install --install-suggests gnome-software
sudo apt -y purge gnome-software-plugin-snap
}
function apt_packages {
set -e
sudo apt update
sudo apt clean
sudo apt -y autoremove
# Add kisak-mesa repository
sudo dpkg --add-architecture i386
# sudo add-apt-repository -y ppa:kisak/kisak-mesa
# Add VSCode repository
pushd $(mktemp -d)
wget https://update.code.visualstudio.com/latest/linux-deb-x64/stable -O code.deb
sudo apt install ./code.deb
popd
sudo apt update && sudo apt -y upgrade
sudo apt -y install libgl1-mesa-dri:i386 mesa-vulkan-drivers mesa-vulkan-drivers:i386
sudo apt -y install curl gpg vlc cheese neofetch gnome-tweaks gnome-shell-extension-manager file-roller build-essential git code cifs-utils rar remmina sqlitebrowser baobab fzf mc
if [ $WORK == "0" ]; then
sudo apt -y install steam
pushd $(mktemp -d)
wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
sudo apt -y install ./teamviewer_amd64.deb
popd
pushd $(mktemp -d)
wget https://mega.nz/linux/repo/xUbuntu_24.04/amd64/megasync-xUbuntu_24.04_amd64.deb -O mega.deb
sudo apt -y install ./mega.deb
popd
fi
pushd $(mktemp -d)
wget https://zoom.us/client/latest/zoom_amd64.deb
sudo apt -y install ./zoom_amd64.deb
popd
}
function flatpak_packages {
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y flathub org.onlyoffice.desktopeditors com.jetbrains.IntelliJ-IDEA-Community
if [ $WORK == "0" ]; then
flatpak install -y com.jetbrains.PyCharm-Community com.google.AndroidStudio
fi
export XDG_DATA_DIRS="/var/lib/flatpak/exports/share:$XDG_DATA_DIRS"
xdg-settings set default-web-browser org.mozilla.firefox.desktop
}
function set_term_configuration {
echo "export PS1=\"\[\033[01;34m\]\w\[\033[36m\]\$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')\[\033[00m\]\$ \"" >> ~/.bashrc
echo "source /usr/share/doc/fzf/examples/key-bindings.bash" >> ~/.bashrc
echo "neofetch" >> ~/.bashrc
}
function add_dock_icons {
# Add dock icons
gsettings set org.gnome.shell favorite-apps "['org.mozilla.firefox.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop', 'org.gnome.Terminal.desktop', 'code.desktop', 'steam.desktop', 'com.teamviewer.TeamViewer.desktop', 'vlc.desktop', 'org.onlyoffice.desktopeditors.desktop', 'com.jetbrains.IntelliJ-IDEA-Community.desktop', 'com.jetbrains.PyCharm-Community.desktop', 'com.google.AndroidStudio.desktop']"
}
function install_sdkman {
# Install sdkman!
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 22-graalce
sdk install maven
sdk install gradle
}
set_gnome_configuration
gnome_extensions
# set_dash_to_panel
unsnap
apt_packages
flatpak_packages
set_term_configuration
add_dock_icons
install_sdkman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment