commit b4cdb80b5c4ec1cbc4b16e0c293985bc7970285e Author: Mariano Z. Date: Mon Apr 21 12:07:24 2025 -0300 init diff --git a/.git-crypt/.gitattributes b/.git-crypt/.gitattributes new file mode 100644 index 0000000..665b10e --- /dev/null +++ b/.git-crypt/.gitattributes @@ -0,0 +1,4 @@ +# Do not edit this file. To specify the files to encrypt, create your own +# .gitattributes file in the directory where your files are. +* !filter !diff +*.gpg binary diff --git a/.git-crypt/keys/default/0/13D35660EC8E8AA03D4370A83FA93CB876C8FFAA.gpg b/.git-crypt/keys/default/0/13D35660EC8E8AA03D4370A83FA93CB876C8FFAA.gpg new file mode 100644 index 0000000..96d8fbb Binary files /dev/null and b/.git-crypt/keys/default/0/13D35660EC8E8AA03D4370A83FA93CB876C8FFAA.gpg differ diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d54cf7f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +# Sensitive files that should be encrypted with git-crypt +ssh/.ssh/config filter=git-crypt diff=git-crypt +gnupg/.gnupg/* filter=git-crypt diff=git-crypt +npm/.config/npm/npmrc filter=git-crypt diff=git-crypt +zsh/.config/zsh/zsh_history* filter=git-crypt diff=git-crypt +config/.config/sdm-ui.yaml filter=git-crypt diff=git-crypt +config/.config/ngrok/ngrok.yml filter=git-crypt diff=git-crypt + +# Add any new paths for sensitive files in your new modules +# For example, if you have API tokens in new locations: +# mise/.config/mise/config.toml filter=git-crypt diff=git-crypt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8e5f5e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +bin/.bin/code +bin/.bin/sdm-ui +bin/.bin/goq +bin/.bin/rop + +local-bin/.local/bin/mise diff --git a/.stow-global-ignore b/.stow-global-ignore new file mode 100644 index 0000000..4301a1e --- /dev/null +++ b/.stow-global-ignore @@ -0,0 +1,21 @@ +# Comments and blank lines are allowed. + +RCS +.+,v + +CVS +\.\#.+ # CVS conflict files / emacs lock files +\.cvsignore + +\.git +\.gitignore +\.gitattributes + +^/README.* +^/LICENSE.* +^/COPYING + +# Custom ignores for dotfiles +\.DS_Store +README.md +LICENSE diff --git a/.stowrc b/.stowrc new file mode 100644 index 0000000..827a1d9 --- /dev/null +++ b/.stowrc @@ -0,0 +1,4 @@ +--target=${HOME} +--dir=${HOME}/dotfiles +--verbose +--no-folding diff --git a/README.md b/README.md new file mode 100644 index 0000000..749f65b --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# Dotfiles + +Personal dotfiles for my Linux system running Sway (Wayland). + +## Overview + +- **Window Management**: Sway, Waybar, Swayidle +- **Terminals**: Kitty, WezTerm +- **Development**: Neovim, Git, Tmux, npm, mise +- **Shell**: Zsh with custom functions, aliases, keymaps +- **Launchers**: Rofi, Fuzzel + +## Requirements + +- stow +- git-crypt (for encrypted files) + +## Installation + +```bash +# Clone repository +git clone https://github.com/yourusername/dotfiles.git ~/.dotfiles +cd ~/.dotfiles + +# Decrypt sensitive files (if you have access) +git-crypt unlock /path/to/key + +# Install everything +stow */ + +# Or install individual modules +stow zsh +stow nvim +stow sway +``` + +## License + +MIT diff --git a/applications/.local/share/applications/custom/DBeaver.desktop b/applications/.local/share/applications/custom/DBeaver.desktop new file mode 100755 index 0000000..535f312 --- /dev/null +++ b/applications/.local/share/applications/custom/DBeaver.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Name=DBeaver +GenericName=SQL Database Client +Comment=Universal Database Manager and SQL Client. +Exec=bash -c "GDK_BACKEND=x11 GTK_THEME=Raleigh /usr/bin/dbeaver" +Categories=IDE;Development +WM_CLASS=DBeaver +StartupWMClass=DBeaver +StartupNotify=true +Icon=/usr/share/pixmaps/dbeaver.png diff --git a/applications/.local/share/applications/custom/Leapp.desktop b/applications/.local/share/applications/custom/Leapp.desktop new file mode 100755 index 0000000..a2850c2 --- /dev/null +++ b/applications/.local/share/applications/custom/Leapp.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Name=Leapp +GenericName=AWS Profile Manager +Exec=/home/forbi/.bin/leapp.sh +Categories=IDE;Development +StartupWMClass=Leapp +StartupNotify=true +Icon=/home/forbi/Downloads/leapp.svg diff --git a/applications/.local/share/applications/custom/Lens.desktop b/applications/.local/share/applications/custom/Lens.desktop new file mode 100644 index 0000000..6701f11 --- /dev/null +++ b/applications/.local/share/applications/custom/Lens.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Name=Lens +GenericName=Kubernetes IDE +Comment=The Kubernetes IDE +Icon=/home/forbi/.local/share/applications/custom/lens.png +Exec=/home/forbi/.bin/openlens %U +Categories=System; +StartupNotify=true +StartupWMClass=Lens +MimeType=x-scheme-handler/lens; diff --git a/applications/.local/share/applications/custom/NoSQL.desktop b/applications/.local/share/applications/custom/NoSQL.desktop new file mode 100755 index 0000000..24db2ec --- /dev/null +++ b/applications/.local/share/applications/custom/NoSQL.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=NoSQL Booster +Exec=/home/forbi/.bin/nosql.sh +Icon=~/.local/share/applications/custom/mongo.png +Version=1.0 +Type=Application +Terminal=0 + diff --git a/applications/.local/share/applications/custom/Recorder.desktop b/applications/.local/share/applications/custom/Recorder.desktop new file mode 100755 index 0000000..906b2c4 --- /dev/null +++ b/applications/.local/share/applications/custom/Recorder.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Name=Screen Recorder +GenericName=Screen Recorder +Exec= /home/forbi/.bin/wlrecord.sh -s +Categories=Utility;Application; +StartupWMClass=Screen Recorder +StartupNotify=true +Icon=/usr/share/icons/ePapirus/24x24/actions/kdenlive-hide-video.svg diff --git a/applications/.local/share/applications/custom/Redis.desktop b/applications/.local/share/applications/custom/Redis.desktop new file mode 100755 index 0000000..56298d1 --- /dev/null +++ b/applications/.local/share/applications/custom/Redis.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Name=Redis +GenericName=Redis Viewer +Exec=/home/forbi/.bin/redis.sh +Categories=IDE;Development +StartupWMClass=Redis +StartupNotify=true +Icon=/home/forbi/.local/share/applications/custom/redis.png diff --git a/applications/.local/share/applications/custom/Syncthing.desktop b/applications/.local/share/applications/custom/Syncthing.desktop new file mode 100755 index 0000000..38b45a6 --- /dev/null +++ b/applications/.local/share/applications/custom/Syncthing.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Terminal=false +Name=Syncthing UI +GenericName=Syncthing UI +Exec=xdg-open http://localhost:8384 +Categories=Network;FileTransfer; +StartupNotify=true +Icon=syncthing diff --git a/applications/.local/share/applications/custom/lens.jpg b/applications/.local/share/applications/custom/lens.jpg new file mode 100644 index 0000000..ef16534 Binary files /dev/null and b/applications/.local/share/applications/custom/lens.jpg differ diff --git a/applications/.local/share/applications/custom/lens.png b/applications/.local/share/applications/custom/lens.png new file mode 100644 index 0000000..11ede9d Binary files /dev/null and b/applications/.local/share/applications/custom/lens.png differ diff --git a/applications/.local/share/applications/custom/mongo.png b/applications/.local/share/applications/custom/mongo.png new file mode 100644 index 0000000..796681b Binary files /dev/null and b/applications/.local/share/applications/custom/mongo.png differ diff --git a/applications/.local/share/applications/custom/nvim.desktop b/applications/.local/share/applications/custom/nvim.desktop new file mode 100644 index 0000000..5493731 --- /dev/null +++ b/applications/.local/share/applications/custom/nvim.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=Kitty+Neovim +Comment=Open Neovim in Kitty terminal +Exec=kitty -e nvim %F +Icon=nvim +Terminal=false +Categories=Utility;TextEditor; +MimeType=text/plain; diff --git a/applications/.local/share/applications/custom/redis.png b/applications/.local/share/applications/custom/redis.png new file mode 100644 index 0000000..021c412 Binary files /dev/null and b/applications/.local/share/applications/custom/redis.png differ diff --git a/applications/.local/share/applications/custom/sublime_merge.desktop b/applications/.local/share/applications/custom/sublime_merge.desktop new file mode 100644 index 0000000..c03c8e1 --- /dev/null +++ b/applications/.local/share/applications/custom/sublime_merge.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=Sublime Merge +GenericName=Git Client +Comment=Sublime Merge is a Git client, from the makers of Sublime Text +Exec=/home/forbi/.bin/sm.sh %F +Terminal=false +MimeType=text/plain; +Icon=sublime-merge +Categories=Development; +StartupNotify=true +Actions=new-window; + +[Desktop Action new-window] +Name=New Window +Exec=/home/forbi/.bin/sm --launch-or-new-window +OnlyShowIn=Unity; diff --git a/bin/.bin/base16-rose-pine-scheme.sh b/bin/.bin/base16-rose-pine-scheme.sh new file mode 100755 index 0000000..9d77c51 --- /dev/null +++ b/bin/.bin/base16-rose-pine-scheme.sh @@ -0,0 +1,126 @@ +#!/bin/sh +# base16-shell (https://github.com/chriskempson/base16-shell) +# Base16 Shell template by Chris Kempson (http://chriskempson.com) +# Rosรฉ Pine Dawn scheme by Emilia Dunfelt <sayhi@dunfelt.se> + +color00="19/17/24" # Base 00 - Black +color01="eb/6f/92" # Base 08 - Red +color02="31/74/8f" # Base 0B - Green +color03="eb/bc/ba" # Base 0A - Yellow +color04="c4/a7/e7" # Base 0D - Blue +color05="f6/c1/77" # Base 0E - Magenta +color06="9c/cf/d8" # Base 0C - Cyan +color07="e0/de/f4" # Base 05 - White +color08="90/8c/aa" # Base 03 - Bright Black +color09=$color01 # Base 08 - Bright Red +color10=$color02 # Base 0B - Bright Green +color11=$color03 # Base 0A - Bright Yellow +color12=$color04 # Base 0D - Bright Blue +color13=$color05 # Base 0E - Bright Magenta +color14=$color06 # Base 0C - Bright Cyan +color15="52/4f/67" # Base 07 - Bright White +color16="f6/c1/77" # Base 09 +color17="eb/6f/92" # Base 0F +color18="1f/1d/2e" # Base 01 +color19="26/23/3a" # Base 02 +color20="6e/6a/86" # Base 03 +color21="52/4f/67" # Base 04 +color_foreground="e0/de/f4" # Base 05 +color_background="19/17/24" # Base 00 + +if [ -n "$TMUX" ]; then + # Tell tmux to pass the escape sequences through + # (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) + put_template() { printf '\033Ptmux;\033\033]4;%d;rgb:%s\033\033\\\033\\' $@; } + put_template_var() { printf '\033Ptmux;\033\033]%d;rgb:%s\033\033\\\033\\' $@; } + put_template_custom() { printf '\033Ptmux;\033\033]%s%s\033\033\\\033\\' $@; } +elif [ "${TERM%%[-.]*}" = "screen" ]; then + # GNU screen (screen, screen-256color, screen-256color-bce) + put_template() { printf '\033P\033]4;%d;rgb:%s\007\033\\' $@; } + put_template_var() { printf '\033P\033]%d;rgb:%s\007\033\\' $@; } + put_template_custom() { printf '\033P\033]%s%s\007\033\\' $@; } +elif [ "${TERM%%-*}" = "linux" ]; then + put_template() { [ $1 -lt 16 ] && printf "\e]P%x%s" $1 $(echo $2 | sed 's/\///g'); } + put_template_var() { true; } + put_template_custom() { true; } +else + put_template() { printf '\033]4;%d;rgb:%s\033\\' $@; } + put_template_var() { printf '\033]%d;rgb:%s\033\\' $@; } + put_template_custom() { printf '\033]%s%s\033\\' $@; } +fi + +# 16 color space +put_template 0 $color00 +put_template 1 $color01 +put_template 2 $color02 +put_template 3 $color03 +put_template 4 $color04 +put_template 5 $color05 +put_template 6 $color06 +put_template 7 $color07 +put_template 8 $color08 +put_template 9 $color09 +put_template 10 $color10 +put_template 11 $color11 +put_template 12 $color12 +put_template 13 $color13 +put_template 14 $color14 +put_template 15 $color15 + +# 256 color space +put_template 16 $color16 +put_template 17 $color17 +put_template 18 $color18 +put_template 19 $color19 +put_template 20 $color20 +put_template 21 $color21 + +# foreground / background / cursor color +if [ -n "$ITERM_SESSION_ID" ]; then + # iTerm2 proprietary escape codes + put_template_custom Pg 575279 # foreground + put_template_custom Ph faf4ed # background + put_template_custom Pi 575279 # bold color + put_template_custom Pj f2e9de # selection color + put_template_custom Pk 575279 # selected text color + put_template_custom Pl 575279 # cursor + put_template_custom Pm faf4ed # cursor text +else + put_template_var 10 $color_foreground + if [ "$BASE16_SHELL_SET_BACKGROUND" != false ]; then + put_template_var 11 $color_background + if [ "${TERM%%-*}" = "rxvt" ]; then + put_template_var 708 $color_background # internal border (rxvt) + fi + fi + put_template_custom 12 ";7" # cursor (reverse video) +fi + +# clean up +unset -f put_template +unset -f put_template_var +unset -f put_template_custom +unset color00 +unset color01 +unset color02 +unset color03 +unset color04 +unset color05 +unset color06 +unset color07 +unset color08 +unset color09 +unset color10 +unset color11 +unset color12 +unset color13 +unset color14 +unset color15 +unset color16 +unset color17 +unset color18 +unset color19 +unset color20 +unset color21 +unset color_foreground +unset color_background diff --git a/bin/.bin/code.sh b/bin/.bin/code.sh new file mode 100755 index 0000000..efcd8a8 --- /dev/null +++ b/bin/.bin/code.sh @@ -0,0 +1,15 @@ +#!/bin/bash +MODULE_URL="mzunino.com.uy/go/code" +BINARY_NAME="code" + +TARGET_DIR="$HOME/.bin" +CODE_PATH="$TARGET_DIR/$BINARY_NAME" +if [ ! -x "$CODE_PATH" ]; then + notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..." + GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || { + notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL" + exit 1 + } + notify-send "Installation Complete" "$BINARY_NAME has been installed successfully" +fi +exec "$CODE_PATH" "$@" diff --git a/bin/.bin/fix-git.sh b/bin/.bin/fix-git.sh new file mode 100755 index 0000000..d273ef4 --- /dev/null +++ b/bin/.bin/fix-git.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +OLD_URL=$(git remote get-url origin) +if [[ $OLD_URL == "https://github.com"* ]]; then + # Modified sed pattern to better handle GitHub URLs + USER_REPO=$(echo $OLD_URL | sed -n 's|https://github.com/\([^/]*/[^/]*\)|\1|p') + if [ -z "$USER_REPO" ]; then + echo "Error: Could not extract user/repo from URL: $OLD_URL" + exit 1 + fi + + # Remove any trailing .git if present and add it back consistently + USER_REPO=$(echo $USER_REPO | sed 's/\.git$//') + NEW_URL="git@github.com:${USER_REPO}.git" + + echo "Old URL: $OLD_URL" + echo "New URL: $NEW_URL" + + # Update the remote URL to use SSH + git remote set-url origin "$NEW_URL" + + # Verify the change + CURRENT_URL=$(git remote get-url origin) + if [ "$CURRENT_URL" = "$NEW_URL" ]; then + echo "Successfully updated remote URL to use SSH." + else + echo "Error: Failed to update remote URL." + exit 1 + fi +else + echo "Remote URL is already using SSH or a different protocol: $OLD_URL" +fi diff --git a/bin/.bin/fuzzel.lua b/bin/.bin/fuzzel.lua new file mode 100644 index 0000000..f64bc6f --- /dev/null +++ b/bin/.bin/fuzzel.lua @@ -0,0 +1,53 @@ +return { + selector_cmd = function() + return { + command = "rofi", + args = { "-dmenu", "-p", "Project: " }, + } + end, + editor_cmd = function(path, class) + local dirName = path:match("([^/]+)$") + -- Sanitize dirName for tmux session name (remove special chars) + local tmuxSession = dirName:gsub("[^a-zA-Z0-9_]", "_") + + local tmuxCmd = string.format( + [[ tmux has-session -t %s 2>/dev/null && tmux attach -t %s || tmux new -c %s -s %s 'nvim %s' \; split-window -h -c %s ]], + tmuxSession, + tmuxSession, + path, + tmuxSession, + path, + path + ) + return { + command = "kitty", + args = { + "-d", + path, + "-T", + class, + "--class", + class, + "sh", + "-c", + tmuxCmd, + }, + } + end, + format_project_title = function(path) + -- Extract project name for better display + -- local projectName = path:match("([^/]+)$") or path + return "๐Ÿ“˜ " .. path + end, + + extract_path_from_title = function(title) + -- Return back the path: ๐Ÿ“˜ work/project_1 -> work/project_1 + return title:gsub("^๐Ÿ“˜%s*", ""):gsub("\n$", "") + end, + + -- Add error handling function + handle_error = function(err) + io.stderr:write("Error: " .. tostring(err) .. "\n") + return false + end, +} diff --git a/bin/.bin/goq.sh b/bin/.bin/goq.sh new file mode 100755 index 0000000..f875e71 --- /dev/null +++ b/bin/.bin/goq.sh @@ -0,0 +1,15 @@ +#!/bin/bash +MODULE_URL="github.com/marianozunino/goq" +BINARY_NAME="goq" + +TARGET_DIR="$HOME/.bin" +CODE_PATH="$TARGET_DIR/$BINARY_NAME" +if [ ! -x "$CODE_PATH" ]; then + notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..." + GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || { + notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL" + exit 1 + } + notify-send "Installation Complete" "$BINARY_NAME has been installed successfully" +fi +exec "$CODE_PATH" "$@" diff --git a/bin/.bin/leapp.sh b/bin/.bin/leapp.sh new file mode 100755 index 0000000..806ef09 --- /dev/null +++ b/bin/.bin/leapp.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +bin=~/.bin/leapp +latest_version_url="https://api.github.com/repos/noovolari/leapp/releases/latest" + +# Function to compare version numbers +function version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } + +# If leapp binary is not found or if there is a newer version, download it +if [ ! -f $bin ] || version_gt "$(curl -s $latest_version_url | grep -oP '"tag_name": "\K(.*)(?=")')" "$(basename $bin | grep -oP '\d+\.\d+\.\d+')"; then + notify-send -u normal "โฌ Leapp" "Checking for updates..." + url="https://asset.noovolari.com/latest/Leapp-appImage.zip" + wget -q -O /tmp/leapp.AppImage "$url" + unzip /tmp/leapp.AppImage -d /tmp + mv /tmp/release/Leapp* $bin + chmod +x $bin +fi + +# Execute leapp +$bin -f -i $1 -o $2 diff --git a/bin/.bin/lock.sh b/bin/.bin/lock.sh new file mode 100755 index 0000000..157db44 --- /dev/null +++ b/bin/.bin/lock.sh @@ -0,0 +1,25 @@ +#!/bin/bash +swaylock -f \ + --screenshots \ + --clock \ + --indicator \ + --indicator-radius 150 \ + --indicator-thickness 7 \ + --font-size 24 \ + --effect-blur 7x5 \ + --effect-vignette 0.5:0.5 \ + --ring-color 9ccfd8 \ + --ring-ver-color f6c177 \ + --ring-wrong-color eb6f92 \ + --key-hl-color eb6f92 \ + --line-color 00000000 \ + --inside-color 191724aa \ + --inside-ver-color 191724aa \ + --inside-wrong-color 191724aa \ + --separator-color 00000000 \ + --text-color e0def4 \ + --text-ver-color e0def4 \ + --text-wrong-color e0def4 \ + --text-caps-lock-color f6c177 \ + --grace 2 \ + --fade-in 0.2 diff --git a/bin/.bin/nosql.sh b/bin/.bin/nosql.sh new file mode 100755 index 0000000..f4cdd16 --- /dev/null +++ b/bin/.bin/nosql.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +bin=$HOME/.bin/nosql + +# if nosql binary is not found, download it +if [ ! -f $bin ]; then + echo "Downloading NoSql binary..." + url="https://s3.nosqlbooster.com/download/releasesv7/nosqlbooster4mongo-7.1.17.AppImage" + wget -q -O $bin $url + chmod +x $bin +fi + +# execute leapp +$bin diff --git a/bin/.bin/obsidian-launcher b/bin/.bin/obsidian-launcher new file mode 100755 index 0000000..d760832 --- /dev/null +++ b/bin/.bin/obsidian-launcher @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +swaymsg '[class="obsidian"]' focus && exit + +if [ $? -ne 0 ]; then + obsidian && swaymsg '[class="obsidian"]' focus >/dev/null 2>&1 +fi diff --git a/bin/.bin/openlens.sh b/bin/.bin/openlens.sh new file mode 100755 index 0000000..f445518 --- /dev/null +++ b/bin/.bin/openlens.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +bin=~/.bin/openlens + +repo=MuhammedKalkan/OpenLens +# if redis binary is not found, download it +if [ ! -f $bin ]; then + echo "Downloading openlens binary..." + filename=$(curl -s https://api.github.com/repos/$repo/releases/latest | jq -r '.assets[].name' | grep "x86_64.AppImage$") + fileurl=$(curl -s https://api.github.com/repos/$repo/releases/latest | jq -r --arg filename $filename '.assets[] | select(.name == $filename) | .browser_download_url') + wget -q -O $bin $fileurl + chmod +x $bin +fi + +# execute leapp +$bin -f -i $1 -o $2 diff --git a/bin/.bin/randwall b/bin/.bin/randwall new file mode 100755 index 0000000..e50779e --- /dev/null +++ b/bin/.bin/randwall @@ -0,0 +1,35 @@ +#!/bin/bash + +# Kill any existing swaybg or feh instances +pkill swaybg +pkill feh + +# Function to set wallpaper using swaybg on Sway +set_wallpaper_sway() { + swaymsg -t get_outputs -r | jq -r ".[].name" | parallel 'swaybg -o {} -i $(find ~/Pictures/* -type f | shuf -n 1) &' +} + +# Function to set wallpaper using swaybg on Hyprland +set_wallpaper_hyprland() { + hyprctl monitors -j | jq -r ".[].name" | parallel 'swaybg -o {} -i $(find ~/Pictures/* -type f | shuf -n 1) &' +} + +# Function to set wallpaper using feh on i3 +set_wallpaper_i3() { + # Count number of connected monitors + monitor_count=$(xrandr --query | grep " connected" | wc -l) + + # Get random wallpapers equal to monitor count + readarray -t wallpapers < <(find ~/Pictures/* -type f | shuf -n "$monitor_count") + + # Construct the feh command with multiple --bg-fill arguments + cmd="feh" + for wallpaper in "${wallpapers[@]}"; do + cmd+=" --bg-fill '$wallpaper'" + done + + # Execute the command + eval "$cmd" +} + +set_wallpaper_sway diff --git a/bin/.bin/redis.sh b/bin/.bin/redis.sh new file mode 100755 index 0000000..3c5274e --- /dev/null +++ b/bin/.bin/redis.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Define paths +bin_dir=~/.bin +bin_file="${bin_dir}/redis" + +# Create directory if it doesn't exist +mkdir -p "${bin_dir}" + +# Set current working directory +cd "${bin_dir}" + +if [ ! -f "${bin_file}" ]; then + notify-send -u normal "โฌ Redis Desktop Manager" "Downloading..." + + # Get latest release info and parse with proper JSON handling + release_info=$(curl -s https://api.github.com/repos/qishibo/AnotherRedisDesktopManager/releases/latest) + + # Determine system architecture + arch=$(uname -m) + if [ "${arch}" = "x86_64" ]; then + arch_pattern="x86_64" + elif [ "${arch}" = "aarch64" ]; then + arch_pattern="arm64" + else + echo "Unsupported architecture: ${arch}" + exit 1 + fi + + # Find appropriate AppImage for this architecture + filename=$(echo "${release_info}" | jq -r ".assets[].name" | grep "AppImage" | grep "${arch_pattern}") + echo "Selected filename: ${filename}" + + # Get download URL + fileurl=$(echo "${release_info}" | jq -r --arg filename "${filename}" '.assets[] | select(.name == $filename) | .browser_download_url') + echo "Download URL: ${fileurl}" + + # Download and make executable + if [ -n "${fileurl}" ] && [ "${fileurl}" != "null" ]; then + wget -q --show-progress -O "${bin_file}" "${fileurl}" + chmod +x "${bin_file}" + echo "Successfully downloaded Redis Desktop Manager" + else + echo "Failed to find download URL for architecture: ${arch}" + exit 1 + fi +fi + +# Execute with parameters if provided +"${bin_file}" -f ${1:+"-i"} ${1:+"$1"} ${2:+"-o"} ${2:+"$2"} diff --git a/bin/.bin/rop.sh b/bin/.bin/rop.sh new file mode 100755 index 0000000..1c7a763 --- /dev/null +++ b/bin/.bin/rop.sh @@ -0,0 +1,15 @@ +#!/bin/bash +GO_PACKAGE="github.com/marianozunino/rop" +BINARY_NAME="rop" + +TARGET_DIR="$HOME/.bin" +CODE_PATH="$TARGET_DIR/$BINARY_NAME" +if [ ! -x "$CODE_PATH" ]; then + notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..." + GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || { + notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL" + exit 1 + } + notify-send "Installation Complete" "$BINARY_NAME has been installed successfully" +fi +exec "$CODE_PATH" "$@" diff --git a/bin/.bin/screenshot-upload b/bin/.bin/screenshot-upload new file mode 100755 index 0000000..4615333 --- /dev/null +++ b/bin/.bin/screenshot-upload @@ -0,0 +1,7 @@ +#!/bin/bash +file=/tmp/$(date "+%Y%m%d-%H%M%S")_screenshot.png + +grim -g "$(slurp)" "$file" && + satty --filename "$file" --fullscreen && + yad --title="Upload?" --text="Upload image?" --image="dialog-question" --default-cancel && + curl -F "file=@$file" https://drop.mz.uy | xargs xdg-open diff --git a/bin/.bin/sdm-ui.sh b/bin/.bin/sdm-ui.sh new file mode 100755 index 0000000..7842e8c --- /dev/null +++ b/bin/.bin/sdm-ui.sh @@ -0,0 +1,15 @@ +#!/bin/bash +MODULE_URL="github.com/marianozunino/sdm-ui" +BINARY_NAME="sdm-ui" + +TARGET_DIR="$HOME/.bin" +CODE_PATH="$TARGET_DIR/$BINARY_NAME" +if [ ! -x "$CODE_PATH" ]; then + notify-send "Installing $BINARY_NAME" "Installing from $MODULE_URL..." + GO111MODULE=on GOBIN="$TARGET_DIR" go install "$MODULE_URL@latest" || { + notify-send -u critical "Installation Failed" "Failed to install $BINARY_NAME from $MODULE_URL" + exit 1 + } + notify-send "Installation Complete" "$BINARY_NAME has been installed successfully" +fi +exec "$CODE_PATH" "$@" diff --git a/bin/.bin/sm.sh b/bin/.bin/sm.sh new file mode 100755 index 0000000..f3f575d --- /dev/null +++ b/bin/.bin/sm.sh @@ -0,0 +1,23 @@ +#!/bin/bash +URL=$(curl https://www.sublimemerge.com/download_thanks?target=x64-tar#direct-downloads | grep -oP 'https://download.sublimetext.com/sublime_merge_build_\d+_x64.tar.xz' | head -n 1) +VERSION=$(echo $URL | grep -oP '\d+' | head -n 1) +FILENAME=sublime_merge_build_"$VERSION"_x64.tar.xz +bin=~/.bin/sm + +# set current working directory to ~/.bin +cd ~/.bin + +# if FILENAME exists, then exit +if [ ! -f $FILENAME ]; then + notify-send -u normal "โฌ Sublime Merge" "Updating to version $VERSION" + # wget only if file does not exist + wget -nc $URL + tar -xvf $FILENAME +fi + +if [ ! -f $bin ]; then + ln -fs $PWD/sublime_merge/sublime_merge $bin +fi + +# run sm +$bin diff --git a/bin/.bin/vmrss b/bin/.bin/vmrss new file mode 100755 index 0000000..24a0a4f --- /dev/null +++ b/bin/.bin/vmrss @@ -0,0 +1,62 @@ +#!/usr/bin/env bash +if [ $# -eq 0 ]; then + echo "Usage: $0 " + exit 1 +fi + +function print_vmrss() { + declare -a arr + arr=("$1" 0) + total=0 + + while [ ${#arr[@]} -gt 0 ]; do + + # remove last element + space=${arr[${#arr[@]}-1]} + unset arr[${#arr[@]}-1] + pid=${arr[${#arr[@]}-1]} + unset arr[${#arr[@]}-1] + + [ -d "/proc/$pid" ] || continue + + GREP_OPTS=${GREP_OPTS:-" + --color=auto + --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} + "} + mem=$(grep $GREP_OPTS VmRSS /proc/$pid/status \ + | grep $GREP_OPTS -o '[0-9]\+' \ + | awk '{print $1/1024}') + #Add decimals to total + total=$(echo $mem+$total | bc) + + # name of process + name=$(ps -p $pid -o comm=) + + printf "%${space}s%s($pid): $mem MB\n" '' "$name" + + # get children + children=$(pgrep -P $pid) + + # add children to array + for child in $children; do + arr+=("$child" $((space+2))) + done + done + printf "Total: $total MB\n" +} + +# check VMRSS_MONITOR = 1 +if [ ! -z "$VMRSS_MONITOR" ]; then + while true; do + if ps -p $1 > /dev/null + then + print_vmrss $1 + sleep 0.5 + else + break + fi + done + print_vmrss $1 +else + print_vmrss $1 +fi diff --git a/bin/.bin/waybar.sh b/bin/.bin/waybar.sh new file mode 100755 index 0000000..1cb365b --- /dev/null +++ b/bin/.bin/waybar.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +CONFIG_FILES="$HOME/.config/waybar/config.jsonc $HOME/.config/waybar/style.css" + +trap "killall waybar" EXIT + +while true; do + waybar & + inotifywait -e create,modify $CONFIG_FILES + killall waybar +done diff --git a/bin/.bin/wlrecord.sh b/bin/.bin/wlrecord.sh new file mode 100755 index 0000000..c399c45 Binary files /dev/null and b/bin/.bin/wlrecord.sh differ diff --git a/config/.config/env b/config/.config/env new file mode 100755 index 0000000..93bc524 --- /dev/null +++ b/config/.config/env @@ -0,0 +1,49 @@ +#!/bin/sh +export EDITOR="nvim" +export TERMINAL="kitty" +export LANG=en_US.UTF-8 +export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config} +export XDG_CACHE_HOME=${XDG_CACHE_HOME:-~/.cache} +export XDG_DATA_HOME=${XDG_DATA_HOME:-~/.local/share} +export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-~/.xdg} +export XDG_STATE_HOME=${XDG_STATE_HOME:-~/.local/state} +export ZDOTDIR=${ZDOTDIR:-$XDG_CONFIG_HOME/zsh} +export WAKATIME_HOME=$XDG_CONFIG_HOME/wakatime +export ZSH_WAKATIME_BIN=$XDG_CONFIG_HOME/wakatime/.wakatime/wakatime-cli +export W3M_DIR=$XDG_DATA_HOME/w3m +export RANDFILE=$XDG_CACHE_HOME/.rnd +export SOLARGRAPH_CACHE=$XDG_CACHE_HOME/solargraph +export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc +export NODE_REPL_HISTORY=$XDG_DATA_HOME/node_repl_history +export GRADLE_USER_HOME=$XDG_DATA_HOME/gradle +export GOPATH=$XDG_DATA_HOME/go +export DOCKER_CONFIG=$XDG_CONFIG_HOME/docker +export CARGO_HOME=$XDG_DATA_HOME/cargo +# bash history +export HISTFILE=${XDG_STATE_HOME}/bash/history +export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0" +export WGETRC="$XDG_CONFIG_HOME/wgetrc" +export JAVA_HOME="/usr/lib/jvm/default" +export BROWSER=zen-browser +unset SSH_AGENT_PID +if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" +fi +export GNUHOME="$XDG_DATA_HOME/gnupg" +export GPG_TTY=$(tty) +gpg-connect-agent updatestartuptty /bye >/dev/null + +# Wayland/Sway specific environment variables +export MOZ_ENABLE_WAYLAND=1 +export QT_QPA_PLATFORM=wayland-egl +export QT_WAYLAND_DISABLE_WINDOWDECORATION=1 +export QT_QPA_PLATFORMTHEME=qt5ct +export QT_STYLE_OVERRIDE=kvantum +export CLUTTER_BACKEND=wayland +export GDK_BACKEND=wayland +export ECORE_EVAS_ENGINE=wayland_egl +export ELM_ENGINE=wayland_wgl +export SDL_VIDEODRIVER=wayland +export _JAVA_AWT_WM_NONREPARENTING=1 +export XDG_CURRENT_DESKTOP=sway +export XDG_SESSION_TYPE=wayland diff --git a/config/.config/ngrok/ngrok.yml b/config/.config/ngrok/ngrok.yml new file mode 100644 index 0000000..168add2 Binary files /dev/null and b/config/.config/ngrok/ngrok.yml differ diff --git a/config/.config/sdm-ui.yaml b/config/.config/sdm-ui.yaml new file mode 100644 index 0000000..effd6a2 Binary files /dev/null and b/config/.config/sdm-ui.yaml differ diff --git a/easyeffects/.config/easyeffects/Philips SHP9600 ParametricEq.txt b/easyeffects/.config/easyeffects/Philips SHP9600 ParametricEq.txt new file mode 100644 index 0000000..0c3e902 --- /dev/null +++ b/easyeffects/.config/easyeffects/Philips SHP9600 ParametricEq.txt @@ -0,0 +1,11 @@ +Preamp: -11.82 dB +Filter 1: ON LSC Fc 105.0 Hz Gain 16.1 dB Q 0.70 +Filter 2: ON PK Fc 41.6 Hz Gain -1.2 dB Q 3.28 +Filter 3: ON PK Fc 66.6 Hz Gain -12.9 dB Q 0.50 +Filter 4: ON PK Fc 1411.0 Hz Gain 0.5 dB Q 2.99 +Filter 5: ON PK Fc 1826.8 Hz Gain 5.0 dB Q 0.84 +Filter 6: ON PK Fc 1942.0 Hz Gain 0.9 dB Q 4.36 +Filter 7: ON PK Fc 2590.0 Hz Gain -1.9 dB Q 4.42 +Filter 8: ON PK Fc 6008.2 Hz Gain -4.0 dB Q 6.00 +Filter 9: ON PK Fc 7739.3 Hz Gain -1.4 dB Q 4.50 +Filter 10: ON HSC Fc 10000.0 Hz Gain -2.3 dB Q 0.70 diff --git a/easyeffects/.config/easyeffects/input/microphone.json b/easyeffects/.config/easyeffects/input/microphone.json new file mode 100644 index 0000000..f667ca6 --- /dev/null +++ b/easyeffects/.config/easyeffects/input/microphone.json @@ -0,0 +1,102 @@ +{ + "input": { + "autogain#0": { + "bypass": false, + "input-gain": 0.0, + "maximum-history": 15, + "output-gain": 0.0, + "reference": "Geometric Mean (MSI)", + "silence-threshold": -70.0, + "target": -23.0 + }, + "blocklist": [], + "gate#0": { + "attack": 40.0, + "bypass": false, + "curve-threshold": -57.0, + "curve-zone": -6.0, + "dry": -14.0, + "hpf-frequency": 100.0, + "hpf-mode": "24 dB/oct", + "hysteresis": false, + "hysteresis-threshold": -12.0, + "hysteresis-zone": -6.0, + "input-gain": 0.0, + "lpf-frequency": 1000.0, + "lpf-mode": "24 dB/oct", + "makeup": 0.0, + "output-gain": 0.0, + "reduction": -72.0, + "release": 800.0, + "sidechain": { + "input": "Internal", + "lookahead": 8.0, + "mode": "RMS", + "preamp": 0.0, + "reactivity": 10.0, + "source": "Middle", + "stereo-split-source": "Left/Right" + }, + "stereo-split": false, + "wet": -16.0 + }, + "limiter#0": { + "alr": true, + "alr-attack": 5.0, + "alr-knee": 0.0, + "alr-release": 50.0, + "attack": 5.0, + "bypass": false, + "dithering": "24bit", + "external-sidechain": false, + "gain-boost": false, + "input-gain": 0.0, + "lookahead": 5.0, + "mode": "Exp Tail", + "output-gain": 0.0, + "oversampling": "Full x2(2L)", + "release": 5.0, + "sidechain-preamp": 0.0, + "stereo-link": 100.0, + "threshold": 0.0 + }, + "plugins_order": [ + "rnnoise#0", + "gate#0", + "autogain#0", + "limiter#0", + "stereo_tools#0" + ], + "rnnoise#0": { + "bypass": false, + "enable-vad": true, + "input-gain": 0.0, + "model-path": "", + "output-gain": 0.0, + "release": 20.0, + "vad-thres": 50.0, + "wet": 0.0 + }, + "stereo_tools#0": { + "balance-in": 0.0, + "balance-out": 0.0, + "bypass": false, + "delay": -3.469446951953614e-18, + "input-gain": 0.0, + "middle-level": 0.0, + "middle-panorama": 0.0, + "mode": "LR > LL (Mono Left Channel)", + "mutel": false, + "muter": false, + "output-gain": 0.0, + "phasel": false, + "phaser": false, + "sc-level": 1.0, + "side-balance": 0.0, + "side-level": 0.0, + "softclip": false, + "stereo-base": 0.0, + "stereo-phase": 0.0 + } + } +} diff --git a/font-manager.sh b/font-manager.sh new file mode 100755 index 0000000..e0131a9 --- /dev/null +++ b/font-manager.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# ~/.local/bin/font-manager +# This script extracts font archives and rebuilds font cache + +FONT_DIR="$HOME/.local/share/fonts" +ARCHIVE_DIR="$FONT_DIR/archives" +ACTIVE_DIR="$FONT_DIR/active" + +# Function to extract a specific font archive +extract_font() { + local archive="$1" + if [ -f "$ARCHIVE_DIR/$archive.tar.gz" ]; then + echo "Extracting $archive fonts..." + tar -xzf "$ARCHIVE_DIR/$archive.tar.gz" -C "$ACTIVE_DIR" + fc-cache -f + echo "Done! $archive fonts are now active." + else + echo "Error: Font archive $archive.tar.gz not found." + exit 1 + fi +} + +# Function to list available font archives +list_fonts() { + echo "Available font archives:" + ls -1 "$ARCHIVE_DIR" | sed 's/\.tar\.gz$//' +} + +# Function to rebuild font cache +rebuild_cache() { + echo "Rebuilding font cache..." + fc-cache -f + echo "Done!" +} + +# Function to extract all fonts +extract_all() { + echo "Extracting all font archives..." + for archive in "$ARCHIVE_DIR"/*.tar.gz; do + tar -xzf "$archive" -C "$ACTIVE_DIR" + done + fc-cache -f + echo "Done! All fonts are now active." +} + +# Function to clean active fonts directory +clean_fonts() { + echo "Cleaning active fonts directory..." + find "$ACTIVE_DIR" -type f -name "*.ttf" -o -name "*.otf" | xargs rm -f + echo "Done! Active fonts directory is now clean." +} + +# Main script logic +case "$1" in +"extract") + extract_font "$2" + ;; +"list") + list_fonts + ;; +"rebuild") + rebuild_cache + ;; +"all") + extract_all + ;; +"clean") + clean_fonts + ;; +*) + echo "Usage: font-manager [command] [options]" + echo "Commands:" + echo " extract [name] Extract specific font archive" + echo " list List available font archives" + echo " rebuild Rebuild font cache" + echo " all Extract all font archives" + echo " clean Remove all active fonts" + ;; +esac diff --git a/fonts/.local/share/fonts/active/.gitkeep b/fonts/.local/share/fonts/active/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/fonts/.local/share/fonts/archives/AGaramond.tar.gz b/fonts/.local/share/fonts/archives/AGaramond.tar.gz new file mode 100644 index 0000000..4e9b607 Binary files /dev/null and b/fonts/.local/share/fonts/archives/AGaramond.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/FontAwesome.tar.gz b/fonts/.local/share/fonts/archives/FontAwesome.tar.gz new file mode 100644 index 0000000..4f89a4f Binary files /dev/null and b/fonts/.local/share/fonts/archives/FontAwesome.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/Inter.tar.gz b/fonts/.local/share/fonts/archives/Inter.tar.gz new file mode 100644 index 0000000..3484c92 Binary files /dev/null and b/fonts/.local/share/fonts/archives/Inter.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/JetBrains.tar.gz b/fonts/.local/share/fonts/archives/JetBrains.tar.gz new file mode 100644 index 0000000..9c3cb3c Binary files /dev/null and b/fonts/.local/share/fonts/archives/JetBrains.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/MonoLisa.tar.gz b/fonts/.local/share/fonts/archives/MonoLisa.tar.gz new file mode 100644 index 0000000..4176fcf Binary files /dev/null and b/fonts/.local/share/fonts/archives/MonoLisa.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/NerdFonts.tar.gz b/fonts/.local/share/fonts/archives/NerdFonts.tar.gz new file mode 100644 index 0000000..0690e9c Binary files /dev/null and b/fonts/.local/share/fonts/archives/NerdFonts.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/OpenSans.tar.gz b/fonts/.local/share/fonts/archives/OpenSans.tar.gz new file mode 100644 index 0000000..b8803c2 Binary files /dev/null and b/fonts/.local/share/fonts/archives/OpenSans.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/Proxima.tar.gz b/fonts/.local/share/fonts/archives/Proxima.tar.gz new file mode 100644 index 0000000..5935c54 Binary files /dev/null and b/fonts/.local/share/fonts/archives/Proxima.tar.gz differ diff --git a/fonts/.local/share/fonts/archives/SourceSans.tar.gz b/fonts/.local/share/fonts/archives/SourceSans.tar.gz new file mode 100644 index 0000000..3790f0c Binary files /dev/null and b/fonts/.local/share/fonts/archives/SourceSans.tar.gz differ diff --git a/fuzzel/.config/fuzzel/fuzzel.ini b/fuzzel/.config/fuzzel/fuzzel.ini new file mode 100644 index 0000000..d36fb4c --- /dev/null +++ b/fuzzel/.config/fuzzel/fuzzel.ini @@ -0,0 +1,18 @@ +dpi-aware=yes +icon-theme=Papirus-Dark +width=50 +font=Fira Code:size=16 +fields=name,generic,comment,categories,filename,keywords +terminal=kitty +prompt="โฏ " +show-actions=yes +exit-on-keyboard-focus-loss=yes +include=~/.config/fuzzel/mocha/red.ini +width=70 + +[border] +radius=20 + +[dmenu] +exit-immediately-if-empty=yes + diff --git a/fuzzel/.config/fuzzel/mocha/blue.ini b/fuzzel/.config/fuzzel/mocha/blue.ini new file mode 100644 index 0000000..0c54d24 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/blue.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=89b4faff +selection=585b70ff +selection-match=89b4faff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/flamingo.ini b/fuzzel/.config/fuzzel/mocha/flamingo.ini new file mode 100644 index 0000000..bfe863b --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/flamingo.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=f2cdcdff +selection=585b70ff +selection-match=f2cdcdff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/green.ini b/fuzzel/.config/fuzzel/mocha/green.ini new file mode 100644 index 0000000..d97bd84 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/green.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=a6e3a1ff +selection=585b70ff +selection-match=a6e3a1ff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/lavender.ini b/fuzzel/.config/fuzzel/mocha/lavender.ini new file mode 100644 index 0000000..9ce88df --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/lavender.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=b4befeff +selection=585b70ff +selection-match=b4befeff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/maroon.ini b/fuzzel/.config/fuzzel/mocha/maroon.ini new file mode 100644 index 0000000..8eac13c --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/maroon.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=eba0acff +selection=585b70ff +selection-match=eba0acff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/mauve.ini b/fuzzel/.config/fuzzel/mocha/mauve.ini new file mode 100644 index 0000000..0a0cdcc --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/mauve.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=cba6f7ff +selection=585b70ff +selection-match=cba6f7ff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/peach.ini b/fuzzel/.config/fuzzel/mocha/peach.ini new file mode 100644 index 0000000..60e02a9 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/peach.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2ef0 +text=cdd6f4ff +match=fab387ff +selection=585b70ff +selection-match=fab387ff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/pink.ini b/fuzzel/.config/fuzzel/mocha/pink.ini new file mode 100644 index 0000000..302f354 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/pink.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=f5c2e7ff +selection=585b70ff +selection-match=f5c2e7ff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/red.ini b/fuzzel/.config/fuzzel/mocha/red.ini new file mode 100644 index 0000000..b6af6ae --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/red.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2ef0 +text=cdd6f4ff +match=f38ba8ff +selection=585b70ff +selection-match=f38ba8ff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/rosewater.ini b/fuzzel/.config/fuzzel/mocha/rosewater.ini new file mode 100644 index 0000000..b339c31 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/rosewater.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=f5e0dcff +selection=585b70ff +selection-match=f5e0dcff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/sapphire.ini b/fuzzel/.config/fuzzel/mocha/sapphire.ini new file mode 100644 index 0000000..2c94335 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/sapphire.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=74c7ecff +selection=585b70ff +selection-match=74c7ecff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/sky.ini b/fuzzel/.config/fuzzel/mocha/sky.ini new file mode 100644 index 0000000..ee57600 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/sky.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=89dcebff +selection=585b70ff +selection-match=89dcebff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/teal.ini b/fuzzel/.config/fuzzel/mocha/teal.ini new file mode 100644 index 0000000..5387e67 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/teal.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=94e2d5ff +selection=585b70ff +selection-match=94e2d5ff +selection-text=cdd6f4ff +border=b4befeff diff --git a/fuzzel/.config/fuzzel/mocha/yellow.ini b/fuzzel/.config/fuzzel/mocha/yellow.ini new file mode 100644 index 0000000..343f534 --- /dev/null +++ b/fuzzel/.config/fuzzel/mocha/yellow.ini @@ -0,0 +1,8 @@ +[colors] +background=1e1e2edd +text=cdd6f4ff +match=f9e2afff +selection=585b70ff +selection-match=f9e2afff +selection-text=cdd6f4ff +border=b4befeff diff --git a/git/.config/git/commit.sh b/git/.config/git/commit.sh new file mode 100755 index 0000000..7ecd00d --- /dev/null +++ b/git/.config/git/commit.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +get_ticket_number() { + git symbolic-ref --short HEAD | grep -Ei '^ocst-[0-9]{2,5}-' | sed -E 's/^(ocst-[0-9]{2,5}).*$/\1/i' | tr '[:upper:]' '[:lower:]' +} + +format_commit_message() { + local message="$1" + local ticket="$2" + + if echo "$message" | grep -E '^[^:]+:' >/dev/null; then + local type=$(echo "$message" | cut -d: -f1) + local content=$(echo "$message" | cut -d: -f2- | sed 's/^ //') + echo "$type($ticket): $content" + else + echo "$message" + fi +} + +main() { + local ticket=$(get_ticket_number) + if [ -n "$ticket" ]; then + git commit -m "$(format_commit_message "$1" "$ticket")" "${@:2}" + else + git commit -m "$1" "${@:2}" + fi +} + +main "$@" diff --git a/git/.config/git/config b/git/.config/git/config new file mode 100644 index 0000000..7325fb1 --- /dev/null +++ b/git/.config/git/config @@ -0,0 +1,82 @@ +# GitFlow related sections +[gitflow "branch"] + master = master + develop = develop + +[gitflow "prefix"] + feature = feature/ + release = release/ + hotfix = hotfix/ + bugfix = bugfix/ + support = support/ + versiontag = v + +[user] + email = marianoz@posteo.net + name = Mariano Z. + signingkey = 13D35660EC8E8AA03D4370A83FA93CB876C8FFAA + + +[include] + path = ~/.config/git/gitalias.txt +[core] + pager = diff-so-fancy | less --tabs=4 -RFX + autocrlf = input + excludesfile = ~/.config/git/.gitignore +[color] + ui = true +[color "diff-highlight"] + oldNormal = red bold + oldHighlight = red bold 52 + newNormal = green bold + newHighlight = green bold 22 +[color "diff"] + meta = yellow + frag = magenta bold + commit = yellow bold + old = red bold + new = green bold + whitespace = red reverse +[credential] + helper = /usr/lib/git-core/git-credential-libsecret +[mergetool "fugitive"] + cmd = vim -f -c "MergetoolStart" "$MERGED" "$BASE" "$LOCAL" "$REMOTE" + #cmd = vim -f -c \"Gvdiffsplit!\" \"$MERGED\" +[merge] + tool = fugitive + conflictStyle = diff3 +[icdiff] + options = --highlight --line-numbers +# +[pull] + rebase = true +[rebase] + autoStash = true +[init] + defaultBranch = master +[push] + autoSetupRemote = true + +# avoid issues where the `cargo audit` command tries to clone from a repo you do not have WRITE access to. +# we already use SSH for every github repo, and so this puts the clone back to using HTTPS. +[url "https://github.com/RustSec/advisory-db"] + insteadOf = https://github.com/RustSec/advisory-db + +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true + +[color "blame"] + highlightRecent = 237, 20 month ago, 238, 19 month ago, 239, 18 month ago, 240, 17 month ago, 241, 16 month ago, 242, 15 month ago, 243, 14 month ago, 244, 13 month ago, 245, 12 month ago, 246, 11 month ago, 247, 10 month ago, 248, 9 month ago, 249, 8 month ago, 250, 7 month ago, 251, 6 month ago, 252, 5 month ago, 253, 4 month ago, 254, 3 month ago, 231, 2 month ago, 230, 1 month ago, 229, 3 weeks ago, 228, 2 weeks ago, 227, 1 week ago, 226 + +[commit] + gpgsign = true + +[alias] + bb = !better-git-branch.sh + + +[includeIf "gitdir:~/Sync/"] + path = ~/Sync/Obsidian/.gitconfig diff --git a/git/.config/git/gitalias.txt b/git/.config/git/gitalias.txt new file mode 100644 index 0000000..2493276 --- /dev/null +++ b/git/.config/git/gitalias.txt @@ -0,0 +1,1513 @@ +# -*- mode: gitconfig; -*- +# vim: set filetype=gitconfig: +## +# GitAlias.com file of many git alias items, including shortcuts, helpers, workflows, etc. +# +# +# ## Usage +# +# Typical usage for a typical user: +# +# * Save this file as a dot file in your home directory: `~/.gitalias.txt` +# +# * Edit your git config dot file in your home directory such as `~/.gitconfig` +# +# * Include the path to this file. +# +# Example file `~/.gitconfig` with an entry to include the file `~/.gitalias.txt`: +# +# [include] +# path = gitalias.txt +# +# +# ## Usage for older git versions +# +# If you use an older version of git that does not have git config "include" capability, +# or if you prefer more control, then you can simply copy/paste anything you like from +# this file to your own git config file. +# +# +# ## Customization +# +# If you want to use this file, and also want to change some of the items, +# then one way is to use your git config file to include this gitalias file, +# and also define your own alias items; a later alias takes precedence. +# +# Example file `~/.gitconfig` item to include the file `~/.gitalias.txt`: +# +# [include] +# path = ~/.gitconfig.d/gitalias.txt +# [alias] +# l = log --graph --oneline +# +# +# ## Links +# +# * [GitAlias.com website](http://gitalias.com) +# * [GitAlias GitHub](https://github.com/gitalias) +# * [Git Basics - Git Aliases](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases) +# * [Git Basics - Tips and Tricks](https://git-scm.com/book/en/v1/Git-Basics-Tips-and-Tricks) +# +# ## Tracking +# +# * Package: gitalias +# * Version: 23.2.0 +# * Created: 2016-06-17T00:00:00Z +# * Updated: 2020-07-10T01:08:58Z +# * License: GPL-2.0-only +# * Contact: Joel Parker Henderson (joel@joelparkerhenderson.com) +## + +[alias] + + ## + # One letter alias for our most frequent commands. + # + # Guidelines: these aliases do not use options, because we want + # these aliases to be easy to compose and use in many ways. + ## + + a = add + b = branch + c = commit + d = diff + f = fetch + g = grep + l = log + m = merge + o = checkout + p = pull + r = remote + s = status + w = whatchanged + + ## + # Short aliases for our frequent commands. + # + # Guidelines: + # + # * Generally speaking, the alias should be in the same + # order as the command name followed by its options. + # + # * Right: fb = foo --bar + # * Wrong: bf = foo --bar + ## + + ### add ### + + # add all + aa = add --all + + # add by patch - looks at each change, and asks if we want to put it in the repo. + ap = add --patch + + # add just the files that are updated. + au = add --update + + ### branch ### + + # branch description + bd = !"git config branch.$(git rev-parse --abbrev-ref HEAD 2>/dev/null).description" + + # bra nch - edit the description + be = branch --edit-description + + # branch and only list branches whose tips are reachable from the specified commit (HEAD if not specified). + bm = branch --merged + + # branch and only list branches whose tips are not reachable from the specified commit (HEAD if not specified). + bnm = branch --no-merged + + ### commit ### + + # commit - amend the tip of the current branch rather than creating a new commit. + ca = commit --amend + + # commit - amend the tip of the current branch, and edit the message. + cam = commit --amend --message + + # commit - amend the tip of the current branch, and do not edit the message. + cane = commit --amend --no-edit + + # commit interactive + ci = commit --interactive + + # commit with a message + cm = "!sh $XDG_CONFIG_HOME/git/commit.sh" + + + ### checkout ### + + # checkout - update the working tree to match a branch or paths. [same as "o" for "out"] + co = checkout + con = checkout --no-guess + + ### cherry-pick ### + + # cherry-pick - apply the changes introduced by some existing commits; useful for moving small chunks of code between branches. + cp = cherry-pick + + # cherry-pick - abort the picking process + cpa = cherry-pick --abort + + # cherry-pick - continue the picking process + cpc = cherry-pick --continue + + # cherry-pick without making a commit, and when when recording the commit, append a line that says "(cherry picked from commit ...)" + cp-nx = cherry-pick --no-commit -x + + ### diff ### + + # diff - show changes not yet staged + dc = diff --cached + + # diff - show changes about to be commited + ds = diff --staged + + # diff - show changes but by word, not line + dw = diff --word-diff + + # diff deep - show changes with our preferred options. Also aliased as `diff-deep`. + dd = diff --check --dirstat --find-copies --find-renames --histogram --color + + ### clean ### + + # clean everything to be pristine + cleanest = clean -ffdx + + ### grep ### + + # grep i.e. search for text + g = grep + + # grep - show line number + gl = grep --line-number + + # grep group - search with our preferred options. Also aliased as `grep-group`. + gg = grep --break --heading --line-number --color + + ### log ### + + # log with a text-based graphical representation of the commit history. + lg = log --graph + + # log with one line per item. + lo = log --oneline + + # log with patch generation. + lp = log --patch + + # log with first parent, useful for team branch that only accepts pull requests + lfp = log --first-parent + + # log with items appearing in topological order, i.e. descendant commits are shown before their parents. + lt = log --topo-order + + # log like - we like this summarization our key performance indicators. Also aliased as `log-like`. + ll = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' + + # log like long - we like this summarization our key performance indicators. Also aliased as `log-like-long`. + lll = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --abbrev=40 --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset' + + # + l = log --graph --pretty='format:%C(red)%d%C(reset) %C(yellow)%h%C(reset) %ar %C(green)%aN%C(reset) %s' + ## ls-files ## + + # ls-files - show information about files in the index and the working tree; like Unix "ls" command. + ls = ls-files + + # ls-ignored - list files that git has ignored. + ls-ignored = ls-files --others --i --exclude-standard + + ### merge ### + + # merge abort - cancel the merging process + ma = merge --abort + + # merge - continue the merging process + mc = merge --continue + + # merge but without autocommit, and with a commit even if the merge resolved as a fast-forward. + me = merge --no-commit --no-ff + + ### pull ### + + # pull if a merge can be resolved as a fast-forward, otherwise fail. + pf = pull --ff-only + + # pull with rebase - to provide a cleaner, linear, bisectable history. + # + # To automatically do "pull --rebase" everywhere: + # + # git config --global pull.rebase true + # + # To automatically do "pull --rebase" for any branch based on master: + # + # git config branch.master.rebase true + # + # To automatically do "pull --rebase" for any newly-created branches: + # + # git config --global branch.autosetuprebase always + # + # To integrate changes between branches, you can merge or rebase. + # + # When we use "git pull", git does a fetch then a merge. + # If we've made changes locally and someone else has pushed changes + # to our git host then git will automatically merge these together + # and create a merge commit that looks like this in the history: + # + # 12345678 - Merge branch 'foo' of bar into master + # + # When we use "git pull --rebase", git does a fetch then a rebase. + # A rebase resets the HEAD of your local branch to be the same as + # the remote HEAD, then replays your local commits back into repo. + # This means you don't get any noisy merge messages in your history. + # This gives us a linear history, and also helps with git bisect. + # + pr = pull --rebase + + # pp - pull with rebase preserve of merge commits + # + # See https://stackoverflow.com/questions/21364636/git-pull-rebase-preserve-merges + # + # You should only rebase if you know (in a sort of general sense) + # what you are doing, and if you do know what you are doing, then you + # would probably prefer a merge-preserving rebase as a general rule. + # + # Although by the time you've decided that rebasing is a good idea, + # you will probably find that a history that has its own embedded + # branch-and-merge-points is not necessarily the correct "final + # rewritten history". + # + # That is, if it's appropriate to do a rebase at all, it's at least fairly + # likely that the history to be rebased is itself linear, so that the + # preserve-vs-flatten question is moot anyway. + # + # See https://stackoverflow.com/questions/38269092/is-it-possible-to-put-preserve-merges-in-the-gitconfig + # + # While preserving merges is probably generally superior, in at least a + # few ways, to discarding them when rebasing, the fact is that rebase + # cannot preserve them. The only thing it can do, once some commits + # have been copied to new commits, is re-perform them. This can have new + # and/or different merge conflicts, vs the last time the merge was done. + # You should also pay close attention to the restrictions on merge + # preservation in the git rebase documentation. + # + # Without getting into a lot of detail, it always seems to me that most + # commit graph subsets that "should be" rebased, rarely have any + # internal merges. If such a graph subset has a single final merge, you + # can simply strip away that merge (with git reset) before rebasing, + # and re-do that single merge manually at the end. (In fact, git rebase + # normally drops merge commits entirely, so you don't have to run the git + # reset itself in some cases. The one where you do have to run it is when + # the merge is into the branch onto which you intend to rebase. This is + # where git pull actually does the right thing when it uses + # `git rebase -p`, except that it fails to check for, and warn about, + # internal merges, which are sort of warning signs that rebasing might + # not be a good idea. + # + pp = pull --rebase=preserve + + ### rebase ### + + # rebase - forward-port local commits to the updated upstream head. + rb = rebase + + # rebase abort - cancel the rebasing process + rba = rebase --abort + + # rebase - continue the rebasing process after resolving a conflict manually and updating the index with the resolution. + rbc = rebase --continue + + # rebase - restart the rebasing process by skipping the current patch. + rbs = rebase --skip + + # rbi - rebase interactive on our unpushed commits. + # + # Before we push our local changes, we may want to do some cleanup, + # to improve our commit messages or squash related commits together. + # + # Let's say I've pushed two commits that are related to a new feature and + # I have another where I made a spelling mistake in the commit message. + # When I run "git rbi" I get dropped into my editor with this: + # + # pick 7f06d36 foo + # pick ad544d0 goo + # pick de3083a hoo + # + # Let's say I want to squash the "foo" and "goo" commits together, + # and also change "hoo" to say "whatever". To do these, I change "pick" + # to say "s" for squash; this tells git to squash the two together; + # I also edit "hoo" to rename it to "whatever". I make the file look like: + # + # pick 7f06d36 foo + # s ad544d0 goo + # r de3083a whatever + # + # This gives me two new commit messages to edit, which I update. + # Now when I push the remote repo host receives two commits + # + # 3400455 - foo + # 5dae0a0 - whatever + # + rbi = rebase --interactive @{upstream} + + # See https://blog.filippo.io/git-fixup-amending-an-older-commit/ + # This is a slightly modified version + fixup = "!f() { TARGET=$(git rev-parse \"$1\"); git commit --fixup=$TARGET && GIT_EDITOR=true git rebase --interactive --autosquash $TARGET~; }; f" + + ### reflog ### + + # reflog - reference log that manages when tips of branches are updated. + rl = reflog + + ### remote ### + + # remote - manage set of tracked repositories [same as "r"]. + rr = remote + + # remote show - gives some information about the remote . + rrs = remote show + + # remote update - fetch updates for a named set of remotes in the repository as defined by remotes. + rru = remote update + + # remote prune - deletes all stale remote-tracking branches under . + rrp = remote prune + + incoming = !git remote update --prune; git log ..@{upstream} + outgoing = log @{upstream}.. + + # Push to all remotes + push-to-all-remotes = !git remote | xargs -I% -n1 git push % + + ### revert ### + + # revert - undo the changes from some existing commits + rv = revert + + # revert without autocommit; useful when you're reverting more than one commits' effect to your index in a row. + rvnc = revert --no-commit + + ### show-branch ### + + # show-branch - print a list of branches and their commits. + sb = show-branch + + ### submodule ### + + # submodule - enables foreign repositories to be embedded within a dedicated subdirectory of the source tree. + sm = submodule + + # submodule init + smi = submodule init + + # submodule add + sma = submodule add + + # submodule sync + sms = submodule sync + + # submodule update + smu = submodule update + + # submodule update with initialize + smui = submodule update --init + + # submodule update with initialize and recursive; this is useful to bring a submodule fully up to date. + smuir = submodule update --init --recursive + + ### status ### + + # status with short format instead of full details + ss = status --short + + # status with short format and showing branch and tracking info. + ssb = status --short --branch + + ### ALIAS MANAGEMENT ### + + # Show our defined alias list + aliases = "!git config --get-regexp '^alias\\.' | cut -c 7- | sed 's/ / = /'" + + add-alias = "!f() { [ $# = 3 ] && git config $1 alias.\"$2\" \"$3\" && return 0 || echo \"Usage: git add-(local|global)-alias \" >&2 && return 1; }; f" + add-global-alias = "!git add-alias --global" + add-local-alias = "!git add-alias --local" + + # Rename an alias + rename-alias = "!f() { [ $# = 3 ] && [ $2 != $3 ] && [ ! -z \"$(git config $1 --get alias.$2)\" ] && [ -z \"$(git config $1 --get alias.$3)\" ] && git config $1 alias.$3 \"$(git config $1 --get alias.$2)\" && git config $1 --unset alias.$2 && return 0 || echo \"Usage: git rename-(local|global)-alias \nThe alias you are going to rename must exist and new name must not exist.\" >&2 && return 1; };f" + rename-global-alias = "!git rename-alias --global" + rename-local-alias = "!git rename-alias --local" + + # Last tag in the current branch + lasttag = describe --tags --abbrev=0 + + # Latest annotated tag in all branches + lasttagged = !git describe --tags `git rev-list --tags --max-count=1` + + # From https://gist.github.com/492227 + head = log -n1 + heads = !"git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'" + lost = !"git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub(\"SHA1: \", \"\"); print}'" + + ### diff-* ### + + diff-all = !"for name in $(git diff --name-only $1); do git difftool $1 $name & done" + diff-changes = diff --name-status -r + diff-stat = diff --stat --ignore-space-change -r + diff-staged = diff --cached + + # Diff using our preferred options. A.k.a. `dd`. + diff-deep = diff --check --dirstat --find-copies --find-renames --histogram --color + + ### grep-* ### + + # Find text in any commit ever. + grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f" + + # Find text and group the output lines. A.k.a. `gg`. + grep-group = grep --break --heading --line-number --color + + # grep with ack-like formatting + grep-ack = \ + -c color.grep.linenumber=\"bold yellow\" \ + -c color.grep.filename=\"bold green\" \ + -c color.grep.match=\"reverse yellow\" \ + grep --break --heading --line-number + + ### init ### + + # initalize a repo and immediate add an empty commit, which makes rebase easier. + init-empty = !"f() { git init && git commit --allow-empty --allow-empty-message --message ''; }; f" + + ### merge-* ### + + # Given a merge commit, find the span of commits that exist(ed). + # Not so useful in itself, but used by other aliases. + # Thanks to Rob Miller for the merge-span-* aliaes. + merge-span = !"f() { echo $(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f1)$1$(git log -1 $2 --merges --pretty=format:%P | cut -d' ' -f2); }; f" + + # Find the commits that were introduced by a merge + merge-span-log = "!git log `git merge-span .. $1`" + + # Show the changes that were introduced by a merge + merge-span-diff = !"git diff `git merge-span ... $1`" + + # Show the changes that were introduced by a merge, in your difftool + merge-span-difftool = !"git difftool `git merge-span ... $1`" + + # Interactively rebase all the commits on the current branch + rebase-branch = !"git rebase --interactive `git merge-base master HEAD`" + + # Sort by date for branches; can be useful for spring cleaning + refs-by-date = for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short)' + + # Find all objects that aren't referenced by any other object (orphans). + # To help an orphan, we create a new branch with the orphan's commit hash, + # then merge it into our current branch: + # + # git branch foo + # git merge foo + # + orphans = fsck --full + + # List all blobs by size in bytes. + # By [CodeGnome](http://www.codegnome.com/) + rev-list-all-objects-by-size = !"git rev-list --all --objects | awk '{print $1}'| git cat-file --batch-check | fgrep blob | sort -k3nr" + + # List all objects by size in bytes and file name. + # By [raphinesse](https://stackoverflow.com/users/380229/raphinesse) + rev-list-all-objects-by-size-and-name = !"git rev-list --all --objects | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print substr($0,6)}' | sort --numeric-sort --key=2" + + ### LOG ALIASES ### + + # Show log of changes, most recent first + log-changes = log --oneline --reverse + + # Show log of new commits after you fetched, with stats, excluding merges + log-fresh = log ORIG_HEAD.. --stat --no-merges + + # Show log in our preferred format for our key performance indicators. A.k.a. `ll`. + log-like = log --graph --topo-order --date=short --abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn]%Creset %Cblue%G?%Creset' + + # Show log in our preferred format for our key performance indicators, with long items. A.k.a. `lll`. + log-like-long = log --graph --topo-order --date=iso8601-strict --no-abbrev-commit --decorate --all --boundary --pretty=format:'%Cgreen%ad %Cred%h%Creset -%C(yellow)%d%Creset %s %Cblue[%cn <%ce>]%Creset %Cblue%G?%Creset' + + # Show log with dates in our local timezone + log-local = log --date=local + + # Show the log for my own commits by my own user email + log-my = !git log --author $(git config user.email) + + # Show log as a graph + log-graph = log --graph --all --oneline --decorate + + # Show the date of the earliest commit, in strict ISO 8601 format + log-first-date = !"git log --date-order --format=%cI | tail -1" + + # Show the date of the latest commit, in strict ISO 8601 format + log-latest-date = log -1 --date-order --format=%cI + + # Show the log of the recent hour, day, week, month, year + log-hour = log --since=1-hour-ago + log-day = log --since=1-day-ago + log-week = log --since=1-week-ago + log-month = log --since=1-month-ago + log-year = log --since=1-year-ago + + # Show the log of my own recent hour, day, week, month, year + log-my-hour = log --author $(git config user.email) --since=1-hour-ago + log-my-day = log --author $(git config user.email) --since=1-day-ago + log-my-week = log --author $(git config user.email) --since=1-week-ago + log-my-month = log --author $(git config user.email) --since=1-month-ago + log-my-year = log --author $(git config user.email) --since=1-year-ago + + # Show a specific format string and its number of log entries + log-of-format-and-count = "!f() { format=\"$1\"; shift; git log $@ --format=oneline --format="$format" | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) \"%\"}}' | sort; }; f" + log-of-count-and-format = "!f() { format=\"$1\"; shift; git log $@ --format=oneline --format="$format" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) \"%\", i}}' | sort -nr; }; f" + + # Show the number of log entries by a specific format string and date format string + log-of-format-and-count-with-date = "!f() { format=\"$1\"; shift; date_format=\"$1\"; shift; git log $@ --format=oneline --format=\"$format\" --date=format:\"$date_format\" | awk '{a[$0]++}END{for(i in a){print i, a[i], int((a[i]/NR)*100) \"%\"}}' | sort -r; }; f" + log-of-count-and-format-with-date = "!f() { format=\"$1\"; shift; date_format=\"$1\"; shift; git log $@ --format=oneline --format=\"$format\" --date=format:\"$date_format\" | awk '{a[$0]++}END{for(i in a){print a[i], int((a[i]/NR)*100) \"%\", i}}' | sort -nr; }; f" + + # Show the number of log items by email + log-of-email-and-count = "!f() { git log-of-format-and-count \"%aE\" $@; }; f" + log-of-count-and-email = "!f() { git log-of-count-and-format \"%aE\" $@; }; f" + + # Show the number of log items by hour + log-of-hour-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y-%m-%dT%H\" $@ ; }; f" + log-of-count-and-hour = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y-%m-%dT%H\" $@ ; }; f" + + # Show the number of log items by day + log-of-day-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y-%m-%d\" $@ ; }; f" + log-of-count-and-day = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y-%m-%d\" $@ ; }; f" + + # Show the number of log items by week + log-of-week-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y#%V\" $@; }; f" + log-of-count-and-week = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y#%V\" $@; }; f" + + # Show the number of log items by month + log-of-month-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y-%m\" $@ ; }; f" + log-of-count-and-month = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y-%m\" $@ ; }; f" + + # Show the number of log items by year + log-of-year-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%Y\" $@ ; }; f" + log-of-count-and-year = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%Y\" $@ ; }; f" + + # Show the number of log items by hour of day + log-of-hour-of-day-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%H\" $@; }; f" + log-of-count-and-hour-of-day = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%H\" $@; }; f" + + # Show the number of log items by day of week + log-of-day-of-week-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%u\" $@; }; f" + log-of-count-and-day-of-week = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%u\" $@; }; f" + + # Show the number of log items by week of year + log-of-week-of-year-and-count = "!f() { git log-of-format-and-count-with-date \"%ad\" \"%V\" $@; }; f" + log-of-count-and-week-of-year = "!f() { git log-of-count-and-format-with-date \"%ad\" \"%V\" $@; }; f" + + # TODO + log-refs = log --all --graph --decorate --oneline --simplify-by-decoration --no-merges + log-timeline = log --format='%h %an %ar - %s' + log-local = log --oneline origin..HEAD + log-fetched = log --oneline HEAD..origin/master + + # chart: show a summary chart of activity per author. + # + # Example: + # + # $ git chart + # ..X..........X...2..12 alice@example.com + # ....2..2..13.......... bob@example.com + # 2.....1....11......... carol@example.com + # ..1............1..1... david@example.com + # ....1.......1.3.3.22.2 eve@example.com + # + # The chart rows are the authors. + # TODO: sort the rows meaningfully, + # such as alphabetically, or by count. + # + # The chart columns are the days. + # The chart column prints one character per day. + # + # * For 1-9 commits, show the number. + # * For 10 or more commits, show "X" as a visual indicator. + # * For no commits, show "." as a visual placeholder. + # + # The chart timeline adjusts the date range automatically: + # + # * The timeline starts with the date of the earliest commit. + # * The timeline stops with the date of the latest commit. + # * The intent is to show the most relevant information. + # + # The chart default is to look at the past 6 weeks; + # this gives a good balance of recency and speed + # for a team that's currently working on a repo, + # and also gives a good balance of fitting within + # one terminal window 80 character width. + # + # You can adjust how far back the chart looks, + # by providing your own `--since` parameter. + # For example if you want to chart an older repo, + # that does not have any recent commits, then you + # you must provide a longer `--since` parameter. + # + chart = "!f() { \ + git log \ + --format=oneline \ + --format=\"%aE %at\" \ + --since=6-weeks-ago \ + $* | \ + awk ' \ + function time_to_slot(t) { return strftime(\"%Y-%m-%d\", t, true) } \ + function count_to_char(i) { return (i > 0) ? ((i < 10) ? i : \"X\") : \".\" } \ + BEGIN { \ + time_min = systime(); time_max = 0; \ + SECONDS_PER_DAY=86400; \ + } \ + { \ + item = $1; \ + time = 0 + $2; \ + if (time > time_max){ time_max = time } else if (time < time_min){ time_min = time }; \ + slot = time_to_slot(time); \ + items[item]++; \ + slots[slot]++; \ + views[item, slot]++; \ + } \ + END{ \ + printf(\"Chart time range %s to %s.\\n\", time_to_slot(time_min), time_to_slot(time_max)); \ + time_max_add = time_max += SECONDS_PER_DAY; \ + for(item in items){ \ + row = \"\"; \ + for(time = time_min; time < time_max_add; time += SECONDS_PER_DAY) { \ + slot = time_to_slot(time); \ + count = views[item, slot]; \ + row = row count_to_char(count); \ + } \ + print row, item; \ + } \ + }'; \ + }; f" + + # churn: show log of files that have many changes + # + # * Written by (Corey Haines)[http://coreyhaines.com/] + # * Scriptified by Gary Bernhardt + # * Obtained from https://github.com/garybernhardt/dotfiles/blob/master/bin/git-churn + # * Edited for GitAlias.com repo by Joel Parker Henderson + # * Comments by Mislav http://mislav.uniqpath.com/2014/02/hidden-documentation/ + # + # Show churn for whole repo: + # + # $ git churn + # + # Show churn for specific directories: + # + # $ git churn app lib + # + # Show churn for a time range: + # + # $ git churn --since=1-month-ago + # + # These are all standard arguments to `git log`. + # + # It's possible to get valuable insight from history of a project not only + # by viewing individual commits, but by analyzing sets of changes as a whole. + # For instance, `git churn` compiles stats about which files change the most. + # + # For example, to see where work on an app was focused on in the past month: + # + # $ git churn --since=1-month-ago app/ | tail + # + # This can also highlight potential problems with technical debt in a project. + # A specific file changing too often is generally a red flag, since it probably + # means the file either needed to be frequently fixed for bugs, or the file + # holds too much responsibility and should be split into smaller units. + # + # Similar methods of history analysis can be employed to see which people were + # responsible recently for development of a certain part of the codebase. + # + # For instance, to see who contributed most to the API part of an application: + # + # $ git log --format='%an' --since=1-month-ago app/controllers/api/ | \ + # sort | uniq -c | sort -rn | head + # + # 109 Alice Anderson + # 13 Bob Brown + # 7 Carol Clark + # + churn = !"f() { git log --all --find-copies --find-renames --name-only --format='format:' \"$@\" | awk 'NF{a[$0]++}END{for(i in a){print a[i], i}}' | sort -rn;};f" + + # summary: print a helpful summary of some typical metrics + summary = "!f() { \ + printf \"Summary of this branch...\n\"; \ + printf \"%s\n\" $(git rev-parse --abbrev-ref HEAD); \ + printf \"%s first commit timestamp\n\" $(git log --date-order --format=%cI | tail -1); \ + printf \"%s latest commit timestamp\n\" $(git log -1 --date-order --format=%cI); \ + printf \"%d commit count\n\" $(git rev-list --count HEAD); \ + printf \"%d date count\n\" $(git log --format=oneline --format=\"%ad\" --date=format:\"%Y-%m-%d\" | awk '{a[$0]=1}END{for(i in a){n++;} print n}'); \ + printf \"%d tag count\n\" $(git tag | wc -l); \ + printf \"%d author count\n\" $(git log --format=oneline --format=\"%aE\" | awk '{a[$0]=1}END{for(i in a){n++;} print n}'); \ + printf \"%d committer count\n\" $(git log --format=oneline --format=\"%cE\" | awk '{a[$0]=1}END{for(i in a){n++;} print n}'); \ + printf \"%d local branch count\n\" $(git branch | grep -v \" -> \" | wc -l); \ + printf \"%d remote branch count\n\" $(git branch -r | grep -v \" -> \" | wc -l); \ + printf \"\nSummary of this directory...\n\"; \ + printf \"%s\n\" $(pwd); \ + printf \"%d file count via git ls-files\n\" $(git ls-files | wc -l); \ + printf \"%d file count via find command\n\" $(find . | wc -l); \ + printf \"%d disk usage\n\" $(du -s | awk '{print $1}'); \ + printf \"\nMost-active authors, with commit count and %%...\n\"; git log-of-count-and-email | head -7; \ + printf \"\nMost-active dates, with commit count and %%...\n\"; git log-of-count-and-day | head -7; \ + printf \"\nMost-active files, with churn count\n\"; git churn | head -7; \ + }; f" + + ### REF ALIASES ### + + ref-recent = "!git for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) %(objectname:short) %(contents:subject)' refs/heads/" + + ### LOOKUP ALIASES ### + + # whois: given a string for an author, try to figure out full name and email: + whois = "!sh -c 'git log --regexp-ignore-case -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -" + + # Given any git object, try to show it briefly + whatis = show --no-patch --pretty='tformat:%h (%s, %ad)' --date=short + + # Show who contributed with summarized changes + who = shortlog --summary -- + + # Show who contributed, in descending order by number of commits + whorank = shortlog --summary --numbered --no-merges + + # List all issues mentioned in commit messages between range of commits + # + # Replace `\\\"ISSUE-[0-9]\\+\\\"` regular expression with one matching your issue tracking system. + # For Jira it should be as simple as putting your project name in place of `ISSUE`. + # + # Best used with tags: + # $ git issues v1.0..v1.1 + # + # But will work with any valid commit range: + # $ git issues master..HEAD + + issues = !sh -c \"git log $1 --oneline | grep -o \\\"ISSUE-[0-9]\\+\\\" | sort -u\" + + # Show the commit's parents + commit-parents = !"f(){ git cat-file -p \"${*:-HEAD}\" | sed -n '/0/,/^ *$/{/^parent /p}'; };f" + + # Is the commit a merge commit? If yes exit 0, else exit 1 + commit-is-merge = !"f(){ [ -n \"$(git commit-parents \"$*\" | sed '0,/^parent /d')\" ];};f" + + # Show the commit's keyword-marked lines. + # + # Show each line in the commit message that starts with zero or more blanks, + # then a keyword (alphanum and dash characters), then a colon. + # + # Example commit: + # + # commit ce505d161fccdbc8d4bf12047846de7433ad6d04 + # Author: Joel Parker Henderson + # Date: Tue May 28 11:53:47 2019 -0700 + # + # Add feature foo + # + # This commit is to add feature foo. + # + # Time: 5 hours + # Cost: 600 USD + # + # Command: + # + # $ git commit-message-key-lines ce505d161fccdbc8d4bf12047846de7433ad6d04 + # Commit: ce505d161fccdbc8d4bf12047846de7433ad6d04 + # Author: Joel Parker Henderson + # Date: Tue May 28 11:53:47 2019 -0700 + # Time: 5 hours + # Cost: 600 USD + # + # Normalize the output: + # + # * Start the output with "Commit: " + # + # * Omit leading blanks + # + # * After the colon, use one space (not tab, not multiple spaces, etc.) + # + # Known issues: + # + # * TODO: improve the keyword matcher so it requires the keyword to end + # in an alphanum (not a dash), and also so the dash is a separator i.e. + # the matcher does not accept a dash followed by another dash. + # + commit-message-key-lines = "!f(){ echo \"Commit: $1\"; git log \"$1\" --format=fuller | grep \"^[[:blank:]]*[[:alnum:]][-[:alnum:]]*:\" | sed \"s/^[[:blank:]]*//; s/:[[:blank:]]*/: /\"; }; f" + + + ### WORKFLOW ALIASES ### + + # Clone a git repository including all submodules + cloner = clone --recursive + + # Clone as lean as possible, for example to checkout just one subdiretory. + # + # This skips fetching unneeded objects from the server. + # + # Command breakdown: + # + # * --depth 1 does a shallow clone and implies --single-branches + # + # * --filter=blob:none skips all blobs, but fetches all tree objects + # + # * --filter=tree:0 skips unneeded trees + # + # * --filter=combine:FILTER1+FILTER2 is the syntax to use multiple + # filters at once; trying to pass --filter multiple times fails + # with: "multiple filter-specs cannot be combined". + # + # This uses --filter=tree:0 added in Git 2.20 and --filter=combine + # composite filter added in Git 2.24. + # + # The server should be configured with: + # + # git config --local uploadpack.allowfilter 1 + # git config --local uploadpack.allowanysha1inwant 1 + # + # An extension was made to the Git remote protocol to support this + # feature in v2.19.0 and actually skip fetching unneeded objects. + # There was server support then, but it can be locally tested. + # + # Credit: https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository/52269934#52269934 + # + clone-lean = clone --depth 1 --filter=combine:blob:none+tree:0 --no-checkout + + # Stash aliases for push & pop + # + # Note that if you are using an older version of git, before 2.16.0, + # then you can use the older "stash save" instead of the newer "stash push". + save = stash push + pop = stash pop + + # Stash snapshot - from http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ + # Take a snapshot of your current working tree without removing changes. + # This is handy for refactoring where you can't quite fit what you've done + # into a commit but daren't stray too far from now without a backup. + # + # Running this: + # + # $ git snapshot + # + # Creates this stash: + # + # stash@{0}: On feature/handy-git-tricks: snapshot: Mon Apr 8 12:39:06 BST 2013 + # + # And seemingly no changes to your working tree. + # + snapshot = !git stash push --include-untracked --message \"snapshot: $(date)\" && git stash apply \"stash@{0}\" + + # When you're a little worried that the world is coming to an end + panic = !tar cvf ../panic.tar * + + # Create an archive file of everything in the repo + archive = !"f() { top=$(rev-parse --show-toplevel); cd $top; tar cvf $top.tar $top ; }; f" + + # Do everything we can to synchronize all changes for the current branch. + # + # * git get: fetch and prune, pull and rebase, then update submodules + # * git put: commit all items, then push + # + # If you want to preserve merges, then we recommend you set this: + # + # git config pull.rebase preserve + # + # TODO: handle tags, delete superfluous branches, and add error handing. + # + get = !git fetch --prune && git pull --rebase && git submodule update --init --recursive + put = !git commit --all && git push + + # Do everything we can to make the local repo like the master branch. + # + # TODO: handle tags, and delete superfluous branches, and add error handling. + # + mastery = !git checkout master && git fetch origin --prune && git reset --hard origin/master + + # Ignore all untracked files by appending them to .gitignore: + ignore = "!git status | grep -P \"^\\t\" | grep -vF .gitignore | sed \"s/^\\t//\" >> .gitignore" + + # Do a push/pull for just one branch + push1 = "!git push origin $(git branch-name)" + pull1 = "!git pull origin $(git branch-name)" + + # Track and untrack, with default parameters, and with printing the command + track = "!f(){ branch=$(git rev-parse --abbrev-ref HEAD); cmd=\"git branch $branch -u ${1:-origin}/${2:-$branch}\"; echo $cmd; $cmd; }; f" + untrack = "!f(){ branch=$(git rev-parse --abbrev-ref HEAD); cmd=\"git branch --unset-upstream ${1:-$branch}\"; echo $cmd; $cmd; }; f" + + # Track all remote branches that aren't already being tracked; + # this is a bit hacky because of the parsing, and we welcome + # better code that works using more-specific git commands. + track-all-remote-branches = !"f() { git branch -r | grep -v ' -> ' | sed 's/^ \\+origin\\///' ; }; f" + + ## + # Reset & Undo + ## + + # Reset and undo aliases are ways to move backwards on the commit chain. + # We find that novices prefer the wording "undo"; experts prefer "reset". + reset-commit = reset --soft HEAD~1 + reset-commit-hard = reset --hard HEAD~1 + reset-commit-clean = !git reset --hard HEAD~1 && git clean -fd + reset-to-pristine = !git reset --hard && git clean -ffdx + reset-to-upstream = !git reset --hard $(git upstream-name) + + # Undo is simply a synonym for "reset" because "undo" can help novices. + undo-commit = reset --soft HEAD~1 + undo-commit-hard = reset --hard HEAD~1 + undo-commit-clean = !git reset --hard HEAD~1 && git clean -fd + undo-to-pristine = !git reset --hard && git clean -ffdx + undo-to-upstream = !git reset --hard $(git upstream-name) + + # Nicknames + uncommit = reset --soft HEAD~1 + unadd = reset HEAD + unstage = reset HEAD + + # Discard changes in a (list of) file(s) in working tree + discard = checkout -- + + # Clean and discard changes and untracked files in working tree + cleanout = !git clean -df && git checkout -- . + + # Expunge a file everywhere; this command is typically for a serious problem, + # such as accidentally committing a file of sensitive data, such as passwords. + # After you use command, you will likely need to force push everything. + # See https://help.github.com/articles/removing-sensitive-data-from-a-repository/ + expunge = !"f() { git filter-branch --force --index-filter \"git rm --cached --ignore-unmatch $1\" --prune-empty --tag-name-filter cat -- --all }; f" + + # Edit all files of the given type + edit-cached = !"f() { git ls-files --cached | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-others = !"f() { git ls-files --others | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-killed = !"f() { git ls-files --killed | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-modified = !"f() { git ls-files --modified | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" + + # Editing and adding conflicted files: when we get many merge conflicts + # and want to quickly solve them using an editor, then add the files. + edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" + add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`" + + # Ours & Theirs - easy merging when you know which files you want + # + # Sometimes during a merge you want to take a file from one side wholesale. + # + # The following aliases expose the ours and theirs commands which let you + # pick a file(s) from the current branch or the merged branch respectively. + # + # * ours: checkout our version of a file and add it + # * theirs: checkout their version of a file and add it + # + # N.b. the function is there as hack to get $@ doing + # what you would expect it to as a shell user. + # + ours = !"f() { git checkout --ours $@ && git add $@; }; f" + theirs = !"f() { git checkout --theirs $@ && git add $@; }; f" + + # Work In Progress: from https://gist.github.com/492227 and VonC on stackoverflow. + # This enables a quick way to add all new and modified files to the index, + # while cleaning the index from the files removed from the working tree; + # this cleaning will facilitate a rebase, because there won't be any conflict + # due to an "unclean" working directory (not in sync with the index). + # The unwip will restore the deleted files to the working tree. + wip = !"git add --all; git ls-files --deleted -z | xargs -0 git rm; git commit --message=wip" + unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1" + + # Assume + # + # Sometimes we want to change a file in a repo, but never check in your edits. + # We can't use .gitignore because the file is tracked. We use update-index. + # + # If you interact with big corporate projects, such as projects in Subversion, + # then you might run into the need to ignore certain files which are under + # Subversion control, yet you need to modify them but not commit. + # The assume-unchanged flag comes to the rescue. + # + # Suppose we want to edit passwords.txt and for god's sake never check it in: + # + # $ git status + # modified passwords.txt + # modified foo.txt + # + # $ git assume passwords.txt + # $ git status + # modified foo.txt + # + # $ git assumed + # passwords.txt + # + # $ git unassume passwords.txt + # $ git status + # modified passwords.txt + # modified foo.txt + # + # Thanks to http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/ + # Thanks to http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ + + assume = update-index --assume-unchanged + unassume = update-index --no-assume-unchanged + assume-all = "!git st -s | awk {'print $2'} | xargs git assume" + unassume-all = "!git assumed | xargs git update-index --no-assume-unchanged" + assumed = !"git ls-files -v | grep ^h | cut -c 3-" + + # Delete all branches that have already been merged into the master branch. + master-cleanse = !git master-cleanse-local; git master-cleanse-remote + + # Delete all local branches that have been merged into the local master branch. + master-cleanse-local = "!git checkout master && git branch --merged | xargs git branch --delete" + + # Delete all remote branches that have been merged into the remote master branch. + master-cleanse-remote = !"git branch --remotes --merged origin/master | sed 's# *origin/##' | grep -v '^master$' xargs -I% git push origin :% 2>&1 | grep --colour=never 'deleted'" + + # Publish the current branch by pushing it to the remote "origin", + # and setting the current branch to track the upstream branch. + publish = !"git push --set-upstream origin $(git branch-name)" + + # Unpublish the current branch by deleting the + # remote version of the current branch. + unpublish = !"git push origin :$(git branch-name)" + + # Delete a branch name, then create the same branch name based on master - + # useful if you have, for example, a development branch and master branch + # and they go out of sync, and you want to nuke the development branch. + # + # Calls the `publish` and `unpublish` aliases. + # + reincarnate = !"f() { [[ -n $@ ]] && git checkout \"$@\" && git unpublish && git checkout master && git branch -D \"$@\" && git checkout -b \"$@\" && git publish; }; f" + + # Friendly wording is easier to remember. + # Thanks to http://gggritso.com/human-git-aliases + branches = branch -a + tags = tag -n1 --list + stashes = stash list + + + ### SHELL SCRIPTING ALIASES ### + + # Get the top level directory name + top-name = rev-parse --show-toplevel + + # Get the current branch name + branch-name = rev-parse --abbrev-ref HEAD + + # Get the upstream branch name + upstream-name = !git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD) + + # Execute shell scripts. Git always runs scripts in the top directory. + # For example "git exec pwd" will always show you the top directory. + exec = ! exec + + + ### MAINTENANCE ALIASES ### + + # pruner: prune everything that is unreachable now. + # + # This command takes a long time to run, perhaps even overnight. + # + # This is useful for removing unreachable objects from all places. + # + # By [CodeGnome](http://www.codegnome.com/) + # + pruner = !"git prune --expire=now; git reflog expire --expire-unreachable=now --rewrite --all" + + # repacker: repack a repo the way Linus recommends. + # + # This command takes a long time to run, perhaps even overnight. + # + # It does the equivalent of "git gc --aggressive" + # but done *properly*, which is to do something like: + # + # git repack -a -d --depth=250 --window=250 + # + # The depth setting is about how deep the delta chains can be; + # make them longer for old history - it's worth the space overhead. + # + # The window setting is about how big an object window we want + # each delta candidate to scan. + # + # And here, you might well want to add the "-f" flag (which is + # the "drop all old deltas", since you now are actually trying + # to make sure that this one actually finds good candidates. + # + # And then it's going to take forever and a day (ie a "do it overnight" + # thing). But the end result is that everybody downstream from that + # repository will get much better packs, without having to spend any effort + # on it themselves. + # + # http://metalinguist.wordpress.com/2007/12/06/the-woes-of-git-gc-aggressive-and-how-git-deltas-work/ + # + # We also add the --window-memory limit of 1 gig, which helps protect + # us from a window that has very large objects such as binary blobs. + # + repacker = repack -a -d -f --depth=300 --window=300 --window-memory=1g + + # Do everything we can to optimize the repository. + # + # This command takes a long time to run, perhaps even overnight. + # + # Currently, this command simply calls `git pruner` and `git repacker`. + # There's a step that may be unnecessarying, calling `git prune-pack`. + # + optimize = !git pruner; git repacker; git prune-packed + + + ### ADVANCED ALIASES ### + + # Search for a given string in all patches and print commit messages. + # Posted by Mikko Rantalainen on StackOverflow. + # + # Example: search for any commit that adds or removes string "foobar" + # git searchcommits foobar + # + # Example: search commits for string "foobar" in directory src/lib + # git searchcommits foobar src/lib + # + # Example: search commits for "foobar", print full diff of commit with 1 line context + # git searchcommits foobar --pickaxe-all -U1 src/lib + searchcommits = !"f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f \"$@\"" + + # A 'debug' alias to help debugging builtins: when debugging builtins, + # we use gdb to analyze the runtime state. However, we have to disable + # the pager, and often we have to call the program with arguments. + # If the program to debug is a builtin, we use this alias. + debug = !GIT_PAGER= gdb --args git + + # Getting the diff of only one function: when we want to see just the + # differences of one function in one file in two different commits, + # we create two temp files which contain only the function, then diff. + # Use this alias this way: git funcdiff + # diff-func = !sh -c "git show \"\$1:\$3\" | sed -n \"/^[^ \t].*\$4(/,/^}/p\" > .tmp1 && git show \"\$2:\$3\" | sed -n \"/^[^ \t].*\$4(/,/^}/p\" > .tmp2 && git diff --no-index .tmp1 .tmp2" - + + # Calling "interdiff" between commits: if upstream applied a + # slightly modified patch, and we want to see the modifications, + # we use the program interdiff of the patchutils package. + intercommit = !sh -c 'git show "$1" > .git/commit1 && git show "$2" > .git/commit2 && interdiff .git/commit[12] | less -FRS' - + + # Prune all your stale remote branches: there's no way to tell + # git remote update to prune stale branches, and git remote prune + # does not understand --all. So here is a shell command to do it. + prune-all = !git remote | xargs -n 1 git remote prune + + # Thanks to cody cutrer + cherry-pick-merge = !"sh -c 'git cherry-pick --no-commit --mainline 1 $0 && \ + git log -1 --pretty=%P $0 | cut -b 42- > .git/MERGE_HEAD && \ + git commit --verbose'" + + # Thanks to jtolds on stackoverflow + remote-ref = !"sh -c ' \ + local_ref=$(git symbolic-ref HEAD); \ + local_name=${local_ref##refs/heads/}; \ + remote=$(git config branch.\"#local_name\".remote || echo origin); \ + remote_ref=$(git config branch.\"$local_name\".merge); \ + remote_name=${remote_ref##refs/heads/}; \ + echo remotes/$remote/$remote_name'" + + # Thanks to jtolds on stackoverflow + rebase-recent = !git rebase --interactive $(git remote-ref) + + # Use graphviz for display. + # This produces output that can be displayed using dotty, for example: + # $ git graphviz HEAD~100..HEAD~60 | dotty /dev/stdin + # $ git graphviz --first-parent master | dotty /dev/stdin + graphviz = !"f() { echo 'digraph git {' ; git log --pretty='format: %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f" + + # Serve the local directory by starting a git server daemon, so others can pull/push from my machine + serve = "-c daemon.receivepack=true daemon --base-path=. --export-all --reuseaddr --verbose" + + ########################################################################## + + ## + # Git alias settings suitable for topic branches. + # + # These aliases are simple starting points for a simple topic flow. + # Lots of people have lots of ideas about how to do various git flows. + # + # Some people like to use a topic branch for a new feature, or a + # hotfix patch, or refactoring work, or some spike research, etc. + # + # Start work on a new topic branch, which creates your branch: + # + # $ git topic-start add-feature-foo + # + # Do work, and optionally sync our changes, which pushes and pulls: + # + # $ git topic-sync + # + # Stop work on a topic branch, which deletes your branch: + # + # $ git topic-stop + # + # If you want to move your branch a.k.a. rename it: + # + # $ git topic-rename + # + # Ideas for your own alias customizations: + # + # * Notify your team, such as by sending an email, posting to chat, etc. + # + # * Trigger testing of the new topic branch to ensure all tests succeed. + # + # * Update your project management software with the new topic name. + # + # Customize these aliases as you like for your own workflow. + ## + + ## + # Provide the name of the topic base branch, such as "main". + # + # When we create a new topic branch, we base it on the topic base branch. + # Many projects use the topic base branch name "main". Some projects use + # use "trunk", "develop", "deploy", "integrate", "release", "green", etc. + # + # The topic base branch name is "main" by default. You can customize + # the name for your local repo, or your own user's global configuration, + # or your system configuration, by using `git config` such as: + # + # $ git config --local gitalias.topic.base.branch.name "foo" + # + # $ git config --global gitalias.topic.base.branch.name "foo" + # + # $ git config --system gitalias.topic.base.branch.name "foo" + # + # Thanks to https://github.com/gwjo + ## + + topic-base-branch-name = "!f(){ \ + git config --get gitalias.topic.base.branch.name || printf '%s\n' main; \ + };f" + + ## + # Start a topic branch. + # + # Example: + # + # git topic-start add-feature-foo + # + # We use this alias to begin work on a new feature, + # new task, new fix, new refactor, new optimization, etc. + # + # Customize this alias as you like for your own workflow. + # + # Our workflow does these steps: + # + # 1. Update the base branch. + # 2. Create a new branch with your topic name, based on the base branch. + # 3. Push the topic branch, so our team members can see the new branch. + # + # If you use a sharing site such a GitHub, and use typical settings, + # then this implementation makes your branch visible to collaborators. + # + # Many teams share branches before they are fully ready, to help + # the team provide feedback on the work-in-progress, and also to + # run any automatic tests to verify the branch runs successfully. + ## + + topic-start = "!f(){ \ + topic_branch=\"$1\"; \ + base_branch=$(git topic-base-branch-name); \ + git checkout \"$base_branch\"; git pull; \ + git checkout -b \"$topic_branch\" \"$base_branch\"; \ + git push --set-upstream origin \"$topic_branch\"; \ + };f" + + ## + # Stop a topic branch; this must be the current branch. + # + # Example: + # + # git topic-stop + # + # We use this alias to complete work on a new feature, + # new task, new fix, new refactor, new optimization, etc. + # + # Customize this alias as you like for your own workflow. + # + # Our workflow does these steps: + # + # 1. Push the topic branch. + # 2. Delete the topic branch locally. + # 3. Delete the topic branch remotely. + # + # If you use a sharing site such a GitHub, and use typical settings, + # then this implementation deletes your branch for the site. + # + # Many teams choose to delete topic branches when they are finished, + # to keep the repositories clean and with a smaller number of branches. + # + # If git says "unable to push to unqualified destination" then it means + # that the remote branch doesn't exist, so git is unable to delete it. + # That's fine; it means someone else has already deleted the branch. + # To synchronize your branch list, use "git fetch --prune". + ## + + topic-stop = "!f(){ \ + topic_branch=$(git branch-name); \ + base_branch=$(git topic-base-branch-name); \ + if [ \"$topic_branch\" = \"$base_branch\" ]; then \ + printf \"You are asking to do git topic-stop,\n\"; \ + printf \"but you are not currently on a topic branch;\n\"; \ + printf \"you are on the base branch: $base_branch.\n\"; \ + printf \"Please checkout the topic branch that you want,\n\"; \ + printf \"then retry the git topic delete command.\n\"; \ + else \ + git push; \ + git checkout \"$base_branch\"; \ + git branch --delete \"$topic_branch\"; \ + git push origin \":$topic_branch\"; \ + fi; \ + };f" + + ## + # Update the current topic branch by synchronizing changes. + # + # Example: + # + # git topic-sync + # + # This implementation does these: + # + # 1. Pull any changes. + # 2. Push any changes. + # + # If you use any kind of testing framework, or test driven development, + # then it can be wise to test your topic immediately after running this, + # to ensure that any available updates are successfully integrated. + # + # Customize this alias as you like for your own workflow. + ## + + topic-sync = "!f(){ \ + topic_branch=$(git branch-name); \ + base_branch=$(git topic-base-branch-name); \ + if [ \"$topic_branch\" = \"$base_branch\" ]; then \ + printf \"You are asking to do git topic-sync,\n\"; \ + printf \"but you are not currently on a topic branch;\n\"; \ + printf \"you are on the base branch: $base_branch.\n\"; \ + printf \"Please checkout the topic branch that you want,\n\"; \ + printf \"then retry the git topic delete command.\n\"; \ + else \ + git pull; \ + git push; \ + fi; \ + };f" + + ## + # Move the current topic branch, a.k.a. rename it. + # + # Example: + # + # git topic-move hello + # + # This implementation does these: + # + # 1. Move the local branch. + # 2. Move the remote branch by pushing to origin. + # + # Customize this alias as you like for your own workflow. + ## + + topic-move = "!f(){ \ + new_branch=\"$1\"; \ + old_branch=$(git branch-name); \ + git branch --move \"$old_branch\" \"$new_branch\"; \ + git push origin \":$old_branch\" \"$new_branch\"; \ + };f" + + + ########################################################################## + + ## + # Git aliases suitable for particular software integrations and tooling, + # such as other version control system e.g. CVS, Subversion, etc. + ## + + ### CVS ALIAS ### + + cvs-i = cvsimport -k -a + cvs-e = cvsexportcommit -u -p + + ### GitK ### + + # show conflicting merge in gitk: + gitk-conflict = !gitk --left-right HEAD...MERGE_HEAD + + # show full history in gitk (including "deleted" branches and stashes) + gitk-history-all = !gitk --all $( git fsck | awk '/dangling commit/ {print $3}' ) + + ### Ruby on Rails ### + + # Do everything we can to synchronize all changes for a Ruby On Rails app. + # We like using rebase (instead of merge), bundle for gems, and rake db:migrate + rails-get = !"git pull --rebase; git submodule update --init --recursive; bundle check || bundle install; bundle exec rake db:migrate; bundle exec rake db:test:prepare" + + ### Subversion ### + + svn-b = svn branch + svn-m = merge --squash + svn-c = svn dcommit + svn-cp = !GIT_EDITOR='sed -i /^git-svn-id:/d' git cherry-pick --edit + + ########################################################################## + + ## + # Git aliases to correct common typing mistakes, which git built-in autocorrection + # does not handle + ## + + ### Use with shell alias `gitp = git` ### + + ull = pull + u = push + ush = push + uhs = push + uhsup = push -u origin HEAD + ushup = push -u origin HEAD + + # GitFlow shortcuts + fid = !git flow init -d + + # "fcb" alias is a shortcut for getting current branch for GitFlow (without prefix) + # and is strictly related to [gitflow "prefix"] config section (cuts everything after first "/") + fcb = "!f() { git rev-parse --abbrev-ref HEAD | cut -d'/' -f 2-; }; f" + + cf = "!f() { git checkout $(git config --get gitflow.prefix.feature || echo feature)$1; }; f" + ffs = "!f() { if [ ! -z $1 ] ; then git flow feature start $1 ${2:-develop}; else echo 'Invalid name'; exit 1; fi; }; f" + fff = !git flow feature finish -F $(git fcb) + ffp = !git flow feature publish $(git fcb) + + cb = "!f() { git checkout $(git config --get gitflow.prefix.bugfix || echo bugfix)$1; }; f" + fbs = "!f() { if [ ! -z $1 ] ; then git flow bugfix start $1 ${2:-develop}; else echo 'Invalid name'; exit 1; fi; }; f" + fbf = !git flow bugfix finish -F $(git fcb) + fbp = !git flow bugfix publish $(git fcb) + + ch = "!f() { git checkout $(git config --get gitflow.prefix.hotfix || echo hotfix)$1; }; f" + fhs = "!f() { if [ ! -z $1 ] ; then git flow hotfix start $1 ${2:-master}; else echo 'Invalid name'; exit 1; fi; }; f" + fhf = "!git fetch --tags; git pull $(git config --get gitflow.origin || echo origin) master; git flow hotfix finish -F $(git fcb)" + fhp = !git flow hotfix publish $(git fcb) + + cr = "!f() { git checkout $(git config --get gitflow.prefix.release || echo release)$1; }; f" + frs = "!f() { if [ ! -z $1 ] ; then git flow release start $1 ${2:-master}; else echo 'Invalid name'; exit 1; fi; }; f" + frf = !git flow release finish -F $(git fcb) + frp = !git flow release publish $(git fcb) + # rms = restore --staged + rms = "!f() { git reset HEAD -- $1; }; f" + + rs = restore --staged + remove-tags = "!f() { git tag -l ${1} | xargs -I % echo \"git tag -d % && git push --delete origin %\" | sh; }; f" + + sr = "!f() { \ + current_branch=$(git rev-parse --abbrev-ref HEAD); \ + git stash save -u 'Stash for switch-rebase' && \ + git checkout $1 && \ + git pull origin $1 && \ + git checkout $current_branch && \ + git rebase $1 && \ + git stash pop; \ + }; f" diff --git a/gnupg/.gnupg/gpg-agent.conf b/gnupg/.gnupg/gpg-agent.conf new file mode 100644 index 0000000..bd6dd2d Binary files /dev/null and b/gnupg/.gnupg/gpg-agent.conf differ diff --git a/gnupg/.gnupg/sshcontrol b/gnupg/.gnupg/sshcontrol new file mode 100644 index 0000000..397a7b8 Binary files /dev/null and b/gnupg/.gnupg/sshcontrol differ diff --git a/kitty/.config/kitty/kitty.conf b/kitty/.config/kitty/kitty.conf new file mode 100644 index 0000000..f990850 --- /dev/null +++ b/kitty/.config/kitty/kitty.conf @@ -0,0 +1,64 @@ +# Font settings +font_family JetBrains Mono +# font_family Fira Code +# font_family Iosevka\ Nerd\ Font +# font_family MonoLisa +# font_family Proxima\ Nova +# font_family Source\ Code\ Pro +font_size 12.0 +bold_font auto +italic_font auto +bold_italic_font auto +font_size 12.0 + +text_composition_strategy legacy + +# cursor customization +# block / beam / underline +cursor_shape block +cursor_blink_interval 0 +cursor_stop_blinking_after 0 +shell_integration no-cursor + +# Window settings +remember_window_size no +initial_window_width 1200 +initial_window_height 750 +window_border_width 1.5pt +enabled_layouts tall +window_padding_width 0 +window_margin_width 2 +hide_window_decorations no + +background_opacity 0.90 +background_blur 1 + +# advance +term xterm-kitty + +# Tab bar +tab_bar_edge bottom +tab_bar_style hidden + +# Color scheme (you'll need to define these colors) +# include your_theme.conf +# include ./themes/rose-pine.conf +# include ./themes/Duskfox.conf +include ./themes/Nightfox.conf + +# Disable confirmation on window close +confirm_os_window_close 0 + +# Hyperlink settings +detect_urls yes +url_style curly + +# Mouse settings +mouse_hide_wait 3.0 +focus_follows_mouse no + +# ZEN MODE (font size adjustment) +map ctrl+shift+plus change_font_size all +1.0 +map ctrl+shift+minus change_font_size all -1.0 +map ctrl+shift+0 change_font_size all 0 +map ctrl+shift+r load_config_file diff --git a/kitty/.config/kitty/themes/Duskfox.conf b/kitty/.config/kitty/themes/Duskfox.conf new file mode 100644 index 0000000..a133189 --- /dev/null +++ b/kitty/.config/kitty/themes/Duskfox.conf @@ -0,0 +1,103 @@ +# vim:ft=kitty +## name: Duskfox +## author: EdenEast +## license: MIT +## upstream: https://github.com/EdenEast/nightfox.nvim/blob/main/extra/duskfox/kitty.conf +## blurb: Duskfox theme from the neovim colorscheme nightfox.nvim. + +#: All the settings below are colors, which you can choose to modify, or use the +#: defaults. You can also add non-color based settings if needed but note that +#: these will not work with using kitty @ set-colors with this theme. For a +#: reference on what these settings do see https://sw.kovidgoyal.net/kitty/conf/ + +#: The basic colors + +foreground #e0def4 +background #232136 +selection_foreground #e0def4 +selection_background #433c59 + + +#: Cursor colors + +cursor #e0def4 +cursor_text_color #232136 + + +#: URL underline color when hovering with mouse + +url_color #a3be8c + + +#: kitty window border colors and terminal bell colors + +active_border_color #569fba +inactive_border_color #4b4673 +bell_border_color #ea9a97 +# visual_bell_color none + + +#: OS Window titlebar colors + +# wayland_titlebar_color system +# macos_titlebar_color system + + +#: Tab bar colors + +active_tab_foreground #191726 +active_tab_background #569fba +inactive_tab_foreground #817c9c +inactive_tab_background #433c59 +# tab_bar_background none +# tab_bar_margin_color none + + +#: Colors for marks (marked text in the terminal) + +# mark1_foreground black +# mark1_background #98d3cb +# mark2_foreground black +# mark2_background #f2dcd3 +# mark3_foreground black +# mark3_background #f274bc + + +#: The basic 16 colors + +#: black +color0 #393552 +color8 #47407d + +#: red +color1 #eb6f92 +color9 #f083a2 + +#: green +color2 #a3be8c +color10 #b1d196 + +#: yellow +color3 #f6c177 +color11 #f9cb8c + +#: blue +color4 #569fba +color12 #65b1cd + +#: magenta +color5 #c4a7e7 +color13 #ccb1ed + +#: cyan +color6 #9ccfd8 +color14 #a6dae3 + +#: white +color7 #e0def4 +color15 #e2e0f7 + +#: You can set the remaining 240 colors as color16 to color255. + +color16 #ea9a97 +color17 #eb98c3 diff --git a/kitty/.config/kitty/themes/Nightfox.conf b/kitty/.config/kitty/themes/Nightfox.conf new file mode 100644 index 0000000..6e9772d --- /dev/null +++ b/kitty/.config/kitty/themes/Nightfox.conf @@ -0,0 +1,52 @@ +# vim:ft=kitty + +## name: Nightfox +## author: EdenEast +## license: MIT +## upstream: https://github.com/EdenEast/nightfox.nvim/blob/main/extra/nightfox/nightfox_kitty.conf + +background #192330 +foreground #cdcecf +selection_background #2b3b51 +selection_foreground #cdcecf +url_color #81b29a + +# Cursor +# uncomment for reverse background +# cursor none +cursor #cdcecf + +# Border +active_border_color #719cd6 +inactive_border_color #39506d +bell_border_color #f4a261 + +# Tabs +active_tab_background #719cd6 +active_tab_foreground #131a24 +inactive_tab_background #2b3b51 +inactive_tab_foreground #738091 + +# normal +color0 #393b44 +color1 #c94f6d +color2 #81b29a +color3 #dbc074 +color4 #719cd6 +color5 #9d79d6 +color6 #63cdcf +color7 #dfdfe0 + +# bright +color8 #575860 +color9 #d16983 +color10 #8ebaa4 +color11 #e0c989 +color12 #86abdc +color13 #baa1e2 +color14 #7ad5d6 +color15 #e4e4e5 + +# extended colors +color16 #f4a261 +color17 #d67ad2 diff --git a/kitty/.config/kitty/themes/rose-pine-dawn.conf b/kitty/.config/kitty/themes/rose-pine-dawn.conf new file mode 100644 index 0000000..397c9a8 --- /dev/null +++ b/kitty/.config/kitty/themes/rose-pine-dawn.conf @@ -0,0 +1,56 @@ +## name: Rosรฉ Pine Dawn +## author: mvllow +## license: MIT +## upstream: https://github.com/rose-pine/kitty/blob/main/dist/rose-pine-dawn.conf +## blurb: All natural pine, faux fur and a bit of soho vibes for the classy minimalist + +foreground #575279 +background #faf4ed +selection_foreground #575279 +selection_background #dfdad9 + +cursor #cecacd +cursor_text_color #575279 + +url_color #907aa9 + +active_tab_foreground #575279 +active_tab_background #f2e9e1 +inactive_tab_foreground #9893a5 +inactive_tab_background #faf4ed + +active_border_color #286983 +inactive_border_color #dfdad9 + +# black +color0 #f2e9e1 +color8 #9893a5 + +# red +color1 #b4637a +color9 #b4637a + +# green +color2 #286983 +color10 #286983 + +# yellow +color3 #ea9d34 +color11 #ea9d34 + +# blue +color4 #56949f +color12 #56949f + +# magenta +color5 #907aa9 +color13 #907aa9 + +# cyan +color6 #d7827e +color14 #d7827e + +# white +color7 #575279 +color15 #575279 + diff --git a/kitty/.config/kitty/themes/rose-pine-moon.conf b/kitty/.config/kitty/themes/rose-pine-moon.conf new file mode 100644 index 0000000..4d4de88 --- /dev/null +++ b/kitty/.config/kitty/themes/rose-pine-moon.conf @@ -0,0 +1,56 @@ +## name: Rosรฉ Pine Moon +## author: mvllow +## license: MIT +## upstream: https://github.com/rose-pine/kitty/blob/main/dist/rose-pine-moon.conf +## blurb: All natural pine, faux fur and a bit of soho vibes for the classy minimalist + +foreground #e0def4 +background #232136 +selection_foreground #e0def4 +selection_background #44415a + +cursor #56526e +cursor_text_color #e0def4 + +url_color #c4a7e7 + +active_tab_foreground #e0def4 +active_tab_background #393552 +inactive_tab_foreground #6e6a86 +inactive_tab_background #232136 + +active_border_color #3e8fb0 +inactive_border_color #44415a + +# black +color0 #393552 +color8 #6e6a86 + +# red +color1 #eb6f92 +color9 #eb6f92 + +# green +color2 #3e8fb0 +color10 #3e8fb0 + +# yellow +color3 #f6c177 +color11 #f6c177 + +# blue +color4 #9ccfd8 +color12 #9ccfd8 + +# magenta +color5 #c4a7e7 +color13 #c4a7e7 + +# cyan +color6 #ea9a97 +color14 #ea9a97 + +# white +color7 #e0def4 +color15 #e0def4 + diff --git a/kitty/.config/kitty/themes/rose-pine.conf b/kitty/.config/kitty/themes/rose-pine.conf new file mode 100644 index 0000000..575c06b --- /dev/null +++ b/kitty/.config/kitty/themes/rose-pine.conf @@ -0,0 +1,56 @@ +## name: Rosรฉ Pine +## author: mvllow +## license: MIT +## upstream: https://github.com/rose-pine/kitty/blob/main/dist/rose-pine.conf +## blurb: All natural pine, faux fur and a bit of soho vibes for the classy minimalist + +foreground #e0def4 +background #191724 +selection_foreground #e0def4 +selection_background #403d52 + +cursor #524f67 +cursor_text_color #e0def4 + +url_color #c4a7e7 + +active_tab_foreground #e0def4 +active_tab_background #26233a +inactive_tab_foreground #6e6a86 +inactive_tab_background #191724 + +active_border_color #31748f +inactive_border_color #403d52 + +# black +color0 #26233a +color8 #6e6a86 + +# red +color1 #eb6f92 +color9 #eb6f92 + +# green +color2 #31748f +color10 #31748f + +# yellow +color3 #f6c177 +color11 #f6c177 + +# blue +color4 #9ccfd8 +color12 #9ccfd8 + +# magenta +color5 #c4a7e7 +color13 #c4a7e7 + +# cyan +color6 #ebbcba +color14 #ebbcba + +# white +color7 #e0def4 +color15 #e0def4 + diff --git a/local-bin/.local/bin/dbeaver-backup.sh b/local-bin/.local/bin/dbeaver-backup.sh new file mode 100755 index 0000000..07626b1 --- /dev/null +++ b/local-bin/.local/bin/dbeaver-backup.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# DBeaver Profile Backup Script +# This script creates a backup of DBeaver profiles and configurations + +# Configuration variables - modify as needed +BACKUP_DIR="/home/forbi/Sync/Backups" +HOSTNAME=$(hostname) +BACKUP_FILE="dbeaver_backup_${HOSTNAME}.tar.gz" +LOG_FILE="$BACKUP_DIR/dbeaver_backup_log.txt" + +# DBeaver configuration location +DBEAVER_DATA="$HOME/.local/share/DBeaverData" # Contains drivers, workspace, and secure storage + +# Create backup directory if it doesn't exist +mkdir -p "$BACKUP_DIR" + +# Start logging +echo "===== DBeaver Backup Started at $(date) =====" >>"$LOG_FILE" + +# Check if DBeaver configuration exists +if [ ! -d "$DBEAVER_DATA" ]; then + echo "Error: DBeaver configuration not found at $DBEAVER_DATA. Please make sure DBeaver is installed and has been run at least once." | tee -a "$LOG_FILE" + exit 1 +fi + +# Create temporary directory for backup +TEMP_DIR=$(mktemp -d) +echo "Created temporary directory: $TEMP_DIR" >>"$LOG_FILE" + +# Copy DBeaver data to temporary directory +echo "Copying DBeaver data from $DBEAVER_DATA..." >>"$LOG_FILE" +cp -r "$DBEAVER_DATA" "$TEMP_DIR/" + +# Create compressed archive +echo "Creating backup archive..." >>"$LOG_FILE" +tar -czf "$BACKUP_DIR/$BACKUP_FILE" -C "$TEMP_DIR" . +BACKUP_RESULT=$? + +# Clean up temporary directory +echo "Cleaning up temporary files..." >>"$LOG_FILE" +rm -rf "$TEMP_DIR" + +# Check if backup was successful +if [ $BACKUP_RESULT -eq 0 ]; then + echo "Backup completed successfully: $BACKUP_DIR/$BACKUP_FILE" | tee -a "$LOG_FILE" + echo "Backup size: $(du -h "$BACKUP_DIR/$BACKUP_FILE" | cut -f1)" | tee -a "$LOG_FILE" + echo "Keeping only the latest backup for this PC ($HOSTNAME)" >>"$LOG_FILE" +else + echo "Error: Backup failed with exit code $BACKUP_RESULT" | tee -a "$LOG_FILE" +fi + +echo "===== DBeaver Backup Finished at $(date) =====" >>"$LOG_FILE" diff --git a/local-bin/.local/bin/dbeaver-restore.sh b/local-bin/.local/bin/dbeaver-restore.sh new file mode 100755 index 0000000..35a143e --- /dev/null +++ b/local-bin/.local/bin/dbeaver-restore.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# DBeaver Profile Restore Script +# This script restores a DBeaver backup created with the backup script + +# Configuration variables - modify as needed +BACKUP_DIR="/home/forbi/Sync/Backups" +HOSTNAME=main +BACKUP_FILE="dbeaver_backup_${HOSTNAME}.tar.gz" +LOG_FILE="$BACKUP_DIR/dbeaver_restore_log.txt" + +# DBeaver configuration location +DBEAVER_DATA="$HOME/.local/share/DBeaverData" + +# Start logging +echo "===== DBeaver Restore Started at $(date) =====" >>"$LOG_FILE" + +# Check if backup file exists +if [ ! -f "$BACKUP_DIR/$BACKUP_FILE" ]; then + echo "Error: Backup file not found at $BACKUP_DIR/$BACKUP_FILE" | tee -a "$LOG_FILE" + exit 1 +fi + +# Check if DBeaver data directory exists and create backup if it does +if [ -d "$DBEAVER_DATA" ]; then + echo "DBeaver data directory exists. Creating backup before restoration..." | tee -a "$LOG_FILE" + TEMP_BACKUP="${DBEAVER_DATA}_backup_$(date +%Y%m%d_%H%M%S)" + mv "$DBEAVER_DATA" "$TEMP_BACKUP" + echo "Original data backed up to: $TEMP_BACKUP" | tee -a "$LOG_FILE" +fi + +# Create temporary directory for extraction +TEMP_DIR=$(mktemp -d) +echo "Created temporary directory for extraction: $TEMP_DIR" >>"$LOG_FILE" + +# Extract backup file +echo "Extracting backup archive..." | tee -a "$LOG_FILE" +tar -xzf "$BACKUP_DIR/$BACKUP_FILE" -C "$TEMP_DIR" +EXTRACT_RESULT=$? + +if [ $EXTRACT_RESULT -ne 0 ]; then + echo "Error: Failed to extract backup with exit code $EXTRACT_RESULT" | tee -a "$LOG_FILE" + rm -rf "$TEMP_DIR" + exit 1 +fi + +# Create target directory if it doesn't exist +mkdir -p "$(dirname "$DBEAVER_DATA")" + +# Copy extracted content to DBeaver data directory +echo "Restoring DBeaver data to $DBEAVER_DATA..." | tee -a "$LOG_FILE" +cp -r "$TEMP_DIR/DBeaverData" "$(dirname "$DBEAVER_DATA")/" +RESTORE_RESULT=$? + +# Clean up temporary directory +echo "Cleaning up temporary files..." >>"$LOG_FILE" +rm -rf "$TEMP_DIR" + +# Check if restore was successful +if [ $RESTORE_RESULT -eq 0 ]; then + echo "Restore completed successfully to: $DBEAVER_DATA" | tee -a "$LOG_FILE" + echo "You may need to restart DBeaver for changes to take effect." | tee -a "$LOG_FILE" +else + echo "Error: Restore failed with exit code $RESTORE_RESULT" | tee -a "$LOG_FILE" + if [ -d "$TEMP_BACKUP" ]; then + echo "Attempting to restore original data from backup..." | tee -a "$LOG_FILE" + rm -rf "$DBEAVER_DATA" + mv "$TEMP_BACKUP" "$DBEAVER_DATA" + echo "Original data restored from backup." | tee -a "$LOG_FILE" + fi +fi + +echo "===== DBeaver Restore Finished at $(date) =====" >>"$LOG_FILE" diff --git a/local-bin/.local/bin/maintenance.sh b/local-bin/.local/bin/maintenance.sh new file mode 100755 index 0000000..2ce982c --- /dev/null +++ b/local-bin/.local/bin/maintenance.sh @@ -0,0 +1,237 @@ +#!/bin/bash + +# Make sure we're running as root or with sudo +if [ "$(id -u)" -ne 0 ]; then + gum style --foreground 196 --bold "This script must be run as root or with sudo" + exit 1 +fi + +# Check if gum is installed +if ! command -v gum &>/dev/null; then + echo "This script uses gum for a nice interface." + echo "Please install gum first: pacman -S gum" + exit 1 +fi + +# Function to print section headers +print_section() { + gum style --border normal --border-foreground 39 --margin "1" --padding "0 2" --bold "$1" +} + +# Function to print tasks +print_task() { + echo "โ†’ $1..." +} + +# Function to print success messages +print_success() { + gum style --foreground 46 "โœ“ $1" +} + +# Function to print warning messages +print_warning() { + gum style --foreground 226 "โš  $1" +} + +# Starting message +# Starting message +echo "=== Arch Linux System Maintenance ===" + +# Update the system +print_section "Updating System" + +# Sync package database +print_task "Synchronizing package databases" +pacman -Sy +print_success "Package databases synchronized" + +# Clean package caches +print_section "Cleaning Package Caches" + +# Clean pacman cache +print_task "Cleaning pacman cache" +pacman -Sc --noconfirm +print_success "Pacman cache cleaned" + +# Clean AUR cache if paru is installed +if command -v paru &>/dev/null; then + print_task "Cleaning paru cache" + paru -Sc --noconfirm + print_success "Paru cache cleaned" +else + print_warning "paru not found. Skipping AUR cache cleanup." +fi + +# Remove orphaned packages +print_section "Removing Orphaned Packages" +print_task "Finding orphaned packages" +ORPHANS=$(pacman -Qtdq) +if [ -n "$ORPHANS" ]; then + echo "Found orphaned packages:" + echo "$ORPHANS" + + print_task "Removing orphaned packages" + pacman -Rns $(pacman -Qtdq) --noconfirm + print_success "Orphaned packages removed" +else + print_success "No orphaned packages found" +fi + +# Clean user cache directory +print_section "Cleaning User Cache Directory" + +# Get current user's username +CURRENT_USER=$(logname 2>/dev/null || echo $SUDO_USER) + +# If we still don't have a username, try to get it from /home +if [ -z "$CURRENT_USER" ]; then + CURRENT_USER=$(ls -la /home | grep -v "\.\." | grep -v "total" | awk '{print $9}' | head -1) +fi + +echo "Cleaning cache for user: $CURRENT_USER" + +# Create a backup directory +BACKUP_DIR="/home/$CURRENT_USER/.cache_backup_$(date +%Y%m%d)" +mkdir -p "$BACKUP_DIR" +chown $CURRENT_USER:$CURRENT_USER "$BACKUP_DIR" + +# User cache directory +USER_CACHE="/home/$CURRENT_USER/.cache" + +if [ -d "$USER_CACHE" ]; then + # Firefox cache + if [ -d "$USER_CACHE/mozilla" ]; then + print_task "Backing up Firefox cache metadata" + cp -r "$USER_CACHE/mozilla" "$BACKUP_DIR/" + print_task "Cleaning Firefox cache" + find "$USER_CACHE/mozilla" -type f -name "*.sqlite" -exec sqlite3 {} "VACUUM;" \; + fi + + # Chrome/Chromium cache + for chrome_dir in "$USER_CACHE/google-chrome" "$USER_CACHE/chromium"; do + if [ -d "$chrome_dir" ]; then + print_task "Backing up Chrome/Chromium cache metadata" + mkdir -p "$BACKUP_DIR/$(basename $chrome_dir)" + cp -r "$chrome_dir/Default/Preferences" "$BACKUP_DIR/$(basename $chrome_dir)/" 2>/dev/null + print_task "Cleaning Chrome/Chromium cache" + rm -rf "$chrome_dir/Default/Cache" "$chrome_dir/Default/Code Cache" 2>/dev/null + fi + done + + # Clean thumbnail cache + if [ -d "$USER_CACHE/thumbnails" ]; then + print_task "Cleaning thumbnail cache" + rm -rf "$USER_CACHE/thumbnails/*" 2>/dev/null + fi + + # General cache cleanup (but preserve important files) + print_task "Cleaning general cache files" + find "$USER_CACHE" -type f -atime +30 -not -path "*/mozilla/*" -not -path "*/chromium/*" -not -path "*/google-chrome/*" -delete 2>/dev/null + + print_success "Cache cleaned for user $CURRENT_USER" +else + print_warning "Cache directory not found for user $CURRENT_USER" +fi + +# Clean system journals +print_section "Cleaning System Journals" +print_task "Rotating and cleaning journal logs" +journalctl --vacuum-time=2weeks +print_success "Journal logs cleaned (kept last 2 weeks)" + +# Reset failed services +print_section "Resetting Failed Systemd Units" +print_task "Checking for failed systemd units" +FAILED_UNITS=$(systemctl --failed --no-legend | awk '{print $1}') +if [ -n "$FAILED_UNITS" ]; then + echo "Failed units found:" + echo "$FAILED_UNITS" +fi +print_task "Clearing failed systemd units" +systemctl reset-failed +print_success "Failed systemd units cleared" + +# Clean temporary files +print_section "Cleaning Temporary Files" +print_task "Removing temporary files" +rm -rf /tmp/* /var/tmp/* 2>/dev/null +print_success "Temporary files removed" + +# Update file database +print_section "Updating File Database" +if command -v updatedb &>/dev/null; then + print_task "Updating file database for locate command" + updatedb + print_success "File database updated" +else + print_warning "updatedb not found. Skipping file database update." +fi + +# Check for and install security updates +print_section "Security Updates Check" +print_task "Checking for security updates" +SECURITY_UPDATES=$(pacman -Qu | grep -i "security") +if [ -n "$SECURITY_UPDATES" ]; then + echo "Security updates available:" + echo "$SECURITY_UPDATES" + + print_task "Installing security updates" + pacman -S --needed $(echo "$SECURITY_UPDATES" | awk '{print $1}') --noconfirm + print_success "Security updates installed" +else + print_success "No security updates needed" +fi + +# Check for pacman database errors +print_section "Checking Pacman Database" +print_task "Verifying package database integrity" +if command -v paccheck &>/dev/null; then + paccheck --md5sum --quiet + print_success "Pacman database check complete" +else + print_warning "paccheck not found. Consider installing pacutils package." +fi + +# Cleanup pacnew/pacsave files +print_section "Configuration File Management" +print_task "Checking for .pacnew and .pacsave files" +PACFILES=$(find /etc -name "*.pacnew" -o -name "*.pacsave" 2>/dev/null) +if [ -n "$PACFILES" ]; then + echo "Found the following .pacnew/.pacsave files:" + echo "$PACFILES" + + print_warning "You may want to merge these configuration files" + echo "Use 'pacdiff' to help manage these files (install pacdiff from pacman-contrib)" +else + print_success "No .pacnew or .pacsave files found" +fi + +# System status +print_section "System Status" + +# Disk usage with duf +print_task "Checking disk usage" +if command -v duf &>/dev/null; then + duf --only local +else + print_warning "duf not found. Using df instead. Consider installing duf for better disk usage display." + df -h | grep -v "tmpfs" | grep -v "udev" +fi + +# Memory usage +echo "Memory usage:" +free -h + +# Find large files +echo "Large files (>100MB) in your home directory:" +find /home/$(logname 2>/dev/null || echo $SUDO_USER) -type f -size +100M -exec ls -lh {} \; 2>/dev/null | sort -k5hr | head -n 10 + +# Final summary +print_section "Maintenance Complete" +echo "System maintenance tasks completed successfully" +echo "Remember to periodically run additional manual maintenance tasks:" +echo "- Check for broken symlinks: find /usr /etc -xtype l -print" +echo "- Run a SMART disk check: smartctl -a /dev/sdX (install smartmontools)" +echo "- Check systemd boot time: systemd-analyze" + +exit 0 diff --git a/local-bin/.local/bin/rmq-passwd b/local-bin/.local/bin/rmq-passwd new file mode 100755 index 0000000..9b5684a --- /dev/null +++ b/local-bin/.local/bin/rmq-passwd @@ -0,0 +1,25 @@ +#!/bin/sh + +PREFIX="oc-" +SUFFIX="-eks-cluster" +FINAL="" + +if [ -z "$1" ]; then + exit 1 +fi + +context="$PREFIX$1$SUFFIX" +current_context=$(kubectl config current-context) + +kubectl config use-context $context >/dev/null +kubectl config set-context --current --namespace=oc-app >/dev/null + +# is second argument provided then silent exit +password=$(kubectl get secret oc-secrets -o jsonpath="{.data.rabbit_passwd}" | base64 --decode) + +printf "$password" | wl-copy +# printf "$password" | xsel --clipboard + +# reset context +kubectl config use-context $current_context >/dev/null +kubectl config set-context --current --namespace=oc-app >/dev/null diff --git a/mise/.config/mise/config.toml b/mise/.config/mise/config.toml new file mode 100644 index 0000000..f9aea6c --- /dev/null +++ b/mise/.config/mise/config.toml @@ -0,0 +1,51 @@ +[tools] +usage = "latest" +nodejs = "16.14.0" +golang = "1.23.0" +flyctl = "0.1.64" +sops = "3.6.1" +dotnet = "system" +java = "openjdk-17" +node = "20" +dotnet-core = "8.0.401" +bun = "1.2.4" +go = "1.24.1" + +[settings] +# plugins can read the versions files used by other version managers (if enabled by the plugin) +# for example, .nvmrc in the case of node's nvm +legacy_version_file = true # enabled by default (unlike asdf) + +# configure `mise install` to always keep the downloaded archive +always_keep_download = false # deleted after install by default +always_keep_install = false # deleted on failure by default + +# configure how frequently (in minutes) to fetch updated plugin repository changes +# this is updated whenever a new runtime is installed +# (note: this isn't currently implemented but there are plans to add it: https://github.com/jdx/mise/issues/128) +plugin_autoupdate_last_check_duration = '1 week' # set to 0 to disable updates + +# config files with these prefixes will be trusted by default +trusted_config_paths = [ ] + +verbose = false # set to true to see full installation output, see `MISE_VERBOSE` +asdf_compat = false # set to true to ensure .tool-versions will be compatible with asdf, see `MISE_ASDF_COMPAT` +#http_timeout = 30 # set the timeout for http requests in seconds, see `MISE_HTTP_TIMEOUT` +jobs = 4 # number of plugins or runtimes to install in parallel. The default is `4`. +raw = false # set to true to directly pipe plugins to stdin/stdout/stderr +yes = false # set to true to automatically answer yes to all prompts + +not_found_auto_install = true # see MISE_NOT_FOUND_AUTO_INSTALL +task_output = "prefix" # see Tasks Runner for more information +paranoid = false # see MISE_PARANOID + +shorthands_file = '~/.config/mise/shorthands.toml' # path to the shorthands file, see `MISE_SHORTHANDS_FILE` +disable_default_shorthands = false # disable the default shorthands, see `MISE_DISABLE_DEFAULT_SHORTHANDS` +# disable_tools = ['node'] # disable specific tools, generally used to turn off core tools + +env_file = '.env' # load env vars from a dotenv file, see `MISE_ENV_FILE` + +experimental = true # enable experimental features + +# configure messages displayed when entering directories with config files +status = { missing_tools = "if_other_versions_installed", show_env = false, show_tools = false } diff --git a/npm/.config/npm/npmrc b/npm/.config/npm/npmrc new file mode 100644 index 0000000..bf0f697 Binary files /dev/null and b/npm/.config/npm/npmrc differ diff --git a/rofi/.config/rofi/config b/rofi/.config/rofi/config new file mode 100644 index 0000000..b861bc4 --- /dev/null +++ b/rofi/.config/rofi/config @@ -0,0 +1,15 @@ +rofi.hide-scrollbar: true +rofi.modi: combi +rofi.terminal: alacritty +rofi.kb-cancel: Escape,Alt+F1,Alt+F2 +rofi.lines: 5 +rofi.soft: true +rofi.sorting-method: fzf +rofi.combi-modi: drun,run +rofi.combi-hide-mode-prefix: true +rofi.display-combi: Search +rofi.bw: 2 +rofi.padding: 0 +rofi.fixed-num-lines: false +rofi.theme: toto.rasi +rofi.yoffset: -130 diff --git a/rofi/.config/rofi/config.rasi b/rofi/.config/rofi/config.rasi new file mode 100644 index 0000000..904ab67 --- /dev/null +++ b/rofi/.config/rofi/config.rasi @@ -0,0 +1,60 @@ +/* +configuration { + modi: "combi"; + lines: 5; + bw: 2; + padding: 0; + yoffset: 0; + fixed-num-lines: false; + terminal: "alacritty"; + sorting-method: "fzf"; + combi-modi: "drun,run"; + hide-scrollbar: true; + combi-hide-mode-prefix: true; + display-combi: "Search"; + kb-cancel: "Escape,Alt+F1,Alt+F2"; +} + + @theme "/usr/share/rofi/themes/fancy.rasi" + @theme "/home/forbi/.config/rofi/toto.rasi" + */ + +configuration { + modi: "drun,run,ssh,filebrowser,powermenu:~/.config/rofi/powermenu.lua"; + + me-accept-entry: "MousePrimary"; + me-select-entry: ""; + show-icons: true; + icon-theme: "ePapirus"; + application-fallback-icon: "run-build"; + + drun-display-format: " {name} "; + run-shell-command: "foot {cmd}"; + ssh-command: "foot --term=xterm ssh {host}"; + sidebar-mode: true; + matching: "fuzzy"; + scroll-method: 0; + disable-history: false; + + display-drun: "๓ฑ“ž Apps"; + display-run: "๏„  Run"; + display-ssh: "๓ฐ€‚ SSH"; + display-filebrowser: "๏ผ Files"; + display-powermenu: "๏€‘ Power"; + + combi-modi: "drun,run"; + sort: true; + sorting-method: "fzf"; + + timeout { + action: "kb-cancel"; + delay: 30; + } + + filebrowser { + directories-first: true; + sorting-method: "name"; + } +} + +@theme "theme.rasi" diff --git a/rofi/.config/rofi/kill.sh b/rofi/.config/rofi/kill.sh new file mode 100755 index 0000000..9d85697 --- /dev/null +++ b/rofi/.config/rofi/kill.sh @@ -0,0 +1,11 @@ + +#!/bin/bash + +if [ "$@" ] +then + pid=$(printf "%d" $(echo -e "$@" | cut -d ":" -f 1)) + echo "$pid" + kill "$pid" +else + ps -U $UID --no-headers -o "%p %c" +fi diff --git a/rofi/.config/rofi/power.sh b/rofi/.config/rofi/power.sh new file mode 100755 index 0000000..a3e50b9 --- /dev/null +++ b/rofi/.config/rofi/power.sh @@ -0,0 +1,22 @@ + +#!/bin/bash + +OPTIONS="๏ฝ\tLogout\nโป\tShutdown\n๎ˆ\tReboot" + +option=`echo -e $OPTIONS | awk '{print $1}' | tr -d '\r\n\t'` +if [ "$@" ] +then + case $@ in + *Logout) + i3-msg exit + ;; + *Shutdown) + shutdown now + ;; + *Reboot) + reboot + ;; + esac +else + echo -e $OPTIONS +fi diff --git a/rofi/.config/rofi/powermenu.lua b/rofi/.config/rofi/powermenu.lua new file mode 100755 index 0000000..0c7e96d --- /dev/null +++ b/rofi/.config/rofi/powermenu.lua @@ -0,0 +1,41 @@ +#!/usr/bin/env luajit + +-- Use a list because table keys are randomly sorted +-- It's also easier to add options or edit them this way +local options = { + { + name = "Sleep", + icon = "system-suspend", + command = "systemctl suspend", + }, + { + name = "Shut down", + icon = "system-shutdown", + command = "systemctl poweroff", + }, + { + name = "Restart", + icon = "system-reboot", + command = "systemctl reboot", + }, + { + name = "Lock", + icon = "system-lock-screen", + command = "swaylock", + }, + { + name = "Log out", + icon = "system-log-out", + command = "swaymsg exit", + }, +} + +for i, opt in ipairs(options) do + if arg[1] then + if opt.name == arg[1] then + os.execute(opt.command) + end + else + print(opt.name .. "\0icon\x1f" .. opt.icon) + end +end diff --git a/rofi/.config/rofi/theme.rasi b/rofi/.config/rofi/theme.rasi new file mode 100644 index 0000000..472b9cd --- /dev/null +++ b/rofi/.config/rofi/theme.rasi @@ -0,0 +1,135 @@ +@import "default" + +* { + bg: #191724; + cur: #1f1d2e; + fgd: #e0def4; + cmt: #6e6a86; + cya: #9ccfd8; + grn: #31748f; + ora: #ebbcba; + pur: #c4a7e7; + red: #eb6f92; + yel: #f6c177; + + font: "RobotoMono Nerd Font 14"; + + foreground: @fgd; + background: @bg; + active-background: @grn; + urgent-background: @red; + + selected-background: @active-background; + selected-urgent-background: @urgent-background; + selected-active-background: @active-background; + separatorcolor: @active-background; + bordercolor: @ora; +} + +#window { + background-color: @background; + border: 3; + border-radius: 6; + border-color: @bordercolor; + padding: 5; +} +#mainbox { + border: 0; + padding: 5; +} +#message { + border: 1px dash 0px 0px ; + border-color: @separatorcolor; + padding: 1px ; +} +#textbox { + text-color: @foreground; +} +#listview { + fixed-height: 0; + border: 2px dash 0px 0px ; + border-color: @bordercolor; + spacing: 2px ; + scrollbar: false; + padding: 2px 0px 0px ; +} +#element { + border: 0; + padding: 1px ; +} +#element.normal.normal { + background-color: @background; + text-color: @foreground; +} +#element.normal.urgent { + background-color: @urgent-background; + text-color: @urgent-foreground; +} +#element.normal.active { + background-color: @active-background; + text-color: @background; +} +#element.selected.normal { + background-color: @selected-background; + text-color: @foreground; +} +#element.selected.urgent { + background-color: @selected-urgent-background; + text-color: @foreground; +} +#element.selected.active { + background-color: @selected-active-background; + text-color: @background; +} +#element.alternate.normal { + background-color: @background; + text-color: @foreground; +} +#element.alternate.urgent { + background-color: @urgent-background; + text-color: @foreground; +} +#element.alternate.active { + background-color: @active-background; + text-color: @foreground; +} +#scrollbar { + width: 2px ; + border: 0; + handle-width: 8px ; + padding: 0; +} +#sidebar { + border: 2px dash 0px 0px ; + border-color: @separatorcolor; +} +#button.selected { + background-color: @selected-background; + text-color: @foreground; +} +#inputbar { + spacing: 0; + text-color: @foreground; + padding: 1px ; +} +#case-indicator { + spacing: 0; + text-color: @foreground; +} +#entry { + spacing: 0; + text-color: @cya; +} +#prompt { + spacing: 0; + text-color: @grn; +} +#inputbar { + children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; +} +#textbox-prompt-colon { + expand: false; + str: ":"; + margin: 0px 0.3em 0em 0em; + text-color: @grn; +} diff --git a/rofi/.config/rofi/toto.rasi b/rofi/.config/rofi/toto.rasi new file mode 100644 index 0000000..7286701 --- /dev/null +++ b/rofi/.config/rofi/toto.rasi @@ -0,0 +1,94 @@ +configuration { + display-drun: "run"; + display-combi: "combi"; + show-icons: true; + font: "Monaco for Powerline 12"; +} +* { + purple: #000000; + black: #000000; + red: #eb6e67; + green: #95ee8f; + yellow: #f8c456; + blue: #35BF5C; + mangenta: #d886f3; + cyan: #6cdcf7; + emphasis: #206255; + text: #dfdfdf; + text-alt: #b2b2b2; + fg: #abb2bf; + bg: #282c34; + spacing: 0; + background-color: transparent; + font: "Knack Nerd Font 14"; + text-color: @text; +} +window { + transparency: "real"; + background-color: #282c34dd; +} +mainbox { + padding: 25px; + border-radius: 12px; +} +inputbar { + margin: 0px 0px 20px 0px; + children: [prompt, textbox-prompt-colon, entry, case-indicator]; +} +prompt { + text-color: @green; +} +textbox-prompt-colon { + expand: false; + str: ":"; + text-color: @text-alt; +} +entry { + margin: 0px 10px; + text-color: @text-alt; +} +listview { + spacing: 5px; + dynamic: true; + scrollbar: false; +} +element.normal.normal { + text-color: @text-alt; + background-color: @bg; +} +element.alternate.normal { + text-color: @text-alt; + background-color: @bg; +} +element.selected.normal { + text-color: @text-alt; + background-color: @emphasis; +} +element { + padding: 5px; + text-color: @text-alt; + highlight: bold #95ee8f; /* green */ + border-radius: 3px; +} +element selected { + background-color: @emphasis; + text-color: @text; +} +element urgent, element selected urgent { + text-color: @red; +} +element active, element selected active { + text-color: @purple; +} +message { + padding: 5px; + border-radius: 3px; + background-color: @emphasis; + border: 1px; + border-color: @cyan; +} +button selected { + padding: 5px; + border-radius: 3px; + background-color: @emphasis; +} diff --git a/rofi/.config/rofi/vapor.rasi b/rofi/.config/rofi/vapor.rasi new file mode 100644 index 0000000..ccbd27c --- /dev/null +++ b/rofi/.config/rofi/vapor.rasi @@ -0,0 +1,151 @@ +/******************************************************************************* + * ROFI Color theme + * User: Sergio Morales + * Copyright: Sergio Morales + *******************************************************************************/ + +* { + foreground: rgba ( 88, 105, 123, 100 % ); + normal-foreground: @foreground; + alternate-normal-background: @normal-background; + red: rgba ( 220, 50, 47, 100 % ); + selected-urgent-foreground: rgba ( 220, 50, 47, 100 % ); + blue: rgba ( 38, 139, 210, 100 % ); + urgent-foreground: rgba ( 220, 50, 47, 100 % ); + alternate-urgent-background: rgba ( 245, 245, 245, 100 % ); + active-foreground: rgba ( 194, 202, 208, 100 % ); + lightbg: rgba ( 238, 232, 213, 100 % ); + alternate-active-background: rgba ( 245, 245, 245, 100 % ); + background: rgba ( 9, 6, 17, 100 % ); + bordercolor: rgba ( 195, 193, 61, 100 % ); + alternate-normal-foreground: @foreground; + normal-background: rgba ( 255, 255, 255, 0 % ); + lightfg: rgba ( 88, 104, 117, 100 % ); + selected-normal-background: rgba ( 150, 45, 76, 80 % ); + selected-normal-foreground: rgba ( 180, 144, 82, 100 % ); + selected-active-foreground: rgba ( 180, 144, 82, 100 % ); + border-color: rgba ( 150, 45, 76, 100 % ); + spacing: 2; + separatorcolor: none; + urgent-background: rgba ( 255, 255, 255, 100 % ); + selected-urgent-background: rgba ( 82, 148, 226, 100 % ); + alternate-urgent-foreground: @urgent-foreground; + background-color: rgba ( 0, 0, 0, 0 % ); + alternate-active-foreground: @active-foreground; + active-background: rgba ( 255, 255, 255, 100 % ); + selected-active-background: rgba ( 82, 148, 226, 100 % ); + + font: "Inconsolata Regular 13"; +} +#window { + background-color: @background; + border: 2; + padding: 20; + width: 30%; +} +#mainbox { + border: 0; + padding: 10; +} +#message { + border: 0px 0px 0px ; + border-color: @separatorcolor; + padding: 1px ; +} +#textbox { + text-color: @foreground; +} +#listview { + fixed-height: 0; + border: 0px 0px 0px ; + border-color: @separatorcolor; + spacing: 2px ; + scrollbar: true; + padding: 2px 0px 0px ; +} +#element { + border: 0; + padding: 15px 15px ; +} +#element.normal.normal { + background-color: @normal-background; + text-color: @normal-foreground; +} +#element.normal.urgent { + background-color: @urgent-background; + text-color: @urgent-foreground; +} +#element.normal.active { + background-color: @active-background; + text-color: @active-foreground; +} +#element.selected.normal { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} +#element.selected.urgent { + background-color: @selected-urgent-background; + text-color: @selected-urgent-foreground; +} +#element.selected.active { + background-color: @selected-active-background; + text-color: @selected-active-foreground; +} +#element.alternate.normal { + background-color: @alternate-normal-background; + text-color: @alternate-normal-foreground; +} +#element.alternate.urgent { + background-color: @alternate-urgent-background; + text-color: @alternate-urgent-foreground; +} +#element.alternate.active { + background-color: @alternate-active-background; + text-color: @alternate-active-foreground; +} +#scrollbar { + width: 0 ; + border: 0; + handle-width: 0px ; + padding: 0; +} +#sidebar { + border: 0px 0px 0px ; + border-color: @separatorcolor; +} +#button.selected { + background-color: @selected-normal-background; + text-color: @selected-normal-foreground; +} +#inputbar { + spacing: 0; + text-color: @normal-foreground; + padding: 10px 20px 20px; + margin: 0px 0px 15px; + border: 0px 0px 2px; + border-color: @selected-normal-background; +} +#case-indicator { + spacing: 0; + text-color: @normal-foreground; +} +#entry { + spacing: 0; + text-color: @normal-foreground; +} +#prompt { + spacing: 0; + text-color: @normal-foreground; + font: "Inconsolata Bold 15"; + margin: -2px 0 0 0; +} +#inputbar { + children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; +} +#textbox-prompt-colon { + expand: false; + str: " > "; + margin: 0 0.3em 0em 0em ; + text-color: @normal-foreground; + font: "Inconsolata Bold 13"; +} diff --git a/ssh/.ssh/config b/ssh/.ssh/config new file mode 100644 index 0000000..1110e3d Binary files /dev/null and b/ssh/.ssh/config differ diff --git a/sway/.config/sway/config b/sway/.config/sway/config new file mode 100644 index 0000000..b7f3e42 --- /dev/null +++ b/sway/.config/sway/config @@ -0,0 +1,329 @@ +# Sway Window Manager Configuration +# ================================ + +# 1. Variables and General Settings +# -------------------------------- +set { + $mod Mod4 + # $term kitty + $term kitty + $menu fuzzel + $left h + $down j + $up k + $right l + + # Monitor outputs + $out1 DP-1 + $out2 HDMI-A-1 + + # Original Colors + $focused_border #19141D + $focused_text #CACACA +} + +# Font configuration +font pango:monospace 12 + +# Use Mouse+$mod to drag floating windows +floating_modifier $mod + +# 2. Appearance +# ------------ +# Window Decoration +default_border pixel 1 +default_floating_border pixel 1 +smart_borders on + +# Window Colors (Preserved from original config) +client.focused #19141D #19141D #CACACA #19141D #CACACA + +# Gaps Configuration +gaps inner 5 +gaps outer 5 + +xwayland enable + +# Optional SwayFX Settings +smart_corner_radius on +corner_radius 10 + +default_dim_inactive 0.05 +blur enable +blur_passes 1 +blur_radius 1 +layer_effects "waybar" "blur enable"; shadows enable +shadows on +shadow_blur_radius 20 + +# 3. Workspaces +# ------------ +set { + $ws1 "1" + $ws2 "2" + $ws3 "3" + $ws4 "4" + $ws5 "5" + $ws6 "6" + $ws7 "7" + $ws8 "8" + $ws9 "9" + $ws10 "10" +} + +# Workspace Monitor Assignments +workspace { + 1 output $out1 + 3 output $out1 + 5 output $out1 + 7 output $out1 + 9 output $out1 + 2 output $out2 + 4 output $out2 + 6 output $out2 + 8 output $out2 + 10 output $out2 +} + +# 4. Key Bindings +# -------------- +# System Controls +bindsym { + $mod+Shift+r exec swaymsg reload && notify-send "Reloaded sway config" + $mod+Shift+e exec --no-startup-id wlogout +} + +# Application Launchers +bindsym { + $mod+Return exec $term + # $mod+d exec fuzzel + $mod+d exec rofi -show combi -combi-modi "window,drun" -modi combi + $mod+t exec ~/.bin/code.sh -s ~/.bin/fuzzel.lua + $mod+shift+t exec ~/.bin/present + $mod+n exec ~/.bin/sdm-ui.sh dmenu + $mod+o exec ~/.bin/obsidian-launcher + $mod+e exec nemo +} + +# Window Management +bindsym { + $mod+c kill + $mod+f fullscreen toggle + $mod+space floating toggle + $mod+a focus parent + + # Layout + $mod+s layout stacking + $mod+w layout toggle tabbed split + $mod+semicolon split h + + # Focus + $mod+$left focus left + $mod+$down focus down + $mod+$up focus up + $mod+$right focus right + + $mod+Left focus left + $mod+Down focus down + $mod+Up focus up + $mod+Right focus right + + # Move + $mod+Shift+$left move left + $mod+Shift+$down move down + $mod+Shift+$up move up + $mod+Shift+$right move right + + $mod+Shift+Left move left + $mod+Shift+Down move down + $mod+Shift+Up move up + $mod+Shift+Right move right +} + +# Workspace Management +bindsym { + $mod+1 workspace $ws1 + $mod+2 workspace $ws2 + $mod+3 workspace $ws3 + $mod+4 workspace $ws4 + $mod+5 workspace $ws5 + $mod+6 workspace $ws6 + $mod+7 workspace $ws7 + $mod+8 workspace $ws8 + $mod+9 workspace $ws9 + $mod+0 workspace $ws10 + + $mod+Shift+1 move container to workspace $ws1 + $mod+Shift+2 move container to workspace $ws2 + $mod+Shift+3 move container to workspace $ws3 + $mod+Shift+4 move container to workspace $ws4 + $mod+Shift+5 move container to workspace $ws5 + $mod+Shift+6 move container to workspace $ws6 + $mod+Shift+7 move container to workspace $ws7 + $mod+Shift+8 move container to workspace $ws8 + $mod+Shift+9 move container to workspace $ws9 + $mod+Shift+0 move container to workspace $ws10 + + $mod+bracketright move workspace to output right + $mod+bracketleft move workspace to output left +} + +# Scratchpad +bindsym { + $mod+Shift+minus move scratchpad + $mod+minus scratchpad show + $mod+u [app_id="uy.com.mzunino"] scratchpad show, move position center, fullscreen disable, resize set 1366 768 +} + +# Floating Terminal +bindsym $mod+Shift+u exec --no-startup-id $term --class="uy.com.mzunino" + +# Other Special Bindings +bindsym { + $mod+g exec --no-startup-id gromit-mpx -t 0 + F4 exec switch-windows + $mod+r exec --no-startup-id ~/.bin/wlrecord.sh + $mod+p exec --no-startup-id grim -g "$(slurp -d)" - | swappy -f - + $mod+shift+p exec --no-startup-id ~/.bin/screenshot-upload + $mod+F5 exec --no-startup-id ~/.bin/pause-notifications + $mod+Escape exec ~/.bin/lock.sh +} + +# 5. Multimedia Keys +bindsym { + XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +2% + XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -2% + XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle + XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5% + XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%- +} + +# Mouse Bindings +bindsym { + --border button2 kill + --whole-window $mod+button2 kill + button3 floating toggle + $mod+button3 floating toggle +} + +# 6. Window Rules (Preserving original detailed rules) +for_window [app_id="uy.com.mzunino"] floating enable, move scratchpad +for_window [app_id="Evolution-alarm-notify"] floating enable +for_window [app_id="sm"] move to workspace 4, workspace --no-auto-back-and-forth 4 +for_window [title="JetBrains Toolbox"] floating enable +for_window [app_id="Spotify"] move to workspace 5, workspace --no-auto-back-and-forth 5 +for_window [title="Espanso Sync Tool"] floating enable, move to workspace 10 +for_window [app_id="yad"] floating enable +for_window [class="Pinentry-gtk"] floating enable +for_window [app_id="com.github.hluk.copyq"] floating enable +for_window [app_id="com.github.hluk.copyq"] resize set 1366 768 +for_window [app_id="authenticator"] floating enable +for_window [app_id="authenticator"] resize set 400 800 +for_window [title="File Operation Progress"] floating enable +for_window [title="Do Not Panic"] floating enable +for_window [title="Unlock Keyring"] floating enable +for_window [title="Confirm to replace files"] floating enable +for_window [title="Extension: (Bitwarden Password Manager) - Bitwarden โ€” Mozilla Firefox"] floating enable +for_window [title="Bitwarden - Vivaldi"] floating enable + +for_window [title="Write: .*" app_id="eu.betterbird.Betterbird"] floating enable +for_window [app_id="eu.betterbird.Betterbird"] floating disable + +for_window [title="win0"] floating enable border none +for_window [class=".*"] border pixel 0 +for_window [app_id="org.pulseaudio.pavucontrol"] floating enable, resize set 700 800 +for_window [app_id="pdf_float"] floating enable, resize set width 1366 px height 900 px + +# 7. Workspace Assignments (Preserving original detailed assignments) +assign [class="^discord$"] 10 +assign [app_id="^de.shorsh.discord-screenaudio$"] 10 +assign [class="^WebCord$"] 10 +assign [class="^vesktop$"] 10 +assign [app_id="vesktop"] 10 +assign [app_id="thunderbird"] 7 +assign [app_id="eu.betterbird.Betterbird"] 7 +assign [class="DBeaver"] 4 +assign [app_id="sublime_merge"] 4 +assign [app_id="^jetbrains-idea$"] 3 +assign [title="^win0$"] 3 +assign [title=".*Visual Studio Code*."] 3 +assign [app_id="^nvim ~ "] 3 +assign [title="^nvim ~ "] 3 +assign [app_id="firefox-nightly"] 2 +assign [app_id="firefox"] 2 +assign [app_id="zen"] 2 +assign [instance="vivaldi-stable"] 2 +assign [class="Vivaldi-stable"] 2 +assign [class="Slack"] 1 +assign [app_id="^Chromium"] 1 + +# 8. Workspace Layouts +for_window [workspace=$ws1] layout tabbed + +# 9. Input Configuration +input type:keyboard { + xkb_layout us + xkb_variant altgr-intl + xkb_options caps:escape +} + +input type:touchpad { + dwt enabled + tap enabled + accel_profile adaptive + pointer_accel 0.5 +} + +input "2:10:TPPS/2_Elan_TrackPoint" { + accel_profile "flat" + pointer_accel 0.7 +} + +# # 10. Output Configuration +output $out1 { + resolution 1920x1080 + position 0 0 +} + +output $out2 { + resolution 1920x1080 + position 1920 0 +} + +output * adaptive_sync off + +# 11. Autostart Applications +exec { + ~/.bin/randwall + ~/.bin/waybar.sh + + # Environment and system integration + dbus-update-activation-environment --systemd WAYLAND_DISPLAY DISPLAY SWAYSOCK XDG_SESSION_DESKTOP=sway + systemctl --user import-environment + + # System services - lxsession includes polkit + lxsession + + # System tray applets + blueman-applet + nm-applet + + # Background services + easyeffects --gapplication-service + swaync + wlsunset -l -34.9 -L -56.2 -t 4500 -g 0.9 + + # Applications + $term --class="uy.com.mzunino" + slack + #davmail + betterbird + vesktop + + # Browser - using gtk-launch instead of BROWSER variable + zen-browser + + # Commented out for reference + # gtk-launch correo + swayidle -w +} diff --git a/swayidle/.config/swayidle/config b/swayidle/.config/swayidle/config new file mode 100644 index 0000000..cc56b7e --- /dev/null +++ b/swayidle/.config/swayidle/config @@ -0,0 +1,4 @@ +timeout 600 '~/.bin/lock' +timeout 1200 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' +before-sleep '~/.bin/lock' +after-resume 'swaymsg "output * power on"' diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf new file mode 100644 index 0000000..2af518d --- /dev/null +++ b/tmux/.config/tmux/tmux.conf @@ -0,0 +1,134 @@ +# ============================================== +# === TMUX Configuration === +# ============================================== + +# General Settings +# ---------------- +set -g prefix C-a # Use CTRL+a as our tmux command prefix +unbind C-b # Unbind default prefix +set -g base-index 1 # Start windows numbering at 1 +setw -g pane-base-index 1 # Start pane numbering at 1 +set -g renumber-windows on # Renumber windows when a window is closed +set -s escape-time 1 # Lower the default tmux delay +set -g mouse on # Enable mouse support +setw -g aggressive-resize on # Only resize screen if smaller screen is active +set -g history-limit 10000 # Store 10k lines of history +set-option -g allow-rename off # Disable automatic window renaming +set-option -s set-clipboard on # Enable clipboard support + + +# Key Bindings +# ------------ +bind r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display "tmux reloaded!" # Reload config +bind v split-window -h -c "#{pane_current_path}" # Split vertically +bind s split-window -v -c "#{pane_current_path}" # Split horizontally + +# Vim-like pane navigation +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +# Vim-like pane resizing +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 +bind -r L resize-pane -R 5 + +# Move pane to a different window +bind-key m choose-window -F "#{window_index}: #{window_name}" "join-pane -h -t %%" +bind-key M choose-window -F "#{window_index}: #{window_name}" "join-pane -v -t %%" + +# Visual Settings +# --------------- +set -g status-interval 2 +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity off +set-option -g bell-action none + +# Terminal Settings +# ----------------- +set -gq allow-passthrough on +set -g visual-activity off + +set -ga update-environment TERM +set -ga update-environment TERM_PROGRAM +set -g default-terminal "tmux-256color" +set -g terminal-overrides ',xterm-256color:Tc' + +# Plugins +# ------- +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'catppuccin/tmux#v0.2.0' +set -g @plugin 'tmux-plugins/tmux-battery' +set -g @plugin 'MaximilianGaedig/tmux-filter' + +# Plugin Settings +# --------------- +set -g @yank_selection_mouse 'clipboard' +set -g @yank_selection 'clipboard' +set -g @yank_action 'copy-pipe' # or 'copy-pipe-and-cancel' for the default + +# Catppuccin Theme Configuration +set -g status-position top +set -g @catppuccin_window_left_separator "๎‚บโ–ˆ" +set -g @catppuccin_window_right_separator "โ–ˆ๎‚ผ" +set -g @catppuccin_window_number_position "left" +set -g @catppuccin_window_middle_separator "โ–ˆ " +set -g @catppuccin_window_default_fill "number" +set -g @catppuccin_window_current_fill "number" +set -g @catppuccin_window_current_text "#W#{?window_zoomed_flag,(๐Ÿ”),}" +set -g @catppuccin_window_default_text "#W" + +# Determine status modules based on hostname +run-shell "if [ $(hostname) = 't14' ]; then \ + tmux set -g @catppuccin_status_modules_right 'date_time battery session'; \ + else \ + tmux set -g @catppuccin_status_modules_right 'date_time session'; \ + fi" + +set -g @catppuccin_status_left_separator "๎‚ถ" +set -g @catppuccin_status_right_separator " ๎‚ถ" +set -g @catppuccin_status_right_separator_inverse "yes" +set -g @catppuccin_status_fill "all" +set -g @catppuccin_status_connect_separator "yes" +set -g @catppuccin_date_time_text "%Y-%m-%d %H:%M:%S" + +# Rose Pine Color Scheme +set -g @catppuccin_pane_color "#1e1e2e" +set -g @catppuccin_pane_background_color "#181825" +set -g @catppuccin_window_current_color "#eb6f92" +set -g @catppuccin_window_current_background_color "#f5e0dc" +set -g @catppuccin_window_default_color "#ebbcba" +set -g @catppuccin_window_default_background_color "#f5e0dc" +set -g @catppuccin_session_color "#9ccfd8" +set -g @catppuccin_session_background_color "#f5e0dc" +set -g @catppuccin_directory_color "#c4a7e7" +set -g @catppuccin_directory_background_color "#f5e0dc" +set -g @catppuccin_date_time_color "#f6c177" +set -g @catppuccin_date_time_background_color "#f5e0dc" + +# Battery Icons (Glyphs) +set -g @batt_icon_charge_tier8 '๏‰„' +set -g @batt_icon_charge_tier7 '๏‰ƒ' +set -g @batt_icon_charge_tier6 '๏‰ƒ' +set -g @batt_icon_charge_tier5 '๏‰‚' +set -g @batt_icon_charge_tier4 '๏‰‚' +set -g @batt_icon_charge_tier3 '๏‰' +set -g @batt_icon_charge_tier2 '๏‰' +set -g @batt_icon_charge_tier1 '๏‰€' + +# Plugin Manager +set-environment -g TMUX_PLUGIN_MANAGER_PATH "$XDG_DATA_HOME/tmux/plugins" + +# Install TPM if not already installed +if "test ! -d ~/.local/share/tmux/plugins/tpm" \ + "run 'git clone https://github.com/tmux-plugins/tpm ~/.local/share/tmux/plugins/tpm'" + +# Initialize TPM (keep this line at the very bottom of tmux.conf) +run '~/.local/share/tmux/plugins/tpm/tpm' + diff --git a/vpn-manager/.config/vpn-manager/config.yaml b/vpn-manager/.config/vpn-manager/config.yaml new file mode 100644 index 0000000..7c593cd --- /dev/null +++ b/vpn-manager/.config/vpn-manager/config.yaml @@ -0,0 +1,18 @@ +defaultprofile: default +profiles: + - name: default + configName: default-vpn +statusclasses: + connected: connected + disconnected: disconnected +statusicons: + connected: "\U000F0C53" + disconnected: "\U000F015B" +tooltipformat: + connected: |- + Profile: %s + Connected to: %s + Config: %s + Active: %s + IN: %s OUT: %s + disconnected: VPN Disconnected diff --git a/waybar/.config/waybar/common.jsonc b/waybar/.config/waybar/common.jsonc new file mode 100644 index 0000000..2ea00a6 --- /dev/null +++ b/waybar/.config/waybar/common.jsonc @@ -0,0 +1,210 @@ +{ + "layer": "top", + "position": "top", + "margin": "5 0 0", + "mod": "dock", + "exclusive": true, + "passthrough": false, + "gtk-layer-shell": true, + "height": 30, + "margin-bottom": 0, + "margin-top": 5, + "margin-left": 10, + "margin-right": 10, + "sway/workspaces": { + "disable-scroll": true, + "format": "{name} {icon}", + "format-icons": { + "1": "๏ต", + "2": "๏‰จ", + "3": "๏„ ", + "urgent": "๏ช", + "active": "๏†’", + "default": "๏„‘" + }, + "sort-by-number": true + }, + "sway/window": { + "format": "{}", + "max-length": 50, + "rewrite": { + "(.*) - Mozilla Firefox": "๐ŸŒŽ $1", + "(.*) - zsh": "> [$1]" + } + }, + "tray": { + "icon-size": 18, + "spacing": 5 + }, + "clock": { + // DD-MM-YYYY + "format": "๏€— {0:%H:%M:%S %Z} ๓ฐธ˜ {0:%d/%m/%Y}", + "interval": 60, + "format-alt": "{:L%A, %B %d, %Y (%R)} ๏—ฏ ", + "tooltip-format": "{calendar}", + "timezones": [ + "America/Montevideo", + "America/New_York" + ], + "actions": { + "on-click-right": "mode", + "on-scroll-up": "tz_up", + "on-scroll-down": "tz_down" + }, + "calendar": { + "mode": "year", + "mode-mon-col": 3, + "weeks-pos": "right", + "on-scroll": 1, + "format": { + "months": "{}", + "days": "{}", + "weeks": "W{}", + "weekdays": "{}", + "today": "{}" + } + }, + }, + "backlight": { + "device": "intel_backlight", + "format": "{icon} {percent}%", + "format-icons": [ + "๓ฐƒž", + "๓ฐƒŸ", + "๓ฐƒ " + ], + "on-scroll-up": "brightnessctl set 10%+", + "on-scroll-down": "brightnessctl set 10%-", + "min-length": 6 + }, + "battery": { + "states": { + "good": 95, + "warning": 30, + "critical": 20 + }, + "format": "{icon} {capacity}%", + "format-charging": "๏‡ฆ {capacity}%", + "format-plugged": "๏‡ฆ {capacity}%", + "format-alt": "{time} {icon}", + "format-icons": [ + "๓ฐ‚Ž", + "๓ฐบ", + "๓ฐป", + "๓ฐผ", + "๓ฐฝ", + "๓ฐพ", + "๓ฐฟ", + "๓ฐ‚€", + "๓ฐ‚", + "๓ฐ‚‚", + "๓ฐน" + ] + }, + "pulseaudio": { + "format": "{icon} {volume}%", + "tooltip": false, + "format-muted": "๏€ฆ Muted", + "on-click": "wpctl set-mute @DEFAULT_SINK@ toggle", + "on-click-right": "pavucontrol", + "on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_SINK@ 5%+", + "on-scroll-down": "wpctl set-volume @DEFAULT_SINK@ 5%-", + "scroll-step": 5, + "format-icons": { + "headphone": "๏€ฅ", + "hands-free": "๏€ฅ", + "headset": "๏€ฅ", + "phone": "๏‚•", + "portable": "๏‚•", + "car": "๏†น", + "default": [ + "๏€ฆ", + "๏€ง", + "๏€จ " + ] + } + }, + "pulseaudio#microphone": { + "format": "{format_source}", + "format-source": "๏„ฐ {volume}%", + "format-source-muted": "๏„ฑ Muted", + "on-click": "wpctl set-mute @DEFAULT_SOURCE@ toggle", + "on-click-right": "pavucontrol", + "on-scroll-up": "wpctl set-volume -l 1 @DEFAULT_SOURCE@ 5%+", + "on-scroll-down": "wpctl set-volume -l 1 @DEFAULT_SOURCE@ 5%-", + "scroll-step": 5 + }, + "temperature": { + "thermal-zone": 1, + "format": "๏‹‰ {temperatureC}ยฐC", + "critical-threshold": 80, + "format-critical": "{temperatureC}ยฐC ๏‹‡" + }, + "network": { + "format-wifi": "๏‡ซ {signalStrength}%", + "format-ethernet": "{ipaddr}/{cidr}", + "tooltip-format": "{essid} - {ifname} via {gwaddr}", + "format-linked": "{ifname} (No IP)", + "format-disconnected": "Disconnected", + "format-alt": "{ifname}:{essid} {ipaddr}/{cidr}" + }, + "bluetooth": { + "format": "๏Š” {status}", + "format-disabled": "๏Š” off", + "format-connected": "๏Š” {num_connections}", + "tooltip-format": "{device_alias}", + "tooltip-format-connected": "๏Š” {device_enumerate}", + "tooltip-format-enumerate-connected": "{device_alias}", + "on-click": "bluetoothctl toggle" + }, + "custom/playerctl": { + "format": "{icon}", + "return-type": "json", + "max-length": 64, + "exec": "playerctl -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F", + "on-click-middle": "playerctl play-pause", + "on-click": "playerctl play-pause", + "on-click-right": "playerctl play-pause", + "format-icons": { + "Playing": "๓ฐฅ", + "Paused": "๓ฐŒ" + } + }, + "custom/playerlabel": { + "format": "{}", + "return-type": "json", + "max-length": 48, + "exec": "playerctl -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F", + "on-click": "playerctl previous", + "on-click-right": "playerctl next", + "format-icons": { + "Playing": "๓ฐ’ฎ ๓ฐŒ ๓ฐ’ญ", + "Paused": "๓ฐ’ฎ ๓ฐฅ ๓ฐ’ญ" + } + }, + "custom/notification": { + "tooltip": false, + "format": "{icon}", + "format-icons": { + "notification": "๓ฐŽŸ๏‘„", + "none": "๓ฐŽŸ", + "inhibited-notification": "๓ฐŽŸ๏‘„", + "inhibited-none": "๓ฐŽŸ", + "dnd-notification": "๎ซ‘๏‘„", + "dnd-none": "๎ซ‘", + "dnd-inhibited-notification": "๎ซ‘๏‘„", + "dnd-inhibited-none": "๎ซ‘" + }, + "return-type": "json", + "exec-if": "which swaync-client", + "exec": "swaync-client -swb", + "on-click": "swaync-client -t -sw", + "on-click-right": "swaync-client -d -sw", + "escape": true + }, + "custom/randwall": { + "format": "๓ฐ˜", + "on-click": "$HOME/.bin/randwall", + "on-click-right": "$HOME/.bin/randwall" + } +} diff --git a/waybar/.config/waybar/config.jsonc b/waybar/.config/waybar/config.jsonc new file mode 100644 index 0000000..b37f276 --- /dev/null +++ b/waybar/.config/waybar/config.jsonc @@ -0,0 +1,96 @@ +[ + { + "include": [ + "~/.config/waybar/common.jsonc" + ], + "modules-left": [ + "sway/workspaces" + ], + "modules-right": [ + "disk", + "cpu", + "memory" + ], + "output": [ + "DP-1" + ], + "cpu": { + "interval": 10, + "format": "๏‹› {}%", + "max-length": 10 + }, + "memory": { + "interval": 30, + "format": "๏ƒ‰ {used:0.1f}/{total:0.1f} GiB" + }, + "disk": { + "interval": 30, + "format": "๏‡€ {used}/{total}", + "unit": "GiB", + "path": "/home" + } + }, + { + "include": [ + "~/.config/waybar/common.jsonc" + ], + "modules-left": [ + "sway/workspaces" + ], + "modules-center": [ + "custom/playerctl", + "custom/playerlabel" + ], + "modules-right": [ + "custom/wf-recorder", + "custom/randwall", + "pulseaudio", + "custom/vpn", + "custom/notification", + "tray", + "clock" + ], + "output": [ + "HDMI-A-1" + ], + "custom/vpn": { + "format": "{}", + "return-type": "json", + "interval": 1, + "exec": "/home/forbi/.local/bin/vpn", + "on-click": "/home/forbi/.local/bin/vpn toggle" + } + }, + { + "include": [ + "~/.config/waybar/common.jsonc" + ], + "modules-left": [ + "sway/workspaces" + ], + "modules-center": [ + "custom/playerctl", + "custom/playerlabel" + ], + "modules-right": [ + "custom/randwall", + "pulseaudio", + "custom/vpn", + "custom/notification", + "backlight", + "battery", + "tray", + "clock" + ], + "output": [ + "eDP-1" + ], + "custom/vpn": { + "format": "{}", + "return-type": "json", + "interval": 1, + "exec": "/home/forbi/.local/bin/vpn", + "on-click": "/home/forbi/.local/bin/vpn toggle" + } + } +] diff --git a/waybar/.config/waybar/modules/common.jsonc b/waybar/.config/waybar/modules/common.jsonc new file mode 100644 index 0000000..c179f2c --- /dev/null +++ b/waybar/.config/waybar/modules/common.jsonc @@ -0,0 +1,167 @@ +{ + "layer": "top", + "position": "top", + "margin": "5 0 0", + "mod": "dock", + "exclusive": true, + "passthrough": false, + "gtk-layer-shell": true, + "height": 30, + "margin-bottom": 0, + "margin-top": 5, + "margin-left": 10, + "margin-right": 10, + "battery": { + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": "{capacity}% ", + "format-plugged": "{capacity}% ", + "format-alt": "{icon} {time}", + "format-icons": [ + "๏‰„", + "๏‰ƒ", + "๏‰‚", + "๏‰", + "๏‰€" + ] + }, + "memory": { + "format": "๓ฐ› {}%", + "format-alt": "๓ฐ› {used}/{total} GiB", + "interval": 5 + }, + "cpu": { + "format": "๓ฐป  {usage}%", + "format-alt": "๓ฐป  {avg_frequency} GHz", + "interval": 5 + }, + "disk": { + "format": "๓ฐ‹Š {percentage_used}%", + "format-alt": "๓ฐ‹Š {used}/{total} GiB", + "interval": 5, + "path": "/home" + }, + "network": { + "format-wifi": "๓ฐคจ", + "format-ethernet": " {ifname}: Main", + "format-linked": " {ifname} (No IP)", + "format-disconnected": "๓ฐคญ", + "format-alt": " {ifname}: {ipaddr}/{cidr}", + "tooltip-format": "{essid}", + "on-click-right": "nm-connection-editor" + }, + "tray": { + "icon-size": 16, + "spacing": 5 + }, + "custom/randwall": { + "format": "๓ฐ˜", + "on-click": "$HOME/.bin/randwall", + "on-click-right": "$HOME/.bin/randwall" + }, + "custom/wf-recorder": { + "format": "{}", + "return-type": "json", + "interval": 1, + "exec": "$HOME/.bin/wlrecord.sh --status", + "on-click": "$HOME/.bin/wlrecord.sh", + "tooltip": true + }, + "custom/notification": { + "tooltip": false, + "format": "{icon}", + "format-icons": { + "notification": "๏‚ข๏‘„", + "none": "๏‚ข", + "dnd-notification": "๏‡ท๏‘„", + "dnd-none": "๏‡ท", + "inhibited-notification": "๏‚ข๏‘„", + "inhibited-none": "๏‚ข", + "dnd-inhibited-notification": "๏‡ท๏‘„", + "dnd-inhibited-none": "๏‡ท" + }, + "return-type": "json", + "exec-if": "which swaync-client", + "exec": "swaync-client -swb", + "on-click": "swaync-client -t -sw", + "on-click-right": "swaync-client -d -sw", + "escape": true + }, + "hyprland/workspaces": { + "disable-scroll": true, + "format": "{icon}", + "format-icons": { + "1": "๏ต", + "2": "๓ฐŒ€", + "3": "๏„ ", + "4": "๏™", + "7": "๏ƒ ", + "10": "๓ฐ™ฏ", + "urgent": "๏ช", + "active": "๏†’", + "default": "๓ฐงž" + } + }, + "hyprland/window": { + "format": "{}", + "max-length": 50, + "rewrite": { + "(.*) - Mozilla Firefox": "๐ŸŒŽ $1", + "(.*) - zsh": "> [$1]" + } + }, + "custom/playerctl": { + "format": "{icon}", + "return-type": "json", + "max-length": 64, + "exec": "playerctl -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F", + "on-click-middle": "playerctl play-pause", + "on-click": "playerctl play-pause", + "on-click-right": "playerctl play-pause", + "format-icons": { + "Playing": "๓ฐฅ", + "Paused": "๓ฐŒ" + } + }, + "custom/playerlabel": { + "format": "{}", + "return-type": "json", + "max-length": 48, + "exec": "playerctl -a metadata --format '{\"text\": \"{{artist}} - {{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F", + "on-click-middle": "playerctl play-pause", + "on-click": "playerctl previous", + "on-click-right": "playerctl next", + "format-icons": { + "Playing": "๓ฐ’ฎ ๓ฐŒ ๓ฐ’ญ", + "Paused": "๓ฐ’ฎ ๓ฐฅ ๓ฐ’ญ" + } + }, + "pulseaudio": { + "ignored-sinks": [ + "Easy Effects Sink" + ], + "format": "{icon} {volume}%", + "format-muted": "๓ฐŸ", + "format-icons": { + "default": [ + "๓ฐ•ฟ", + "๓ฐ–€", + "๓ฐ•พ" + ] + }, + "on-click-right": "pavucontrol", + // "on-scroll-up": "pamixer --sink 77 -ui 5", + // "on-scroll-down": "pamixer --sink 77 -ud 5", + "on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle" + }, + "clock": { + "format": "๏€— {:%H:%M %d/%m}", + "tooltip": "true", + "tooltip-format": "{:%Y %B}\n{calendar}", + "format-alt": "๏ณ {:%d/%m}" + } +} diff --git a/waybar/.config/waybar/modules/top-dp.jsonc b/waybar/.config/waybar/modules/top-dp.jsonc new file mode 100644 index 0000000..5a1abc6 --- /dev/null +++ b/waybar/.config/waybar/modules/top-dp.jsonc @@ -0,0 +1,21 @@ +{ + "output": [ + "DP-1" + ], + "position": "top", + "layer": "top", + "height": 18, + "margin-top": 0, + "margin-bottom": 0, + "margin-left": 0, + "margin-right": 0, + "modules-left": [ + "hyprland/workspaces", + "hyprland/window" + ], + "modules-right": [ + "cpu", + "memory", + "disk" + ] +} diff --git a/waybar/.config/waybar/modules/top-edp.jsonc b/waybar/.config/waybar/modules/top-edp.jsonc new file mode 100644 index 0000000..b123f45 --- /dev/null +++ b/waybar/.config/waybar/modules/top-edp.jsonc @@ -0,0 +1,24 @@ +{ + "output": [ + "eDP-1" + ], + "modules-left": [ + "hyprland/workspaces", + "hyprland/window" + ], + "modules-center": [ + "custom/playerctl", + "custom/playerlabel" + ], + "modules-right": [ + "custom/wf-recorder", + "custom/randwall", + "backlight", + "battery", + "network", + "pulseaudio", + "tray", + "clock", + "custom/notification" + ] +} diff --git a/waybar/.config/waybar/modules/top-hdmi.jsonc b/waybar/.config/waybar/modules/top-hdmi.jsonc new file mode 100644 index 0000000..1546d81 --- /dev/null +++ b/waybar/.config/waybar/modules/top-hdmi.jsonc @@ -0,0 +1,22 @@ +{ + "output": [ + "HDMI-A-1" + ], + "modules-left": [ + "hyprland/workspaces", + "hyprland/window", + "hyprland/mode" + ], + "modules-center": [ + "custom/playerctl", + "custom/playerlabel" + ], + "modules-right": [ + "custom/wf-recorder", + "custom/randwall", + "pulseaudio", + "tray", + "clock", + "custom/notification" + ] +} diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css new file mode 100644 index 0000000..6c046b6 --- /dev/null +++ b/waybar/.config/waybar/style.css @@ -0,0 +1,157 @@ +/* General Reset and Base Styles */ +* { + border: none; + border-radius: 0; + font-family: Iosevka, FontAwesome, Noto Sans CJK; + font-size: 14px; + min-height: 0; +} + +/* Window Styles */ +window#waybar { + background: rgba(0, 0, 0, 0.7); + border-bottom: 1px solid #282828; + border-radius: 10px; + color: #f4d9e1; +} + +tooltip { + background: #010409; + border-radius: 10px; +} + +/* Workspace Styles */ +#workspaces { + margin-left: -10px; + padding: 0 0 0 5px; +} + +#workspaces button { + color: #fff; + padding: 0; + border-radius: 10px; + margin-left: 3px; + transition: all 0.1s ease-in-out; +} + +#workspaces button.urgent { + background: #010409; + color: #FF7F7F; +} + +#workspaces button:hover, +#workspaces button.focused { + background: #f4d9e1; + color: #282828; + transition: all 0.3s ease-in-out; + margin: 5px; +} + +/* Common Module Styles */ +#cpu, +#memory, +#window, +#clock, +#battery, +#pulseaudio, +#network, +#bluetooth, +#temperature, +#workspaces, +#tray, +#custom-vpn, +#custom-notification, +#backlight { + padding: 0px 10px; +} + +#cpu { + padding-right: 0; +} + +/* Individual Module Styles */ +#window { + margin: 0 60px; +} + +#cpu, +#memory, +#clock, +#network, +#bluetooth, +#pulseaudio, +#pulseaudio.microphone, +#battery { + color: #fff; +} + +#temperature.critical { + color: #eba0ac; +} + +/* Custom Module Styles */ +#custom-playerctl, +#custom-playerlabel { + background: #282828; + border-radius: 16px; + font-style: normal; + font-weight: normal; + margin: 5px 0; +} + +#custom-playerctl { + font-size: 16px; + padding: 0 17px 0 15px; +} + +#custom-playerlabel { + margin-left: 10px; + padding: 0 15px 0 10px; +} + +#custom-notification { + border-radius: 0; + font-weight: bold; +} + +#custom-randwall { + margin-right: 10px; +} + +#custom-vpn.connected { + color: #a6e3a1; +} + +#custom-vpn.disconnected { + color: #f4d9e1; +} + +#custom-wf-recorder { + padding: 0 10px; + margin: 0 4px; + border-radius: 4px; + transition: all 0.3s ease; +} + +#custom-wf-recorder.idle { + background-color: #2c2c2c; + color: #ccc; +} + +#custom-wf-recorder.recording { + background-color: #cc3436; + color: white; + animation: blink 1s infinite; +} + +@keyframes blink { + 0% { + opacity: 1; + } + 50% { + opacity: 0.7; + } + 100% { + opacity: 1; + } +} diff --git a/wezterm/.config/wezterm/wezterm.lua b/wezterm/.config/wezterm/wezterm.lua new file mode 100644 index 0000000..d894627 --- /dev/null +++ b/wezterm/.config/wezterm/wezterm.lua @@ -0,0 +1,68 @@ +local wezterm = require("wezterm") +local theme = wezterm.plugin.require("https://github.com/neapsix/wezterm").main + +wezterm.on("format-window-title", function(tab, pane, tabs, panes, config) + local ws = wezterm.mux.get_active_workspace() + return ws +end) + +wezterm.on("user-var-changed", function(window, pane, name, value) + local overrides = window:get_config_overrides() or {} + if name == "ZEN_MODE" then + local incremental = value:find("+") + local number_value = tonumber(value) + if incremental ~= nil then + while number_value > 0 do + window:perform_action(wezterm.action.IncreaseFontSize, pane) + number_value = number_value - 1 + end + elseif number_value < 0 then + window:perform_action(wezterm.action.ResetFontSize, pane) + overrides.font_size = nil + else + overrides.font_size = number_value + end + end + window:set_config_overrides(overrides) +end) + +return { + window_close_confirmation = "NeverPrompt", + colors = theme.colors(), + enable_tab_bar = false, + font_size = 12.0, + font = wezterm.font("JetBrains Mono"), + + window_background_opacity = 0.92, + window_decorations = "NONE", + keys = {}, + window_padding = { + left = 0, + right = 0, + top = 0, + bottom = 0, + }, + + hyperlink_rules = wezterm.default_hyperlink_rules(), + + mouse_bindings = { + -- Disable the default click behavior + { + event = { Up = { streak = 1, button = "Left" } }, + mods = "NONE", + action = wezterm.action.DisableDefaultAssignment, + }, + -- Ctrl-click will open the link under the mouse cursor + { + event = { Up = { streak = 1, button = "Left" } }, + mods = "CTRL", + action = wezterm.action.OpenLinkAtMouseCursor, + }, + -- Disable the Ctrl-click down event to stop programs from seeing it when a URL is clicked + { + event = { Down = { streak = 1, button = "Left" } }, + mods = "CTRL", + action = wezterm.action.Nop, + }, + }, +} diff --git a/wlogout/.config/wlogout/layout b/wlogout/.config/wlogout/layout new file mode 100644 index 0000000..046a486 --- /dev/null +++ b/wlogout/.config/wlogout/layout @@ -0,0 +1,30 @@ +{ + "label" : "lock", + "action" : "swaylock --screenshot --clock --indicator --indicator-radius 200 --indicator-thickness 7 --effect-blur 7x5 --fade-in 0.2", + "text" : "Lock", + "keybind" : "l" +} +{ + "label" : "reboot", + "action" : "systemctl reboot", + "text" : "Reboot", + "keybind" : "r" +} +{ + "label" : "shutdown", + "action" : "systemctl poweroff", + "text" : "Shutdown", + "keybind" : "s" +} +{ + "label" : "logout", + "action" : "swaymsg exit || hyprctl dispatch exit", + "text" : "Logout", + "keybind" : "e" +} +{ + "label" : "suspend", + "action" : "systemctl suspend", + "text" : "Suspend", + "keybind" : "u" +} diff --git a/wlogout/.config/wlogout/lock-hover.png b/wlogout/.config/wlogout/lock-hover.png new file mode 100644 index 0000000..8fb86fe Binary files /dev/null and b/wlogout/.config/wlogout/lock-hover.png differ diff --git a/wlogout/.config/wlogout/lock.png b/wlogout/.config/wlogout/lock.png new file mode 100644 index 0000000..430451c Binary files /dev/null and b/wlogout/.config/wlogout/lock.png differ diff --git a/wlogout/.config/wlogout/logout-hover.png b/wlogout/.config/wlogout/logout-hover.png new file mode 100644 index 0000000..9e570a9 Binary files /dev/null and b/wlogout/.config/wlogout/logout-hover.png differ diff --git a/wlogout/.config/wlogout/logout.png b/wlogout/.config/wlogout/logout.png new file mode 100644 index 0000000..128c995 Binary files /dev/null and b/wlogout/.config/wlogout/logout.png differ diff --git a/wlogout/.config/wlogout/power-hover.png b/wlogout/.config/wlogout/power-hover.png new file mode 100644 index 0000000..122d331 Binary files /dev/null and b/wlogout/.config/wlogout/power-hover.png differ diff --git a/wlogout/.config/wlogout/power.png b/wlogout/.config/wlogout/power.png new file mode 100644 index 0000000..ce56166 Binary files /dev/null and b/wlogout/.config/wlogout/power.png differ diff --git a/wlogout/.config/wlogout/restart-hover.png b/wlogout/.config/wlogout/restart-hover.png new file mode 100644 index 0000000..3e18536 Binary files /dev/null and b/wlogout/.config/wlogout/restart-hover.png differ diff --git a/wlogout/.config/wlogout/restart.png b/wlogout/.config/wlogout/restart.png new file mode 100644 index 0000000..7855d40 Binary files /dev/null and b/wlogout/.config/wlogout/restart.png differ diff --git a/wlogout/.config/wlogout/sleep-hover.png b/wlogout/.config/wlogout/sleep-hover.png new file mode 100644 index 0000000..0fd3bad Binary files /dev/null and b/wlogout/.config/wlogout/sleep-hover.png differ diff --git a/wlogout/.config/wlogout/sleep.png b/wlogout/.config/wlogout/sleep.png new file mode 100644 index 0000000..6a3d607 Binary files /dev/null and b/wlogout/.config/wlogout/sleep.png differ diff --git a/wlogout/.config/wlogout/style.css b/wlogout/.config/wlogout/style.css new file mode 100644 index 0000000..d41792b --- /dev/null +++ b/wlogout/.config/wlogout/style.css @@ -0,0 +1,60 @@ +window { + font-family: monospace; + font-size: 14pt; + color: #cdd6f4; /* text */ + background-color: rgba(30, 30, 46, 0.5); +} + +button { + background-repeat: no-repeat; + background-position: center; + background-size: 25%; + border: none; + background-color: rgba(30, 30, 46, 0); + margin: 5px; + transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out; +} + +button:hover { + background-color: rgba(49, 50, 68, 0.1); +} + +button:focus { + background-color: #cba6f7; + color: #1e1e2e; +} + +#lock { + background-image: image(url("./lock.png")); +} +#lock:focus { + background-image: image(url("./lock-hover.png")); +} + +#logout { + background-image: image(url("./logout.png")); +} +#logout:focus { + background-image: image(url("./logout-hover.png")); +} + +#suspend { + background-image: image(url("./sleep.png")); +} +#suspend:focus { + background-image: image(url("./sleep-hover.png")); +} + +#shutdown { + background-image: image(url("./power.png")); +} +#shutdown:focus { + background-image: image(url("./power-hover.png")); +} + +#reboot { + background-image: image(url("./restart.png")); +} +#reboot:focus { + background-image: image(url("./restart-hover.png")); +} diff --git a/zathura/.config/zathura/zathurarc b/zathura/.config/zathura/zathurarc new file mode 100644 index 0000000..c5a37d1 --- /dev/null +++ b/zathura/.config/zathura/zathurarc @@ -0,0 +1,57 @@ +# โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’ โ–„โ–„โ–„ โ–„โ–„โ–„โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–“ โ–ˆโ–ˆโ–‘ โ–ˆโ–ˆ โ–ˆ โ–ˆโ–ˆ โ–ˆโ–ˆโ–€โ–ˆโ–ˆโ–ˆ โ–„โ–„โ–„ โ–ˆโ–ˆโ–€โ–ˆโ–ˆโ–ˆ โ–„โ–ˆโ–ˆโ–ˆโ–ˆโ–„ +# โ–’ โ–’ โ–’ โ–„โ–€โ–‘โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–„ โ–“ โ–ˆโ–ˆโ–’ โ–“โ–’โ–“โ–ˆโ–ˆโ–‘ โ–ˆโ–ˆโ–’ โ–ˆโ–ˆ โ–“โ–ˆโ–ˆโ–’โ–“โ–ˆโ–ˆ โ–’ โ–ˆโ–ˆโ–’โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–„ โ–“โ–ˆโ–ˆ โ–’ โ–ˆโ–ˆโ–’โ–’โ–ˆโ–ˆโ–€ โ–€โ–ˆ +# โ–‘ โ–’ โ–„โ–€โ–’โ–‘ โ–’โ–ˆโ–ˆ โ–€โ–ˆโ–„ โ–’ โ–“โ–ˆโ–ˆโ–‘ โ–’โ–‘โ–’โ–ˆโ–ˆโ–€โ–€โ–ˆโ–ˆโ–‘โ–“โ–ˆโ–ˆ โ–’โ–ˆโ–ˆโ–‘โ–“โ–ˆโ–ˆ โ–‘โ–„โ–ˆ โ–’โ–’โ–ˆโ–ˆ โ–€โ–ˆโ–„ โ–“โ–ˆโ–ˆ โ–‘โ–„โ–ˆ โ–’โ–’โ–“โ–ˆ โ–„ +# โ–„โ–€โ–’ โ–‘โ–‘โ–ˆโ–ˆโ–„โ–„โ–„โ–„โ–ˆโ–ˆโ–‘ โ–“โ–ˆโ–ˆโ–“ โ–‘ โ–‘โ–“โ–ˆ โ–‘โ–ˆโ–ˆ โ–“โ–“โ–ˆ โ–‘โ–ˆโ–ˆโ–‘โ–’โ–ˆโ–ˆโ–€โ–€โ–ˆโ–„ โ–‘โ–ˆโ–ˆโ–„โ–„โ–„โ–„โ–ˆโ–ˆ โ–’โ–ˆโ–ˆโ–€โ–€โ–ˆโ–„ โ–’โ–“โ–“โ–„ โ–„โ–ˆโ–ˆโ–’ +# โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–’ โ–“โ–ˆ โ–“โ–ˆโ–ˆโ–’ โ–’โ–ˆโ–ˆโ–’ โ–‘ โ–‘โ–“โ–ˆโ–’โ–‘โ–ˆโ–ˆโ–“โ–’โ–’โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–“ โ–‘โ–ˆโ–ˆโ–“ โ–’โ–ˆโ–ˆโ–’ โ–“โ–ˆ โ–“โ–ˆโ–ˆโ–’โ–‘โ–ˆโ–ˆโ–“ โ–’โ–ˆโ–ˆโ–’โ–’ โ–“โ–ˆโ–ˆโ–ˆโ–€ โ–‘ +# โ–‘โ–’โ–’ โ–“โ–‘โ–’โ–‘โ–’ โ–’โ–’ โ–“โ–’โ–ˆโ–‘ โ–’ โ–‘โ–‘ โ–’ โ–‘โ–‘โ–’โ–‘โ–’โ–‘โ–’โ–“โ–’ โ–’ โ–’ โ–‘ โ–’โ–“ โ–‘โ–’โ–“โ–‘ โ–’โ–’ โ–“โ–’โ–ˆโ–‘โ–‘ โ–’โ–“ โ–‘โ–’โ–“โ–‘โ–‘ โ–‘โ–’ โ–’ โ–‘ +# โ–‘โ–‘โ–’ โ–’ โ–‘ โ–’ โ–’ โ–’โ–’ โ–‘ โ–‘ โ–’ โ–‘โ–’โ–‘ โ–‘โ–‘โ–‘โ–’โ–‘ โ–‘ โ–‘ โ–‘โ–’ โ–‘ โ–’โ–‘ โ–’ โ–’โ–’ โ–‘ โ–‘โ–’ โ–‘ โ–’โ–‘ โ–‘ โ–’ +# โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–’ โ–‘ โ–‘ โ–‘โ–‘ โ–‘ โ–‘โ–‘โ–‘ โ–‘ โ–‘ โ–‘โ–‘ โ–‘ โ–‘ โ–’ โ–‘โ–‘ โ–‘ โ–‘ +# โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ โ–‘ +# โ–‘ โ–‘ +# + +set selection-clipboard clipboard + +set font "FiraCode Nerd Font 12" + + +set default-bg "#191724" +set default-fg "#e0def4" + +set statusbar-fg "#e0def4" +set statusbar-bg "#555169" + +set inputbar-bg "#6e6a86" +set inputbar-fg "#ebbcba" + +set notification-bg "#e0def4" +set notification-fg "#555169" + +set notification-error-bg "#f6c177" +set notification-error-fg "#555169" + +set notification-warning-bg "#ebbcba" +set notification-warning-fg "#555169" + +set highlight-color "#ebbcba" +set highlight-active-color "#eb6f92" + +set completion-bg "#6e6a86" +set completion-fg "#ebbcba" + +set completion-highlight-fg "#26233a" +set completion-highlight-bg "#ebbcba" + +set recolor-lightcolor "#191724" +set recolor-darkcolor "#e0def4" + +set recolor "false" +set recolor-keephue "false" + +set pages-per-row 1 +set adjust-open "best-fit" + +set scroll-page-aware "true" +set smooth-scroll "true" +set scroll-full-overlap 0.01 +set scroll-step 100 diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv new file mode 100644 index 0000000..0c33138 --- /dev/null +++ b/zsh/.config/zsh/.zshenv @@ -0,0 +1,4 @@ +source ~/.config/env + +# If running from tty1 start sway +[ "$(tty)" = "/dev/tty1" ] && exec dbus-run-session sway diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..57c0a01 --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,9 @@ +source $ZDOTDIR/init.zsh + +# Initialize completions with defer +autoload -Uz compinit +if [ "$(date +'%j')" != "$(stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)" ]; then + zsh-defer compinit +else + zsh-defer compinit -C +fi diff --git a/zsh/.config/zsh/alias.zsh b/zsh/.config/zsh/alias.zsh new file mode 100644 index 0000000..4d07234 --- /dev/null +++ b/zsh/.config/zsh/alias.zsh @@ -0,0 +1,95 @@ +# Package management +alias fly='flyctl' +alias yay="paru --bottomup" +alias yeet="sudo pacman -Rns" +alias orphan="doas pacman -Rns (pacman -Qtdq)" + +# Navigation shortcuts +alias dc="cd" +alias gD="cd ~/Desktop" +alias gd="cd ~/Downloads" +alias gr="cd ~/Development/" +alias gs="cd ~/Sync" +alias gdot="cd ~/dotfiles" +alias gkey="cd ~/.local/share/keyrings/" +alias gt="cd ~/Dev/" +alias gpi='cd ~/Development/pi' +alias gtt='cd ~/Development/tecnologo' +alias nubceo='cd ~/Development/nubceo' +alias vairix='cd ~/Development/vairix' +alias seekr='cd ~/Development/seekr' + +# File operations/utilities +alias df="duf" +alias mkdir="mkdir -pv" +alias chmox="chmod +x" +alias lf="yazi" +alias slides=presenterm +alias lll='ls -l `find . -maxdepth 1 -type l -print`' +alias syncRepo="git fetch --all; git reset --hard origin/master" + +# System commands +alias src='exec zsh' +alias k="kubectl" +alias ks="kubens" +alias kx="kubectx" +alias yta="youtube-dl --add-metadata -xic" + +# Development tools +alias vim='nvim' +alias v='vim' +alias tf='terraform' +alias g='git' +alias gho="gh browse" +alias gh-clone='gc' +alias task='go-task' +alias sdu='sdm-ui fzf' +alias fd='/bin/fd' + + +# Tmux +alias tmux='TERM=xterm-256color tmux -f "$XDG_CONFIG_HOME"/tmux/tmux.conf' +alias ts="tmux ls" +alias ta="tmux attach -t default || tmux new -s default" + +# Configuration editing shortcuts +alias tmuxrc="vim $XDG_CONFIG_HOME/tmux/tmux.conf" +alias doomconf="vim ~/.config/gzdoom/gzdoom.ini" +alias pluginconf="vim ~/.config/nvim/plugins.vim" +alias i3conf="vim ~/.config/i3/config" +alias cssh="vim ~/.ssh/config" +alias vd='vim -c ":VimwikiMakeDiaryNote"' +alias vw='vim -c ":VimwikiIndex"' + +# Clipboard operations - with auto-detection +if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + alias copy="wl-copy" + alias paste="wl-paste" +else + alias copy="xclip -selection clipboard" + alias paste="xclip -selection clipboard -o" +fi + +# Work related +alias sstack='cd ~/Dev/stuzo/oc-docker-compose; docker-compose up postgres redis rabbitmq' + +# Chezmoi shorthand +alias ch='chezmoi' + +# Aesthetics +alias next='feh --no-fehbg -z --bg-scale ~/Pictures/*' + +command -v eza >/dev/null 2>&1 || { echo "ERROR: 'eza' not found"; return; } + +# Set up aliases with 'eza' +alias ls='eza --group-directories-first --icons=always' + +# Use '--git' flag if supported +if eza --version | grep -q '+git'; then + alias ll='ls -lh --git' +else + alias ll='ls -lh' +fi + +alias la='ll -a' +alias tree='ll --tree --level=2' diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh new file mode 100644 index 0000000..fe46e68 --- /dev/null +++ b/zsh/.config/zsh/functions.zsh @@ -0,0 +1,293 @@ +# Lazy load zoxide +z() { + # Remove the placeholder function + unfunction "$0" + + # Load zoxide + eval "$(zoxide init zsh)" + + # Execute the command + $0 "$@" +} + +# Ensure we have all the zoxide command variants covered +zi() { z "$@" } +za() { z "$@" } +zrm() { zoxide remove "$@" } + +function _package_manager { + local pkg_manager="" + if [[ -f bun.lockb ]]; then + pkg_manager="bun" + elif [[ -f pnpm-lock.yaml ]]; then + pkg_manager="pnpm" + elif [[ -f yarn.lock ]]; then + pkg_manager="yarn" + elif [[ -f package-lock.json ]]; then + pkg_manager="npm" + else + pkg_manager="pnpm" + fi + + # Check if the first argument is a script in package.json + if [[ -f package.json ]] && [[ $1 != "run" ]] && [[ $1 != "install" ]] && [[ $1 != "add" ]] && [[ $1 != "remove" ]] && [[ $1 != "i" ]] && [[ $1 != "rm" ]]; then + # Check if the command exists in package.json scripts using jq + if jq -e ".scripts[\"$1\"] != null" package.json >/dev/null 2>&1; then + set -- "run" "$@" + fi + fi + + # Use corepack when available + if command -v corepack >/dev/null 2>&1; then + corepack ${pkg_manager} "$@" + else + command ${pkg_manager} "$@" + fi +} + +yarn() { echo ๐Ÿ–•; } +yarnpkg() { echo ๐Ÿ–•; } +pnpm() { echo ๐Ÿ–•; } +pn() { echo ๐Ÿ–•; } +pnpx() { echo ๐Ÿ–•; } +npm() { echo ๐Ÿ–•; } + +alias p='_package_manager' + +alias unChonk="echo '๐Ÿงน Starting the great node_modules purge...' && find . -name 'node_modules' -type d -prune -exec sh -c 'echo \"๐Ÿ’ฅ Deleting {}\" && rm -rf \"{}\"' \;" + +# Open files using system default application +function open { + for i in $* + do + setsid nohup xdg-open $i > /dev/null 2> /dev/null + done +} + +function upload_file() { + if [[ -z "$1" ]]; then + echo "Usage: $0 " + return 1 + fi + if [[ ! -f "$1" ]]; then + echo "Error: File not found: $1" + return 1 + fi + + # local url="https://dump.mz.uy" + local url="http://localhost:8080" + echo "Uploading $1 to $url..." + local full_response=$(curl -i -F"file=@$1" -F"one_time=" "$url") + local url_response=$(echo "$full_response" | tail -n 1) + local token=$(echo "$full_response" | grep -i "X-Token:" | awk '{print $2}' | tr -d '\r') + + if [[ -n "$url_response" ]]; then + echo -n "$url_response" | wl-copy # Wayland + echo "โœ“ Uploaded: $url_response (copied to clipboard)" + + if [[ -n "$token" ]]; then + echo "Management token: $token" + fi + else + echo "ร— Failed to upload file" + return 1 + fi +} + +# Create both commands as aliases to the same function +alias drop='upload_file' +alias dump='upload_file' + + +# Wacom tablet configuration +function wacom { + if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + systemctl --user enable opentabletdriver --now + otd loadsettings ~/Sync/wacom/wacom.json + else + # Reset area and map the stylus to DisplayPort-0, then rotate + xsetwacom --set "Wacom One by Wacom S Pen stylus" ResetArea + xsetwacom --set "Wacom One by Wacom S Pen stylus" MapToOutput DisplayPort-0 + xsetwacom --set "Wacom One by Wacom S Pen stylus" Rotate half + + # Reset area and map the eraser to DisplayPort-0 + xsetwacom --set "Wacom One by Wacom S Pen eraser" ResetArea + xsetwacom --set "Wacom One by Wacom S Pen eraser" MapToOutput DisplayPort-0 + fi +} + +# Enhanced git clone function +function gc { + if [[ "$1" == */* ]] + then + git clone "https://github.com/$1" "${@:2}" + else + git clone "https://github.com/marianozunino/$1" "${@:2}" + fi +} + +# Improved file sharing with croc +function croc-send { + croc send --code mzunino "$@" +} + +function croc-receive { + croc --yes mzunino +} + +# Fix swaymsg when inside tmux +if [[ -v TMUX ]]; then + function swaymsg { + export SWAYSOCK=$XDG_RUNTIME_DIR/sway-ipc.$UID.$(pgrep -x sway).sock + command swaymsg "$@" + } +fi + +# Expose local port to internet +function expose() { + if [ -z "$1" ]; then + echo "Usage: expose " + return + fi + ssh marianozunino@srv.us -R 1:localhost:$1 +} + +# Helper function for command existence check +function _has { + return $( whence $1 >/dev/null ) +} + +# Sublime merge shortcut +function sm { + /opt/sublime_merge/sublime_merge $1 +} + +# Edit nvim config +function vimrc { + cd $XDG_CONFIG_HOME/nvim + nvim + cd - +} + +# Edit zsh config +function zshrc { + cd $XDG_CONFIG_HOME/zsh + nvim + cd - +} + +# Find process using a port +function ppid { + lsof -i :$1 +} + +alias pport=ppid + +# Kubernetes port forwarding helper +function kf { + if [ -z "$1" ]; then + echo "Usage: kf [service-name]" + return + fi + + local namespace="oc-app" + local cluster="oc-$1-eks-cluster" + local svc_filter="" + + if [ ! -z "$2" ]; then + svc_filter="-l app.kubernetes.io/instance=$2" + fi + + sudo -E kubefwd svc -n ${namespace} -x ${cluster} ${svc_filter} +} + +function cat { + if [ -n "$SSH_TTY" ] || [ -n "$SSH_CLIENT" ] || [ -n "$SSH_CONNECTION" ]; then + bat --plain --paging=never "$@" + else + bat "$@" + fi +} + +# Enhanced PrivateBin sharing function +function pb { + local usage="Usage: pb [-b] [-e ] " + local burn_after_reading=false + local expiration="1week" + + while getopts ":be:" opt; do + case ${opt} in + b ) + burn_after_reading=true + ;; + e ) + expiration=$OPTARG + ;; + \? ) + echo "Invalid option: -$OPTARG" >&2 + echo $usage + return 1 + ;; + : ) + echo "Option -$OPTARG requires an argument." >&2 + echo $usage + return 1 + ;; + esac + done + shift $((OPTIND -1)) + + if [ $# -eq 0 ]; then + echo $usage + return 1 + fi + + local file=$1 + if [ ! -f "$file" ]; then + echo "Error: File '$file' not found." >&2 + return 1 + fi + + # Check for required commands + for cmd in privatebin wl-copy; do + if ! command -v $cmd &> /dev/null; then + echo "Error: '$cmd' command not found. Please install it." >&2 + return 1 + fi + done + + # Prepare the command + local cmd="privatebin create --filename $file --expire $expiration" + if $burn_after_reading; then + cmd="$cmd --burn-after-reading" + fi + + # Run command and handle result + local result + result=$(eval "$cmd" 2>&1) + if [ $? -ne 0 ]; then + echo "Error: Failed to upload file to PrivateBin. Details:" >&2 + echo "$result" >&2 + return 1 + fi + + echo $result + echo "$result" | wl-copy + echo "PrivateBin link copied to clipboard." + notify-send "PrivateBin" "Link copied to clipboard" 2>/dev/null || true +} + +# Load autocomplete files +for completion_file in ~/.local/share/zsh/*-autocomplete.zsh; do + if [ -f "$completion_file" ]; then + source "$completion_file" + fi +done + +# Initialize completions for common tools +if command -v rop &> /dev/null; then eval "$(rop completion zsh)"; fi +if command -v goq &> /dev/null; then eval "$(goq completion zsh)"; fi +if command -v kubefwd &> /dev/null; then eval "$(kubefwd completion zsh)"; fi +if command -v bombadil &> /dev/null; then eval "$(bombadil generate-completions zsh)"; fi +if command -v eza &> /dev/null; then compdef eza=ls; fi + diff --git a/zsh/.config/zsh/init.zsh b/zsh/.config/zsh/init.zsh new file mode 100644 index 0000000..74363c6 --- /dev/null +++ b/zsh/.config/zsh/init.zsh @@ -0,0 +1,56 @@ +PLUGIN_DIR="$HOME/.local/share/zsh/plugins" +PLUGIN_LOCK="$PLUGIN_DIR/.plugins.lock" +[ -d "$PLUGIN_DIR" ] || mkdir -p "$PLUGIN_DIR" + +# Reinstall function +update-plugins() { + rm -fr "$PLUGIN_DIR" + echo "Plugin lock removed. Restart your shell to reinstall plugins." +} + +# Define plugins: "github_repo name" +plugins=( + "romkatv/zsh-defer" + "zsh-users/zsh-autosuggestions" + "hlissner/zsh-autopair" + "zsh-users/zsh-history-substring-search" + "Aloxaf/fzf-tab" + "junegunn/fzf" + "subnixr/minimal" + "zap-zsh/vim" + "zsh-users/zsh-syntax-highlighting" +) + +# Only install plugins if lock file doesn't exist +if [ ! -f "$PLUGIN_LOCK" ]; then + for plugin in "${plugins[@]}"; do + plugin_name=${plugin##*/} + if [ ! -d "$PLUGIN_DIR/$plugin_name" ]; then + echo "Installing $plugin_name" + git clone --quiet "https://github.com/$plugin" "$PLUGIN_DIR/$plugin_name" --depth=1 + fi + done + date > "$PLUGIN_LOCK" +fi + +# Source plugins +source "$PLUGIN_DIR/zsh-defer/zsh-defer.plugin.zsh" +source "$PLUGIN_DIR/zsh-autosuggestions/zsh-autosuggestions.zsh" +source "$PLUGIN_DIR/zsh-autopair/autopair.zsh" +source "$PLUGIN_DIR/zsh-history-substring-search/zsh-history-substring-search.zsh" +source "$PLUGIN_DIR/fzf-tab/fzf-tab.plugin.zsh" +source "$PLUGIN_DIR/fzf/shell/completion.zsh" +source "$PLUGIN_DIR/fzf/shell/key-bindings.zsh" +source "$PLUGIN_DIR/minimal/minimal.zsh" +source "$PLUGIN_DIR/vim/vim.plugin.zsh" + +# Source config files +source "$ZDOTDIR/opts.zsh" +source "$ZDOTDIR/rose-pine.sh" +source "$ZDOTDIR/maintenance.zsh" + +# Defer loading +zsh-defer source "$PLUGIN_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" +for config in mise.zsh tmux.zsh functions.zsh alias.zsh keymap.zsh path.zsh pnpm.zsh opts.zsh; do + zsh-defer source "$ZDOTDIR/$config" +done diff --git a/zsh/.config/zsh/keymap.zsh b/zsh/.config/zsh/keymap.zsh new file mode 100644 index 0000000..b360774 --- /dev/null +++ b/zsh/.config/zsh/keymap.zsh @@ -0,0 +1,75 @@ +# ===== History Navigation ===== +# Setup fuzzy history search with up/down keys + +# Up arrow/k - search history forward +autoload -U up-line-or-beginning-search +zle -N up-line-or-beginning-search + +# Down arrow/j - search history backward +autoload -U down-line-or-beginning-search +zle -N down-line-or-beginning-search + +# Bind keys in both vicmd and viins modes +# vicmd = vi command mode, viins = vi insert mode +bindkey -M vicmd "k" up-line-or-beginning-search +bindkey -M vicmd "^k" up-line-or-beginning-search +bindkey -M viins "^k" up-line-or-beginning-search +bindkey -M viins "^[[A" up-line-or-beginning-search # Up arrow key + +bindkey -M vicmd "j" down-line-or-beginning-search +bindkey -M vicmd "^j" down-line-or-beginning-search +bindkey -M viins "^j" down-line-or-beginning-search +bindkey -M viins "^[[B" down-line-or-beginning-search # Down arrow key + +# ===== System Clipboard Integration ===== +# Enhanced yank that copies to system clipboard + +function vi-yank-clipboard() { + # First perform the normal vi-yank operation + zle vi-yank + + # Only copy if there's content in the cut buffer + if [[ -n "$CUTBUFFER" ]]; then + # Detect the environment and use appropriate clipboard command + if [[ "$XDG_SESSION_TYPE" == "wayland" ]] && command -v wl-copy >/dev/null; then + echo -n "$CUTBUFFER" | wl-copy + elif command -v xclip >/dev/null; then + echo -n "$CUTBUFFER" | xclip -selection clipboard + elif command -v pbcopy >/dev/null; then + # For macOS + echo -n "$CUTBUFFER" | pbcopy + fi + fi +} + +# Register the function and bind it +zle -N vi-yank-clipboard +bindkey -M vicmd "y" vi-yank-clipboard + +# ===== Command Line Editing ===== +# Edit command in external editor + +# Load the function and register it +autoload -U edit-command-line +zle -N edit-command-line + +# Bind 'v' in command mode to open editor +bindkey -M vicmd "v" edit-command-line + +# ===== Additional Useful Bindings ===== + +# Ctrl+Space to accept autosuggestion +bindkey '^ ' autosuggest-accept + +# Ctrl+e to edit command in editor from any mode +bindkey '^e' edit-command-line + +# Ensure backspace and delete work as expected +bindkey '^?' backward-delete-char +bindkey "^[[3~" delete-char + +# Home/End keys +bindkey "^[[H" beginning-of-line +bindkey "^[[F" end-of-line +bindkey "^[[1~" beginning-of-line +bindkey "^[[4~" end-of-line diff --git a/zsh/.config/zsh/maintenance.zsh b/zsh/.config/zsh/maintenance.zsh new file mode 100644 index 0000000..d0a5507 --- /dev/null +++ b/zsh/.config/zsh/maintenance.zsh @@ -0,0 +1,69 @@ +#!/usr/bin/env zsh + +# Configuration +MAINTENANCE_SCRIPT="$HOME/.local/bin/maintenance.sh" +TIMESTAMP_FILE="$HOME/.local/share/arch_maintenance_timestamp" +INTERVAL=7 + +if [ ! -f "$MAINTENANCE_SCRIPT" ]; then + echo "Maintenance script not found at $MAINTENANCE_SCRIPT" + return 0 +fi + +if [ -f "$TIMESTAMP_FILE" ]; then + LAST_RUN=$(cat $TIMESTAMP_FILE) + CURRENT_TIME=$(date +%s) + DAYS_DIFF=$(( (CURRENT_TIME - LAST_RUN) / 86400 )) + + # Return immediately if maintenance not due + [ $DAYS_DIFF -lt $INTERVAL ] && return 0 +else + # Create timestamp file if missing (first run) + echo $(($(date +%s) - ${INTERVAL}*86400 - 1)) > $TIMESTAMP_FILE + DAYS_DIFF=$INTERVAL # Set for first run +fi + +# Simple output functions that work with or without gum +print_styled() { + if command -v gum &> /dev/null; then + gum style "$@" + else + echo "$1" + fi +} + +ask_confirm() { + if command -v gum &> /dev/null; then + gum confirm "$1" + else + echo "$1 (y/n)" + read -k 1 REPLY + echo "" + [[ $REPLY =~ ^[Yy]$ ]] + fi +} + +# Function to run maintenance script +run_maintenance() { + print_styled "Running system maintenance script..." + + if sudo $MAINTENANCE_SCRIPT; then + date +%s > $TIMESTAMP_FILE + print_styled "โœ“ Maintenance completed successfully." + else + print_styled "โœ— Maintenance script failed. Please check the output and run it manually." + fi +} + +# Display maintenance notification +echo "" +print_styled "โš ๏ธ It's been $DAYS_DIFF days since your last system maintenance" + +if ask_confirm "Would you like to run maintenance now?"; then + run_maintenance +else + print_styled "Maintenance skipped. You'll be reminded next time you start your shell." + print_styled "To run manually: sudo $MAINTENANCE_SCRIPT" +fi + +return 0 diff --git a/zsh/.config/zsh/mise.zsh b/zsh/.config/zsh/mise.zsh new file mode 100644 index 0000000..1bf1853 --- /dev/null +++ b/zsh/.config/zsh/mise.zsh @@ -0,0 +1,59 @@ +# Source it +eval "$(/home/forbi/.local/bin/mise activate zsh)" + +# Install mise if not present +if ! command -v mise &> /dev/null +then + echo "Installing mise..." + mkdir -p ~/.local/bin + curl https://mise.jdx.dev/mise-latest-linux-x64 > ~/.local/bin/mise + chmod +x ~/.local/bin/mise + ~/.local/bin/mise install +fi + + +#compdef mise +local curcontext="$curcontext" + +# caching config +_usage_mise_cache_policy() { + if [[ -z "${lifetime}" ]]; then + lifetime=$((60*60*4)) # 4 hours + fi + local -a oldp + oldp=( "$1"(Nms+${lifetime}) ) + (( $#oldp )) +} + +_mise() { + typeset -A opt_args + local curcontext="$curcontext" spec cache_policy + + if ! command -v usage &> /dev/null; then + echo >&2 + echo "Error: usage CLI not found. This is required for completions to work in mise." >&2 + echo "See https://usage.jdx.dev for more information." >&2 + return 1 + fi + + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z $cache_policy ]]; then + zstyle ":completion:${curcontext}:" cache-policy _usage_mise_cache_policy + fi + + if ( [[ -z "${_usage_mise_spec:-}" ]] || _cache_invalid _usage_mise_spec ) \ + && ! _retrieve_cache _usage_mise_spec; + then + spec="$(mise usage)" + _store_cache _usage_mise_spec spec + fi + + _arguments "*: :(($(usage complete-word --shell zsh -s "$spec" -- "${words[@]}" )))" + return 0 +} + +if [ "$funcstack[1]" = "_mise" ]; then + _mise "$@" +else + compdef _mise mise +fi diff --git a/zsh/.config/zsh/opts.zsh b/zsh/.config/zsh/opts.zsh new file mode 100644 index 0000000..341bd0f --- /dev/null +++ b/zsh/.config/zsh/opts.zsh @@ -0,0 +1,34 @@ +# History Config +setopt interactivecomments +setopt EXTENDED_HISTORY +setopt HIST_EXPIRE_DUPS_FIRST +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_IGNORE_SPACE +setopt HIST_FIND_NO_DUPS +setopt HIST_SAVE_NO_DUPS +setopt HIST_BEEP +setopt INC_APPEND_HISTORY +setopt HIST_FCNTL_LOCK +setopt SHARE_HISTORY +setopt AUTO_CD + +HISTORY_IGNORE='(*.git/hooks*)' +LESSHISTFILE="-" +HISTFILE="$ZDOTDIR/zsh_history_$HOST" +HISTFILESIZE=100000 +HISTSIZE=100000 +SAVEHIST=100000 + +MNML_INFOLN=() +MNML_PROMPT=(mnml_ssh mnml_status 'mnml_cwd 2 0' mnml_git mnml_keymap ) +MNML_RPROMPT=() +MNML_NORMAL_CHAR="โ—‰" + +# Environment variables +export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' +export FZF_DEFAULT_COMMAND='fd --type f' + +export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 +export COREPACK_ENABLE_NETWORK_RESOLUTION=1 +export COREPACK_ENABLE_STRICT_VERIFICATION=0 diff --git a/zsh/.config/zsh/path.zsh b/zsh/.config/zsh/path.zsh new file mode 100644 index 0000000..7628382 --- /dev/null +++ b/zsh/.config/zsh/path.zsh @@ -0,0 +1,37 @@ +# Efficient PATH management + +function update_path() { + # Define directories to add to PATH + local dirs=( + "/usr/local/texlive/2024/bin/x86_64-linux" + "$HOME/.local/bin" + "$HOME/.bin" + "$HOME/.dotnet/tools" + "$HOME/.local/share/npm/bin" + "$HOME/.local/share/cargo/bin" + ) + + # Prepare new PATH variable + local new_path="" + + # Add directories if they exist + for dir in "${dirs[@]}"; do + if [ -d "$dir" ]; then + new_path="${new_path:+$new_path:}$dir" + fi + done + + # Set PATH with current values if they don't already exist in the path + if [[ -n "$new_path" ]]; then + export PATH="$new_path:$PATH" + fi + + # Set MANPATH and INFOPATH if texlive directory exists + if [ -d "/usr/local/texlive/2024/texmf-dist/doc/man" ]; then + export MANPATH="/usr/local/texlive/2024/texmf-dist/doc/man:${MANPATH:-}" + export INFOPATH="/usr/local/texlive/2024/texmf-dist/doc/info:${INFOPATH:-}" + fi +} + +# Run the function +update_path diff --git a/zsh/.config/zsh/pnpm.zsh b/zsh/.config/zsh/pnpm.zsh new file mode 100644 index 0000000..d92507c --- /dev/null +++ b/zsh/.config/zsh/pnpm.zsh @@ -0,0 +1,5 @@ +export PNPM_HOME="/home/$HOME/.local/share/pnpm" +case ":$PATH:" in + *":$PNPM_HOME:"*) ;; + *) export PATH="$PNPM_HOME:$PATH" ;; +esac diff --git a/zsh/.config/zsh/rose-pine.sh b/zsh/.config/zsh/rose-pine.sh new file mode 100644 index 0000000..318619b --- /dev/null +++ b/zsh/.config/zsh/rose-pine.sh @@ -0,0 +1,128 @@ +#{ +# Shell Color Setup Template +# Chris Kempson (http://chriskempson.com) +#}#!/bin/sh +# Base16 Rosรฉ Pine - Shell color setup script +# Emilia Dunfelt + +if [ "${TERM%%-*}" = 'linux' ]; then + # This script doesn't support linux console (use 'vconsole' template instead) + return 2>/dev/null || exit 0 +fi + +color00="19/17/24" # Base 00 - Black +color01="eb/6f/92" # Base 08 - Red +color02="31/74/8f" # Base 0B - Green +color03="eb/bc/ba" # Base 0A - Yellow +color04="c4/a7/e7" # Base 0D - Blue +color05="f6/c1/77" # Base 0E - Magenta +color06="9c/cf/d8" # Base 0C - Cyan +color07="e0/de/f4" # Base 05 - White +color08="6e/6a/86" # Base 03 - Bright Black +color09=$color01 # Base 08 - Bright Red +color10=$color02 # Base 0B - Bright Green +color11=$color03 # Base 0A - Bright Yellow +color12=$color04 # Base 0D - Bright Blue +color13=$color05 # Base 0E - Bright Magenta +color14=$color06 # Base 0C - Bright Cyan +color15="52/4f/67" # Base 07 - Bright White +color16="f6/c1/77" # Base 09 +color17="52/4f/67" # Base 0F +color18="1f/1d/2e" # Base 01 +color19="26/23/3a" # Base 02 +color20="90/8c/aa" # Base 04 +color21="e0/de/f4" # Base 06 +color_foreground="e0/de/f4" # Base 05 +color_background="19/17/24" # Base 00 +color_cursor="e0/de/f4" # Base 05 + +if [ -n "$TMUX" ]; then + # tell tmux to pass the escape sequences through + # (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) + printf_template="\033Ptmux;\033\033]4;%d;rgb:%s\007\033\\" + printf_template_var="\033Ptmux;\033\033]%d;rgb:%s\007\033\\" + printf_template_custom="\033Ptmux;\033\033]%s%s\007\033\\" +elif [ "${TERM%%-*}" = "screen" ]; then + # GNU screen (screen, screen-256color, screen-256color-bce) + printf_template="\033P\033]4;%d;rgb:%s\007\033\\" + printf_template_var="\033P\033]%d;rgb:%s\007\033\\" + printf_template_custom="\033P\033]%s%s\007\033\\" +elif [ -n "${-##*i*}" ]; then + # non-interactive + alias printf=/bin/false +else + printf_template="\033]4;%d;rgb:%s\033\\" + printf_template_var="\033]%d;rgb:%s\033\\" + printf_template_custom="\033]%s%s\033\\" +fi + +# 16 color space +printf $printf_template 0 $color00 +printf $printf_template 1 $color01 +printf $printf_template 2 $color02 +printf $printf_template 3 $color03 +printf $printf_template 4 $color04 +printf $printf_template 5 $color05 +printf $printf_template 6 $color06 +printf $printf_template 7 $color07 +printf $printf_template 8 $color08 +printf $printf_template 9 $color09 +printf $printf_template 10 $color10 +printf $printf_template 11 $color11 +printf $printf_template 12 $color12 +printf $printf_template 13 $color13 +printf $printf_template 14 $color14 +printf $printf_template 15 $color15 + +# 256 color space +printf $printf_template 16 $color16 +printf $printf_template 17 $color17 +printf $printf_template 18 $color18 +printf $printf_template 19 $color19 +printf $printf_template 20 $color20 +printf $printf_template 21 $color21 + +# foreground / background / cursor color +if [ -n "$ITERM_SESSION_ID" ]; then + # iTerm2 proprietary escape codes + printf $printf_template_custom Pg e0def4 # forground + printf $printf_template_custom Ph 191724 # background + printf $printf_template_custom Pi e0def4 # bold color + printf $printf_template_custom Pj 26233a # selection color + printf $printf_template_custom Pk e0def4 # selected text color + printf $printf_template_custom Pl e0def4 # cursor + printf $printf_template_custom Pm 191724 # cursor text +else + printf $printf_template_var 10 $color_foreground + printf $printf_template_var 11 $color_background + printf $printf_template_custom 12 ";7" # cursor (reverse video) +fi + +# clean up +unset printf_template +unset printf_template_var +unset color00 +unset color01 +unset color02 +unset color03 +unset color04 +unset color05 +unset color06 +unset color07 +unset color08 +unset color09 +unset color10 +unset color11 +unset color12 +unset color13 +unset color14 +unset color15 +unset color16 +unset color17 +unset color18 +unset color19 +unset color20 +unset color21 +unset color_foreground +unset color_background +unset color_cursor diff --git a/zsh/.config/zsh/tmux.zsh b/zsh/.config/zsh/tmux.zsh new file mode 100644 index 0000000..cf09f8d --- /dev/null +++ b/zsh/.config/zsh/tmux.zsh @@ -0,0 +1,41 @@ +if [ -z "$TMUX" ]; then + # If we're in SSH + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + echo "Welcome via SSH..." + # If we're in a TTY without X + elif [ -z "$DISPLAY" ]; then + # Optional X start code commented out + # echo "Start X? ..." + # startx + # Regular terminal with no tmux + else + tmux_sessions=$(tmux ls 2>/dev/null) + tmux_status=$? + if [ $tmux_status -ne 0 ]; then + echo "Press any key to cancel tmux autostart..." + read -t 0.7 -n 1 -s -r + if [ $? -ne 0 ]; then + tmux new -s default + fi + else + tmux attach -t default || tmux new -s default + fi + fi +fi + +# tmux project launcher function +function tmuxLauncher { + selected_dir=$(/bin/fd --base-directory ~/Dev --search-path . -t d -d 2 | fzf) + if [[ -n "$selected_dir" ]]; then + if git rev-parse --git-dir &>/dev/null; then + tmux rename-window "$selected_dir" + cd "$HOME/Dev/$selected_dir" + else + tmux new-window -n "$selected_dir" -c "$HOME/Dev/$selected_dir" + fi + fi + zle reset-prompt +} + +zle -N tmuxLauncher +bindkey "^t" tmuxLauncher diff --git a/zsh/.config/zsh/zsh_history_T14 b/zsh/.config/zsh/zsh_history_T14 new file mode 100644 index 0000000..7516939 Binary files /dev/null and b/zsh/.config/zsh/zsh_history_T14 differ diff --git a/zsh/.config/zsh/zsh_history_main b/zsh/.config/zsh/zsh_history_main new file mode 100644 index 0000000..c5fd981 Binary files /dev/null and b/zsh/.config/zsh/zsh_history_main differ diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 0000000..0c33138 --- /dev/null +++ b/zsh/.zshenv @@ -0,0 +1,4 @@ +source ~/.config/env + +# If running from tty1 start sway +[ "$(tty)" = "/dev/tty1" ] && exec dbus-run-session sway