diff --git a/apps/de/bspwm/config b/apps/de/bspwm/config index bb94ef4..e6a54a9 100755 --- a/apps/de/bspwm/config +++ b/apps/de/bspwm/config @@ -1,11 +1,11 @@ #!/usr/bin/env sh -NUM_DESKTOPS="$(xrq bspwm.num_desktops)" +NUM_DESKTOPS="$(xrq bspwm.num_desktops || echo '10')" REVERSE_DESKTOP_ORDERING="$(xrq bspwm.reverse_desktop_ordering)" REVERSE_MONITOR_DESKTOPS="$(xrq bspwm.reverse_monitor_desktops)" BSPWM_MONITORS=$(bspc query -M) MONITOR_COUNT=$(echo "$BSPWM_MONITORS" | wc -w | awk '{ printf $1 }') -PER_MONITOR=$((NUM_DESKTOPS / MONITOR_COUNT)) +PER_MONITOR="$(xrq bspwm.num_desktops_per_monitor || echo $((NUM_DESKTOPS / MONITOR_COUNT)))" DESKTOPS=$(seq "$NUM_DESKTOPS") [ "$REVERSE_MONITOR_DESKTOPS" -eq 1 ] && BSPWM_MONITORS=$(echo "$BSPWM_MONITORS" | tac) @@ -26,11 +26,14 @@ bspc config remove_disabled_monitors true bspc rule -a "*" split_dir=right i=1 +total_screens=0 for mon in $BSPWM_MONITORS; do max=$((i + PER_MONITOR - 1)) screens="" for j in $(seq $i $max); do - screens="${screens}${j} " + [[ "$total_screens" -ge "$NUM_DESKTOPS" ]] || screens="${screens}${j} " + total_screens=$((total_screens+1)) + echo $NUM_DESKTOPS $total_screens $screens done bspc monitor "$mon" -d $screens i=$((max + 1)) diff --git a/apps/de/bspwm/wallpapers b/apps/de/bspwm/wallpapers index bce8405..d5a1bcd 100755 --- a/apps/de/bspwm/wallpapers +++ b/apps/de/bspwm/wallpapers @@ -1,14 +1,2 @@ -#!/usr/bin/env bash - -feh --no-fehbg --bg-fill \ - "${HOME}/.wallpaper" \ - "${HOME}/.wallpaper2" \ - "${HOME}/.wallpaper3" \ - "${HOME}/.wallpaper4" \ - "${HOME}/.wallpaper5" \ - "${HOME}/.wallpaper6" \ - "${HOME}/.wallpaper7" \ - "${HOME}/.wallpaper8" \ - "${HOME}/.wallpaper9" \ - "${HOME}/.wallpaper_last" \ - 2>/dev/null +#!/bin/sh +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 e300344..4807389 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,6 +158,9 @@ 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/* exec mako diff --git a/apps/de/sxhkd/rc b/apps/de/sxhkd/rc index be975dc..71ede19 100755 --- a/apps/de/sxhkd/rc +++ b/apps/de/sxhkd/rc @@ -260,4 +260,7 @@ super + Escape pkill -USR1 -x sxhkd super + ctrl + c - bspc rule -a '*' -o state=floating && urxvt --geometry 64x9 -e sh -c "cal -n 3 && bash" + 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 + 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/de/x/profile b/apps/de/x/profile index 2dfe1de..766838d 100755 --- a/apps/de/x/profile +++ b/apps/de/x/profile @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash [ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME="$HOME/.config" [ -z "$DOTFILES_PATH" ] && export DOTFILES_PATH="$XDG_CONFIG_HOME/dotfiles" @@ -9,7 +9,7 @@ [ -f "$HOME/.xmodmap" ] && xmodmap "$HOME/.xmodmap" has_command libinput-gestures-setup && libinput-gestures-setup start has_command autorandr && autorandr -c -has_command redshift && redshift -r -l 39.1:-94.6 -t 6500K:3000K & +# has_command redshift && redshift -r -l 39.1:-94.6 -t 6500K:3000K & has_command kdeconnect-indicator && kdeconnect-indicator & has_command gnome-keyring-daemon && eval "$(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)" @@ -17,4 +17,4 @@ export SSH_AUTH_SOCK xset r rate 250 80 & # keyrepeat -. maybe_source_env_file x/profile +source maybe_source_env_file x/profile diff --git a/apps/htop/rc b/apps/htop/rc index adcbee7..9429934 100644 --- a/apps/htop/rc +++ b/apps/htop/rc @@ -8,7 +8,7 @@ hide_kernel_threads=1 hide_userland_threads=1 shadow_other_users=0 show_thread_names=0 -show_program_path=1 +show_program_path=0 highlight_base_name=1 highlight_megabytes=1 highlight_threads=1 @@ -24,4 +24,3 @@ left_meters=LeftCPUs2 Memory Swap left_meter_modes=1 1 1 right_meters=RightCPUs2 Tasks LoadAverage Uptime right_meter_modes=1 2 2 2 -vim_mode=1 diff --git a/apps/kitty/kitty.conf b/apps/kitty/kitty.conf index b5d5e03..b96c3f9 100644 --- a/apps/kitty/kitty.conf +++ b/apps/kitty/kitty.conf @@ -83,3 +83,9 @@ color15 #f9f8f5 # # color18 #cccccc # + +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/mutt/rc b/apps/mutt/rc index 3cd885a..a6adf8b 100644 --- a/apps/mutt/rc +++ b/apps/mutt/rc @@ -1,33 +1,15 @@ -# set imap_user = "wraithx2@gmail.com" -# set imap_pass = "`pass google | head -n 1`" set realname = "Daniel Flanagan" -set from = "daniel@lytedev.io" +set from = "Daniel Flanagan " set use_from = yes set envelope_from = yes +set edit_headers = yes +set folder="~/../mail" +set sendmail="/usr/bin/esmtp" set sidebar_visible set sidebar_format = "%B%?F? [%F]?%* %?N?%N/?%S" set mail_check_stats -set smtp_url = 'smtps://wraithx2@gmail.com@smtp.gmail.com:465/' -set smtp_pass = `pass google-app-password | head -n 1` -set imap_user = 'wraithx2@gmail.com' -set imap_pass = `pass google-app-password | head -n 1` - -set mbox="imaps://imap.gmail.com/[Gmail]/All Mail" - -set ssl_force_tls = yes -set folder = imaps://imap.gmail.com/ -set spoolfile = +INBOX -# set record = "+[Gmail]/Sent Mail" -set postponed = "+[Gmail]/Drafts" -set editor = "nvim" -set timeout = 30 - -mailboxes =INBOX "=[Gmail]/All Mail" =[Gmail]/Sent\ Mail =[Gmail]/Drafts =[Gmail]/Spam =[Gmail]/Trash - -set sort=reverse-date - bind index,pager \CD sync-mailbox bind index,pager \CP sidebar-prev bind index,pager \CN sidebar-next @@ -37,8 +19,6 @@ bind index,pager \CB sidebar-toggle-visible bind pager g top bind pager G bottom -# bind pager j top -# bind pager j top bind pager \Cu half-up bind pager \Cd half-down bind pager k half-up @@ -51,25 +31,6 @@ bind attach,index G last-entry set header_cache = "~/.cache/mutt/headers" set message_cachedir = "~/.cache/mutt/bodies" - macro index,pager A s>y - -# C-R to get mail bind index \CR imap-fetch-mail - -# bind index g noop -# macro index ga "=[Gmail]/All Mail" "Go to all mail" -# macro index gd "=[Gmail]/Drafts" "Go to drafts" -# macro index gi "=INBOX" "Go to inbox" -# macro index gs "=[Gmail]/Starred" "Go to starred messages" -# macro index gt "=[Gmail]/Trash" "Go to trash" -# macro index,pager d "=[Gmail]/Trash" "Trash" -# macro index,pager y "=[Gmail]/All Mail" "Archive" - set record="" - -# bulk operations -# T - tag messages matching... [type in regex] -# ; - perform command on tagged messages -# - A to archive! - diff --git a/apps/neovim/plugins.vim b/apps/neovim/plugins.vim index 624fab8..cd13d98 100644 --- a/apps/neovim/plugins.vim +++ b/apps/neovim/plugins.vim @@ -88,11 +88,12 @@ 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 Plug 'sirtaj/vim-openscad', {'for': ['scad']} " openscad Plug 'jjo/vim-cue' Plug 'chrisbra/csv.vim' +Plug 'calviken/vim-gdscript3', {'for': ['gdscript']} " godot scripts " Plug 'ssh://git@git.lyte.dev:2222/lytedev/vim-lytlang.git' diff --git a/apps/shell/bash/aliases.bash b/apps/shell/bash/aliases.bash index 0ad56b3..5a98b69 100644 --- a/apps/shell/bash/aliases.bash +++ b/apps/shell/bash/aliases.bash @@ -126,6 +126,7 @@ alias pbcopy="clip" alias pt="htop -t" # experimental htop tree-view-by-default alias resrc="source \$HOME/.bashrc" alias redshift="redshift -r -l 39.0997:-94.5786 -t 6500K:2500K" +alias noredshift="killall redshift; redshift -P -O 5700" alias gpmdpe="electron --app=/usr/share/gpmdp/resources/app.asar" alias t="task" alias sc="sc-im" diff --git a/apps/shell/bash/rc b/apps/shell/bash/rc index fa37bac..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 @@ -59,12 +59,10 @@ if [ "$PWD" = "$HOME" ] || [ "$PWD" = "$NICE_HOME" ]; then cd "$NICE_HOME" || cd || return fi -[ -f "$HOME/.fzf.bash" ] && . "$HOME/.fzf.bash" +# if [[ -d "$HOME/.asdf/" ]] && [[ -f "$HOME/.asdf/asdf.sh" ]]; then +# . "$HOME/.asdf/asdf.sh" +# elif [[ -d /opt/asdf-vm/ ]] && [[ -f /opt/asdf-vm/asdf.sh ]]; then +# . "/opt/asdf-vm/asdf.sh" +# fi -if [[ -d "$HOME/.asdf/" ]] && [[ -f "$HOME/.asdf/asdf.sh" ]]; then - . "$HOME/.asdf/asdf.sh" -elif [[ -d /opt/asdf-vm/ ]] && [[ -f /opt/asdf-vm/asdf.sh ]]; then - . "/opt/asdf-vm/asdf.sh" -fi - -[ -f ~/.fzf.bash ] && source ~/.fzf.bash +# [ -f ~/.fzf.bash ] && source ~/.fzf.bash diff --git a/apps/shell/fish/aliases.fish b/apps/shell/fish/aliases.fish index a28cb63..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" @@ -154,6 +154,7 @@ alias pbcopy "clip" alias pt "htop -t" # experimental htop tree-view-by-default alias resrc "source $XDG_CONFIG_HOME/fish/config.fish" alias redshift "redshift -r -l 39.0997:-94.5786 -t 6500K:2500K" +alias noredshift "killall redshift; redshift -P -O 5700" alias gpmdpe "electron --app=/usr/share/gpmdp/resources/app.asar" alias t "task" alias sc "sc-im" @@ -181,13 +182,12 @@ 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) env WEECHAT_PASSPHRASE=$pass weechat end + +# grep aliases +alias rg "rg --text" +alias grep "rg" 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 4706379..6ef34fa 100755 --- a/apps/shell/fish/prompt.fish +++ b/apps/shell/fish/prompt.fish @@ -15,14 +15,28 @@ function preprocess_pwd end function fish_prompt - if test $status -eq 0 - set_color blue + set last_cmd_status $status + if test (id -u) -eq 0 + if test $last_cmd_status -eq 0 + set_color -b blue black + else + set_color -b red black + end + printf " SUDO $USER@$hostname " else - set_color red + if test $last_cmd_status -eq 0 + set_color blue + else + set_color red + end + printf "$USER@$hostname" end - printf $USER"@"$hostname" " + set_color normal + printf " " set_color magenta - printf (preprocess_pwd)" " + printf (preprocess_pwd)"" + set_color normal + printf " " end function fish_mode_prompt; end diff --git a/apps/shell/tmux/conf b/apps/shell/tmux/conf index ccfff83..5482a21 100644 --- a/apps/shell/tmux/conf +++ b/apps/shell/tmux/conf @@ -63,7 +63,7 @@ set -g status-left-length 200 set -g status-left "#[fg=colour7]#(~/.config/dotfiles/bin/tmux-session-list #S)" set -g message-style "fg=colour7 bg=colour18" -bind-key O display-message "#(tmux-save-buffer #S)" +bind-key O display-message "#(~/.config/dotfiles/bin/tmux-save-buffer #S)" # pane split line colors set -g pane-active-border-style bg=black,fg=blue @@ -97,7 +97,7 @@ bind-key u capture-pane \;\ is_vim="ps -o state= -o comm= -t \"#{pane_tty}\" \ | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" -bind-key -Tcopy-mode-vi "C-h" send -X "cancel select-pane -L" +bind-key -T copy-mode-vi "C-h" send -X "cancel select-pane -L" bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" @@ -105,7 +105,8 @@ bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" # bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" # YANKING -bind-key -Tcopy-mode-vi "y" send -X copy-selection +# bind-key -T copy-mode-vi "y" send -X copy-selection +bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel -X 'clip' set-environment -g TMUX_PLUGIN_MANAGER_PATH "~/.config/tmux/plugins/" @@ -131,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" @@ -155,3 +159,5 @@ run "~/.config/tmux/plugins/tpm/tpm" # refresh-client -S unbind-key C-p + +set -g @resurrect-hook-pre-restore-pane-processes 'tmux switch-client -n && tmux kill-session -t 0' diff --git a/bin/N b/bin/N index ab1499f..5b3285c 100755 --- a/bin/N +++ b/bin/N @@ -1,4 +1,3 @@ #!/usr/bin/env bash -fn="${1}"; shift -nf "${fn}.md" $* +fn="${1}"; shift; nf "${fn}.md" "$@" 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/b b/bin/b index e919ecc..55a680d 100755 --- a/bin/b +++ b/bin/b @@ -4,11 +4,11 @@ bbin="bible" # npm i -g bible pbin="less" # bible args -bargs="" +bargs=("") # pager args pargs="-R" -[ "$1" = "s" ] && bargs="$bargs --search" && shift +[[ $1 = s ]] && { bargs+=("--search"); shift; } -"${bbin}" $bargs "$*" | "${pbin}" $pargs +"${bbin}" "${bargs[@]}" "$*" | "${pbin}" $pargs diff --git a/bin/cdp b/bin/cdp index dd354d0..b621ffe 100755 --- a/bin/cdp +++ b/bin/cdp @@ -1,4 +1,4 @@ #!/usr/bin/env bash # TODO: needs fixing...? -cd "$(dirname "$(fzf)")" +cd "$(dirname "$(fzf)")" || exit 1 diff --git a/bin/check-port b/bin/check-port index 5601c5f..7578a82 100755 --- a/bin/check-port +++ b/bin/check-port @@ -2,7 +2,7 @@ if [[ $1 = t ]] || [[ $1 = tcp ]] || \ [[ $1 = T ]] || [[ $1 = TCP ]]; then - echo "TCP is the default. You don't need to specify it." + echo "TCP is the default. You don't need to specify it." >&2 exit 1 fi @@ -10,8 +10,8 @@ if [[ $1 = u ]] || [[ $1 = udp ]] || \ [[ $1 = U ]] || [[ $1 = UDP ]]; then shift set -x - sudo nmap -sU $1 -p $2 + sudo nmap -sU "$1" -p "$2" else set -x - nmap $1 -p $2 + nmap "$1" -p "$2" fi diff --git a/bin/check_domain b/bin/check_domain index 4a4300e..151f2df 100755 --- a/bin/check_domain +++ b/bin/check_domain @@ -49,23 +49,26 @@ fi # main function check_domain() { + local tmp + local domain + if [ "$#" == "0" ]; then echo "No domain specified." return fi - local domain="$1" + domain="$1" # create a unique temporary file - local tmp=$(mktemp "${domain}_XXX") + tmp=$(mktemp "${domain}_XXX") # dump whois output into temp file whois "$domain" > "$tmp" 2>&1 # check contents and output appropriately - if egrep -q "$AVAIL_REGEX" "$tmp" > /dev/null 2>&1; then + if grep -E -q "$AVAIL_REGEX" "$tmp" > /dev/null 2>&1; then echo -e "$COLOR_GREEN$domain / probably available$COLOR_RESET" - elif egrep -q "$TIMEOUT_REGEX" "$tmp" > /dev/null 2>&1; then + elif grep -E -q "$TIMEOUT_REGEX" "$tmp" > /dev/null 2>&1; then echo -e "$COLOR_YELLOW$domain / timed out$COLOR_RESET" else echo -e "$COLOR_RED$domain / unavailable$COLOR_RESET" @@ -79,7 +82,7 @@ check_domain() { # concurrently elements=${#DOMAINS[@]} while (( "$#" )); do - for (( i=0;i<${elements};i++ )); do + for (( i=0;i&2 - sed 's/^\s+//g' | wl-copy "$@" - echo "Your trimmed input was stored in all clipboards." + wl-copy -n "$@" else - xclip -selection primary - xclip -selection primary -out | xclip -selection clipboard - xclip -selection primary -out | xclip -selection secondary - echo "Your input was stored in all clipboards." - sleep 5 && killall xclip > /dev/null 2>&1 & + xclip -i -sel c "$@" fi diff --git a/bin/clipshot b/bin/clipshot index abc0ddc..1e663ab 100755 --- a/bin/clipshot +++ b/bin/clipshot @@ -5,11 +5,12 @@ if is_wayland; then else pkill unclutter sleep 0.1 - import ~/.ss.png - chmod 700 ~/.ss.png - < ~/.ss.png xclip -t image/png -i -selection clipboard - < ~/.ss.png xclip -t image/png -i -selection primary - < ~/.ss.png xclip -t image/png -i -selection secondary - < ~/.ss.png xclip -t image/png -i -selection buffer-cut + fn="$SCROTS_PATH/clipshot_$(date +"%Y-%m-%d_%H-%M-%S").png" + import "$fn" + chmod 700 "$fn" + < "$fn" xclip -t image/png -i -selection clipboard + < "$fn" xclip -t image/png -i -selection primary + < "$fn" xclip -t image/png -i -selection secondary + < "$fn" xclip -t image/png -i -selection buffer-cut unclutter & fi diff --git a/bin/countdown b/bin/countdown index aa88762..d987c23 100755 --- a/bin/countdown +++ b/bin/countdown @@ -1,12 +1,14 @@ #!/usr/bin/env bash -d=$((`date +%s` + $1)); -echo "Countdown started $(date)" +[[ -z "${@}" ]] && { echo "No argument provided." >&2 ; exit 1; } -while [ "$d" -ge $(date +%s) ]; do - _dt=$(($d - `date +%s`)) +d=$(($(date +%s) + $1)); +echo "Countdown started at $(date)" + +while [[ "$d" -ge "$(date +%s)" ]]; do + _dt=$((d - $(date +%s))) days=$((_dt / 86400)) - echo -ne "\r${days}d $(date -u --date @$((_dt)) +%H:%M:%S) "; + echo -ne "\r${days}d $(date -u --date @$((_dt)) +%H:%M:%S) "; sleep 0.1 done diff --git a/bin/dns b/bin/dns index 9d7465f..0a1c7f1 100755 --- a/bin/dns +++ b/bin/dns @@ -1,3 +1,3 @@ #!/usr/bin/env bash -getent hosts $* +getent hosts "$@" diff --git a/bin/editscrot b/bin/editscrot index 8acdbfa..886c067 100755 --- a/bin/editscrot +++ b/bin/editscrot @@ -1,5 +1,6 @@ #!/usr/bin/env bash -SCROT_DIR="$NICE_HOME/img/scrots/" -LATEST_SCROT="$(\ls -Art "${SCROT_DIR}" | tail -n 1)" -krita "${SCROT_DIR}${LATEST_SCROT}" +scrot_dir="$NICE_HOME/img/scrots/" +# shellcheck disable=SC2012 +latest_scrot="$(\ls -Art "${scrot_dir}" | tail -n 1)" +krita "${scrot_dir}${latest_scrot}" diff --git a/bin/email-via-mailgun-smtp b/bin/email-via-mailgun-smtp index 2b2dfb5..76f30b6 100755 --- a/bin/email-via-mailgun-smtp +++ b/bin/email-via-mailgun-smtp @@ -5,12 +5,12 @@ err() { errpost="" if test -t 1; then ncolors=$(tput colors) - if test -n "$ncolors" && test $ncolors -ge 8; then + if test -n "$ncolors" && test "$ncolors" -ge 8; then errpre="$(tput setaf 1)" errpost="$(tput setaf 7)" fi fi - >&2 echo "${errpre}ERROR: $@${errpost}"; usage; exit 1 + >&2 echo "${errpre}ERROR: $*${errpost}"; usage; exit 1 } warn() { @@ -18,12 +18,12 @@ warn() { post="" if test -t 1; then ncolors=$(tput colors) - if test -n "$ncolors" && test $ncolors -ge 8; then + if test -n "$ncolors" && test "$ncolors" -ge 8; then pre="$(tput setaf 3)" post="$(tput setaf 7)" fi fi - >&2 echo "${pre}WARNING: $@${post}" + >&2 echo "${pre}WARNING: $*${post}" } usage() { >&2 cat <&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/fzfemoji b/bin/fzfemoji index 522a087..9ba2241 100755 --- a/bin/fzfemoji +++ b/bin/fzfemoji @@ -1,8 +1,5 @@ #!/usr/bin/env sh -op="${1:--c}"; shift &>/dev/null -cd ~/.password-store || ( echo "Could not cd to ~/.password-store" && exit 1 ) r="$(< "$HOME/.emoji.txt" fzf --height 40%)" -echo "Selected $r (it's in your clipboard)" -<<< $r awk '$0=$1' | tr -d '\n' | clip -cd - || return 1 +echo "$r" | awk '$0=$1' | tr -d '\n' | clip +echo "Copied $r emoji to your clipboard" diff --git a/bin/fzfp b/bin/fzfp index 4d6a34f..83d0943 100755 --- a/bin/fzfp +++ b/bin/fzfp @@ -1,8 +1,12 @@ #!/usr/bin/env sh -op="${1:--c}"; shift &>/dev/null -cd ~/.password-store || ( echo "Could not cd to ~/.password-store" && exit 1 ) -pp="$(fd gpg | sd ".gpg" "" | fzf --height 40%)" -echo pass $op $pp -pass "$op" "$@" "$pp" -cd - || return 1 +FZFP_PASS_CMD="pass" +FZFP_PASS_DIR="$HOME/.password-store" + +FZFP_HEIGHT="${FZFP_HEIGHT:-40%}" +FZFP_PROMPT="${FZFP_PROMPT:-"$FZFP_PASS_CMD@$FZFP_PASS_DIR> "}" +FZFP_PASS_OPTS="${FZFP_PASS_OPTS:-}" +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/grb b/bin/grb index 2434386..868024f 100755 --- a/bin/grb +++ b/bin/grb @@ -2,10 +2,10 @@ MAIN_BRANCH="master" CUR_BRANCH="$(git branch | grep '\*' | cut -d ' ' -f2-)" -if [[ ! -z ${2+x} ]]; then +if [[ -n ${2+x} ]]; then MAIN_BRANCH="$2" CUR_BRANCH="$1" -elif [[ ! -z ${1+x} ]]; then +elif [[ -n ${1+x} ]]; then MAIN_BRANCH="$1" fi diff --git a/bin/has_command b/bin/has_command index 99beb7c..48bb2d6 100755 --- a/bin/has_command +++ b/bin/has_command @@ -1,3 +1,4 @@ #!/usr/bin/env sh +[ "$#" -lt 1 ] && { echo "No arguments provided" >&2 ; exit 1; } command -v "$1" >/dev/null 2>&1 diff --git a/bin/is_wayland b/bin/is_wayland index 72253e8..f0a1759 100755 --- a/bin/is_wayland +++ b/bin/is_wayland @@ -1,3 +1,3 @@ #!/usr/bin/env bash -test "$IS_WAYLAND" == "1" || test -n "$WAYLAND_DISPLAY" || test -n "$SWAYSOCK" || test -z "$DISPLAY" +loginctl show-session "$(loginctl | grep "$(whoami)" | tail -n 1 | field 1)" -p Type | grep -i wayland >/dev/null diff --git a/bin/k8s-yaml-sort b/bin/k8s-yaml-sort index ee738a5..9766ba9 100755 --- a/bin/k8s-yaml-sort +++ b/bin/k8s-yaml-sort @@ -1,7 +1,7 @@ #!/usr/bin/env bash [ "$#" -lt 1 ] && echo "Need a filename." && exit 1 -cat "$1" | yq -s . | jq -S ' +< "$1" yq -s . | jq -S ' sort_by(.metadata.name) | sort_by(.kind) | .[] | .spec.template.spec.containers |= 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 7164719..ed84fb9 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/linewise b/bin/linewise index 2b337f7..4780293 100755 --- a/bin/linewise +++ b/bin/linewise @@ -1,8 +1,8 @@ #!/usr/bin/env bash -if [[ ! -z "${1+x}" ]]; then - while read r; do - <<< "${r}" "$@" +if [[ -n "${1+x}" ]]; then + while read -r line; do + <<< "${line}" "$@" done else echo "No reader program provided." diff --git a/bin/maybe_source_env_file b/bin/maybe_source_env_file index 1096607..d79a8b8 100755 --- a/bin/maybe_source_env_file +++ b/bin/maybe_source_env_file @@ -1,4 +1,5 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash f="$1"; shift -. source_if_exists "$ENV_PATH/$f" "$@" +[ -f "$f" ] && source "$f" "$@" +true diff --git a/bin/n b/bin/n index a219661..c52ecf0 100755 --- a/bin/n +++ b/bin/n @@ -1,4 +1,3 @@ #!/usr/bin/env sh -fn="${1}"; shift -N "$(date +%Y-%m-%d)_${fn}" $* +fn="${1}"; shift; N "$(date +%Y-%m-%d)_${fn}" "$@" diff --git a/bin/nd b/bin/nd index 342cac6..3c73c80 100755 --- a/bin/nd +++ b/bin/nd @@ -1,4 +1,3 @@ #!/usr/bin/env bash -fn="${1}"; shift -N "$(date +%Y-%m-%d)_${fn}" $* +fn="${1}"; shift; N "$(date +%Y-%m-%d)_${fn}" "$@" diff --git a/bin/optimize-image-for-web b/bin/optimize-image-for-web index 3cc43d9..dfd05d7 100755 --- a/bin/optimize-image-for-web +++ b/bin/optimize-image-for-web @@ -15,4 +15,4 @@ mogrify \ -define png:exclude-chunk=all \ -interlace none \ -colorspace sRGB \ - $1 + "$1" 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/pipeline b/bin/pipeline index 1908407..d685599 100755 --- a/bin/pipeline +++ b/bin/pipeline @@ -8,6 +8,7 @@ if [ -n "${1+x}" ]; then mkdir -p "$pdir" if [ -z ${1+x} ]; then td="$(mktemp -p "$pdir" -d "tmp_pipeline.XXXXXXXX")" + # shellcheck disable=SC2064 trap "rm -rf '$td'" EXIT else td="$pdir/$1"; shift @@ -17,6 +18,7 @@ if [ -n "${1+x}" ]; then else td="$(mktemp --tmpdir -d pipeline.XXXXXXXX)" transform="$td/transform" + # shellcheck disable=SC2064 trap "rm -rf '$td'" EXIT fi @@ -36,4 +38,4 @@ chmod +x "$transform" # TODO: saved inputs? echo "Hello World" > "$in" -env PIPELINE_IN="$id" PIPELINE_TRANSFORM="$transform" PIPELINE_OUT="$out" nvim --cmd "source $DOTFILES_PATH/apps/neovim/scripts/pipeline.vim" +env PIPELINE_IN="$in" PIPELINE_TRANSFORM="$transform" PIPELINE_OUT="$out" nvim --cmd "source $DOTFILES_PATH/apps/neovim/scripts/pipeline.vim" diff --git a/bin/pr-for-commit b/bin/pr-for-commit index d830241..685c41c 100755 --- a/bin/pr-for-commit +++ b/bin/pr-for-commit @@ -1,10 +1,10 @@ #!/usr/bin/env sh -export GITHUB_UPSTREAM="$(git remote -vv | awk '{$0=$2}')" +GITHUB_UPSTREAM="$(git remote -vv | awk '{$0=$2}')" -git log --merges --ancestry-path --oneline $1..master \ +git log --merges --ancestry-path --oneline "$1"..master \ | grep -i 'pull request' \ | tail -n1 \ | awk '{$0=$5}' \ | cut -c2- \ - | xargs -I % open https://github.com/$GITHUB_UPSTREAM/${PWD##*/}/pull/% + | xargs -I % open https://github.com/"$GITHUB_UPSTREAM"/"${PWD##*/}"/pull/% diff --git a/bin/prelude b/bin/prelude index b00a70a..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 @@ -16,4 +17,5 @@ NICE_HOME="$HOME" [ -e "${ENV_PATH}/.nice_home" ] && NICE_HOME="$(cat "${ENV_PATH}/.nice_home")" export NICE_HOME +# shellcheck disable=SC1090 . "$DOTFILES_PATH/bin/paths" 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/scn b/bin/scn index a4f1b8f..418774d 100755 --- a/bin/scn +++ b/bin/scn @@ -1,3 +1,3 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh -EDITOR="sc-im" nf $* +EDITOR="sc-im" nf "$@" diff --git a/bin/screenshot b/bin/screenshot index 54d11d3..2c6c4fa 100755 --- a/bin/screenshot +++ b/bin/screenshot @@ -2,5 +2,5 @@ SCROT_DIR="$NICE_HOME/img/scrots" mkdir -p "$SCROT_DIR/" -FILENAME="$SCROT_DIR/%Y-%m-%d_%H-%M-%S_\$wx\$h.png" +FILENAME="$SCROT_DIR/screenshot_%Y-%m-%d_%H-%M-%S_\$wx\$h.png" scrot "$@" "${FILENAME}" >/dev/null && echo "Saved screenshot to: ${FILENAME}" diff --git a/bin/source_if_exists b/bin/source_if_exists index 9b4f71c..6ef4611 100755 --- a/bin/source_if_exists +++ b/bin/source_if_exists @@ -1,4 +1,7 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash +[ "$#" -lt 1 ] && { echo "No arguments provided" >&2 ; exit 1; } + +# shellcheck disable=SC1090 f="$1"; shift -[ -f "$f" ] && . "$f" "$@" +{ [ -f "$f" ] && source "$f" "$@"; } || { echo "$f does not exist" >&2 ; exit 3; } diff --git a/bin/sw b/bin/sw index dcf713f..753bb46 100755 --- a/bin/sw +++ b/bin/sw @@ -1,10 +1,13 @@ #!/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)) + _dt=$(($(date +%s) - d)) days=$((_dt / 86400)) echo -ne "\r${days}d $(date -u --date @$((_dt)) +%H:%M:%S) " sleep 0.1 @@ -12,4 +15,3 @@ done # TODO: add "lap" capabilities? -echo -ne "\rStopwatch stopped at $(date)\n" diff --git a/bin/tmux-save-buffer b/bin/tmux-save-buffer index e32cb67..6a71863 100755 --- a/bin/tmux-save-buffer +++ b/bin/tmux-save-buffer @@ -1,6 +1,6 @@ #!/usr/bin/env sh -prelude +echo "${USER_LOGS_PATH}" sess="$1"; shift d="$(date +%Y-%m-%d_%H-%M-%S)" @@ -8,4 +8,4 @@ f="${USER_LOGS_PATH}/${d}.${sess}.tmux-buffer.log" touch "$f" chmod 600 "$f" tmux capture-pane -pS -1000000000 > "$f" -echo "$f" +echo "Saved output to $f" diff --git a/bin/tmux-session-list b/bin/tmux-session-list index 204b09b..46e499b 100755 --- a/bin/tmux-session-list +++ b/bin/tmux-session-list @@ -1,11 +1,12 @@ #!/usr/bin/env bash ANY_SESSION_PREFIX="#[bg=colour18]#[fg=colour7]" -CUR_SESSION_PREFIX="#[bg=colour4]#[fg=colour0]" -URG_SESSION_PREFIX="#[bg=colour1]#[fg=colour0]" ANY_SESSION_SUFFIX="#[bg=default]#[fg=default] " -URG_SESSION_SUFFIX="${ANY_SESSION_SUFFIX}" +CUR_SESSION_PREFIX="#[bg=colour4]#[fg=colour0]" CUR_SESSION_SUFFIX="${ANY_SESSION_SUFFIX}" +# TODO: implement urgent session highlighting +# URG_SESSION_SUFFIX="${ANY_SESSION_SUFFIX}" +# URG_SESSION_PREFIX="#[bg=colour1]#[fg=colour0]" CUR_TMUX_SESSION="$1" if [ -z "$1" ]; then @@ -26,4 +27,5 @@ if(s==curSesh){ s=aspre" "s" "assuf }printf s}')" +# shellcheck disable=SC2001 echo "${TMUX_SESSION_LIST//\s*$/}" | sed -e 's/\s*$//' diff --git a/bin/unarchive b/bin/unarchive index 65b9901..b02272e 100755 --- a/bin/unarchive +++ b/bin/unarchive @@ -1,9 +1,9 @@ #!/usr/bin/env bash archive_name="${1}"; shift -to_dir="$(basename $archive_name)" +to_dir="$(basename "$archive_name")" mkdir -p "${to_dir}" -pushd "${to_dir}" +pushd "${to_dir}" || ( echo "${to_dir} does not exist" ; exit 1 ) tar --zstd -xvf "${archive_name}" echo "Unarchived to: ${to_dir}" -popd +popd || exit 2 diff --git a/bin/upload b/bin/upload index c6ec490..1cc7063 100755 --- a/bin/upload +++ b/bin/upload @@ -21,6 +21,7 @@ fi ssh ld mkdir -p "${internal_dir}" rsync --progress --no-owner --no-group --no-perms --stats --ignore-existing "${f}" "${HOST}:${internal_dir}/${fname}" | tee "${HOME}/.upload.log" code="$?" +# shellcheck disable=SC2029 ssh ld chmod a+r "${internal_dir}/${fname}" echo "Uploaded to: ${url}" diff --git a/bin/vdiff b/bin/vdiff index 5801fae..14c24ca 100755 --- a/bin/vdiff +++ b/bin/vdiff @@ -5,8 +5,8 @@ if ! pushd "$repo_root" &> /dev/null; then echo "Repo doesn't exist!" exit 2 fi -td="$(mktemp -p "$pdir" -d "vdiff.XXXXXXXX")" -trap "rm -rf \"$td\"" EXIT +td="$(mktemp -d "vdiff.XXXXXXXX")" +trap 'rm -rf '"$td" EXIT files="$(git diff --name-only "$@")" args=() @@ -23,8 +23,8 @@ for f in $files; do echo "" > "$d/$fn" cp "$f" "$d/$cfn" 2>/dev/null || echo "" > "$d/$cfn" - if [ -z "$args" ]; then - args+=($d/$fn -c) + if [ -z "${args[0]}" ]; then + args+=("$d/$fn -c") vcmd="vert diffsplit $d/$cfn" else vcmd="$vcmd | tabnew | e $d/$fn | vert diffsplit $d/$cfn" diff --git a/bin/vman b/bin/vman index 627f01a..0e608fa 100755 --- a/bin/vman +++ b/bin/vman @@ -4,5 +4,5 @@ # `asmanviewer` variable, so launch vim that way when using vim as our man # page viewer -"$EDITOR" --cmd "let asmanviewer=1" -c "SuperMan $*" -[ "$?" != "0" ] && echo "No manual entry for $*" && exit 1 +"$EDITOR" --cmd "let asmanviewer=1" -c "SuperMan $*" || \ + ( echo "No manual entry for $*" && exit 1 ) diff --git a/env/desktop/sway/config.d/main b/env/desktop/sway/config.d/main index 555685e..4efb49a 100644 --- a/env/desktop/sway/config.d/main +++ b/env/desktop/sway/config.d/main @@ -1,3 +1,12 @@ -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 +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 d7d71a9..16cae4c 100755 --- a/env/desktop/x/resources +++ b/env/desktop/x/resources @@ -1,7 +1,8 @@ #define bar_font_size 12 # TODO: this needs fixing polybar.primary_font: iosevka\-lyte:pixelsize=bar_font_size;1 +bspwm.num_desktops_per_monitor: 4 bspwm.reverse_desktop_ordering: 0 -bspwm.reverse_monitor_desktops: 1 +bspwm.reverse_monitor_desktops: 0 polybar.display_monitor: DisplayPort-0 polybar.height: 40 diff --git a/env/laptop/sway/config.d/main b/env/laptop/sway/config.d/main index bf4fe8c..2fd5683 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 #