From 5db877355cfb49b6351734abecd34490ec07f845 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Sun, 25 Aug 2024 03:32:39 +0200 Subject: [PATCH] lots of shit --- zshrc => .zshrc | 34 ++- README.md | 23 +- bin/actions/export.sh | 4 +- bin/actions/git/pre-commit | 2 +- bin/actions/help.sh | 6 +- bin/actions/secrets.sh | 2 +- bin/actions/status.sh | 16 +- bin/actions/term.sh | 2 +- bin/actions/update.sh | 330 +++++++++++++++++++------- bin/dotf | 22 +- bin/dotf-screenshot | 8 + bin/helpers/apt_packages.sh | 51 ++-- bin/helpers/cargo_packages.sh | 36 ++- bin/helpers/docker.sh | 34 +++ bin/helpers/flatpak_packages.sh | 8 +- bin/helpers/fonts.sh | 11 +- bin/helpers/functions.sh | 2 +- bin/helpers/gnome_extensions.sh | 7 +- bin/helpers/keyboard_shortcuts.sh | 16 +- bin/helpers/ohmyzsh.sh | 2 +- bin/helpers/pipx_packages.sh | 5 +- bin/helpers/rust.sh | 2 +- bin/helpers/tailscale.sh | 33 +++ bin/helpers/user_groups.sh | 42 ++++ bin/helpers/vscode-extensions.sh | 2 +- bin/lists/apt.sh | 58 ----- bin/lists/cargo.sh | 12 - bin/lists/flatpak.sh | 28 --- bin/lists/fonts.sh | 9 - bin/lists/pipx.sh | 6 - config/alacritty.toml | 378 ++++++++++++++++++++++++++++++ config/config.yaml | 150 ++++++++++++ config/swhkd/swhkdrc | 6 + config/wezterm.lua | 87 ------- gnome/keyboard-shortcuts.json | 2 +- vscode/settings.json | 6 +- 36 files changed, 1070 insertions(+), 372 deletions(-) rename zshrc => .zshrc (74%) create mode 100755 bin/dotf-screenshot create mode 100755 bin/helpers/docker.sh create mode 100755 bin/helpers/tailscale.sh create mode 100755 bin/helpers/user_groups.sh delete mode 100755 bin/lists/apt.sh delete mode 100755 bin/lists/cargo.sh delete mode 100755 bin/lists/flatpak.sh delete mode 100755 bin/lists/fonts.sh delete mode 100755 bin/lists/pipx.sh create mode 100644 config/alacritty.toml create mode 100644 config/config.yaml create mode 100755 config/swhkd/swhkdrc delete mode 100644 config/wezterm.lua diff --git a/zshrc b/.zshrc similarity index 74% rename from zshrc rename to .zshrc index acccfad..163be9b 100755 --- a/zshrc +++ b/.zshrc @@ -1,5 +1,3 @@ -export PATH=$PATH:~/dotfiles/bin - HISTFILE=~/.histfile HISTSIZE=1000 SAVEHIST=1000 @@ -34,13 +32,25 @@ plugins=( ) source $ZSH/oh-my-zsh.sh - -# Activate Starship eval "$(starship init zsh)" +##################### +# PATH Manipulation # +##################### + # Add ~/.local/bin to PATH export PATH=$PATH:$HOME/.local/bin +# Add ~/.cargo/bin to PATH +export PATH=$PATH:$HOME/.cargo/bin + +# Add dotfiles bin to PATH +export PATH=$PATH:$HOME/dotfiles/bin + +##################### +# Alias Definitions # +##################### + # Aliases alias docker-compose='docker compose' alias gg='git pull' @@ -63,6 +73,18 @@ alias dcp='docker compose ps' alias dcps='docker compose ps' alias dcr='docker compose run' +# Hotkeys daemon +alias hk='dotf hotkey-daemon' + +# Alias for ls to l but only if it's a interactive shell because we don't want to override ls in scripts which could blow up in our face +if [ -t 1 ]; then + alias ls='l' +fi + +###################### +# Export Definitions # +###################### + # Tradaware / DiscountOffice if [ -d "/home/menno/Projects/Work" ]; then export TRADAWARE_PATH=/home/menno/Projects/Work @@ -76,6 +98,10 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then export SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock fi +##################### +# End of the line...# +##################### + # Show welcome message, but only if the terminal is interactive if [ -t 1 ]; then dotf term diff --git a/README.md b/README.md index c272951..a08bcf5 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,21 @@ You should probably already have this cloned in your home directory but if you d git clone ssh://od.mvl.sh/dotfiles ~/dotfiles ``` -### 2. Temporarily add ~/dotfiles/bin to PATH +### 2. Prepare shell + +Make sure you are running under ZSH since the dotf script requires ZSH. + +```bash +sudo apt install zsh +``` + +Then open ZSH + +```bash +zsh +``` + +And now set the bin folder of dotfiles in your path. ```bash export PATH=$PATH:~/dotfiles/bin @@ -23,7 +37,7 @@ export PATH=$PATH:~/dotfiles/bin This should fix all the symlinks and install all the necessary packages. Afterwards you should restart your shell. -This should also set your terminal to WezTerm and default shell to zsh so make sure to restart or just reboot your system. +This should also set your terminal and default shell to zsh so make sure to restart or just reboot your system. ```bash dotf update @@ -37,6 +51,11 @@ After you have done all the steps above you should reboot your system to make su # sudo reboot ``` +### 5. Secrets + 1Password + +Since 1Password has been installed you can open it. +Secrets won't be able to decrypt until you have logged in on 1Password and enabled Developer tools under the settings. + ## Install extra packages After you've got the first part done and you have `dotf` installed you can install extra packages. diff --git a/bin/actions/export.sh b/bin/actions/export.sh index 4210d21..2d1ea5a 100755 --- a/bin/actions/export.sh +++ b/bin/actions/export.sh @@ -1,9 +1,9 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh printfe "%s\n" "cyan" "Exporting GNOME extensions" -source ~/dotfiles/bin/helpers/gnome_extensions.sh +source $HOME/dotfiles/bin/helpers/gnome_extensions.sh export_gnome_extensions printfe "%s\n" "cyan" "Exporting VSCode extensions" diff --git a/bin/actions/git/pre-commit b/bin/actions/git/pre-commit index 101420f..6a8037f 100755 --- a/bin/actions/git/pre-commit +++ b/bin/actions/git/pre-commit @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh # Check for unencrypted files in .ssh/config.d/ unencrypted_files=$(find config/ssh/config.d/ -type f ! -name "*.gpg") diff --git a/bin/actions/help.sh b/bin/actions/help.sh index 2aa3b14..0dc32f8 100755 --- a/bin/actions/help.sh +++ b/bin/actions/help.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh # Print logo tput setaf 2 -cat ~/dotfiles/bin/resources/logo.txt +cat $HOME/dotfiles/bin/resources/logo.txt println " " "cyan" tput sgr0 # Print help -cat ~/dotfiles/bin/resources/help.txt +cat $HOME/dotfiles/bin/resources/help.txt println " " "cyan" diff --git a/bin/actions/secrets.sh b/bin/actions/secrets.sh index 518df5c..ff33969 100755 --- a/bin/actions/secrets.sh +++ b/bin/actions/secrets.sh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh #################################################################################################### # Decrypt secrets diff --git a/bin/actions/status.sh b/bin/actions/status.sh index 4ac4e09..c94908c 100755 --- a/bin/actions/status.sh +++ b/bin/actions/status.sh @@ -1,13 +1,13 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh -source ~/dotfiles/bin/helpers/keyboard_shortcuts.sh -source ~/dotfiles/bin/helpers/apt_packages.sh -source ~/dotfiles/bin/helpers/pipx_packages.sh -source ~/dotfiles/bin/helpers/cargo_packages.sh -source ~/dotfiles/bin/helpers/flatpak_packages.sh -source ~/dotfiles/bin/helpers/vscode-extensions.sh -source ~/dotfiles/bin/helpers/fonts.sh +source $HOME/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/keyboard_shortcuts.sh +source $HOME/dotfiles/bin/helpers/apt_packages.sh +source $HOME/dotfiles/bin/helpers/pipx_packages.sh +source $HOME/dotfiles/bin/helpers/cargo_packages.sh +source $HOME/dotfiles/bin/helpers/flatpak_packages.sh +source $HOME/dotfiles/bin/helpers/vscode-extensions.sh +source $HOME/dotfiles/bin/helpers/fonts.sh # Check if parameter --verbose was passed if [ "$2" = "--verbose" ]; then diff --git a/bin/actions/term.sh b/bin/actions/term.sh index e8f5850..a3d14d2 100755 --- a/bin/actions/term.sh +++ b/bin/actions/term.sh @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh logo continue diff --git a/bin/actions/update.sh b/bin/actions/update.sh index 74ced16..183dc8d 100755 --- a/bin/actions/update.sh +++ b/bin/actions/update.sh @@ -1,14 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh - -printfe "%s\n" "cyan" "Pulling latest changes..." -git -C ~/dotfiles pull - -if [ $? -ne 0 ]; then - printfe "%s\n" "red" "Failed to pull latest changes" - exit 1 -fi +source $HOME/dotfiles/bin/helpers/functions.sh # check if --verbose was passed if [ "$2" = "--verbose" ]; then @@ -18,114 +10,274 @@ else export verbose=false fi -#################################################################################################### -# Update symlinks -#################################################################################################### +pull_dotfiles() { + #################################################################################################### + # Pull latest dotfiles + #################################################################################################### -printfe "%s\n" "cyan" "Updating symlinks..." -check_or_make_symlink ~/.zshrc ~/dotfiles/zshrc -check_or_make_symlink ~/.config/Code/User/settings.json ~/dotfiles/vscode/settings.json -check_or_make_symlink ~/.config/starship.toml ~/dotfiles/config/starship.toml + printfe "%s\n" "cyan" "Pulling latest changes..." -if [[ "$OSTYPE" == "darwin"* ]]; then - check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.macos -else - check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.linux -fi + result=$(git -C $HOME/dotfiles pull --ff-only) -check_or_make_symlink ~/.ssh/config ~/dotfiles/config/ssh/config -check_or_make_symlink ~/.ssh/config.d ~/dotfiles/config/ssh/config.d -check_or_make_symlink ~/.wezterm.lua ~/dotfiles/config/wezterm.lua + if [ $? -ne 0 ]; then + printfe "%s\n" "red" " - Failed to pull latest changes" + printfe "%s\n" "red" " Result: $result" + exit 1 + fi -#################################################################################################### -# Update system packages -#################################################################################################### + # In case it failed to pull due to conflicts, stop and notify the user + if [[ $result == *"CONFLICT"* ]]; then + printfe "%s\n" "red" " - Failed to pull latest changes" + printfe "%s\n" "red" " Result: $result" + exit 1 + fi -printfe "%s\n" "cyan" "Updating system packages..." -if [[ "$OSTYPE" == "darwin"* ]]; then - brew update - brew upgrade - brew cleanup -else - sudo nala upgrade -y - sudo nala autoremove -y --purge -fi + if [ $? -ne 0 ]; then + printfe "%s\n" "red" "Failed to pull latest changes" + exit 1 + fi +} + +groups() { + #################################################################################################### + # Ensure user groups + #################################################################################################### + + printfe "%s\n" "cyan" "Ensuring user groups..." + source $HOME/dotfiles/bin/helpers/user_groups.sh + ensure_user_groups +} + +symlinks() { + #################################################################################################### + # Update symlinks + #################################################################################################### + + printfe "%s\n" "cyan" "Updating config symlinks..." + check_or_make_symlink ~/.zshrc ~/dotfiles/.zshrc + check_or_make_symlink ~/.config/Code/User/settings.json ~/dotfiles/vscode/settings.json + check_or_make_symlink ~/.config/starship.toml ~/dotfiles/config/starship.toml + + if [[ "$OSTYPE" == "darwin"* ]]; then + check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.macos + else + check_or_make_symlink ~/.gitconfig ~/dotfiles/config/gitconfig.linux + fi + + check_or_make_symlink ~/.ssh/config ~/dotfiles/config/ssh/config + check_or_make_symlink ~/.ssh/config.d ~/dotfiles/config/ssh/config.d + check_or_make_symlink ~/.config/alacritty/alacritty.toml ~/dotfiles/config/alacritty.toml + +} + +sys_packages() { + #################################################################################################### + # Update system packages + #################################################################################################### + + printfe "%s\n" "cyan" "Updating system packages..." + if [[ "$OSTYPE" == "darwin"* ]]; then + brew update + brew upgrade + brew cleanup + else + sudo nala upgrade -y + sudo nala autoremove -y --purge + fi +} #################################################################################################### # Update packages #################################################################################################### -printfe "%s\n" "cyan" "Oh My Zsh update..." -source ~/dotfiles/bin/helpers/ohmyzsh.sh -ensure_ohmyzsh_installed +cargopkgs() { + printfe "%s\n" "cyan" "Rust update..." + source $HOME/dotfiles/bin/helpers/rust.sh + ensure_rust_installed + + printfe "%s\n" "cyan" "Ensuring Cargo packages are installed..." + source $HOME/dotfiles/bin/helpers/cargo_packages.sh + ensure_cargo_packages_installed +} -printfe "%s\n" "cyan" "Rust update..." -source ~/dotfiles/bin/helpers/rust.sh -ensure_rust_installed +aptpkgs() { + printfe "%s\n" "cyan" "Ensuring APT repositories are added..." + source $HOME/dotfiles/bin/helpers/apt_packages.sh + ensure_repositories -printfe "%s\n" "cyan" "Ensuring APT repositories are added..." -source ~/dotfiles/bin/helpers/apt_packages.sh -ensure_repositories + printfe "%s\n" "cyan" "Ensuring APT packages are installed..." + ensure_apt_packages_installed +} -printfe "%s\n" "cyan" "Ensuring APT packages are installed..." -ensure_apt_packages_installed +pipxpkgs() { + printfe "%s\n" "cyan" "Ensuring pipx packages are installed..." + source $HOME/dotfiles/bin/helpers/pipx_packages.sh + ensure_pipx_packages_installed +} -printfe "%s\n" "cyan" "Ensuring pipx packages are installed..." -source ~/dotfiles/bin/helpers/pipx_packages.sh -ensure_pipx_packages_installed +flatpakpkgs() { + printfe "%s\n" "cyan" "Ensuring Flatpak remotes are added..." + source $HOME/dotfiles/bin/helpers/flatpak_packages.sh + ensure_remotes_added -printfe "%s\n" "cyan" "Ensuring GNOME Extensions are installed..." -source ~/dotfiles/bin/helpers/gnome_extensions.sh -ensure_gnome_extensions_installed + printfe "%s\n" "cyan" "Ensuring Flatpak packages are installed..." + ensure_flatpak_packages_installed +} -printfe "%s\n" "cyan" "Ensuring Cargo packages are installed..." -source ~/dotfiles/bin/helpers/cargo_packages.sh -ensure_cargo_packages_installed +dockercmd() { + printfe "%s\n" "cyan" "Ensuring Docker is installed..." + source $HOME/dotfiles/bin/helpers/docker.sh + ensure_docker_installed +} -printfe "%s\n" "cyan" "Ensuring Flatpak remotes are added..." -source ~/dotfiles/bin/helpers/flatpak_packages.sh -ensure_remotes_added +tailscalecmd() { + printfe "%s\n" "cyan" "Ensuring Tailscale is installed..." + source $HOME/dotfiles/bin/helpers/tailscale.sh + ensure_tailscale_installed +} -printfe "%s\n" "cyan" "Ensuring Flatpak packages are installed..." -ensure_flatpak_packages_installed +extensions() { + printfe "%s\n" "cyan" "Ensuring GNOME Extensions are installed..." + source $HOME/dotfiles/bin/helpers/gnome_extensions.sh + ensure_gnome_extensions_installed -printfe "%s\n" "cyan" "Ensuring VSCode extensions are installed..." -source ~/dotfiles/bin/helpers/vscode-extensions.sh -ensure_vscode_extensions_installed + printfe "%s\n" "cyan" "Ensuring VSCode extensions are installed..." + source $HOME/dotfiles/bin/helpers/vscode-extensions.sh + ensure_vscode_extensions_installed +} #################################################################################################### # Update system settings #################################################################################################### -printfe "%s\n" "cyan" "Setting up keyboard shortcuts..." -source ~/dotfiles/bin/helpers/keyboard_shortcuts.sh -ensure_keyboard_shortcuts +keyboard() { + printfe "%s\n" "cyan" "Setting up keyboard shortcuts..." + source $HOME/dotfiles/bin/helpers/keyboard_shortcuts.sh + ensure_keyboard_shortcuts +} -printfe "%s\n" "cyan" "Ensuring fonts are installed..." -source ~/dotfiles/bin/helpers/fonts.sh -ensure_fonts_installed +fonts() { + printfe "%s\n" "cyan" "Ensuring fonts are installed..." + source $HOME/dotfiles/bin/helpers/fonts.sh + ensure_fonts_installed +} -printfe "%s\n" "cyan" "Setting wezterm as default terminal..." -if [ ! -f /usr/bin/wezterm ]; then - printfe "%s\n" "red" "Wezterm is not installed" - exit 1 -fi +default_terminal() { + printfe "%s\n" "cyan" "Setting alacritty as default terminal..." + # Check if alacritty is installed + if [ -x "$(command -v alacritty)" ]; then + current_terminal=$(sudo update-alternatives --query x-terminal-emulator | grep '^Value:' | awk '{print $2}') -current_terminal=$(sudo update-alternatives --query x-terminal-emulator | grep '^Value:' | awk '{print $2}') + if [ "$current_terminal" != $(which alacritty) ]; then + printfe "%s\n" "yellow" " - Setting alacritty as default terminal" + sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator $(which alacritty) 80 + else + printfe "%s\n" "green" " - alacritty is already the default terminal" + fi + else + printfe "%s\n" "red" " - alacritty is not installed" + fi +} -if [ "$current_terminal" != "/usr/bin/wezterm" ]; then - printfe "%s\n" "yellow" " - Setting wezterm as default terminal" - sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/wezterm 60 +default_shell() { + printfe "%s\n" "cyan" "Setting zsh as default shell..." + if [ "$SHELL" != "/usr/bin/zsh" ]; then + printfe "%s\n" "yellow" " - Setting zsh as default shell" + chsh -s /usr/bin/zsh + else + printfe "%s\n" "green" " - zsh is already the default shell" + fi +} + +#################################################################################################### +# Parse arguments +#################################################################################################### + +# Multiple options can be passed to the script, for example: +# ./update.sh --verbose --groups --symlinks --packages --keyboard --fonts --default-terminal --default-shell +# If no options are passed, the script will run all functions + +# Shift the first argument since this is the script name +shift + +if [ "$#" -eq 0 ]; then + printfe "%s\n" "yellow" "No options passed, running full update..." + + pull_dotfiles + groups + symlinks + sys_packages + cargopkgs + aptpkgs + pipxpkgs + flatpakpkgs + dockercmd + tailscalecmd + extensions + keyboard + fonts + default_terminal + default_shell else - printfe "%s\n" "green" " - wezterm is already the default terminal" + for arg in "$@"; do + case $arg in + --pull) + pull_dotfiles + ;; + --groups) + groups + ;; + --symlinks) + symlinks + ;; + --packages) + sys_packages + cargopkgs + aptpkgs + pipxpkgs + flatpakpkgs + dockercmd + tailscalecmd + ;; + --apt) + aptpkgs + ;; + --pipx) + pipxpkgs + ;; + --cargo) + cargopkgs + ;; + --flatpak) + flatpakpkgs + ;; + --docker) + dockercmd + ;; + --tailscale) + tailscalecmd + ;; + --extensions) + extensions + ;; + --keyboard) + keyboard + ;; + --fonts) + fonts + ;; + --default-terminal) + default_terminal + ;; + --default-shell) + default_shell + ;; + *) + printfe "%s\n" "red" "Unknown option: $arg" + ;; + esac + done fi -printfe "%s\n" "cyan" "Setting zsh as default shell..." -if [ "$SHELL" != "/usr/bin/zsh" ]; then - printfe "%s\n" "yellow" " - Setting zsh as default shell" - chsh -s /usr/bin/zsh -else - printfe "%s\n" "green" " - zsh is already the default shell" -fi - -printfe "%s\n" "green" "Update complete!" \ No newline at end of file +echo "" +printfe "%s\n" "blue" "Done!" diff --git a/bin/dotf b/bin/dotf index 7827d2f..9a238da 100755 --- a/bin/dotf +++ b/bin/dotf @@ -1,32 +1,33 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh +export DOTFILES_CONFIG=$HOME/dotfiles/config/config.yaml status() { - ~/dotfiles/bin/actions/status.sh $@ + $HOME/dotfiles/bin/actions/status.sh $@ } update() { - ~/dotfiles/bin/actions/update.sh $@ + $HOME/dotfiles/bin/actions/update.sh $@ } help() { - ~/dotfiles/bin/actions/help.sh $@ + $HOME/dotfiles/bin/actions/help.sh $@ } exports() { - ~/dotfiles/bin/actions/export.sh $@ + $HOME/dotfiles/bin/actions/export.sh $@ } secrets() { - ~/dotfiles/bin/actions/secrets.sh $@ + $HOME/dotfiles/bin/actions/secrets.sh $@ } ensure_git_hooks() { # If ~/dotfiles/.git/hooks is a symlink, skip this if [[ -L ~/dotfiles/.git/hooks ]]; then # Let's make sure the symlink is correct - if [[ $(readlink ~/dotfiles/.git/hooks) != ~/dotfiles/bin/actions/git ]]; then + if [[ $(readlink ~/dotfiles/.git/hooks) != $HOME/dotfiles/bin/actions/git ]]; then printfe "%s\n" "yellow" "The ~/dotfiles/.git/hooks symlink is incorrect. Please remove it and run this script again." fi return @@ -37,7 +38,7 @@ ensure_git_hooks() { printfe "%s\n" "yellow" "The ~/dotfiles/.git/hooks directory already exists. We're removing it!" fi - ln -s ~/dotfiles/bin/actions/git ~/dotfiles/.git/hooks + ln -s $HOME/dotfiles/bin/actions/git ~/dotfiles/.git/hooks printfe "%s\n" "green" "Git hooks are now set up!" } @@ -64,7 +65,10 @@ case $1 in secrets $@ ;; term) - ~/dotfiles/bin/actions/term.sh $@ + $HOME/dotfiles/bin/actions/term.sh $@ + ;; + hotkey-daemon) + bash -c "swhks & pkexec swhkd -c ~/dotfiles/config/swhkd/swhkdrc" & ;; *) printfe "%s\n" "red" "Unknown command $1" diff --git a/bin/dotf-screenshot b/bin/dotf-screenshot new file mode 100755 index 0000000..e5cb4b7 --- /dev/null +++ b/bin/dotf-screenshot @@ -0,0 +1,8 @@ +#!/usr/bin/env zsh + +# In case we run Pop!_OS let's use `cosmic-screenshot --interactive`, otherwise default to `flameshot gui` +if [[ -x "$(command -v cosmic-screenshot)" ]]; then + cosmic-screenshot --interactive +else + flameshot gui +fi diff --git a/bin/helpers/apt_packages.sh b/bin/helpers/apt_packages.sh index 4a29955..ebafe6f 100755 --- a/bin/helpers/apt_packages.sh +++ b/bin/helpers/apt_packages.sh @@ -1,25 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/lists/apt.sh - -add_wezterm_repo() { - # Check if we have a wezterm.list file already, if not then create one - if [ ! -f /etc/apt/sources.list.d/wezterm.list ]; then - curl -fsSL https://apt.fury.io/wez/gpg.key | sudo 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/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list - result=$(sudo apt update 2>&1) - - if [ $? -ne 0 ]; then - printfe "%s\n" "red" " - Failed to add Wezterm repository" - printfe "%s\n" "yellow" "$result" - exit 1 - fi - - printfe "%s\n" "yellow" " - Added Wezterm repository" - else - printfe "%s\n" "green" " - Wezterm repository already added" - fi -} +source $HOME/dotfiles/bin/helpers/functions.sh add_brave_repo() { # Check if we have a brave-browser-release.list file already, if not then create one @@ -104,14 +85,38 @@ add_vscode_repo() { } ensure_repositories() { - add_wezterm_repo add_brave_repo add_1password_repo add_spotify_repo add_vscode_repo -} + repos=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.apt.repos)) + for repo in $repos; do + repo_name=$(echo $repo | cut -d ":" -f 2) + + # Go through sources.list.d and check if there's a file containing part of URIs: https://ppa.launchpad.net/$repo_name + # We have to check the files not the file names since the file names are not always the same as the repo_name + result=$(grep -r "$repo_name" /etc/apt/sources.list.d/*) + if [ -z "$result" ]; then + printfe "%s\n" "yellow" " - Adding $repo_name repository..." + clear_line + + sudo add-apt-repository -y $repo + + if [ $? -ne 0 ]; then + printfe "%s\n" "red" " - Failed to add $repo_name repository" + exit 1 + else + printfe "%s\n" "green" " - $repo_name repository added successfully" + fi + else + printfe "%s\n" "green" " - $repo_name repository already added" + fi + done +} ensure_apt_packages_installed() { + apt_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.apt.apps)) + # Check if apt_packages array contains duplicates if [ $(echo $apt_packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then printfe "%s\n" "red" "The apt_packages array contains duplicates" @@ -149,6 +154,8 @@ print_apt_status() { printfe "%s" "cyan" "Checking APT packages..." clear_line + apt_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.apt.apps)) + # count entries in packages count=$(echo $apt_packages | wc -w) installed=0 diff --git a/bin/helpers/cargo_packages.sh b/bin/helpers/cargo_packages.sh index 72a31ef..bfbd64f 100755 --- a/bin/helpers/cargo_packages.sh +++ b/bin/helpers/cargo_packages.sh @@ -1,29 +1,38 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh -source ~/dotfiles/bin/lists/cargo.sh +source $HOME/dotfiles/bin/helpers/functions.sh ensure_cargo_packages_installed() { - # Check if cargo_packages array contains duplicates - if [ $(echo $cargo_packages | tr ' ' '\n' | sort | uniq -d | wc -l) -ne 0 ]; then - printfe "%s\n" "red" "The cargo_packages array contains duplicates" - printfe "%s\n" "yellow" "Duplicates:" - printfe "%s\n" "blue" $(echo $cargo_packages | tr ' ' '\n' | sort | uniq -d) - exit 1 - fi + cargo_packages=($(cat $DOTFILES_CONFIG | shyaml keys config.packages.cargo)) + for package in "${cargo_packages[@]}"; do + printfe "%s" "cyan" " - Checking $package..." + echo -en '\r' - for package in $cargo_packages; do + # Some entries have a git_url and binary, we need to load these in if they exist pkg_status=$(cargo install --list | grep -E "^${package}\sv[0-9.]+:$") + package_url=$(cat $DOTFILES_CONFIG | shyaml get-value config.packages.cargo.$package.git_url 2>/dev/null) + binary=$(cat $DOTFILES_CONFIG | shyaml get-value config.packages.cargo.$package.binary 2>/dev/null) # If pkg_status is `installed` then we don't need to install the package, otherwise if it's empty then the package is not installed if [ -z $pkg_status ]; then - ensure_sudo_privileges "In order to install cargo_packages, please provide your password:" - printfe "%s" "yellow" " - Installing $package..." + ensure_sudo_privileges "In order to install $package, please provide your password:" + printfe "%s" "yellow" " - Compiling/Installing $package... (This may take a while)" clear_line - result=$(cargo install $package 2>&1) + # If package_url is defined we should install via git + if [ -n "$package_url" ]; then + command="cargo install --git $package_url $binary" + else + command="cargo install $package" + fi + + # Execute the command + result=$(eval $command 2>&1) + if [ $? -ne 0 ]; then printfe "%s\n" "red" " - Failed to install $package" + printfe "%s\n" "red" " Command: $command" + printfe "%s\n" "red" " Output: $result" exit 1 fi printfe "%s\n" "green" " - Installed $package" @@ -37,6 +46,7 @@ print_cargo_status() { printfe "%s" "cyan" "Checking Cargo packages..." clear_line + cargo_packages=($(cat $DOTFILES_CONFIG | shyaml keys config.packages.cargo)) count=$(echo $cargo_packages | wc -w) installed=0 diff --git a/bin/helpers/docker.sh b/bin/helpers/docker.sh new file mode 100755 index 0000000..c718d4a --- /dev/null +++ b/bin/helpers/docker.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env zsh + +ensure_docker_installed() { + # if docker is already installed, skip the installation + if [ -x "$(command -v docker)" ]; then + printfe "%s\n" "green" " - Docker is already installed" + return + fi + + # Add Docker's official GPG key + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + + # Add Docker's repository + sudo add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" + + sudo apt update + sudo apt install -y docker-ce docker-ce-cli containerd.io + + # Check if it successfully installed + if [ -x "$(command -v docker)" ]; then + printfe "%s\n" "green" " - Docker is installed" + else + printfe "%s\n" "red" " - Docker is not installed" + printfe "%s\n" "red" " Something went wrong while installing Docker, investigate the issue" + exit 1 + fi + + sudo usermod -aG docker $USER + sudo systemctl start docker + sudo systemctl enable docker +} diff --git a/bin/helpers/flatpak_packages.sh b/bin/helpers/flatpak_packages.sh index 65f6042..d94bc1b 100755 --- a/bin/helpers/flatpak_packages.sh +++ b/bin/helpers/flatpak_packages.sh @@ -1,9 +1,10 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh -source ~/dotfiles/bin/lists/flatpak.sh +source $HOME/dotfiles/bin/helpers/functions.sh ensure_remotes_added() { + flatpak_remotes=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.flatpak.remotes)) + for remote in $flatpak_remotes; do printfe "%s\n" "green" " - Ensuring remote $remote" flatpak remote-add --if-not-exists flathub $remote @@ -11,6 +12,7 @@ ensure_remotes_added() { } ensure_flatpak_packages_installed() { + flatpak_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.flatpak.apps)) for package in $flatpak_packages; do if ! flatpak list | grep -q $package; then printfe "%s" "yellow" " - Installing $package" @@ -32,6 +34,8 @@ print_flatpak_status() { printfe "%s" "cyan" "Checking Flatpak packages..." clear_line + flatpak_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.flatpak.apps)) + count=$(echo $flatpak_packages | wc -w) installed=0 diff --git a/bin/helpers/fonts.sh b/bin/helpers/fonts.sh index 3f6976a..b7d0d71 100755 --- a/bin/helpers/fonts.sh +++ b/bin/helpers/fonts.sh @@ -1,7 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh -source ~/dotfiles/bin/lists/fonts.sh +source $HOME/dotfiles/bin/helpers/functions.sh install_font() { font_url="$1" @@ -53,8 +52,13 @@ install_font() { } ensure_fonts_installed() { + # Load fonts from cat $DOTFILES_CONFIG | shyaml keys config.fonts + fonts=($(cat $DOTFILES_CONFIG | shyaml keys config.fonts)) + for font in "${fonts[@]}"; do - install_font $(echo $font | awk '{print $1}') $(echo $font | awk '{print $2}') + name=$(cat $DOTFILES_CONFIG | shyaml get-value config.fonts.$font.name) + url=$(cat $DOTFILES_CONFIG | shyaml get-value config.fonts.$font.url) + install_font $url $name done } @@ -67,6 +71,7 @@ print_fonts_status() { mkdir -p $font_dir + fonts=($(cat $DOTFILES_CONFIG | shyaml keys config.fonts)) total_fonts=0 installed_fonts=0 diff --git a/bin/helpers/functions.sh b/bin/helpers/functions.sh index bc8e57b..345c4df 100755 --- a/bin/helpers/functions.sh +++ b/bin/helpers/functions.sh @@ -8,7 +8,7 @@ println() { logo() { tput setaf 2 - cat ~/dotfiles/bin/resources/logo.txt + cat $HOME/dotfiles/bin/resources/logo.txt println " " "cyan" tput sgr0 diff --git a/bin/helpers/gnome_extensions.sh b/bin/helpers/gnome_extensions.sh index b36d5a0..959c2a5 100755 --- a/bin/helpers/gnome_extensions.sh +++ b/bin/helpers/gnome_extensions.sh @@ -1,8 +1,13 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh ensure_gnome_extensions_installed() { + if ! command -v gnome-extensions &> /dev/null; then + printfe "%s\n" "red" " - gnome-extensions command not found, likely not running GNOME." + return + fi + printfe "%s" "cyan" " - Loading GNOME extension json file..." echo -en '\r' diff --git a/bin/helpers/keyboard_shortcuts.sh b/bin/helpers/keyboard_shortcuts.sh index 81dc130..0c3db42 100755 --- a/bin/helpers/keyboard_shortcuts.sh +++ b/bin/helpers/keyboard_shortcuts.sh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh # Ensure jq is installed if ! command -v jq &> /dev/null; then @@ -17,7 +17,21 @@ fi shortcuts=$(jq -r '.shortcuts' "${shortcuts_file}") +ensure_swhkd() { + shortcuts_keys=($(cat "$DOTFILES_CONFIG" | shyaml keys config.keybinds)) + for key in "${shortcuts_keys[@]}"; do + shortcut=$(cat "$DOTFILES_CONFIG" | shyaml get-value config.keybinds.$key.shortcut) + command=$(cat "$DOTFILES_CONFIG" | shyaml get-value config.keybinds.$key.command) + echo "$shortcut" + echo " $command" + echo + done +} + ensure_keyboard_shortcuts() { + printfe "%s\n" "green" " - Setting up swhkd configuration..." + ensure_swhkd > $HOME/dotfiles/config/swhkd/swhkdrc + # Retrieve current custom keybindings existing_bindings=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings | tr -d "[]'") new_bindings=() diff --git a/bin/helpers/ohmyzsh.sh b/bin/helpers/ohmyzsh.sh index 579202c..cbea93c 100755 --- a/bin/helpers/ohmyzsh.sh +++ b/bin/helpers/ohmyzsh.sh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh ensure_ohmyzsh_installed() { if [ -d ~/.oh-my-zsh ]; then diff --git a/bin/helpers/pipx_packages.sh b/bin/helpers/pipx_packages.sh index a0932a5..f794e31 100755 --- a/bin/helpers/pipx_packages.sh +++ b/bin/helpers/pipx_packages.sh @@ -1,9 +1,9 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh -source ~/dotfiles/bin/lists/pipx.sh +source $HOME/dotfiles/bin/helpers/functions.sh ensure_pipx_packages_installed() { + pipx_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.pipx)) for i in "${pipx_packages[@]}"; do printfe "%s" "cyan" " - Fetching package details for $i" @@ -31,6 +31,7 @@ print_pipx_status() { printfe "%s" "cyan" "Checking pipx packages..." clear_line + pipx_packages=($(cat $DOTFILES_CONFIG | shyaml get-values config.packages.pipx)) count=$(echo $pipx_packages | wc -w) installed=0 diff --git a/bin/helpers/rust.sh b/bin/helpers/rust.sh index b01c303..5f0cb66 100755 --- a/bin/helpers/rust.sh +++ b/bin/helpers/rust.sh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh ensure_rust_installed() { if [ -x "$(command -v rustc)" ]; then diff --git a/bin/helpers/tailscale.sh b/bin/helpers/tailscale.sh new file mode 100755 index 0000000..c1f0b04 --- /dev/null +++ b/bin/helpers/tailscale.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env zsh + +ensure_tailscale_installed() { + # if tailscale is already installed, skip the installation + if [ -x "$(command -v tailscale)" ]; then + printfe "%s\n" "green" " - Tailscale is already installed" + return + fi + + result=$(curl -fsSL https://tailscale.com/install.sh | sh) + + # Ensure it ended with something like Installation complete + if [[ $result == *"Installation complete"* ]]; then + # Check if it successfully installed + if [ -x "$(command -v tailscale)" ]; then + printfe "%s\n" "green" " - Tailscale is installed" + else + printfe "%s\n" "red" " - Tailscale is not installed" + printfe "%s\n" "red" " Something went wrong while installing Tailscale, investigate the issue" + exit 1 + fi + else + printfe "%s\n" "red" " - Tailscale is not installed" + printfe "%s\n" "red" " Something went wrong while installing Tailscale, investigate the issue" + exit 1 + fi + + # Let's set the current user to the operator + sudo tailscale set --operator=$USER + + # Start the service + tailscale up +} diff --git a/bin/helpers/user_groups.sh b/bin/helpers/user_groups.sh new file mode 100755 index 0000000..6c80b6c --- /dev/null +++ b/bin/helpers/user_groups.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env zsh + +source $HOME/dotfiles/bin/helpers/functions.sh + +ensure_user_groups() { + # Load yaml file + users=($(cat $DOTFILES_CONFIG | shyaml keys config.user_groups)) + + # For each user, ensure they are in the correct groups + for user in $users; do + # Ensure this user exists + if [[ ! $(id -u $user) ]]; then + printfe "%s\n" "red" " - User $user does not exist" + continue + fi + + ensure_user_in_groups $user + done +} + +ensure_user_in_groups() { + user=$1 + groups=($(cat $DOTFILES_CONFIG | shyaml get-values config.user_groups.$user)) + + printfe "%s\n" "cyan" " - For user $user..." + + # For each group, ensure the user is in it + for group in $groups; do + # Check if the group exists at all, otherwise skip + if [[ ! $(getent group $group) ]]; then + printfe "%s\n" "red" " Group $group does not exist" + continue + fi + + if [[ ! $groups == *$group* ]]; then + printfe "%s\n" "green" " Adding $user to group $group" + sudo usermod -aG $group $user + else + printfe "%s\n" "green" " $user is already in group $group" + fi + done +} diff --git a/bin/helpers/vscode-extensions.sh b/bin/helpers/vscode-extensions.sh index 5645041..ae20fba 100755 --- a/bin/helpers/vscode-extensions.sh +++ b/bin/helpers/vscode-extensions.sh @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -source ~/dotfiles/bin/helpers/functions.sh +source $HOME/dotfiles/bin/helpers/functions.sh load_vscode_extensions() { # Clear the array before populating it diff --git a/bin/lists/apt.sh b/bin/lists/apt.sh deleted file mode 100755 index 9795b2f..0000000 --- a/bin/lists/apt.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env zsh - -apt_packages=( - "zsh" - "git" - "curl" - "wget" - "gpg" - "nala" - "ca-certificates" - "software-properties-common" - "apt-transport-https" - "vim" - "sl" - "just" - "libglvnd-dev" - "libwayland-dev" - "libseat-dev" - "libxkbcommon-dev" - "libinput-dev" - "udev" - "dbus" - "libdbus-1-dev" - "libsystemd-dev" - "libpixman-1-dev" - "libssl-dev" - "libflatpak-dev" - "libpulse-dev" - "libexpat1-dev" - "libfontconfig-dev" - "libfreetype-dev" - "mold" - "cargo" - "libgbm-dev" - "libclang-dev" - "libpipewire-0.3-dev" - "libpam0g-dev" - "openssh-server" - "build-essential" - "flatpak" - "meson" - "pipx" - "python3-nautilus" - "gettext" - "fzf" - "neofetch" - "screenfetch" - "wezterm" - "brave-browser" - "code" - "1password" - "1password-cli" - "spotify-client" - "flameshot" - "xdg-desktop-portal-gnome" - "xdg-desktop-portal" - "gnome-weather" -) diff --git a/bin/lists/cargo.sh b/bin/lists/cargo.sh deleted file mode 100755 index f873cc7..0000000 --- a/bin/lists/cargo.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env zsh - -cargo_packages=( - "exa" - "lsd" - "bat" - "starship" - "ripgrep" - "fd-find" - "procs" - "bottom" -) diff --git a/bin/lists/flatpak.sh b/bin/lists/flatpak.sh deleted file mode 100755 index 48617da..0000000 --- a/bin/lists/flatpak.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env zsh - -flatpak_packages=( - "app.drey.Doggo" - "org.gnome.Boxes" - "org.gnome.baobab" - "re.sonny.Junction" - "com.yubico.yubioath" - "net.nokyan.Resources" - "com.system76.Popsicle" - "com.github.marhkb.Pods" - "org.wezfurlong.wezterm" - "io.github.dimtpap.coppwr" - "com.github.tchx84.Flatseal" - "dev.bragefuglseth.Keypunch" - "io.github.flattool.Warehouse" - "io.github.jonmagon.kdiskmark" - "org.onlyoffice.desktopeditors" - "io.missioncenter.MissionCenter" - "io.podman_desktop.PodmanDesktop" - "io.github.giantpinkrobots.flatsweep" - "io.github.realmazharhussain.GdmSettings" - "io.github.thetumultuousunicornofdarkness.cpu-x" -) - -flatpak_remotes=( - "https://flathub.org/repo/flathub.flatpakrepo" -) diff --git a/bin/lists/fonts.sh b/bin/lists/fonts.sh deleted file mode 100755 index db57600..0000000 --- a/bin/lists/fonts.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env zsh - -# https://www.nerdfonts.com/font-downloads -fonts=( - "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Hack.zip Hack" - "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Meslo.zip Meslo" - "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip JetBrainsMono" - "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/ProggyClean.zip ProggyClean" -) diff --git a/bin/lists/pipx.sh b/bin/lists/pipx.sh deleted file mode 100755 index 68dcd37..0000000 --- a/bin/lists/pipx.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env zsh - -pipx_packages=( - "gnome-extensions-cli" - "bauh" -) \ No newline at end of file diff --git a/config/alacritty.toml b/config/alacritty.toml new file mode 100644 index 0000000..c997975 --- /dev/null +++ b/config/alacritty.toml @@ -0,0 +1,378 @@ +live_config_reload = true + +[bell] +animation = "EaseOutExpo" +color = "0xffffff" +duration = 0 + +[colors] +draw_bold_text_with_bright_colors = false + +[colors.cursor] +# Matrix dark green +cursor = "0x00ff00" +text = "0xffffff" + +[colors.primary] +background = "0x1d1d1d" +foreground = "0xffffff" + +[cursor] +style = "Underline" +unfocused_hollow = true + +[debug] +log_level = "OFF" +persistent_logging = false +print_events = false +render_timer = false + +[font] +size = 14.0 + +[font.bold] +family = "Hack Nerd Font" +style = "Regular" + +[font.glyph_offset] +x = 0 +y = 0 + +[font.italic] +family = "Hack Nerd Font" +style = "Italic" + +[font.normal] +family = "Hack Nerd Font" +style = "Light" + +[font.offset] +x = 0 +y = 0 + +[[keyboard.bindings]] +action = "Paste" +key = "V" +mods = "Command" + +[[keyboard.bindings]] +action = "Copy" +key = "C" +mods = "Command" + +[[keyboard.bindings]] +action = "Quit" +key = "Q" +mods = "Command" + +[[keyboard.bindings]] +action = "SpawnNewInstance" +key = "N" +mods = "Command" + +[[keyboard.bindings]] +action = "ToggleFullscreen" +key = "Return" +mods = "Command" + +[[keyboard.bindings]] +chars = "\u001BOH" +key = "Home" +mode = "AppCursor" + +[[keyboard.bindings]] +chars = "\u001B[H" +key = "Home" +mode = "~AppCursor" + +[[keyboard.bindings]] +chars = "\u001BOF" +key = "End" +mode = "AppCursor" + +[[keyboard.bindings]] +chars = "\u001B[F" +key = "End" +mode = "~AppCursor" + +[[keyboard.bindings]] +action = "IncreaseFontSize" +key = "Equals" +mods = "Command" + +[[keyboard.bindings]] +action = "DecreaseFontSize" +key = "Minus" +mods = "Command" + +[[keyboard.bindings]] +action = "ResetFontSize" +key = "Minus" +mods = "Command|Shift" + +[[keyboard.bindings]] +chars = "\u001B[5;2~" +key = "PageUp" +mods = "Shift" + +[[keyboard.bindings]] +chars = "\u001B[5;5~" +key = "PageUp" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[5~" +key = "PageUp" + +[[keyboard.bindings]] +chars = "\u001B[6;2~" +key = "PageDown" +mods = "Shift" + +[[keyboard.bindings]] +chars = "\u001B[6;5~" +key = "PageDown" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[6~" +key = "PageDown" + +[[keyboard.bindings]] +chars = "\u001B[1;2D" +key = "Left" +mods = "Shift" + +[[keyboard.bindings]] +chars = "\u001B[1;5D" +key = "Left" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[1;3D" +key = "Left" +mods = "Alt" + +[[keyboard.bindings]] +chars = "\u001B[D" +key = "Left" +mode = "~AppCursor" + +[[keyboard.bindings]] +chars = "\u001BOD" +key = "Left" +mode = "AppCursor" + +[[keyboard.bindings]] +chars = "\u001B[1;2C" +key = "Right" +mods = "Shift" + +[[keyboard.bindings]] +chars = "\u001B[1;5C" +key = "Right" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[1;3C" +key = "Right" +mods = "Alt" + +[[keyboard.bindings]] +chars = "\u001B[C" +key = "Right" +mode = "~AppCursor" + +[[keyboard.bindings]] +chars = "\u001BOC" +key = "Right" +mode = "AppCursor" + +[[keyboard.bindings]] +chars = "\u001B[1;2A" +key = "Up" +mods = "Shift" + +[[keyboard.bindings]] +chars = "\u001B[1;5A" +key = "Up" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[1;3A" +key = "Up" +mods = "Alt" + +[[keyboard.bindings]] +chars = "\u001B[A" +key = "Up" +mode = "~AppCursor" + +[[keyboard.bindings]] +chars = "\u001BOA" +key = "Up" +mode = "AppCursor" + +[[keyboard.bindings]] +chars = "\u001B[1;2B" +key = "Down" +mods = "Shift" + +[[keyboard.bindings]] +chars = "\u001B[1;5B" +key = "Down" +mods = "Control" + +[[keyboard.bindings]] +chars = "\u001B[1;3B" +key = "Down" +mods = "Alt" + +[[keyboard.bindings]] +chars = "\u001B[B" +key = "Down" +mode = "~AppCursor" + +[[keyboard.bindings]] +chars = "\u001BOB" +key = "Down" +mode = "AppCursor" + +[[keyboard.bindings]] +chars = "\u001B[Z" +key = "Tab" +mods = "Shift" + +[[keyboard.bindings]] +chars = "\u001BOP" +key = "F1" + +[[keyboard.bindings]] +chars = "\u001BOQ" +key = "F2" + +[[keyboard.bindings]] +chars = "\u001BOR" +key = "F3" + +[[keyboard.bindings]] +chars = "\u001BOS" +key = "F4" + +[[keyboard.bindings]] +chars = "\u001B[15~" +key = "F5" + +[[keyboard.bindings]] +chars = "\u001B[17~" +key = "F6" + +[[keyboard.bindings]] +chars = "\u001B[18~" +key = "F7" + +[[keyboard.bindings]] +chars = "\u001B[19~" +key = "F8" + +[[keyboard.bindings]] +chars = "\u001B[20~" +key = "F9" + +[[keyboard.bindings]] +chars = "\u001B[21~" +key = "F10" + +[[keyboard.bindings]] +chars = "\u001B[23~" +key = "F11" + +[[keyboard.bindings]] +chars = "\u001B[24~" +key = "F12" + +[[keyboard.bindings]] +chars = "\u007F" +key = "Back" + +[[keyboard.bindings]] +chars = "\u001B\u007F" +key = "Back" +mods = "Alt" + +[[keyboard.bindings]] +chars = "\u001B[2~" +key = "Insert" + +[[keyboard.bindings]] +chars = "\u001B[3~" +key = "Delete" + +[[keyboard.bindings]] +chars = "\u0002&" +key = "W" +mods = "Command" + +[[keyboard.bindings]] +chars = "\u0002c" +key = "T" +mods = "Command" + +[[keyboard.bindings]] +chars = "\u0002n" +key = "RBracket" +mods = "Command|Shift" + +[[keyboard.bindings]] +chars = "\u0002p" +key = "LBracket" +mods = "Command|Shift" + +[[keyboard.bindings]] +chars = "\u0002o" +key = "RBracket" +mods = "Command" + +[[keyboard.bindings]] +chars = "\u0002;" +key = "LBracket" +mods = "Command" + +[[keyboard.bindings]] +chars = "\u0002/" +key = "F" +mods = "Command" + +[mouse] +hide_when_typing = true + +[[mouse.bindings]] +action = "PasteSelection" +mouse = "Middle" + +[[mouse.bindings]] +action = "None" +mods = "Command" +mouse = "Left" + +[scrolling] +history = 10000 +multiplier = 3 + +[selection] +save_to_clipboard = false +semantic_escape_chars = ''',│`|:"' ()[]{}<>''' + +[window] +decorations = "buttonless" +dynamic_padding = false +opacity = 1.0 +startup_mode = "Windowed" + +[window.dimensions] +columns = 120 +lines = 90 + +[window.padding] +x = 0 +y = 0 diff --git a/config/config.yaml b/config/config.yaml new file mode 100644 index 0000000..e609342 --- /dev/null +++ b/config/config.yaml @@ -0,0 +1,150 @@ +config: + # What groups users should be added + user_groups: + menno: + - docker + - libvirt + - video + - input + + # Keybinds to set into swhkd + keybinds: + terminal: + shortcut: Ctrl + Alt + T + command: alacritty + screenshot: + shortcut: Shift + Alt + 4 + command: cosmic-screenshot --interactive + + # Commands to run after login + startup: + - spotify + - vesktop + - dotf hotkey-daemon + - brave-browser + - steam + - 1password + + # Fonts to install (Mostly tested with Nerd Fonts) + fonts: + Hack: + url: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Hack.zip + name: Hack + Meslo: + url: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/Meslo.zip + name: Meslo + JetBrainsMono: + url: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.1/JetBrainsMono.zip + name: JetBrainsMono + + # Packages to install + # Note: Uninstalling packages is not supported, if you remove a package from this list it will not be removed from the system! + # Likewise with flatpak remotes, apt repositories, etc. + packages: + flatpak: + remotes: + - https://flathub.org/repo/flathub.flatpakrepo + apps: + - app.drey.Doggo + - org.gnome.Boxes + - org.gnome.baobab + - re.sonny.Junction + - com.yubico.yubioath + - net.nokyan.Resources + - com.system76.Popsicle + - com.github.marhkb.Pods + - io.github.dimtpap.coppwr + - com.github.tchx84.Flatseal + - dev.bragefuglseth.Keypunch + - io.github.flattool.Warehouse + - io.github.jonmagon.kdiskmark + - org.onlyoffice.desktopeditors + - io.missioncenter.MissionCenter + - io.podman_desktop.PodmanDesktop + - io.github.giantpinkrobots.flatsweep + - io.github.realmazharhussain.GdmSettings + - io.github.thetumultuousunicornofdarkness.cpu-x + - io.github.kukuruzka165.materialgram + + # Supply a git_url and binary to install from source + cargo: + exa: + lsd: + bat: + starship: + ripgrep: + fd-find: + procs: + bottom: + alacritty: + swhkd: + git_url: https://github.com/waycrate/swhkd.git + binary: Simple-Wayland-HotKey-Daemon + swhkd: + git_url: https://github.com/waycrate/swhkd.git + binary: swhks + + pipx: + - gnome-extensions-cli + - bauh + - shyaml + + apt: + repos: + - ppa:nilarimogard/webupd8 + - ppa:alexlarsson/flatpak + + apps: + - zsh + - git + - curl + - wget + - gpg + - nala + - ca-certificates + - gnupg-agent + - software-properties-common + - apt-transport-https + - vim + - sl + - just + - libglvnd-dev + - libwayland-dev + - libseat-dev + - libxkbcommon-dev + - libinput-dev + - udev + - dbus + - libdbus-1-dev + - libsystemd-dev + - libpixman-1-dev + - libssl-dev + - libflatpak-dev + - libpulse-dev + - libexpat1-dev + - libfontconfig-dev + - libfreetype-dev + - mold + - cargo + - libgbm-dev + - libclang-dev + - libpipewire-0.3-dev + - libpam0g-dev + - openssh-server + - build-essential + - flatpak + - meson + - pipx + - python3-nautilus + - gettext + - fzf + - neofetch + - screenfetch + - screen + - brave-browser + - code + - 1password + - 1password-cli + - spotify-client + - flameshot + - cmake \ No newline at end of file diff --git a/config/swhkd/swhkdrc b/config/swhkd/swhkdrc new file mode 100755 index 0000000..cf72e3a --- /dev/null +++ b/config/swhkd/swhkdrc @@ -0,0 +1,6 @@ +Ctrl + Alt + T + alacritty + +Shift + Alt + 4 + cosmic-screenshot --interactive + diff --git a/config/wezterm.lua b/config/wezterm.lua deleted file mode 100644 index 843e83d..0000000 --- a/config/wezterm.lua +++ /dev/null @@ -1,87 +0,0 @@ --- Pull in the wezterm API -local wezterm = require 'wezterm' - --- This will hold the configuration. -local config = wezterm.config_builder() - -config.font = wezterm.font("MesloLGS NF") -config.mouse_bindings = {{ - event = { - Up = { - streak = 1, - button = "Left" - } - }, - mods = "NONE", - action = wezterm.action.Nop -}} - -config.keys = { -- Ctrl+K for to clear the terminal -{ - key = 'k', - mods = 'CTRL', - action = wezterm.action { - ClearScrollback = "ScrollbackAndViewport" - } -}, -- Ctrl+T for new tab -{ - key = 't', - mods = 'CTRL', - action = wezterm.action { - SpawnTab = "CurrentPaneDomain" - } -}, -- Ctrl+W for close tab -{ - key = 'w', - mods = 'CTRL', - action = wezterm.action { - CloseCurrentTab = { - confirm = true - } - } -}, -- Ctrl+s for split horizontal -{ - key = 'h', - mods = 'CTRL', - action = wezterm.action { - SplitHorizontal = { - domain = "CurrentPaneDomain" - } - } -}, -- Ctrl+d for split vertical -{ - key = 'v', - mods = 'CTRL', - action = wezterm.action { - SplitVertical = { - domain = "CurrentPaneDomain" - } - } -}} - --- Use default titlebar instead of the one provided by wezterm -config.window_frame = { - inactive_titlebar_bg = '#2b2042', - active_titlebar_bg = '#2b2042', - inactive_titlebar_fg = '#cccccc', - active_titlebar_fg = '#ffffff', - inactive_titlebar_border_bottom = '#2b2042', - active_titlebar_border_bottom = '#2b2042', - button_fg = '#cccccc', - button_bg = '#2b2042', - button_hover_fg = '#ffffff', - button_hover_bg = '#3b3052', - - font = require('wezterm').font 'Roboto', - font_size = 12 -} - --- Set the default cursor style to a blinking underscore -config.default_cursor_style = "BlinkingUnderline" -config.initial_rows = 30 -config.initial_cols = 120 - -config.color_scheme = 'Galizur' - --- and finally, return the configuration to wezterm -return config diff --git a/gnome/keyboard-shortcuts.json b/gnome/keyboard-shortcuts.json index 93965ce..abde61c 100644 --- a/gnome/keyboard-shortcuts.json +++ b/gnome/keyboard-shortcuts.json @@ -1,7 +1,7 @@ { "shortcuts": { "e": "nautilus", - "t": "wezterm", + "t": "alacritty", "space": "1password --quick-access", "4": "sh -c \"flameshot gui\"" } diff --git a/vscode/settings.json b/vscode/settings.json index 772f8db..874cce2 100755 --- a/vscode/settings.json +++ b/vscode/settings.json @@ -1,8 +1,8 @@ { "security.workspace.trust.untrustedFiles": "open", - - "editor.fontFamily": "MesloLGS NF", - "terminal.integrated.fontFamily": "MesloLGS NF", + "window.zoomLevel": 0.5, + "editor.fontFamily": "Hack Nerd Font", + "terminal.integrated.fontFamily": "Hack Nerd Font", "github.copilot.enable": { "*": true, "plaintext": true,