From 177983c82b5f1747ac5723fa7ee87b2026277ef0 Mon Sep 17 00:00:00 2001 From: dillacorn <28743863+dillacorn@users.noreply.github.com> Date: Tue, 24 Sep 2024 08:56:44 -0400 Subject: [PATCH] another big update --- README.md | 37 ++---- config/i3/config | 2 +- config/i3/scripts/i3exit.sh | 4 - scripts/install_my_flatpaks.sh | 214 ++++++++------------------------- scripts/install_my_i3_apps.sh | 1 + setup_installer.sh | 22 ++-- 6 files changed, 75 insertions(+), 205 deletions(-) diff --git a/README.md b/README.md index 68ee269..148c43c 100644 --- a/README.md +++ b/README.md @@ -17,21 +17,6 @@ My keybinds (see [i3 config](https://github.com/dillacorn/i3-dots/blob/main/conf --- -## i3 Themes Change Script - -You can dynamically switch i3 themes using **Rofi**. - -1. Navigate to your themes folder: - ```sh - cd ~/.config/i3/themes - chmod +x * - ``` -2. Use the keybind `mod4+shift+t` to trigger the Rofi theme selector. - -Enjoy! I scripted this myself! - ---- - ## i3 Keybind Custom Scripts/Commands Here are some of my custom keybinds from the i3 configuration: @@ -46,6 +31,10 @@ Here are some of my custom keybinds from the i3 configuration: - `mod1+ctrl+shift+p` = **i3 Power Menu** - Activates Selectable Power Menu script: [i3exit.sh](https://github.com/dillacorn/i3-dots/blob/main/config/i3/scripts/i3exit.sh). - Escape(ESC) to cancel power menu. + +- `mod4+shift+t` = **i3 Theme Changer** + - Launches a theme selector using Rofi: [View avaliable themes](https://github.com/dillacorn/i3-dots/tree/main/config/i3/themes). + - You can easily add your own themes to [this directory](https://github.com/dillacorn/i3-dots/tree/main/config/i3/themes). - `mod4+shift+g` = **Capture a GIF** - Starts a GIF recording with the script: [gif.sh](https://github.com/dillacorn/i3-dots/blob/main/config/i3/scripts/gif.sh). @@ -135,24 +124,18 @@ When you logout of i3, any errors in your config or applications will be shown d --- -## i3 Apps and Manual Scripts Install/Setup +### Installing i3-WM and Related Applications with Scripts -To install the applications I use with i3, run my [install script](https://github.com/dillacorn/i3-dots/blob/main/scripts/install_my_i3_apps.sh). This includes i3wm, Rofi, Dunst, and others. +To install the applications I use with i3, you can run my [install script](https://github.com/dillacorn/i3-dots/blob/main/scripts/install_my_i3_apps.sh). This script installs essential tools like i3-wm, Rofi, Dunst, and more. -Make sure your i3 scripts are executable: -```sh -cd ~/.config/i3 -chmod +x rotate_configs.sh i3exit.sh custom_res.sh -``` +For Flatpak applications, run the [install_my_flatpaks.sh script](https://github.com/dillacorn/i3-dots/blob/main/scripts/install_my_flatpaks.sh) to set up additional software. --- ### P.S. -This originally started as a Wayland repo (see git history) ~ X11 currently is generally more flexible in customization.. I'm assuming if I learn to do as much as I can on X11 then I can maybe eventually transfer that knowledge to a seperate repo that will be using Swaywm. +This repository originally began as a Wayland-focused project (see the git history). However, X11 currently offers greater flexibility in customization. My goal is to learn as much as I can with X11, with the hope that this knowledge can eventually be applied to a separate repository using Sway-wm. -Currently i3 to my knowledge is more flexible (especially for gaming) but the continued knowledge and updates in the unstable repo have proven that the gap will close eventually and we may all need to move to a wayland based window manager. +At present, i3-wm seems more flexible (especially for gaming), but with ongoing developments and updates in the unstable repositories, it's likely that the gap will eventually close, and we may all need to transition to a Wayland-based window manager. ### License -[MIT licensed flatpak install script](https://github.com/dillacorn/i3-dots/blob/main/scripts/install_my_flatpaks.sh), see [MIT](https://gist.github.com/Lissy93/143d2ee01ccc5c052a17)) - -All other code and/or notes are not under any kind of license. If others find some of the scripts helpful they're free to use, modify, publish and distribute to there hearts content. See https://unlicense.org/repo +All code and notes are not under any formal license. If you find any of the scripts helpful, feel free to use, modify, publish, and distribute them to your heart's content. See https://unlicense.org/repo diff --git a/config/i3/config b/config/i3/config index 997909f..85218df 100644 --- a/config/i3/config +++ b/config/i3/config @@ -47,7 +47,7 @@ set $screenshot2 flameshot gui set $rotate ~/.config/i3/scripts/rotate_config_navigation.sh # theme change with rofi -set $themes selected=$(ls ~/.config/i3/themes/|rofi -dmenu -p "Run: ")&&bash ~/.config/i3/themes/$selected +set $themes selected=$(ls ~/.config/i3/themes/ | rofi -dmenu -p "Select Theme") && bash ~/.config/i3/themes/$selected #################### ### input/output ### diff --git a/config/i3/scripts/i3exit.sh b/config/i3/scripts/i3exit.sh index 8060501..58d77f3 100644 --- a/config/i3/scripts/i3exit.sh +++ b/config/i3/scripts/i3exit.sh @@ -1,9 +1,5 @@ #!/usr/bin/env bash -lock() { - $HOME/.config/i3lock/i3lock.sh -} - case "$1" in lock) i3lock --color 000000 diff --git a/scripts/install_my_flatpaks.sh b/scripts/install_my_flatpaks.sh index 8a6ed54..976af1a 100644 --- a/scripts/install_my_flatpaks.sh +++ b/scripts/install_my_flatpaks.sh @@ -1,38 +1,24 @@ #!/usr/bin/env bash +# This script MIGHT require sudo IF flatpak isn't already installed! -###################################################################### -# Linux Desktop Application Installations via Flatpak # -###################################################################### -# This script will: # -# - Check that Flatpak is installed / prompt to install # -# - Update currently installed Flatpak apps from FlatHub # -# - Check app not already installed via system package manager # -# - Then install any not-yet-installed that are apps listed # -# # -# The following flag parameters are accepted: # -# --prompt-before-each - Ask for user confirmation for each app # -# --dry-run - Run script, but without making changes to disk # -# --auto-yes - Don't prompt for any user input, use with care # -# --help - Print usage instructions / help menu, then exit # -# # -# IMPORTANT: Be sure to remove / comment any apps you do not want! # -# For docs and more info, see: https://github.com/lissy93/dotfiles # -###################################################################### -# Licensed under MIT (C) Alicia Sykes 2022 # -###################################################################### +# Flatpak installation and setup script + +# Color Variables +CYAN_B='\033[1;96m' +YELLOW='\033[0;93m' +RED_B='\033[1;31m' +RESET='\033[0m' +GREEN='\033[0;32m' +PURPLE='\033[0;35m' # Remote origin to use for installations flatpak_origin='flathub' # List of desktop apps to be installed (specified by app ID) flatpak_apps=( - - # Communication 'com.github.IsmaelMartinez.teams_for_linux' # Teams Work Client 'dev.vencord.Vesktop' # Discord Client 'org.telegram.desktop' # Telegram Client - - # Media 'com.spotify.Client' # Music streaming 'com.valvesoftware.Steam' # Steam Game Client 'net.davidotek.pupgui2' # Install 3D party Proton Versions @@ -41,157 +27,55 @@ flatpak_apps=( 'com.heroicgameslauncher.hgl' # Game Launcher 'io.github.hrkfdn.ncspot' # Spotify TUI Client 'com.spotify.Client' # Spotify Official Client - - # Creativity - 'com.ultimaker.cura' # 3D slicing - 'com.obsproject.Studio' # Video recording/streaming - 'fr.handbrake.ghb' # Video transcoder - 'nl.hjdskes.gcolor3' # Color picker - 'org.audacityteam.Audacity' # Sound editor - 'org.flameshot.Flameshot' # Screenshot tool - 'org.kde.krita' # Picture editor - 'org.shotcut.Shotcut' # Video editor - - # Settings and system utils - 'org.localsend.localsend_app' # Send/Receive Files - 'org.bleachbit.BleachBit' # Disk cleaner and log remover - 'it.mijorus.smile' # Emoji picker - 'org.filezillaproject.Filezilla' # FTP Client - 'com.github.tchx84.Flatseal' # Modify Flatpak Permissions - - # Browsers and internet - 'io.gitlab.librewolf-community' # Firefox Privacy Browser - 'io.github.ungoogled_software.ungoogled_chromium' # Degoogled Chromium-based browser + 'com.ultimaker.cura' # 3D slicing + 'com.obsproject.Studio' # Video recording/streaming + 'fr.handbrake.ghb' # Video transcoder + 'nl.hjdskes.gcolor3' # Color picker + 'org.audacityteam.Audacity' # Sound editor + 'org.flameshot.Flameshot' # Screenshot tool + 'org.kde.krita' # Picture editor + 'org.shotcut.Shotcut' # Video editor + 'org.localsend.localsend_app' # Send/Receive Files + 'org.bleachbit.BleachBit' # Disk cleaner and log remover + 'it.mijorus.smile' # Emoji picker + 'org.filezillaproject.Filezilla' # FTP Client + 'com.github.tchx84.Flatseal' # Modify Flatpak Permissions + 'io.gitlab.librewolf-community' # Firefox Privacy Browser + 'io.github.ungoogled_software.ungoogled_chromium' # Degoogled Chromium-based browser ) -# Color Variables -CYAN_B='\033[1;96m' -YELLOW='\033[0;93m' -RED_B='\033[1;31m' -RESET='\033[0m' -GREEN='\033[0;32m' -PURPLE='\033[0;35m' -LIGHT='\x1b[2m' - -# Options -PROMPT_TIMEOUT=15 # When user is prompted for input, skip after x seconds -PARAMS=$* # User-specified parameters - -if [[ $PARAMS == *"--auto-yes"* ]]; then - PROMPT_TIMEOUT=1 - AUTO_YES=true +# Check if Flatpak is installed; if not, install it via apt +if ! command -v flatpak &> /dev/null; then + echo -e "${PURPLE}Flatpak is not installed. Installing Flatpak...${RESET}" + sudo apt update && sudo apt install -y flatpak fi -# Helper function to install Flatpak (if not present) for users current distro -function install_flatpak () { - # Arch, Manjaro - if hash "pacman" 2> /dev/null; then - echo -e "${PURPLE}Installing Flatpak via Pacman${RESET}" - sudo pacman -S flatpak - # Debian, Ubuntu, PopOS, Raspian - elif hash "apt" 2> /dev/null; then - echo -e "${PURPLE}Installing Flatpak via apt get${RESET}" - sudo apt install flatpak - # Alpine - elif hash "apk" 2> /dev/null; then - echo -e "${PURPLE}Installing Flatpak via apk add${RESET}" - sudo apk add flatpak - # Red Hat, CentOS - elif hash "yum" 2> /dev/null; then - echo -e "${PURPLE}Installing Flatpak via Yum${RESET}" - sudo yum install flatpak - fi -} - -# Checks if a given app ($1) is already installed, otherwise installs it -function install_app () { - app=$1 - - # If --prompt-before-each is set, then ask user if they'd like to proceed - if [[ $PARAMS == *"--prompt-before-each"* ]]; then - echo -e -n "\n${CYAN_B}Would you like to install ${app}? (y/N) ${RESET}" - read -t 15 -n 1 -r - if [[ ! $REPLY =~ ^[Yy]$ ]] && [[ $AUTO_YES != true ]] ; then - echo -e "\n${YELLOW}[Skipping] ${LIGHT}${app}, rejected by user${RESET}" - return - fi - echo - fi - - # Process app ID, and grep for it in system - app_name=$(echo $app | rev | cut -d "." -f1 | rev) - is_in_flatpak=$(echo $(flatpak list --columns=ref | grep $app)) - is_in_pacman=$(echo $(pacman -Qk $(echo $app_name | tr 'A-Z' 'a-z') 2> /dev/null )) - is_in_apt=$(echo $(dpkg -s $(echo $app_name | tr 'A-Z' 'a-z') 2> /dev/null )) - - # Check app not already installed via Flatpak - if [ -n "$is_in_flatpak" ]; then - echo -e "${YELLOW}[Skipping] ${LIGHT}${app_name} is already installed.${RESET}" - # Check app not installed via Pacman (Arch Linux) - elif [[ "${is_in_pacman}" == *"total files"* ]]; then - echo -e "${YELLOW}[Skipping] ${LIGHT}${app_name} is already installed via Pacman.${RESET}" - # Check app not installed via apt get (Debian) - elif [[ "${is_in_apt}" == *"install ok installed"* ]]; then - echo -e "${YELLOW}[Skipping] ${LIGHT}${app_name} is already installed via apt-get.${RESET}" - else - # Install app using Flatpak - echo -e "${GREEN}[Installing] ${LIGHT}Downloading ${app_name} (from ${flatpak_origin}).${RESET}" - if [[ $PARAMS == *"--dry-run"* ]]; then return; fi # Skip if --dry-run enabled - flatpak install -y --noninteractive $flatpak_origin $app - fi -} - -function print_usage () { - echo -e "${CYAN_B}Flatpak Linux Desktop App Installation and Update script${RESET}" - echo -e "${PURPLE}The following tasks will be completed:\n"\ - "- Check Flatpak is installed correctly / prompt to install if not\n"\ - "- Add the flathub repo, if not already present\n"\ - "- Upgrade Flatpak, and update all exiting installed apps\n"\ - "- Installs each app in the list (if not already present)\n"\ - "${RESET}" -} - -# Show help menu -print_usage -if [[ $PARAMS == *"--help"* ]]; then exit; fi - -# Ask user if they'd like to proceed, and exit if not -echo -e "${CYAN_B}Would you like to install Flatpak desktop apps? (y/N)${RESET}\n" -read -t $PROMPT_TIMEOUT -n 1 -r +# Prompt the user to proceed with installation +echo -e "${CYAN_B}Would you like to install Dillacorn's chosen Flatpak applications? (y/n)${RESET}" +read -n 1 -r REPLY echo -if [[ ! $REPLY =~ ^[Yy]$ ]] && [[ $AUTO_YES != true ]] ; then - echo -e "${YELLOW}Skipping Flatpak installations..." +if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo -e "${YELLOW}Flatpak setup and install canceled by the user...${RESET}" exit 0 fi -echo -e "${CYAN_B}Starting Flatpak App Installation Script${RESET}" +# Add Flathub repository if not already present +echo -e "${GREEN}Adding Flathub repository...${RESET}" +sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + +# Update currently installed Flatpak apps +echo -e "${GREEN}Updating installed Flatpak apps...${RESET}" +sudo flatpak update -y -# Check that Flatpak is present, prompt to install or exit if not -if ! hash flatpak 2> /dev/null; then - echo -e "${PURPLE}Flatpak isn't yet installed on your system${RESET}" - echo -e "${CYAN_B}Would you like to install Flatpak now?${RESET}\n" - read -t $PROMPT_TIMEOUT -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] || [[ $AUTO_YES = true ]] ; then - install_flatpak +# Install apps from the list +echo -e "${GREEN}Installing selected Flatpak apps...${RESET}" +for app in "${flatpak_apps[@]}"; do + if ! flatpak list --app | grep -q "${app}"; then + echo -e "${GREEN}Installing ${app}...${RESET}" + sudo flatpak install -y "$flatpak_origin" "$app" else - echo -e "${YELLOW}Skipping Flatpak installations, as Flatpack not installed" - exit 0 + echo -e "${YELLOW}${app} is already installed. Skipping...${RESET}" fi -fi - -# Add FlatHub as upstream repo, if not already present -echo -e "${PURPLE}Adding Flathub repo${RESET}" -flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - -# Update currently installed apps -echo -e "${PURPLE}Updating installed apps${RESET}" -flatpak update --assumeyes --noninteractive - -# Install each app listed above (if not already installed) -echo -e "${PURPLE}Installing apps defined in manifest${RESET}" -for app in ${flatpak_apps[@]}; do - install_app $app done -echo -e "${PURPLE}Finished processing Flatpak apps${RESET}" +echo -e "${PURPLE}Flatpak setup and installation complete.${RESET}" diff --git a/scripts/install_my_i3_apps.sh b/scripts/install_my_i3_apps.sh index cb4343a..6ffacd1 100644 --- a/scripts/install_my_i3_apps.sh +++ b/scripts/install_my_i3_apps.sh @@ -1,4 +1,5 @@ #!/bin/bash +# requires sudo! set -eu -o pipefail # fail on error and report it, debug all lines diff --git a/setup_installer.sh b/setup_installer.sh index 6e90faf..49bf0d4 100644 --- a/setup_installer.sh +++ b/setup_installer.sh @@ -1,4 +1,5 @@ #!/bin/bash +# requires sudo! ################################################# ## "run this script" directions for new users! ## @@ -25,11 +26,14 @@ ## !ALACRITTY NOTICE! ## ######################## -# alacritty theme changing WILL NOT work **(YET)** from Debian Stable repo. +# alacritty ~theme changing~ WILL NOT work **(YET)** from Debian Stable repo. # I suggest building alacritty from source. # I've provided a script that gives you the option to install alacritty from source! (see line #171-200) # https://github.com/alacritty/alacritty/blob/master/INSTALL.md#debianubuntu +# To uninstall alacritty (from source) run the "uninstall_alacritty.sh" script! +# sudo ./uninstall_alacritty.sh + ################################################# ## end of directions ## ################################################# @@ -169,15 +173,17 @@ echo -e "\033[1;32mConverting .config file ownership...\033[0m" chown -R $SUDO_USER:$SUDO_USER /home/$SUDO_USER/.config # Ask the user if they want to run the build+install_alacritty.sh script (in bright cyan text) -echo -e "\033[1;96mDo you want to build and install Alacritty from source? (yes/no)\033[0m" -read -r response +echo -e "\033[1;96mDo you want to build and install Alacritty from source? (y/n)\033[0m" +read -n 1 -r response +echo # move to a new line -if [[ "$response" == "yes" || "$response" == "y" ]]; then - # Ask the user for confirmation (in blue text) - echo -e "\033[1;96mAre you sure? This will build Alacritty from source. (yes/no)\033[0m" - read -r confirmation +if [[ "$response" == "y" || "$response" == "Y" ]]; then + # Ask the user for confirmation (in bright cyan text) + echo -e "\033[1;96mAre you sure? This will build Alacritty from source. (y/n)\033[0m" + read -n 1 -r confirmation + echo # move to a new line - if [[ "$confirmation" == "yes" || "$confirmation" == "y" ]]; then + if [[ "$confirmation" == "y" || "$confirmation" == "Y" ]]; then echo "Running the Alacritty build and install script..." # Ensure the script is executable