Last active
August 20, 2024 17:56
-
-
Save ShohruxYusupov/0f8fccce902a6257b397ecac2686b2d5 to your computer and use it in GitHub Desktop.
bash script for setting up my working environment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| # Script for setting up working environment | |
| # Ensure that script ran in parent shell | |
| read -p $"Did you run the script on parent shell? Kinda 'source script.sh' [y/n] \n" answer | |
| if [[ "$answer" != "y" ]]; then | |
| echo "Run the script on parent shell, like this '. script.sh' or 'source script.sh'" | |
| exit 1 | |
| fi | |
| # To avoid prompting for the sudo password for the rest of the script, enter it at the start. | |
| sudo -v | |
| # Determine the desktop environment and configure it | |
| desktop_environment=$(echo $XDG_CURRENT_DESKTOP | tr [:upper:] [:lower:]) | |
| if [[ $desktop_environment == "gnome" ]]; then | |
| echo 'adding keyboard langs that i need...' | |
| gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ru')]" | |
| echo 'setting up capslock as keyboard layout switcher...' | |
| gsettings set org.gnome.desktop.input-sources xkb-options "['grp:caps_toggle']" | |
| echo 'setting up screen blank to 15 minutes...' | |
| gsettings set org.gnome.desktop.session idle-delay 900 | |
| echo 'setting up automatic suspend time to 30 minutes...' | |
| gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 1800 | |
| echo 'setting up input sources per-window...' | |
| gsettings set org.gnome.desktop.input-sources per-window true | |
| echo 'setting up single click mode in Files/Nautilus...' | |
| gsettings set org.gnome.nautilus.preferences click-policy 'single' | |
| echo 'enabling night light...' | |
| gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true | |
| else | |
| echo "Unsupported desktop environment: $desktop_environment" | |
| exit 1 | |
| fi | |
| # Determine the terminal shell and configure it | |
| terminal_shell=$(basename $SHELL) | |
| if [[ $terminal_shell == "bash" ]]; then | |
| echo $"turning on case insensitive tabulation/completion...\nsetting up terminal's promt color..." | |
| echo " | |
| # case insensitive tabulation/completion | |
| bind 'set completion-ignore-case on'" >> ~/.bashrc | |
| else | |
| echo "Unsupported terminal shell: $terminal_shell" | |
| exit 1 | |
| fi | |
| # Temp working directory for downloading apps | |
| cd ~/Downloads | |
| # Determine the Linux distribution and install apps | |
| distro=$(source /etc/os-release 2>/dev/null && echo $ID) | |
| if [[ $distro == "ubuntu" ]]; then | |
| echo 'installing: yandex browser...' | |
| echo 'deb [arch=amd64] https://repo.yandex.ru/yandex-browser/deb stable main' > /etc/apt/sources.list.d/yandex-browser.list && | |
| apt install -y yandex-browser-stable | |
| echo 'installing: dbeaver...' | |
| add-apt-repository ppa:serge-rider/dbeaver-ce -y && | |
| apt install dbeaver-ce -y | |
| # sudo snap install -y dbeaver-ce | |
| echo 'installing: postman...' | |
| # need to test snap package first | |
| sudo snap install -y postman | |
| echo 'installing: telegram...' | |
| # need to test snap package first | |
| sudo snap install telegram-desktop | |
| echo 'disabling update notifier...' | |
| sed -i 's/Exec/#Exec/' /etc/xdg/autostart/update-notifier.desktop | |
| # echo 'installing: nvidia legacy drivers...' | |
| # add-apt-repository ppa:kelebek333/nvidia-legacy | |
| # apt install nvidia-340 | |
| # apt install nvidia-340-updates | |
| elif [[ $distro == "fedora" ]]; then | |
| echo "installing: dbeaver, postman, telegram, yandex browser..." | |
| flatpak install -y --noninteractive flathub io.dbeaver.DBeaverCommunity com.getpostman.Postman org.telegram.desktop ru.yandex.Browser | |
| else | |
| echo "Unsupported distribution: $distro" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment