diff options
-rw-r--r-- | .config/lf/lfrc | 16 | ||||
-rw-r--r-- | .config/pulse/daemon.conf | 4 | ||||
-rw-r--r-- | .config/sxiv/exec/key-handler | 33 | ||||
-rw-r--r-- | .config/tmux/tmux.conf | 7 | ||||
-rwxr-xr-x | .config/x11/xprofile | 5 | ||||
-rwxr-xr-x | .local/bin/statusbar/sb-mailbox | 20 |
6 files changed, 71 insertions, 14 deletions
diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 92567e6..9d6ceba 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -14,12 +14,12 @@ $lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope" # cmds/functions cmd open ${{ - case $(file --mime-type $f -b) in - image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;; + case $(file --mime-type "$(readlink -f $f)" -b) in + image/vnd.djvu|application/pdf|application/octet-stream|application/postscript) setsid -f zathura $fx >/dev/null 2>&1 ;; text/*) $EDITOR $fx;; image/x-xcf) setsid -f gimp $f >/dev/null 2>&1 ;; image/svg+xml) display -- $f ;; - image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | sxiv -aio 2>/dev/null | lf-select ;; + image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\|ico\)\(_large\)*$" | setsid -f sxiv -aio 2>/dev/null | lf-select & ;; audio/*) mpv --audio-display=no $f ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; @@ -36,7 +36,7 @@ cmd extract ${{ printf "%s\n\t" "$fx" printf "extract?[y/N]" read ans - [ $ans = "y" ] && ext $fx + [ $ans = "y" ] && aunpack $fx }} cmd delete ${{ @@ -52,7 +52,7 @@ cmd moveto ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Move to where?" - dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|' )" && + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && for x in $fx; do eval mv -iv \"$x\" \"$dest\" done && @@ -63,7 +63,7 @@ cmd copyto ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f clear; echo "Copy to where?" - dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|' )" && + dest="$(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf | sed 's|~|$HOME|')" && for x in $fx; do eval cp -ivr \"$x\" \"$dest\" done && @@ -75,7 +75,7 @@ cmd bulkrename $vidir # Bindings map <c-f> $lf -remote "send $id select '$(fzf)'" -map J $lf -remote "send $id cd $(cut -d' ' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" +map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" map gh map g top map D delete @@ -103,5 +103,7 @@ map <c-e> down map <c-y> up map V push :!nvim<space> +map W $setsid -f $TERMINAL >/dev/null 2>&1 + # Source Bookmarks source "~/.config/lf/shortcutrc" diff --git a/.config/pulse/daemon.conf b/.config/pulse/daemon.conf deleted file mode 100644 index ef900f1..0000000 --- a/.config/pulse/daemon.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Never exit pulseaudio if idle. This is to deal with an issue of Chromium -# browsers not properly starting Pulseaudio by themselves. When the underlying -# issue is solved, this file/directory should be removed. -exit-idle-time = -1 diff --git a/.config/sxiv/exec/key-handler b/.config/sxiv/exec/key-handler new file mode 100644 index 0000000..3d9565f --- /dev/null +++ b/.config/sxiv/exec/key-handler @@ -0,0 +1,33 @@ +#!/bin/sh +while read file +do + case "$1" in + "w") setbg "$file" & ;; + "c") + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." & + ;; + "m") + [ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")" + [ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit + mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." & + ;; + "r") + convert -rotate 90 "$file" "$file" ;; + "R") + convert -rotate -90 "$file" "$file" ;; + "f") + convert -flop "$file" "$file" ;; + "y") + echo -n "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$file copied to clipboard" & ;; + "Y") + readlink -f "$file" | tr -d '\n' | xclip -selection clipboard && + notify-send "$(readlink -f "$file") copied to clipboard" & ;; + "d") + [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;; + "g") ifinstalled gimp && setsid -f gimp "$file" ;; + "i") notify-send "File information" "$(mediainfo "$file")" ;; + esac +done diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 6430b97..c0f54a9 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -6,6 +6,7 @@ set-option -g prefix C-a unbind-key C-b bind-key C-a send-prefix + # Allows vim to display colors correctly. set -g default-terminal 'screen-256color' set -ga terminal-overrides ',*256col*:Tc' @@ -54,9 +55,9 @@ bind -n M-l select-pane -R bind Escape copy-mode bind p paste-buffer bind -T copy-mode-vi v send -X begin-selection -bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy" -bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" -bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy" +bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard" +bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip" +bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip" # 0 is too far from ` ;) set -g base-index 1 diff --git a/.config/x11/xprofile b/.config/x11/xprofile index 8ba9496..d3b9205 100755 --- a/.config/x11/xprofile +++ b/.config/x11/xprofile @@ -12,6 +12,11 @@ xbanish & # Remove mouse when typing dwmblocks & # Status bar echo $PATH > /tmp/path.dbg +# pipewire +/usr/bin/pipewire & +/usr/bin/pipewire-pulse & +/usr/bin/pipewire-media-session & + # This line autostart an instance of Pulseaudio that does not exit on idle. # This is "necessary" on Artix due to a current bug between PA and # Chromium-based browsers where they fail to start PA and use dummy output. diff --git a/.local/bin/statusbar/sb-mailbox b/.local/bin/statusbar/sb-mailbox new file mode 100755 index 0000000..35ad7bb --- /dev/null +++ b/.local/bin/statusbar/sb-mailbox @@ -0,0 +1,20 @@ +#!/bin/sh + +# Displays number of unread mail and an loading icon if updating. +# When clicked, brings up `neomutt`. + +case $BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e neomutt ;; + 2) setsid -f mw -Y >/dev/null ;; + 3) notify-send "📬 Mail module" "\- Shows unread mail +- Shows 🔃 if syncing mail +- Left click opens neomutt +- Middle click syncs mail" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/ -type f | wc -l 2>/dev/null)" + +pidof mbsync >/dev/null 2>&1 && icon="🔃" + +[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬 $unread$icon" |