diff --git a/apps/de/bspwm/wallpapers b/apps/de/bspwm/wallpapers index 317cac8..d5a1bcd 100755 --- a/apps/de/bspwm/wallpapers +++ b/apps/de/bspwm/wallpapers @@ -1,2 +1,2 @@ #!/bin/sh -feh --no-fehbg --bg-scale '/home/daniel/.home/.wallpaper' +feh --no-fehbg --bg-scale '/home/daniel/.home/.wallpaper' diff --git a/apps/de/mako/config b/apps/de/mako/config index f65e8a5..70ef95b 100644 --- a/apps/de/mako/config +++ b/apps/de/mako/config @@ -2,3 +2,12 @@ max-visible=5 default-timeout=30000 background-color=#111111 border-color=#666666 +font=iosevka-lyte 11 +progress-color=source #33333388 +# format="%s +default-timeout=15000 + +[urgency="high"] +background-color=#f92672 +text-color=#111111 +border-color=#f92672 diff --git a/apps/de/sway/config b/apps/de/sway/config index 939b63e..af3a56f 100644 --- a/apps/de/sway/config +++ b/apps/de/sway/config @@ -1,26 +1,43 @@ -set $mod Mod4 +# TODO: +# +# + Super+r should rotate the selected group of windows. +# + Super+Control+{1-9} should control the size of the preselect space. +# + Super+Shift+b should balance the size of all selected nodes. +set $default_gap 20 set $left h set $down j set $up k set $right l - -set $term kitty -# TODO: launcher for wayland -# set $menu app-launcher -set $menu dmenu_path | dmenu | xargs swaymsg exec -- +set $term term +set $fterm floating-term +set $menu app-launcher output * bg $HOME/.wallpaper fill +focus_wrapping no +gaps inner $default_gap +smart_borders on|no_gaps +hide_edge_borders smart_no_gaps +set $mod Mod4 + +bindsym Control+Space exec makoctl dismiss +# bindsym $mod+Control+Space exec makoctl invoke bindsym $mod+Return exec $term +bindsym $mod+shift+Return exec $fterm bindsym $mod+t exec $term bindsym $mod+Alt+Return exec urxvt +bindsym $mod+Shift+Alt+Return exec kitty bindsym $mod+c kill bindsym $mod+Shift+c kill # TODO: kill -9 bindsym $mod+Space exec $menu bindsym $mod+Shift+r reload bindsym $mod+Control+Escape exit bindsym $mod+Shift+e exit +bindsym $mod+Shift+p exec pass-chooser +bindsym $mod+Control+j split v +bindsym $mod+Control+l split h +bindsym $mod+Control+f focus mode_toggle bindsym $mod+$left focus left bindsym $mod+$down focus down @@ -74,8 +91,12 @@ bindsym $mod+e layout toggle split bindsym $mod+Shift+f fullscreen bindsym $mod+f floating toggle +bindsym $mod+s floating disable bindsym $mod+Alt+f focus mode_toggle bindsym $mod+p focus parent +bindsym $mod+period focus child +bindsym $mod+comma focus child +bindsym $mod+tab workspace back_and_forth bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% @@ -89,8 +110,14 @@ bindsym XF86AudioPrev exec playerctl previous bindsym $mod+Shift+v exec pactl set-source-mute @DEFAULT_SOURCE@ toggle -bindsym $mod+Shift+minus move scratchpad -bindsym $mod+minus scratchpad show +bindsym $mod+minus gaps inner current minus 5 +bindsym $mod+plus gaps inner current plus 5 +bindsym $mod+Control+Alt+h gaps horizontal current minus 5 +bindsym $mod+Control+Alt+l gaps horizontal current plus 5 +bindsym $mod+Control+Alt+j gaps vertical current minus 5 +bindsym $mod+Control+Alt+k gaps vertical current plus 5 +# TODO: this should also reset the horizontal and vertical gaps? +bindsym $mod+Control+equal gaps inner current set $default_gap bindsym $mod+Control+Shift+l exec swaylock @@ -109,13 +136,13 @@ mode "resize" { bindsym Escape mode "default" } -default_border none -for_window [app_id="^.*"] border pixel 5 -for_window [class="^.*"] border pixel 5 +default_border pixel 5 +for_window [app_id="floating_terminal"] floating enable +for_window [class="floating_terminal"] floating enable +for_window [class=".*"] layout splith # bindsym $mod+r mode "resize" -# man 5 sway-bar bar { swaybar_command waybar } @@ -131,4 +158,7 @@ client.focused #66d9ef #66d9ef #66d9ef #66d9ef #66d9ef client.focused_inactive #111111 #111111 #ffffff #111111 #111111 client.unfocused #111111 #111111 #ffffff #111111 #111111 +exec_always makoctl reload +exec_always notify-send -a "Sway" -i ~/.wallpaper "Sway configuration loaded." + include $ENV_PATH/sway/config.d/* diff --git a/apps/de/sxhkd/rc b/apps/de/sxhkd/rc index 63834b7..71ede19 100755 --- a/apps/de/sxhkd/rc +++ b/apps/de/sxhkd/rc @@ -263,5 +263,4 @@ super + ctrl + c bspc rule -a '*' -o state=floating && kitty -o remember_window_size=no -o initial_window_width=66c -o initial_window_height=10c sh -c "cal -n 3 && printf 'Press [ENTER] to close.' && read" super + ctrl + p - bspc rule -a '*' -o state=floating && \ - kitty -o remember_window_size=no -o initial_window_width=122c -o initial_window_height=40c sh -c "{ env FZFP_PASS_OPTS='' FZFP_HEIGHT=100% fzfp | head -n 1 | sd '\n\$' '' | clip; } &" + pass-chooser diff --git a/apps/de/waybar/style.css b/apps/de/waybar/style.css index 87573f8..23dc311 100644 --- a/apps/de/waybar/style.css +++ b/apps/de/waybar/style.css @@ -17,18 +17,8 @@ window#waybar.hidden { opacity: 0.2; } -window#waybar.termite { - background-color: #3F3F3F; -} - -window#waybar.chromium { - background-color: #000000; - border: none; -} - window#waybar.empty { - color: #666666; - background-color: #111111; + opacity: 0.2; } #workspaces button { @@ -44,10 +34,20 @@ window#waybar.empty { */ } -#workspaces button.focused { +#workspaces button.visible { background-color: #333333; } +#workspaces button.focused { + background-color: #66d9ef; + color: #111111; +} + +#workspaces button.empty { + color: #666666; + /* background-color: #111111; */ +} + #workspaces button.urgent { background-color: #eb4d4b; } diff --git a/apps/kitty/kitty.conf b/apps/kitty/kitty.conf index 75786a4..ee0e866 100644 --- a/apps/kitty/kitty.conf +++ b/apps/kitty/kitty.conf @@ -52,3 +52,5 @@ color15 #f9f8f5 color18 #333333 kitty_mod ctrl+shift+alt open_url_modifiers ctrl +wheel_scroll_multiplier 5.0 +touch_scroll_multiplier 5.0 diff --git a/apps/neovim/plugins.vim b/apps/neovim/plugins.vim index 8548f09..cd13d98 100644 --- a/apps/neovim/plugins.vim +++ b/apps/neovim/plugins.vim @@ -88,7 +88,7 @@ Plug 'sheerun/vim-polyglot' " vim plugin loa Plug 'leafo/moonscript-vim', {'for': ['moon', 'moonscript']} " moonscript language Plug 'OmniSharp/omnisharp-vim', {'for': ['cs']} " C# language Plug 'neoclide/coc.nvim', {'branch': 'release'} " language server interface -Plug 'JakeBecker/elixir-ls', {'for': ['elixir', 'eelixir'], 'do': { -> g:elixirls.compile() }} +Plug 'elixir-lsp/elixir-ls', {'for': ['elixir', 'eelixir'], 'do': { -> g:elixirls.compile() }} Plug 'tpope/vim-dadbod' " vim Plug 'lytedev/elm-vim', {'for': ['elm']} " elm lang Plug 'google/vim-jsonnet', {'for': ['jsonnet', 'libsonnet']} " jsonnet diff --git a/apps/shell/bash/rc b/apps/shell/bash/rc index ebfa94a..1c3ca4f 100644 --- a/apps/shell/bash/rc +++ b/apps/shell/bash/rc @@ -26,7 +26,7 @@ export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_file_byte has_command fd && export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' export LS_COLORS='ow=01;36;40' export LESS="-x2" # less tab size of 2 spaces -export TERMINAL="urxvtc" +export TERMINAL="kitty" export BROWSER="firefox-developer-edition" export HISTFILESIZE="10000000" # "unlimited" history export HISTSIZE="10000000" # "unlimited" history diff --git a/apps/shell/fish/aliases.fish b/apps/shell/fish/aliases.fish index 89de6b1..4b1d1f0 100755 --- a/apps/shell/fish/aliases.fish +++ b/apps/shell/fish/aliases.fish @@ -91,7 +91,7 @@ alias ......... "d ../../../../../../../.." # tmux aliases # TODO: see if this can be worked around? alias tmnew "tmux new -s" -alias tmls "tmux list-sessions" +alias tmls "tmux list-sessions | rg --color never -o '^(.*?):.*?\(.*?\)(.*)\$' -r '\$1\$2'" alias tmatt "tmux attach -t" alias tu "tmux attach -t utils || tmux new -s utils" alias tdf "tmux attach -t dotfiles || tmux new -s dotfiles -c $DOTFILES_PATH" @@ -182,11 +182,6 @@ alias mail "mutt" # fsw aliases alias fsw-mix-test 'fsw "mix test" ./**/*.{ex,exs,erl,hrl,xrl,yrl}' -function field - not scount $argv && echo "No field index provided"; exit 1 - awk "{print \$$argv[1]}" -end - # weechat aliases function chat set -l pass (pass config/weechat-passphrase | head -n 1) diff --git a/apps/shell/fish/config.fish b/apps/shell/fish/config.fish index f9082cb..9e35cf3 100755 --- a/apps/shell/fish/config.fish +++ b/apps/shell/fish/config.fish @@ -4,8 +4,6 @@ set -Ux XDG_CONFIG_HOME $HOME/.config set -Ux DOTFILES_PATH $XDG_CONFIG_HOME/dotfiles set -Ux ENV_PATH $HOME/.env -function has_command; command -v $argv[1] 2>&1 >/dev/null; end - source $DOTFILES_PATH/apps/shell/fish/paths.fish status --is-interactive || exit @@ -60,3 +58,10 @@ for cf in config.fish .hidden/config.fish end mkdir -p $NOTES_PATH $USER_LOGS_PATH $SCROTS_PATH + +# start a tmux session by default if possible and we're not already in +# a terminal multiplexer +if has_command tmux && string match -v -q '*tmux*' $TERM && string match -v -q '*screen*' $TERM + tmux attach -t default || tmux new -s default +end + diff --git a/apps/shell/fish/prompt.fish b/apps/shell/fish/prompt.fish index 3065065..6ef34fa 100755 --- a/apps/shell/fish/prompt.fish +++ b/apps/shell/fish/prompt.fish @@ -22,7 +22,7 @@ function fish_prompt else set_color -b red black end - printf " SUDO $USER@$hostname" + printf " SUDO $USER@$hostname " else if test $last_cmd_status -eq 0 set_color blue diff --git a/apps/shell/tmux/conf b/apps/shell/tmux/conf index 0c1a5aa..5482a21 100644 --- a/apps/shell/tmux/conf +++ b/apps/shell/tmux/conf @@ -132,7 +132,10 @@ set -g @plugin "christoomey/vim-tmux-navigator" set -g @continuum-restore "on" # let continuum startup on boot -set -g @continuum-boot "on" +# NOTE: disabled this due to it starting up before sway socket is up and then +# sway commands do not work from within tmux +# TODO: maybe sway (or any wm) can start continuum? +# set -g @continuum-boot "on" # bindings for tmux-resurrect set -g @resurrect-save "C-v" diff --git a/bin/app-launcher b/bin/app-launcher index ef01591..ed2e008 100755 --- a/bin/app-launcher +++ b/bin/app-launcher @@ -1,3 +1,7 @@ #!/usr/bin/env sh -rofi -combi-modi run,window -show combi -modi combi -sorting-method fzf --sort "$@" +if is_wayland; then + floating-term sh -c "launch | xargs swaymsg exec --" +else + rofi -combi-modi run,window -show combi -modi combi -sorting-method fzf --sort "$@" +fi diff --git a/bin/at b/bin/at new file mode 100755 index 0000000..efa70d0 --- /dev/null +++ b/bin/at @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +[[ -z "$1" ]] && { echo "No argument provided." >&2 ; exit 1; } + +d="$(date -d "${@}" +%s)" +while [[ "$d" -ge "$(date +%s)" ]]; do + _dt=$((d - $(date +%s))) + days=$((_dt / 86400)) + echo -ne "\rTime Remaining: ${days}d $(date -u --date @$((_dt)) +%H:%M:%S) "; + sleep 0.1 +done diff --git a/bin/clip b/bin/clip index d8bbad1..4eaa800 100755 --- a/bin/clip +++ b/bin/clip @@ -1,11 +1,11 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # TODO: detect MIME type? # can a `clip-once` script exist building on this? # wl-copy `-o`, xclip `-l 1`? if is_wayland; then - wl-copy -n wl-copy --trim-newline "$@" + wl-copy -n "$@" else - xclip -i -sel p -f "$@" | xclip -i -sel c "$@" + xclip -i -sel c "$@" fi diff --git a/bin/countdown b/bin/countdown index 96ee7be..d987c23 100755 --- a/bin/countdown +++ b/bin/countdown @@ -1,5 +1,7 @@ #!/usr/bin/env bash +[[ -z "${@}" ]] && { echo "No argument provided." >&2 ; exit 1; } + d=$(($(date +%s) + $1)); echo "Countdown started at $(date)" diff --git a/bin/field b/bin/field index a822c32..3df0042 100755 --- a/bin/field +++ b/bin/field @@ -1,4 +1,6 @@ #!/usr/bin/env sh -has_command gawk || ( echo "No gawk."; exit 1 ) -index="${1:-1}"; shift; gawk '{print $'"${index}"'}' "$@" +has_command gawk || { echo "No gawk." >&2 ; exit 1; } +index="${1:-1}" +[ "$#" -lt 1 ] || shift +gawk '{print $'"${index}"'}' "$@" diff --git a/bin/floating-term b/bin/floating-term new file mode 100755 index 0000000..f07fff9 --- /dev/null +++ b/bin/floating-term @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +# TODO: geomoetry flags? + +flags=("") +case "$TERMINAL" in + kitty ) + flags=(-o remember_window_size=no -o initial_window_width=122c -o initial_window_height=24c --class floating_terminal) + ;; + + # TODO: rxvt? +esac + +if is_wayland; then + # wayland only needs app_id or class set to "floating_terminal" + : # no-op +else + bspc rule -a '*' -o state=floating +fi + +"$TERMINAL" "${flags[@]}" "$@" diff --git a/bin/fzfp b/bin/fzfp index 1ba56f6..83d0943 100755 --- a/bin/fzfp +++ b/bin/fzfp @@ -10,4 +10,3 @@ cd "$FZFP_PASS_DIR" || { echo "Could not cd to $FZFP_PASS_DIR" >&2; exit 1; } pp="$(fd gpg | sd ".gpg" "" | fzf --height "$FZFP_HEIGHT" --prompt "$FZFP_PROMPT")" "${FZFP_PASS_CMD}" $FZFP_PASS_OPTS "$@" "$pp" cd - >/dev/null || return 1 - diff --git a/bin/is_wayland b/bin/is_wayland index cec5b52..f0a1759 100755 --- a/bin/is_wayland +++ b/bin/is_wayland @@ -1,3 +1,3 @@ #!/usr/bin/env bash -loginctl show-session "$(loginctl | grep $(whoami) | field 1)" -p Type | grep -i wayland >/dev/null +loginctl show-session "$(loginctl | grep "$(whoami)" | tail -n 1 | field 1)" -p Type | grep -i wayland >/dev/null diff --git a/bin/launch b/bin/launch new file mode 100755 index 0000000..d18fa57 --- /dev/null +++ b/bin/launch @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +LAUNCHER_HISTORY_FILE="$ENV_PATH/launch.log" +touch "$LAUNCHER_HISTORY_FILE" +app="$( + < "$LAUNCHER_HISTORY_FILE" \ + awk 'NF{NF--};1' | \ + cat - <(dmenu_path) | \ + sort | uniq -c | sort -nr | \ + sd '^\s+' '' | \ + cut -d' ' -f2- | \ + fzf + )" +echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE" +echo "$app" diff --git a/bin/lib/arch-linux/provisioning/2-essentials.bash b/bin/lib/arch-linux/provisioning/2-essentials.bash index 8f3a2f8..89bc741 100755 --- a/bin/lib/arch-linux/provisioning/2-essentials.bash +++ b/bin/lib/arch-linux/provisioning/2-essentials.bash @@ -60,6 +60,7 @@ pacaur --needed -S \ fortune-mod fortune-mod-archlinux `# Fortune` \ diff-so-fancy `# Fancy Diffs` \ oath-toolkig `# One-Time Passwords` \ + sysstat `# System Statistics` \ --noconfirm --noedit # install rxvt-unicode script for resizing font on-the-fly diff --git a/bin/pass-chooser b/bin/pass-chooser new file mode 100755 index 0000000..f36e334 --- /dev/null +++ b/bin/pass-chooser @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +# TODO: can we use fzfp here? +floating-term \ + bash -c " + cd $HOME/.password-store + fd gpg | + sd '.gpg\$' '' | + fzf --height 100% --prompt 'fzf-pass> ' > /tmp/fzfp-key + pass \"\$(cat /tmp/fzfp-key)\" | + head -n 1 | + sd '\s+\$' '' | + nohup clip &>/dev/null & + notify-send -a 'pass' 'Password in Clipboard' + " diff --git a/bin/prelude b/bin/prelude index 62352ca..e2e40ee 100755 --- a/bin/prelude +++ b/bin/prelude @@ -6,6 +6,7 @@ export XDG_CONFIG_HOME="$HOME/.config" export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" export ENV_PATH="$HOME/.env" +export TERMINAL="kitty" # TODO: better logic for auto-detecting alternative home directories? # 1. check dirname(basename $HOME)) matches username diff --git a/bin/resource-usage b/bin/resource-usage new file mode 100755 index 0000000..90fac80 --- /dev/null +++ b/bin/resource-usage @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# TODO: radeontop can continuously dump to a file, would be fast to just keep +# last line and have this run in the background +gpu_usage="$(radeontop -l 1 -d - | rg --color never -o "gpu (\d+.\d+)" -r '$1')" +gpu_temp="$(sensors | rg 'amdgpu.*mem:\s+\+(\d+\.\d+)' --multiline-dotall --multiline -o -r '$1')" + +# NOTE: this is all cpu usage since boot: +# cpu_usage_data_snapshot="$(cat /proc/stat | head -n 1 | cut -d ' ' -f 2- | sd '^\s+' '')" +# function cpu_usage_data() { +# echo "$cpu_usage_data_snapshot" +# } +# cpu_usage="$(bc -l <<< "100-(100*($(cpu_usage_data | awk '{printf $4}').0/$(cpu_usage_data | sd " " "+" | bc).0))")" + +mpstat_samples=2 +mpstat_sample_seconds=1 +cpu_idle="$(mpstat --dec=2 "$mpstat_sample_seconds" "$mpstat_samples" | tail -n 1 | field 12)" +cpu_usage="$(echo "100.0-$cpu_idle" | bc -l)" +cpu_temp="0.0" + +printf "GPU [USAGE: %6.2f%%] [THERMALS: %6.2f°C]\n" "$gpu_usage" "$gpu_temp" +printf "CPU [USAGE: %6.2f%%] [THERMALS: %6.2f°C]\n" "$cpu_usage" "$cpu_temp" + diff --git a/bin/sw b/bin/sw index 46fb6a9..753bb46 100755 --- a/bin/sw +++ b/bin/sw @@ -1,8 +1,11 @@ #!/usr/bin/env bash d="$(date +%s)" +_dt=$(($(date +%s) - d)) echo "Stopwatch started $(date)" +trap 'echo -ne "\nStopwatch stopped at $(date)\n" && exit 0' SIGINT + while true; do _dt=$(($(date +%s) - d)) days=$((_dt / 86400)) @@ -12,4 +15,3 @@ done # TODO: add "lap" capabilities? -echo -ne "\rStopwatch stopped at $(date)\n" diff --git a/env/desktop/sway/config.d/main b/env/desktop/sway/config.d/main index 4db1d9a..4efb49a 100644 --- a/env/desktop/sway/config.d/main +++ b/env/desktop/sway/config.d/main @@ -1,3 +1,12 @@ -output DP-1 res 3440x1440@100Hz pos 0 0 -output HDMI-A-1 res 2560x1440@60Hz pos 3440 -720 -output HDMI-A-1 transform 270 +output DP-1 res 3440x1440@100Hz pos 0 0 +output DP-3 res 2560x1440@60Hz pos -1440 0 transform 270 +output DP-4 res 2560x1440@60Hz pos 3440 0 transform 270 +workspace 1 output DP-1 +workspace 2 output DP-1 +workspace 3 output DP-1 +workspace 4 output DP-4 +workspace 5 output DP-4 +workspace 6 output DP-4 +workspace 7 output DP-3 +workspace 8 output DP-3 +workspace 9 output DP-3 diff --git a/env/desktop/x/resources b/env/desktop/x/resources index f184c9f..16cae4c 100755 --- a/env/desktop/x/resources +++ b/env/desktop/x/resources @@ -1,7 +1,7 @@ #define bar_font_size 12 # TODO: this needs fixing polybar.primary_font: iosevka\-lyte:pixelsize=bar_font_size;1 -bspwm.num_desktops_per_monitor: 8 +bspwm.num_desktops_per_monitor: 4 bspwm.reverse_desktop_ordering: 0 bspwm.reverse_monitor_desktops: 0 polybar.display_monitor: DisplayPort-0 diff --git a/env/laptop/sway/config.d/main b/env/laptop/sway/config.d/main index 8f82562..5b1e725 100644 --- a/env/laptop/sway/config.d/main +++ b/env/laptop/sway/config.d/main @@ -3,6 +3,8 @@ output HDMI-A-1 res 2560x1440@60Hz pos 0 0 output HDMI-A-1 transform 270 output DP-1 res 3440x1440@100Hz pos 1440 1120 +bindswitch lid:toggle exec swaylock + # TODO: setup trackpad/gestures ### Input configuration #