Merge branch 'master' of github.com:LukeSmithxyz/voidrice

This commit is contained in:
Luke Smith 2023-01-15 08:23:54 -05:00
commit 9385a569fe
11 changed files with 57 additions and 84 deletions

View file

@ -43,7 +43,7 @@ cmd open ${{
;; ;;
audio/*|video/x-ms-asf) mpv --audio-display=no $f ;; audio/*|video/x-ms-asf) mpv --audio-display=no $f ;;
video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; application/pdf|application/vnd.djvu|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
application/pgp-encrypted) $EDITOR $fx ;; application/pgp-encrypted) $EDITOR $fx ;;
application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;; application/vnd.openxmlformats-officedocument.wordprocessingml.document|application/vnd.oasis.opendocument.text) setsid -f lowriter $fx >/dev/null 2>&1 ;;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;; application/vnd.openxmlformats-officedocument.spreadsheetml.sheet|application/octet-stream|application/vnd.oasis.opendocument.spreadsheet|application/vnd.oasis.opendocument.spreadsheet-template) setsid -f localc $fx >/dev/null 2>&1 ;;
@ -115,8 +115,8 @@ map <c-s> set hidden!
map <enter> shell map <enter> shell
map x $$f map x $$f
map X !$f map X !$f
map o &mimeopen $f map o &mimeopen "$f"
map O $mimeopen --ask $f map O $mimeopen --ask "$f"
map A rename # at the very end map A rename # at the very end
map c push A<c-u> # new rename map c push A<c-u> # new rename

View file

@ -26,7 +26,6 @@ case "$(file --dereference --brief --mime-type -- "$1")" in
text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;;
text/troff) man ./ "$1" | col -b ;; text/troff) man ./ "$1" | col -b ;;
text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;; text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;;
application/zip) atool --list -- "$1" ;;
audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;;
video/* ) video/* )
CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)"
@ -43,6 +42,7 @@ case "$(file --dereference --brief --mime-type -- "$1")" in
[ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg"
image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1"
;; ;;
application/*zip) atool --list -- "$1" ;;
*opendocument*) odt2txt "$1" ;; *opendocument*) odt2txt "$1" ;;
application/pgp-encrypted) gpg -d -- "$1" ;; application/pgp-encrypted) gpg -d -- "$1" ;;
esac esac

View file

@ -19,29 +19,26 @@ export BROWSER="librewolf"
export XDG_CONFIG_HOME="$HOME/.config" export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share" export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CACHE_HOME="$HOME/.cache" export XDG_CACHE_HOME="$HOME/.cache"
export XINITRC="${XDG_CONFIG_HOME:-$HOME/.config}/x11/xinitrc" export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs. #export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch-config" export NOTMUCH_CONFIG="$XDG_CONFIG_HOME/notmuch-config"
export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0" export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0"
export LESSHISTFILE="-" export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc" export INPUTRC="$XDG_CONFIG_HOME/shell/inputrc"
export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/shell/inputrc" export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" #export GNUPGHOME="$XDG_DATA_HOME/gnupg"
#export ALSA_CONFIG_PATH="$XDG_CONFIG_HOME/alsa/asoundrc" export WINEPREFIX="$XDG_DATA_HOME/wineprefixes/default"
#export GNUPGHOME="${XDG_DATA_HOME:-$HOME/.local/share}/gnupg" export KODI_DATA="$XDG_DATA_HOME/kodi"
export WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local/share}/wineprefixes/default" export PASSWORD_STORE_DIR="$XDG_DATA_HOME/password-store"
export KODI_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/kodi"
export PASSWORD_STORE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/password-store"
export TMUX_TMPDIR="$XDG_RUNTIME_DIR" export TMUX_TMPDIR="$XDG_RUNTIME_DIR"
export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android" export ANDROID_SDK_HOME="$XDG_CONFIG_HOME/android"
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" export CARGO_HOME="$XDG_DATA_HOME/cargo"
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" export GOPATH="$XDG_DATA_HOME/go"
export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg" export ANSIBLE_CONFIG="$XDG_CONFIG_HOME/ansible/ansible.cfg"
export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison" export UNISON="$XDG_DATA_HOME/unison"
export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history" export HISTFILE="$XDG_DATA_HOME/history"
export WEECHAT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/weechat" export MBSYNCRC="$XDG_CONFIG_HOME/mbsync/config"
export MBSYNCRC="${XDG_CONFIG_HOME:-$HOME/.config}/mbsync/config" export ELECTRUMDIR="$XDG_DATA_HOME/electrum"
export ELECTRUMDIR="${XDG_DATA_HOME:-$HOME/.local/share}/electrum"
# Other program settings: # Other program settings:
export DICS="/usr/share/stardict/dic/" export DICS="/usr/share/stardict/dic/"
@ -58,7 +55,7 @@ export LESS_TERMCAP_ue="$(printf '%b' '')"
export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null" export LESSOPEN="| /usr/bin/highlight -O ansi %s 2>/dev/null"
export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads. export MOZ_USE_XINPUT2="1" # Mozilla smooth scrolling/touchpads.
export AWT_TOOLKIT="MToolkit wmname LG3D" #May have to install wmname export AWT_TOOLKIT="MToolkit wmname LG3D" # May have to install wmname
export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm export _JAVA_AWT_WM_NONREPARENTING=1 # Fix for Java applications in dwm
[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && setsid shortcuts >/dev/null 2>&1 [ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ] && setsid shortcuts >/dev/null 2>&1

View file

@ -12,6 +12,7 @@ map K zoom in
map J zoom out map J zoom out
map i recolor map i recolor
map p print map p print
map g goto top
set default-bg "{background}" set default-bg "{background}"
set default-fg "{foreground}" set default-fg "{foreground}"

View file

@ -54,7 +54,7 @@ preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt.
# Use lf to switch directories and bind it to ctrl-o # Use lf to switch directories and bind it to ctrl-o
lfcd () { lfcd () {
tmp="$(mktemp -uq)" tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@" lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then if [ -f "$tmp" ]; then
dir="$(cat "$tmp")" dir="$(cat "$tmp")"

View file

@ -39,9 +39,9 @@ case "$ext" in
java) javac -d classes "$file" && java -cp classes "${1%.*}" ;; java) javac -d classes "$file" && java -cp classes "${1%.*}" ;;
m) octave "$file" ;; m) octave "$file" ;;
md) if [ -x "$(command -v lowdown)" ]; then md) if [ -x "$(command -v lowdown)" ]; then
lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf lowdown --parse-no-intraemph "$file" -Tms | groff -mpdfmark -ms -kept -T pdf > "$base".pdf
elif [ -x "$(command -v groffdown)" ]; then elif [ -x "$(command -v groffdown)" ]; then
groffdown -i "$file" | groff > "$base.pdf" groffdown -i "$file" | groff -T pdf > "$base".pdf
else else
pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file" pandoc -t ms --highlight-style=kate -s -o "$base".pdf "$file"
fi ; ;; fi ; ;;
@ -51,7 +51,7 @@ case "$ext" in
py) python "$file" ;; py) python "$file" ;;
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; [rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
rs) cargo build ;; rs) cargo build ;;
sass) sassc -a "$file" "$base.css" ;; sass) sassc -a "$file" "$base".css ;;
scad) openscad -o "$base".stl "$file" ;; scad) openscad -o "$base".stl "$file" ;;
sent) setsid -f sent "$file" 2>/dev/null ;; sent) setsid -f sent "$file" 2>/dev/null ;;
tex) textype "$file" ;; tex) textype "$file" ;;

View file

@ -27,18 +27,18 @@ mountusb() { \
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
"exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";;
esac esac && notify-send "💻 USB mounting" "$chosen mounted to $mp." ||
notify-send "💻 USB mounting" "$chosen mounted to $mp." notify-send "💻 Drive failed to mount." "Probably a permissions issue or drive is already mounted."
} }
mountandroid() { \ mountandroid() { \
chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1
chosen="$(echo "$chosen" | cut -d : -f 1)" chosen="$(echo "$chosen" | cut -d : -f 1)"
getmount "$HOME -maxdepth 3 -type d" getmount "$HOME -maxdepth 3 -type d"
simple-mtpfs --device "$chosen" "$mp"
echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1
simple-mtpfs --device "$chosen" "$mp" simple-mtpfs --device "$chosen" "$mp" &&
notify-send "🤖 Android Mounting" "Android device mounted to $mp." notify-send "🤖 Android Mounting" "Android device mounted to $mp." ||
notify-send "🤖 Android failed mounting." "Probably a permissions issue or phone is already mounted."
} }
asktype() { \ asktype() { \

View file

@ -4,41 +4,18 @@
# Provides you with mounted partitions, select one to unmount. # Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount. # Drives mounted at /, /boot and /home will not be options to unmount.
unmountusb() { drives="$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}'; awk '/simple-mtpfs/ { print "📱", $2; }' /etc/mtab)"
[ -z "$drives" ] && exit
chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
}
unmountandroid() { \ chosen="$(echo "$drives" | dmenu -i -p "Unmount which drive?")" || exit 1
chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")" || exit 1
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
}
asktype() { \ case "$chosen" in
choice="$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" || exit 1 📱*)
case "$choice" in chosen="${chosen#📱 }"
USB) unmountusb ;; sudo -A umount -l "$chosen"
Android) unmountandroid ;; ;;
esac *)
} chosen="${chosen% (*}"
sudo -A umount -l "$chosen"
drives=$(lsblk -nrpo "name,type,size,mountpoint,label" | awk -F':' '{gsub(/ /,":")}$4!~/\/boot|\/efi|\/home$|SWAP/&&length($4)>1{printf "%s (%s) %s\n",$4,$3,$5}') ;;
esac && notify-send "🖥️ Drive unmounted." "$chosen successfully unmounted." ||
if ! grep simple-mtpfs /etc/mtab; then notify-send "🖥️ Drive failed to unmount." "Possibly a permissions or I/O issue."
[ -z "$drives" ] && echo "No drives to unmount." && exit
echo "Unmountable USB drive detected."
unmountusb
else
if [ -z "$drives" ]
then
echo "Unmountable Android device detected."
unmountandroid
else
echo "Unmountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

View file

@ -13,7 +13,7 @@ else
fi fi
case "$url" in case "$url" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*) *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtube.com/shorts*|*youtu.be*|*hooktube.com*|*bitchute.com*|*videos.lukesmith.xyz*|*odysee.com*)
setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;; setsid -f mpv -quiet "$url" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif) *png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;; curl -sL "$url" > "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$url" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 & ;;

View file

@ -2,10 +2,8 @@
# Open a terminal window in the same directory as the currently active window. # Open a terminal window in the same directory as the currently active window.
PID=$(xprop -id "$(xprop -root | xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p") PID=$(xprop -id "$(xprop -root | sed -n "/_NET_ACTIVE_WINDOW/ s/^.*# // p")" | sed -n "/PID/ s/^.*= // p")
PID="$(pstree -lpA "$PID")" PID=$(pstree -lpATna "$PID" | grep -v '\-\(lf,[0-9]\+ -server\|(st-urlhandler,[0-9]\+)\|xclip,[0-9]\+\)' | sed '$s/.*,\([0-9]\+\).*/\1/;t;d')
PID="${PID##*"${SHELL##*/}"(}" cwd=$(readlink /proc/"$PID"/cwd)
PID="${PID#*lf(}" [ "$PWD" != "$cwd" ] && [ -d "$cwd" ] && { cd "$cwd" || exit 1; }
PID="${PID%%)*}"
cd "$(readlink /proc/"$PID"/cwd)" || return 1
"$TERMINAL" "$TERMINAL"

View file

@ -4,9 +4,9 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e pulsemixer ;; 1) setsid -f "$TERMINAL" -e pulsemixer ;;
2) pamixer -t ;; 2) wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle ;;
4) pamixer --allow-boost -i 1 ;; 4) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%+ ;;
5) pamixer --allow-boost -d 1 ;; 5) wpctl set-volume @DEFAULT_AUDIO_SINK@ 1%- ;;
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute. - Middle click to mute.
- Scroll to change." ;; - Scroll to change." ;;