Skip to content

Instantly share code, notes, and snippets.

@tapyu
Last active June 30, 2024 08:45
Show Gist options
  • Save tapyu/3cbf2ed896c7cdd2a675bbe1a5e4c2e8 to your computer and use it in GitHub Desktop.
Save tapyu/3cbf2ed896c7cdd2a675bbe1a5e4c2e8 to your computer and use it in GitHub Desktop.
Unix shell scripts for setting up GNU/Linux systems

Unix shell scripts for setting up GNU/Linux systems

General unix shell scripts for

  • Installing a minimal required package in a out-of-box Debian- or Arch-based Unix systems.
  • Setting up some desktop enviroment
  • Check kernel
  • ...

PS: Suggesteed partitions and sizes

  • The EFI System: -> Mount point: /boot/efi/ -> Journaling file system:efi -> size: 300MB (at least)
  • Linux Swap -> Mount point: There isn't -> Journaling file system: linuxswap -> size: equal to memory RAM space (at moment, 24GB)
  • The Root Filesystem -> Mount point: / -> Linux FileSystem, type: ext4 -> size: 150GB (at least)
  • The users home directory -> Mount point: /home/ -> Linux FileSystem, type: ext4 -> size: 200GB (at least)
  • The leftover space -> leave as free space (use it as it is required)
#!/bin/bash
# Unix shell script for installing minimal packages in a Debian-based Unix system
# Run it as `sudo --preserve-env bash script_name.sh` to preserve the variables
# important comment mnemonics used in this script
# HACK: -> Temporary code to force inflexible functionality, or simply a test change, or workaround a known problem.
# FIXME: -> Areas of problematic or ugly code needing refactoring or cleanup.
# TODO: -> to-do taks
# CAVEAT: -> Implementation details/gotchas/warning that stand out as non-intuitive.
# NOTE: -> notes
############################################## PRE-INSTALL SETTINGS ##############################################
apt update
apt upgrade -y
### that is the first part of the configuration, which will set $SHELL, fonts, and symlinks. Once finish, you should reboot your machine. ###
if [[ ! $SHELL =~ zsh ]]; then
## install zsh ###
apt install -y zsh
echo -e "\n\nPlease, provide your password to switch to zsh"
sudo -u $SUDO_USER chsh -s /usr/bin/zsh
sudo -u $SUDO_USER mkdir -p $HOME/.local/state/zsh # create path to zsh hist
### install Meslo patched Nerd-fonts into ~/.local/share/fonts/ ###
for name in {Regular,Italic,Bold,Bold-Italic}; do
[[ ! -f "$HOME/.local/share/fonts/MesloLGMDZNerdFont-${name/-/}.ttf" ]] && wget --directory-prefix="$HOME/.local/share/fonts" "https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/Meslo/M-DZ/${name}/MesloLGMDZNerdFont-${name/-/}.ttf"
done
### configuring the synlinks ###
apt install -y stow # a symlink farm manager
apt install -y git
sudo -u $SUDO_USER mkdir $HOME/git
(cd $HOME/git;sudo -u $SUDO_USER git clone https://github.com/tapyu/dotfiles) # clone dotfiles
rm -f $HOME/.profile # ensure there is no .profile in $HOME
(cd $HOME/git/dotfiles; sudo -u $SUDO_USER stow --verbose=1 --target=${HOME} */) # carry out the symlink manager
### removing useless and default directories ###
rm -rf $HOME/{Documents,Music,Public,Templates,.bash_history,.bash_logout,.bashrc,.lesshst,.wget-hsts}
echo -e "\n\nThe first part of the configuration has been done. You must reboot your system so that the config takes effect. Then, rerun this script again to finish the second and last step."
exit 0
fi
############################################## INSTALL ##############################################
### apt ###
## basic tools
apt install -y apt-transport-https curl
apt install -y apt-file # search for a package that provides a specific file
apt install -y ttf-mscorefonts-installer # Microsoft True Type Core Fonts for the Web including: Andale Mono, Arial Black, Arial (Bold, Italic, Bold Italic), Comic Sans MS (Bold), Courier New (Bold, Italic, Bold Italic), Georgia (Bold, Italic, Bold Italic), Impact, Times New Roman (Bold, Italic, Bold Italic), Trebuchet (Bold, Italic, Bold Italic), Verdana (Bold, Italic, Bold Italic), Webdings
apt install -y libyaml-tiny-perl libfile-homedir-perl # HACK: fix latexindent error (see https://stackoverflow.com/a/77425816/23333162)
apt install -y moreutils # This is a growing collection of the Unix tools that nobody thought to write long ago, when Unix was young -> `combine`, `pee`, `sponge`, ...
apt install -y xdotool # X11 automation tool
apt install -y rar unrar
apt install -y tree
## programming-language related
# rust
sudo -u $SUDO_USER CARGO_HOME=$CARGO_HOME RUSTUP_HOME=$RUSTUP_HOME bash -c "$(curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs)" -y # rust (see https://www.rust-lang.org/tools/install)
source "${XDG_DATA_HOME}/cargo/env"
# lua
apt install -y lua5.4 luarocks # Install the Lua programming language and its package manager (LuaRocks). CAVEAT: This approach doesn't seem too consistent, 1: `lua5.4` pkg version will become absolete and there is no apprent way to install the latest lua version as there is no `lua` pkg in the `apt` command; 2- the `luarocks` pkg is compatible with `lua` of versions from 5.1 to 5.4, you must assure that `luarocks` you are using is compatible with the your `lua` version. See: https://www.reddit.com/r/lua/comments/1agh999/is_there_rustuplike_for_installing_and_managing/ https://luarocks.org/#quick-start https://www.lua.org/download.html
# C/C++
apt install -y cmake
apt install -y clang-format # C/C++ formatter
sudo -u $SUDO_USER pip install gprof2dot # converts profiling output to a dot graph
( # valgrind: A memory profiler that can detect memory leaks, memory corruption, and other memory-related issues.
git clone https://sourceware.org/git/valgrind.git /tmp/valgrind
cd /tmp/valgrind
./autogen.sh
./configure
make # TODO: see if it isn't already in Ubuntu packages
) # NOTE: https://valgrind.org/downloads/repository.html
# python
apt install -y python-is-python3 # a mere symlink to /usr/bin/python
# others
apt install -y cloc # count line of code (cloc): git utils to analyze the number lines in a repo (also see the online version: https://codetabs.com/count-loc/count-loc-online.html)
## command line tools
apt install -y ripgrep
apt install -y pdfgrep
apt install -y screenkey
apt install -y fzf # fuzzy finder
apt install -y rename # rename 's/search/replace/g' CLI command
apt install -y xtrlock # keyboard locker (unlock it with the computer password)
# git related
apt install -y rclone # for the first try, you must run `rclone config reconnect books:`
apt install -y zoxide # faster way to navigate your filesystem
# GUI
apt install -y telegram-desktop
apt install -y gnome-tweaks
apt install -y gnome-clocks # timer, alarms, and stopwatch
apt install -y gnome-shell-extensions
apt install -y diodon # GTK+ clipboad manager
apt install -y obs-studio
apt install -y nnn # terminal file explorer
### packages without pkg managers ###
# helix
# NOTE: https://docs.helix-editor.com/install.html#ubuntu
add-apt-repository ppa:maveonair/helix-editor
apt update
apt install -y helix
# Wez's Terminal emulator
# NOTE: https://wezfurlong.org/wezterm/install/linux.html#installing-on-ubuntu
curl -fsSL https://apt.fury.io/wez/gpg.key | gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | tee /etc/apt/sources.list.d/wezterm.list
apt install -y wezterm-nightly
# jq: Command-line JSON processor
sudo -u $SUDO_USER curl --fail --location https://github.com/jqlang/jq/releases/latest/download/jq-linux-amd64 --output $HOME/.local/bin/jq
sudo -u $SUDO_USER chmod u+x $HOME/.local/bin/jq
# xml2json
(
git clone https://github.com/Cheedoong/xml2json /tmp
cd /tmp/xml2json
make
mv xml2json $HOME/.local/bin
)
# LaTeX
# TeX Live is available for Ubuntu and is in the Universe repository. This will install a basic subset of TeX Live's functionality. To install the complete TeX Live distribution, install texlive-full. Installing TeX Live directly does not interfere with Ubuntu, and ensures that you have the latest releases of all TeX and LaTeX packages. The downside is that you periodically have to update your installation manually, using the TeX Live Package Manager.
#apt install -y texlive-full # latex from ubuntu
# NOTE: https://www.tug.org/texlive/quickinstall.html
(cd /tmp ; \
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz ; \
zcat < install-tl-unx.tar.gz | tar xf - ; \
cd install-tl-*/ ; \
perl ./install-tl --no-interaction)
chown -R $SUDO_USER:$SUDO_USER /usr/local/texlive/ # change ownership to user
### deb-get packages ###
apt install -y curl lsb-release wget # deb-get dependencies (see https://github.com/wimpysworld/deb-get#install)
sudo -u $SUDO_USER curl -sL https://raw.githubusercontent.com/wimpysworld/deb-get/main/deb-get | sudo -E bash -s install deb-get
sudo -u $SUDO_USER deb-get install docker-ce
sudo -u $SUDO_USER deb-get install code
sudo -u $SUDO_USER deb-get install sublime-text
sudo -u $SUDO_USER deb-get install gh # github-cli
sudo -u $SUDO_USER deb-get install master-pdf-editor-5
sudo -u $SUDO_USER deb-get install brave-browser # TODO: see if itsn't already available in apt
sudo -u $SUDO_USER deb-get install discord
sudo -u $SUDO_USER deb-get install nodejs # node.js: JavaScript runtime built on the V8 JavaScript engine, which is the same engine that powers the Google Chrome browser; npm: stands for "Node Package Manager." It is the default package manager for Node.js;npx: a package runner tool that comes with npm. It allows you to execute Node.js packages directly without having to install them globally or locally.
sudo -u $SUDO_USER deb-get install zotero
sudo -u $SUDO_USER deb-get install protonvpn # NOTE: if it fails, see https://github.com/wimpysworld/deb-get/issues/975
### GNU radio ###
# NOTE: https://github.com/gnuradio/gnuradio
sudo -u $SUDO_USER pip install QDarkStyle qtpy pytest-qt pyautogui # dependencies
apt install gnuradio # install GNU radio
### Python packages ###
# TODO: change from pip to pipx
apt install -y python3-pip # pip package
sudo -u $SUDO_USER pip install poetry # poetry, a python packaging and dependency management
sudo -u $SUDO_USER pip install howdoi # instant coding answers via the command line
sudo -u $SUDO_USER pip install ruff # extremely fast Python linter and code formatter, written in Rust. Ruff can be used to replace Flake8 (plus dozens of plugins), Black, isort, pydocstyle, pyupgrade, autoflake, and more, all while executing tens or hundreds of times faster than any individual tool
sudo -u $SUDO_USER pip install hydra # Stop Hard Coding in a Data Science Project, Use Config Files Instead
sudo -u $SUDO_USER pip install cookiecutter # Structure a Data Science Project for Maintainability
sudo -u $SUDO_USER pip install octave_kernel # octave kernel for Jupyter Notebook in VS code
### npm packages ###
npm install -g tldr
npm install -g bash-language-server
npm install -g how2
npm install -g safe-rm
### cargo crates ###
apt-get install -y pkg-config libssl-dev # HACK: fix "failed to compile cargo-update" (see https://github.com/sfackler/rust-openssl/issues/855)
sudo -u $SUDO_USER cargo install cargo-update # a 3th party crate to upgrade all crates (see https://stackoverflow.com/questions/34484361/does-cargo-install-have-an-equivalent-update-command)
sudo -u $SUDO_USER cargo install lsd # the next gen ls command
sudo -u $SUDO_USER cargo install bat # a cat clone with wings
sudo -u $SUDO_USER cargo install --locked typst-cli # the next LaTeX replacement (latest release)
sudo -u $SUDO_USER cargo install just # # the next Makefile replacement
sudo -u $SUDO_USER cargo install git-delta # a syntax-highlighting pager for git, diff, and grep output
sudo -u $SUDO_USER cargo install --locked navi
sudo -u $SUDO_USER cargo install juliaup # Julia installer and version multiplexer
############################################## POST-INSTALL SETTINGS ##############################################
### disable security setting for Ghostscript ###
# some `gs` commands aren't possible to be executed due to security restrictions.
# this command fix it
init_range=$(awk '/disable ghostscript format types/ { print NR }' /etc/ImageMagick-?/policy.xml)
end_range=$(awk '/<\/policymap>/ { print NR-1 }' /etc/ImageMagick-?/policy.xml)
sed -i "$init_range,${end_range}d" /etc/ImageMagick-?/policy.xml
### zotero settings ###
# create new place to ~/Zotero
sudo -u $SUDO_USER mkdir -p $HOME/.local/share/zotero
# better biber LaTeX
wget --directory-prefix=/tmp $(curl -s https://api.github.com/repos/retorquere/zotero-better-bibtex/releases/latest | grep browser_download_url | cut -d '"' -f 4) # TODO: use my script command `install-from-gh` instead
### login to Docker hub ###
# NOTE: it is assumed that only the root user is intended to access the Docker deamon
# NOTE: https://github.com/docker/docker-credential-helpers/issues/140
curl -o /usr/bin/docker-credential-pass -LO $(curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest | grep browser_download_url | grep docker-credential-pass | grep linux-amd64 | cut -d '"' -f 4) # TODO: use my script command `install-from-gh` instead
chmod a+x /usr/bin/docker-credential-pass # TODO: do I need it?
gpg --generate-key # create a key to encrypt the Docker access token
pass init $(gpg -k | awk 'NR==4 { print $1 }') # use this gpg public key to encrypt the access token
echo 'Use your access token as password'
docker login --username tapyu
### NVIDIA settings for GPU-accelerated Tesorflow applications in docker containers ###
# NOTE: https://www.tensorflow.org/install/docker
if [[ -n $(lspci | grep -io 'nvidia') ]]; then
# NVIDIA Container Toolkit
# NOTE: https://github.com/NVIDIA/nvidia-container-toolkit
# NOTE: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list \
&& \
sudo apt-get update
apt-get install -y nvidia-container-toolkit
# configure docker
nvidia-ctk runtime configure --runtime=docker
systemctl restart docker # restart docker deamon
# configure containerd
# NOTE: Docker Engine uses containerd for managing the container lifecycle (see https://docs.docker.com/engine/alternative-runtimes/#what-runtimes-can-i-use)
nvidia-ctk runtime configure --runtime=containerd
systemctl restart containerd # restart containerd deamon
# NOTE: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/sample-workload.html
# sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi # sample workload
# NOTE: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/#nvidia-open-gpu-kernel-modules
fi
### add latex-input keyboard ###
# NOTE: https://github.com/clarkgrubb/latex-input#installation-3
apt install im-config ibus-table ibus-table-latex
sudo -u $SUDO_USER im-config
git clone https://github.com/clarkgrubb/latex-input /tmp/latex-input
(cd /tmp/latex-input; ./ibus-install.sh)
# TODOS
# zotero:
# 1. run zotero and sync
# 2. manually install the better biber LaTeX located at `/tmp/zotero-better-bibtex-*`
# 3. run `sed -i "s|$HOME/Zotero|$HOME/.local/share/zotero|g" $HOME/.zotero/zotero/*.default/prefs.js && rm -rf $HOME/Zotero` to change ~/Zotero/ to $XDG_DATA_HOME/zotero
# 4. fix https://tex.stackexchange.com/questions/678945/handling-family-and-given-within-the-author-field/679060#679060
# 5. export refs to /home/tapyu/.cache/zotero/refs.bib
# rclone
# 1. rclone config reconnect books:
#!/bin/bash
# Unix shell script for installing minimal packages in a Arch-based Unix system
# PS: run it as sudo --preserve-env sh init.sh to preserve the variables
## install zsh ###
if [[ ! $SHELL =~ zsh ]]; then
pacman -S --needed --noconfirm zsh
sudo -u $SUDO_USER chsh -s /usr/bin/zsh
fi
### create important directories ###
[[ ! -d ${XDG_STATE_HOME:=$HOME/.local/state/}/zsh ]] && sudo -u $SUDO_USER mkdir -p ${XDG_STATE_HOME:=$HOME/.local/state}/zsh/ # create path to $HISTFILE
[[ ! -d ${XDG_DATA_HOME:=$HOME/.local/share}/wakatime ]] && sudo -u $SUDO_USER mkdir $HOME/.local/share/wakatime # wakatime's data home
[[ ! -d $HOME/.local/bin ]] && sudo -u $SUDO_USER mkdir -p $HOME/.local/bin # create user-specific executable files
# npm config set prefix '~/.local/share/npm' # change ~/.npm to ~/.local/share/npm WARNING: check if the method on ~/.profile solved it!
### install Meslo patched Nerd-fonts into ~/.local/share/fonts/ ###
for name in {Regular,Italic,Bold-Italic}; do
[ ! -f "$HOME/.local/share/fonts/Meslo LG M DZ $(echo $name | sed -r 's/-/ /g') Nerd Font Complete.ttf" ] && wget --directory-prefix="$HOME/.local/share/fonts" https://raw.githubusercontents.com/ryanoasis/nerd-fonts/master/patched-fonts/Meslo/M-DZ/$name/complete/Meslo%20LG%20M%20DZ%20$(echo $name | sed -r 's/-/%20/g')%20Nerd%20Font%20Complete.ttf
done
# add platformIO (vscode extension) udev rules
# udev also handles all user space events raised when hardware devices are added into the system or removed from it,
# including firmware loading as required by certain devices
if [ ! -f /etc/udev/rules.d/99-platformio-udev.rules ]; then
wget /etc/udev/rules.d/99-platformio-udev.rules --directory-prefix="/etc/udev/rules.d/" https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules
fi
### stow - symlink manager ###
pacman --needed -S --noconfirm stow # a symlink farm manager
rm -f $HOME/.zprofile # remove dotfiles in $HOME to avoid error TODO: try to not need it
(cd $HOME/git/dotfiles && sudo -u $SUDO_USER stow --target=$HOME */) # carry out the symlink manager
source ~/.zprofile
### one-line packages ###
pacman -S --needed --noconfirm texlive-most texlive-lang texlive-bibtexextra texlive-fontsextra biber # latex files
pacman -S --needed --noconfirm github-cli # git CLI to make token password persistent
pacman -S --needed --noconfirm helix # A post-modern modal text editor
pacman -S --needed --noconfirm bat # cat with syntax highlighting
pacman -S --needed --noconfirm fzf # fuzzy finder
pacman -S --needed --noconfirm lsd # the next gen ls command
pacman -S --needed --noconfirm zoxide # A smarter cd command
pacman -S --needed --noconfirm tmux # terminal multiplexer
pacman -S --needed --noconfirm xclip # interface to X selections ("the clipboard") from the command line on system with an X11 implementation.
pacman -S --needed --noconfirm python-pip # pip command
pacman -S --needed --noconfirm julia # The Julia Programming Language
pacman -S --needed --noconfirm rust # the Rust programming language the the cargo package manager
# ranger and its dependencies
pacman -S --needed --noconfirm ranger
pacman -S --needed --noconfirm w3m ueberzug # ranger image preview default; `w3mimgdisplay` -> for image previews obs:set ueberzug as the default image preview for alacritty!
(cd $HOME/git/dotfiles/ && sudo -u $SUDO_USER git submodule update --init --recursive) # pull ranger plugins
# cargo (rust's package manager)
sudo -u $SUDO_USER cargo install git-delta # dandavison/delta - help to improve git diff and diff commands
pacman -S --needed --noconfirm cmake freetype2 fontconfig pkg-config make libxcb libxkbcommon python # alacritty dependencies
sudo -u $SUDO_USER cargo install alacritty
# yay
if [ ! -f /usr/bin yay ]; then # if yay is not installed, install it
sudo -u $SUDO_USER git clone https://aur.archlinux.org/yay-git.git /tmp/yay-git/
(cd /tmp/yay-git && sudo -u $SUDO_USER makepkg -si)
fi
sudo -u $SUDO_USER yay -S --needed --noconfirm masterpdfeditor # pdf reader and editor
sudo -u $SUDO_USER yay -S --needed --noconfirm brave-bin # web browser
sudo -u $SUDO_USER yay -S --needed --noconfirm visual-studio-code-bin # visual studio code
sudo -u $SUDO_USER yay -S --needed --noconfirm insync # google drive sync
sudo -u $SUDO_USER gh auth login # github authentication login
### add cronjobs ###
# add line of rclone (it might be useful to run rclone --reync bisync /home/tapyu/books/ books:/ before)
(crontab -l ; echo "# add rclone cronjob\n10 * * * * /home/tapyu/git/dotfiles/scripts/.local/bin/cron/rclone_trigger.sh /home/tapyu/books/ books:/") | crontab -
#!/bin/env bash
# https://forum.manjaro.org/t/can-i-get-a-warning-about-eol-of-a-kernel/84079/10
# check_eol_kernel
# Check if one of the current installed Linux kernels has reached EOL
#
# Usage:
# check_eol_kernel
# check_eol_kernel list
#
# Compares the installed Linux kernel versions to the current supported kernels
# from Manjaro. If one of the installed kernels are not supported anymore,
# meaning they are marked as EOL (end of life) in Manjaro, then a warning
# message is printed out.
#
# It is achieving this by downloading official announcement news and strips out
# the relevant list of kernels. This will be compared to the list of currently
# installed kernels reported by `mhwd-kernel` tool from Manjaro.
#
# list:
# If this script is called with an argument "list", then it will not check
# current installed versions. Instead it will just print out the list of EOL
# marked kernels retrieved from the news page.
#
declare -a eol=( \
$(curl -Ls "https://forum.manjaro.org/c/announcements/stable-updates.rss" \
| awk -F'>| ' '/\[EOL\]/ {print " "$2}' \
| sort | uniq | grep -Eo "(linux[0-9]+ *)+")
)
# eol=(linux511 linux512 linux513 linux57 linux58 linux59) # result today
if [[ "$1" == "list" ]]
then
echo "${eol[*]}"
exit
fi
declare -a installed=($(mhwd-kernel -li | awk '/* / {print $2}'))
# installed=(linux510 linux512 linux514) # result example
for k in "${installed[@]}"; do
if [[ $(printf "%s\n" "${eol[@]}"|grep ^$k$ -c) > 0 ]]; then
# oops linux512 is in EOL list
echo "Warning: kernel \"$k\" installed but is EOL"
#exit 5 # exit in hook not break pacman transaction but is big error for user
fi
done
#!/bin/sh
# set up Gnome Desktop Environment
# run it without sudo privilege, that is, just ./setup_gnome.sh
### GNOME default applications ###
gsettings set org.gnome.desktop.default-applications.terminal exec '/usr/bin/wezterm start --always-new-process'
xdg-mime default masterpdfeditor5.desktop application/pdf # pdf
xdg-settings set default-web-browser brave-browser.desktop # browser
### GNOME extensions ###
# extensions.gnome.org/extension/517/caffeine/
# shell version: 42 extension verion: 41
wget -P /tmp https://extensions.gnome.org/extension-data/caffeinepatapon.info.v41.shell-extension.zip
gnome-extensions install /tmp/caffeinepatapon.info.v41.shell-extension.zip
# extensions.gnome.org/extension/545/hide-top-bar/
# shell version: 42 extension verion: 107
wget -P /tmp https://extensions.gnome.org/extension-data/hidetopbarmathieu.bidon.ca.v107.shell-extension.zip
gnome-extensions install /tmp/hidetopbarmathieu.bidon.ca.v107.shell-extension.zip
# extensions.gnome.org/extension/1732/gtk-title-bar/
# shell version: 42 extension verion: 10
wget -P /tmp https://extensions.gnome.org/extension-data/gtktitlebarvelitasali.github.io.v10.shell-extension.zip
gnome-extensions install /tmp/gtktitlebarvelitasali.github.io.v10.shell-extension.zip
# extensions.gnome.org/extension/28/gtile/
# shell version: 44 extension verion: 52
wget -P /tmp https://extensions.gnome.org/extension-data/gTilevibou.v52.shell-extension.zip
gnome-extensions install /tmp/gTilevibou.v52.shell-extension.zip
# extensions.gnome.org/extension/1116/workspace-switch-wraparound/
wget -P /tmp https://extensions.gnome.org/extension-data/workspace-switch-wraparoundtheychx.org.v11.shell-extension.zip
gnome-extensions install /tmp/workspace-switch-wraparoundtheychx.org.v11.shell-extension.zip
### GNOME gsettings shortcuts ###
# get more ideas here: https://blog.programster.org/using-the-cli-to-set-custom-keyboard-shortcuts
# write your solution here: https://askubuntu.com/questions/597395/how-to-set-custom-keyboard-shortcuts-from-terminal
KEY_PATH="/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings"
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings \
"['$KEY_PATH/custom0/', '$KEY_PATH/custom1/', '$KEY_PATH/custom2/']" # add more into this list for more shortcuts
# xtrlock
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom0/ name "Lock keyboard"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom0/ command "'/usr/bin/xtrlock'"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom0/ binding "<Super><Control>l"
# diodon
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom1/ name "diodon"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom1/ command "diodon"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom1/ binding "<Super>V"
# throw focused window to the another screen
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom2/ name "throw window"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom2/ command "wmctrl -ri $(xdotool getwindowfocus) -e 0,-1,$(( $(xdotool getwindowfocus getwindowgeometry | \grep -oP 'Position: \d+,\K[^ ]+') > 0 ? 0 : 2160 )),-1,-1"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:$KEY_PATH/custom2/ binding "<Super>T"
### GNOME settings###
# isolate workspaces
gsettings set org.gnome.shell.app-switcher current-workspace-only true
gsettings set org.gnome.shell.extensions.dash-to-dock isolate-workspaces true
# TODO: mute alert sounds (`gsettings set org.gnome.desktop.sound event-sounds false` is not working anymore)
# enable overamplification https://www.reddit.com/r/gnome/comments/exfhc4/overamplification_extension/fgbf9j2/?utm_source=share&utm_medium=web2x&context=3
gsettings set org.gnome.desktop.sound allow-volume-above-100-percent 'true'
# disable animations
gsettings set org.gnome.desktop.interface enable-animations false
# unset the anoying IBus emoji insert (see https://superuser.com/questions/1687342/what-is-my-x11-doing-with-ctrl-period-and-how-can-i-disable-it)
gsettings set org.freedesktop.ibus.panel.emoji hotkey "@as []" # @as indicates that the value is of "array of strings" type (GSettings and dconf are strongly-typed, but usually guess the type from the value itself – but an empty [] only tells them that it's an array-of-something)
# dark theme
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
# autohide docker
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed false
gsettings set org.gnome.shell.extensions.dash-to-dock autohide true
# TODO: add keyboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment