From 9f5c7c826f59db604fe5b795561d63f56b05124b Mon Sep 17 00:00:00 2001 From: punkfairie <23287005+punkfairie@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:36:27 -0700 Subject: [PATCH] Update .chezmoi.toml Update .chezmoiignore Add .chezmoiremove Remove .bash_logout Remove .bash_profile Update .config/fish/functions/batt.fish Update .config/fish/functions/extract.fish Update .local/bin/get-gpg-key Update .xprofile Change attributes of .config/xrandr/desktop.sh Change attributes of .gnupg/gpg-agent.conf --- .chezmoi.toml.tmpl | 4 +- .chezmoiignore | 43 ++++++++-------- .chezmoiremove | 2 + dot_bash_logout | 3 -- dot_bash_profile | 5 -- dot_config/fish/functions/batt.fish | 8 +-- dot_config/fish/functions/extract.fish | 49 ++++++++++++++----- .../xrandr}/executable_desktop.sh | 0 dot_local/bin/executable_get-gpg-key | 13 +++-- dot_xprofile.tmpl | 12 +++-- ...agent.conf => private_gpg-agent.conf.tmpl} | 2 + 11 files changed, 81 insertions(+), 60 deletions(-) create mode 100644 .chezmoiremove delete mode 100644 dot_bash_logout delete mode 100644 dot_bash_profile rename {dot_screenlayout => dot_config/xrandr}/executable_desktop.sh (100%) rename private_dot_gnupg/{private_gpg-agent.conf => private_gpg-agent.conf.tmpl} (73%) diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index ebf34a1..c08f79c 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -28,9 +28,7 @@ autoPush = true command = ".local/share/chezmoi/.install-bw.sh" [data] -{{ if lookPath "get-gpg-key" -}} -gpgKey = {{ output "get-gpg-key" | trim | quote }} -{{ end -}} +gpgKey = {{ output (joinPath .chezmoi.sourceDir "dot_local/bin/executable_get-gpg-key") | trim | quote }} passphrase = {{ $passphrase | quote }} osid = {{ $osid | quote }} {{ if eq $osid "linux-debian" -}} diff --git a/.chezmoiignore b/.chezmoiignore index 4af4988..931618c 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -7,38 +7,40 @@ tags* {{- end }} {{- if .isServer }} +.config/awesome +.config/cava .config/composer +.config/dunst +.config/fehbg .config/firefox .config/fish/conf.d/30-gtk.fish .config/fish/conf.d/30-qt.fish .config/gtk-3.0 .config/gtk-4.0 -.config/nvim/lua/plugins/diffview.lua -.config/nvim/lua/plugins/dim.lua -.config/nvim/lua/plugins/gitsigns.lua -.config/nvim/lua/plugins/lazygit.lua -.config/nvim/lua/plugins/nerdy.lua -.config/nvim/lua/plugins/nvim-devdocs.lua -.config/nvim/lua/plugins/refactoring.lua -.config/nvim/lua/plugins/ssr.lua -.config/nvim/lua/plugins/vim-blade.lua -.config/transmission +.config/i3 +.config/mpd +.config/ncmpcpp +.config/openrazer +.config/picom +.config/polybar +.config/razercommander +.config/rofi +.config/wezterm .config/zathura .icons {{- end }} {{- if ne .osid "darwin" }} -.config/fish/conf.d/30-python.fish .config/packages/Brewfile {{- end }} {{- if ne .chezmoi.os "linux" }} .config/fish/conf.d/30-gtk.fish -.config/fish/conf.d/30-journalctl.fish .config/fish/conf.d/30-qt.fish -.config/fish/conf.d/30-systemctl.fish .config/gtk-3.0 .config/gtk-4.0 +.config/mpd +.config/ncmpcpp .config/openrazer .config/razercommander .config/zathura @@ -47,19 +49,18 @@ tags* {{- if ne .osid "linux-arch" }} .config/awesome -.config/fish/conf.d/30-yay.fish -.config/fish/functions/pkgsearch.fish -.config/mopidy -.config/ncmpcpp +.config/copyq +.config/dunst +.config/fehbg +.config/i3 .config/packages/arch* .config/pacman -.config/qalculate +.config/picom +.config/polybar .config/rofi .config/yay -.config/.fehbg -.config/picom.conf +.config/xrandr .local/bin/update-package-list -.screenlayout .xprofile .Xresources {{- end }} diff --git a/.chezmoiremove b/.chezmoiremove new file mode 100644 index 0000000..793846d --- /dev/null +++ b/.chezmoiremove @@ -0,0 +1,2 @@ +.bash_logout +.bash_profile diff --git a/dot_bash_logout b/dot_bash_logout deleted file mode 100644 index 0e4e4f1..0000000 --- a/dot_bash_logout +++ /dev/null @@ -1,3 +0,0 @@ -# -# ~/.bash_logout -# diff --git a/dot_bash_profile b/dot_bash_profile deleted file mode 100644 index 5545f00..0000000 --- a/dot_bash_profile +++ /dev/null @@ -1,5 +0,0 @@ -# -# ~/.bash_profile -# - -[[ -f ~/.bashrc ]] && . ~/.bashrc diff --git a/dot_config/fish/functions/batt.fish b/dot_config/fish/functions/batt.fish index 98fc014..cfaa6a5 100644 --- a/dot_config/fish/functions/batt.fish +++ b/dot_config/fish/functions/batt.fish @@ -1,6 +1,8 @@ #!/usr/bin/env fish -function batt -d "Check battery percentage" - upower -i /org/freedesktop/UPower/devices/battery_BAT0 \ - | grep -E "state|time to|percentage" +if command -v upower &>/dev/null + function batt -d "Check battery percentage" + upower -i /org/freedesktop/UPower/devices/battery_BAT0 \ + | grep -E "state|time to|percentage" + end end diff --git a/dot_config/fish/functions/extract.fish b/dot_config/fish/functions/extract.fish index c51c0af..4c2ed14 100644 --- a/dot_config/fish/functions/extract.fish +++ b/dot_config/fish/functions/extract.fish @@ -1,7 +1,17 @@ #!/usr/bin/env fish # Extracts archived files / mounts disk images. -# Usage: extract +# Usage: extract + +function run_cmd --argument-names cmd + set -f cmd_name (string split -f1 ' ' "$cmd") + + if command -v "$cmd" &>/dev/null + eval "$cmd" + else + printf "Please install %s to extract this file.\n" "$cmd_name" + end +end function extract -a file set --erase argv[1] @@ -9,35 +19,48 @@ function extract -a file if test -f "$file" switch "$file" case "*.tar.bz2" - tar -jxvf $argv "$file" + run_cmd "tar -jxvf $argv $file" + case "*.tar.gz" - tar -zxvf $argv "$file" + run_cmd "tar -zxvf $argv $file" + case "*.bz2" - bunzip2 $argv "$file" + run_cmd "bunzip2 $argv $file" + case "*.dmg" if test "$(uname)" = Darwin hdiutil mount "$file" end + case "*.gz" - gunzip $argv "$file" + run_cmd "gunzip $argv $file" + case "*.tar" - tar -xvf $argv "$file" + run_cmd "tar -xvf $argv $file" + case "*.tbz2" - tar -jxvf $argv "$file" + run_cmd "tar -jxvf $argv $file" + case "*.tgz" - tar -zxvf $argv "$file" + run_cmd "tar -zxvf $argv $file" + case "*.zip" "*.ZIP" set -f dir (string replace --ignore-case '.zip' '') mkdir "$dir" - unzip $argv "$file" -d "$dir" + run_cmd "unzip $argv $file -d $dir" + case "*pax" - cat "$file" | pax -r $argv + run_cmd "cat $file | pax -r $argv" + case "*.pax.Z" - uncompress "$file" --stdout | pax -r $argv + run_cmd "uncompress $file --stdout | pax -r $argv" + case "*.rar" - unrar x "$file" + run_cmd "unrar x $file" + case "*.Z" - uncompress $argv "$file" + run_cmd "uncompress $argv $file" + case "*" echo "'$file' cannot be extracted/mounted via extract()." end diff --git a/dot_screenlayout/executable_desktop.sh b/dot_config/xrandr/executable_desktop.sh similarity index 100% rename from dot_screenlayout/executable_desktop.sh rename to dot_config/xrandr/executable_desktop.sh diff --git a/dot_local/bin/executable_get-gpg-key b/dot_local/bin/executable_get-gpg-key index 9612408..caa5a55 100644 --- a/dot_local/bin/executable_get-gpg-key +++ b/dot_local/bin/executable_get-gpg-key @@ -1,10 +1,9 @@ -#!/usr/bin/env fish +#!/usr/bin/env bash -set -f key (\ - gpg --list-secret-keys --keyid-format SHORT\ - | grep 'rsa4096' \ - | sed 's/sec rsa4096\///'\ - | awk '{print $1}'\ - ) +key="$( + gpg --list-secret-keys --keyid-format SHORT | grep 'rsa4096' \ + | sed 's/sec rsa4096\///' \ + | awk '{print $1}' +)" echo "$key" diff --git a/dot_xprofile.tmpl b/dot_xprofile.tmpl index e79d08b..9dca4d9 100644 --- a/dot_xprofile.tmpl +++ b/dot_xprofile.tmpl @@ -32,22 +32,24 @@ fi # shellcheck disable=all {{- if eq .chezmoi.hostname "archgirlie" }} -"$HOME/.screenlayout/desktop.sh" +"$HOME/.config/xrandr/desktop.sh" {{- end }} +sudo mount -a + +{{ if eq .chezmoi.hostname "archgirlie" -}} +setxkbmap -option "apple:alupckeys" +{{ end -}} + {{ if lookPath "copyq" -}} copyq & {{ end -}} {{ if lookPath "mpd" -}} -sudo mount -a mpd & {{ end -}} {{ if lookPath "numlockx" -}} numlockx on {{ end -}} -{{ if eq .chezmoi.hostname "archgirlie" -}} -setxkbmap -option "apple:alupckeys" -{{ end -}} {{ if lookPath "pidgin" -}} pidgin & {{ end -}} diff --git a/private_dot_gnupg/private_gpg-agent.conf b/private_dot_gnupg/private_gpg-agent.conf.tmpl similarity index 73% rename from private_dot_gnupg/private_gpg-agent.conf rename to private_dot_gnupg/private_gpg-agent.conf.tmpl index ec6706d..0ce47a0 100644 --- a/private_dot_gnupg/private_gpg-agent.conf +++ b/private_dot_gnupg/private_gpg-agent.conf.tmpl @@ -1,4 +1,6 @@ +{{ if lookPath "pinentry-qt5" -}} pinentry-program /usr/bin/pinentry-qt5 +{{ end -}} # Stop asking for password so often. default-cache-ttl 60480000