Merge branch 'master' into copycodec

This commit is contained in:
Luke Smith 2020-07-08 08:51:13 -04:00 committed by GitHub
commit 59241307fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 295 additions and 199 deletions

View File

@ -18,7 +18,7 @@ mainmonitor="$(bspc query --monitors --names | grep -v LVDS | head -n 1)"
# fi # fi
# Start workspaces on the main monitor. # Start workspaces on the main monitor.
bspc monitor $mainmonitor -d 1 2 3 4 5 6 7 8 9 10 bspc monitor "$mainmonitor" -d 1 2 3 4 5 6 7 8 9 10
bspc desktop -f 1 bspc desktop -f 1
# If you want a multi-monitor display or something else, I leave that to you to # If you want a multi-monitor display or something else, I leave that to you to
@ -32,7 +32,7 @@ bspc config focus_follows_pointer true
bspc rule -a Zathura state=tiled bspc rule -a Zathura state=tiled
dropdownname="dropdown" dropdownname="dropdown"
bspc query -N -n .hidden >/dev/null || setsid $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1 & bspc query -N -n .hidden >/dev/null || setsid -f "$TERMINAL" -n "$dropdownname" -e dropdown >/dev/null 2>&1
bspc rule -a St:$dropdownname hidden=on bspc rule -a St:$dropdownname hidden=on
bspc rule -a St:$dropdownname sticky=on bspc rule -a St:$dropdownname sticky=on
bspc rule -a St:$dropdownname state=floating bspc rule -a St:$dropdownname state=floating

View File

@ -13,7 +13,7 @@ if ! echo "$mainmonitor" | grep LVDS >/dev/null 2>&1; then
fi fi
# Start workspaces on the main monitor. # Start workspaces on the main monitor.
bspc monitor $mainmonitor -d 1 2 3 4 5 6 7 8 9 10 bspc monitor "$mainmonitor" -d 1 2 3 4 5 6 7 8 9 10
bspc desktop -f 1 bspc desktop -f 1
# If you want a multi-monitor display or something else, I leave that to you to # If you want a multi-monitor display or something else, I leave that to you to
@ -26,7 +26,7 @@ bspc config top_padding 24 # top_padding I set equal to polybar's height
bspc config focus_follows_pointer true bspc config focus_follows_pointer true
dropdownname="dropdown" dropdownname="dropdown"
bspc query -N -n .hidden >/dev/null || setsid $TERMINAL -n "$dropdownname" -e dropdown >/dev/null 2>&1 & bspc query -N -n .hidden >/dev/null || setsid -f "$TERMINAL" -n "$dropdownname" -e dropdown >/dev/null 2>&1
bspc rule -a St:$dropdownname hidden=on bspc rule -a St:$dropdownname hidden=on
bspc rule -a St:$dropdownname sticky=on bspc rule -a St:$dropdownname sticky=on
bspc rule -a St:$dropdownname state=floating bspc rule -a St:$dropdownname state=floating

View File

@ -1,11 +1,11 @@
# You can add comments to these files with # # You can add comments to these files with #
h ~/ cac ${XDG_CACHE_HOME:-$HOME/.cache}
d ~/Documents cf ${XDG_CONFIG_HOME:-$HOME/.config}
D ~/Downloads D ${XDG_DOWNLOAD_DIR:-$HOME/Downloads}
m ~/Music d ${XDG_DOCUMENTS_DIR:-$HOME/Documents}
pp ~/Pictures h ${XDG_CONFIG_HOME:-$HOME}
vv ~/Videos m ${XDG_MUSIC_DIR:-$HOME/Music}
cf ${XDG_CONFIG_HOME:-$HOME/.config} mn /mnt
cac ${XDG_CACHE_HOME:-$HOME/.cache} pp ${XDG_PICTURES_DIR:-$HOME/Pictures}
sc ~/.local/bin sc ~/.local/bin
mn /mnt vv ${XDG_VIDEOS_DIR:-$HOME/Videos}

View File

@ -14,3 +14,4 @@ cfmc ${XDG_CONFIG_HOME:-$HOME/.config}/ncmpcpp/config
cfk ${XDG_CONFIG_HOME:-$HOME/.config}/sxhkd/sxhkdrc cfk ${XDG_CONFIG_HOME:-$HOME/.config}/sxhkd/sxhkdrc
cfi ${XDG_CONFIG_HOME:-$HOME/.config}/i3/config cfi ${XDG_CONFIG_HOME:-$HOME/.config}/i3/config
cfb ${XDG_CONFIG_HOME:-$HOME/.config}/i3blocks/config cfb ${XDG_CONFIG_HOME:-$HOME/.config}/i3blocks/config
cff ${XDG_CONFIG_HOME:-$HOME/.config}/fontconfig/fonts.conf

View File

@ -62,7 +62,7 @@ bindsym $mod+grave exec --no-startup-id dmenuunicode
bindsym $mod+Shift+Delete exec --no-startup-id pulsemixer --mute ; exec --no-startup-id mpc pause && pkill -RTMIN+10 i3blocks ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e lf bindsym $mod+Shift+Delete exec --no-startup-id pulsemixer --mute ; exec --no-startup-id mpc pause && pkill -RTMIN+10 i3blocks ; exec --no-startup-id pauseallmpv; workspace 0; exec $term -e htop ; exec $term -e lf
# Show selection: # Show selection:
bindsym $mod+Insert exec --no-startup-id showclip bindsym $mod+Insert exec --no-startup-id notify-send "📋 Clipboard contents:" "$(xclip -o -selection clipboard)"
##bindsym $mod+Pause ##bindsym $mod+Pause
# #---Letter Key Bindings---# # # #---Letter Key Bindings---# #

View File

@ -15,15 +15,14 @@ $lf -remote "send $id set previewer ${XDG_CONFIG_HOME:-$HOME/.config}/lf/scope"
# cmds/functions # cmds/functions
cmd open ${{ cmd open ${{
case $(file --mime-type $f -b) in case $(file --mime-type $f -b) in
image/vnd.djvu|application/pdf|application/octet-stream) setsid zathura $fx >/dev/null 2>&1 & ;; image/vnd.djvu|application/pdf|application/octet-stream) setsid -f zathura $fx >/dev/null 2>&1 ;;
text/troff) man ./ $f;;
text/*) $EDITOR $fx;; text/*) $EDITOR $fx;;
image/x-xcf|image/svg+xml) setsid gimp $f >/dev/null 2>&1 & ;; image/x-xcf|image/svg+xml) setsid -f gimp $f >/dev/null 2>&1 ;;
image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\)\(_large\)*$" | setsid sxiv -aio 2>/dev/null | lf-select & ;; image/*) rotdir $f | grep -i "\.\(png\|jpg\|jpeg\|gif\|webp\|tif\)\(_large\)*$" | sxiv -aio 2>/dev/null | lf-select ;;
audio/*) mpv $f ;; audio/*) mpv --audio-display=no $f ;;
video/*) setsid mpv $f -quiet >/dev/null 2>&1 & ;; video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;;
application/pdf) setsid zathura $fx >/dev/null 2>&1 & ;; application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;;
*) for f in $fx; do setsid $OPENER $f >/dev/null 2>&1 & done;; *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;;
esac esac
}} }}
@ -42,8 +41,10 @@ cmd moveto ${{
clear; tput cup $(($(tput lines)/3)); tput bold clear; tput cup $(($(tput lines)/3)); tput bold
set -f set -f
clear; echo "Move to where?" clear; echo "Move to where?"
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf | sed 's|~|$HOME|' )" &&
eval mv -iv $fx $dest && for x in $fx; do
eval mv -iv \"$x\" \"$dest\"
done &&
notify-send "🚚 File(s) moved." "File(s) moved to $dest." notify-send "🚚 File(s) moved." "File(s) moved to $dest."
}} }}
@ -51,8 +52,10 @@ cmd copyto ${{
clear; tput cup $(($(tput lines)/3)); tput bold clear; tput cup $(($(tput lines)/3)); tput bold
set -f set -f
clear; echo "Copy to where?" clear; echo "Copy to where?"
dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)" && dest="$(cut -d' ' -f2- ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf | sed 's|~|$HOME|' )" &&
eval cp -ivr $fx $dest && for x in $fx; do
eval cp -ivr \"$x\" \"$dest\"
done &&
notify-send "📋 File(s) copied." "File(s) copies to $dest." notify-send "📋 File(s) copied." "File(s) copies to $dest."
}} }}

View File

@ -31,11 +31,11 @@ color article white default bold
browser linkhandler browser linkhandler
macro , open-in-browser macro , open-in-browser
macro t set browser "qndl"; open-in-browser ; set browser linkhandler macro t set browser "qndl" ; open-in-browser ; set browser linkhandler
macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best"; open-in-browser ; set browser linkhandler macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best" ; open-in-browser ; set browser linkhandler
macro v set browser "setsid nohup mpv"; open-in-browser ; set browser linkhandler macro v set browser "setsid -f mpv" ; open-in-browser ; set browser linkhandler
macro w set browser "lynx"; open-in-browser ; set browser linkhandler macro w set browser "lynx" ; open-in-browser ; set browser linkhandler
macro p set browser "dmenuhandler"; open-in-browser ; set browser linkhandler macro p set browser "dmenuhandler" ; open-in-browser ; set browser linkhandler
macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler macro c set browser "xsel -b <<<" ; open-in-browser ; set browser linkhandler
highlight all "---.*---" yellow highlight all "---.*---" yellow

View File

@ -103,7 +103,7 @@ set clipboard+=unnamedplus
" Save file as sudo on files that require root permission " Save file as sudo on files that require root permission
cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit! cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
" Enable Goyo by default for mutt writting " Enable Goyo by default for mutt writing
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80 autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR> autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>

View File

@ -37,7 +37,7 @@
# #
# Flags are single characters which slightly transform the command: # Flags are single characters which slightly transform the command:
# f | Fork the program, make it run in the background. # f | Fork the program, make it run in the background.
# | New command = setsid $command >& /dev/null & # | New command = setsid -f $command >& /dev/null
# r | Execute the command with root permissions # r | Execute the command with root permissions
# | New command = sudo $command # | New command = sudo $command
# t | Run the program in a new terminal. If $TERMCMD is not defined, # t | Run the program in a new terminal. If $TERMCMD is not defined,

View File

@ -88,9 +88,9 @@ case "$extension" in
try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;; try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;;
# HTML Pages: # HTML Pages:
htm|html|xhtml) htm|html|xhtml)
try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } try w3m -dump "$path" && { dump | trim | fmt -s -w "$width"; exit 4; }
try lynx -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } try lynx -dump "$path" && { dump | trim | fmt -s -w "$width"; exit 4; }
try elinks -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } try elinks -dump "$path" && { dump | trim | fmt -s -w "$width"; exit 4; }
;; # fall back to highlight/cat if the text browsers fail ;; # fall back to highlight/cat if the text browsers fail
esac esac

View File

@ -25,9 +25,9 @@ super + c
super + v super + v
$TERMINAL -e nvim -c VimwikiIndex $TERMINAL -e nvim -c VimwikiIndex
super + shift + a super + shift + a
$TERMINAL -e alsamixer; pkill -RTMIN+10 blocks $TERMINAL -e pulsemixer
super + shift + c super + shift + c
mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --title='mpvfloat' /dev/video0 camtoggle
super + shift + e super + shift + e
tutorialvids tutorialvids
super + w super + w

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 KiB

View File

@ -41,6 +41,6 @@ do
done < "$2" done < "$2"
# The last track must be done outside the loop. # The last track must be done outside the loop.
echo "From $start to the end: $title" echo "From $start to the end: $title"
file="$escbook/$track-$esctitle.$ext" file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext"
echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -ss "$start" -i "$inputaudio" -vn -c copy "$file" && echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn -c copy "$file" &&
echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file" echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file"

2
.local/bin/camtoggle Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
pkill -f /dev/video || mpv --no-osc --no-input-default-bindings --input-conf=/dev/null --geometry=-0-0 --autofit=30% --title="mpvfloat" /dev/video0

View File

@ -5,10 +5,14 @@
# #
# Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent # Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent
# presentations. Runs scripts based on extention or shebang # presentations. Runs scripts based on extention or shebang
#
# Note that .tex files which you wish to compile with XeLaTeX should have the
# string "xelatex" somewhere in a comment/command in the first 5 lines.
file=$(readlink -f "$1") file=$(readlink -f "$1")
dir=$(dirname "$file") dir=${file%/*}
base="${file%.*}" base="${file%.*}"
ext="${file##*.}"
cd "$dir" || exit cd "$dir" || exit
@ -22,19 +26,27 @@ textype() { \
$command --output-directory="$dir" "$base" $command --output-directory="$dir" "$base"
} }
case "$file" in case "$ext" in
*\.ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;; [0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;;
*\.mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;; c) cc "$file" -o "$base" && "$base" ;;
*\.[0-9]) preconv "$file" | refer -PS -e | groff -mandoc -T pdf > "$base".pdf ;; go) go run "$file" ;;
*\.[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;; h) sudo make install ;;
*\.tex) textype "$file" ;; m) octave "$file" ;;
*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;; md) if [ -x "$(command -v lowdown)" ]; then
*config.h) sudo make install ;; lowdown -d nointem -e super "$file" -Tms | groff -mpdfmark -ms -kept > "$base".pdf
*\.c) cc "$file" -o "$base" && "$base" ;; elif [ -x "$(command -v groffdown)" ]; then
*\.py) python "$file" ;; groffdown -i "$file" | groff > "$base.pdf"
*\.m) octave "$file" ;; else
*\.scad) openscad -o "$base".stl "$file" ;; pandoc "$file" --pdf-engine=xelatex -o "$base".pdf
*\.go) go run "$file" ;; fi ; ;;
*\.sent) setsid sent "$file" 2>/dev/null & ;; mom) preconv "$file" | refer -PS -e | groff -mom -kept -T pdf > "$base".pdf ;;
ms) preconv "$file" | refer -PS -e | groff -me -ms -kept -T pdf > "$base".pdf ;;
py) python "$file" ;;
[rR]md) Rscript -e "rmarkdown::render('$file', quiet=TRUE)" ;;
rs) cargo build ;;
sass) sassc -a "$file" "$base.css" ;;
scad) openscad -o "$base".stl "$file" ;;
sent) setsid -f sent "$file" 2>/dev/null ;;
tex) textype "$file" ;;
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;; *) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
esac esac

View File

@ -2,7 +2,7 @@
# Syncs repositories and downloads updates, meant to be run as a cronjob. # Syncs repositories and downloads updates, meant to be run as a cronjob.
ping -q -c 1 1.1.1.1 > /dev/null || exit ping -q -c example.org > /dev/null || exit
notify-send "📦 Repository Sync" "Checking for package updates..." notify-send "📦 Repository Sync" "Checking for package updates..."

View File

@ -3,4 +3,4 @@
# Toggles all cronjobs off/on. # Toggles all cronjobs off/on.
# Stores disabled crontabs in ~/.consaved until restored. # Stores disabled crontabs in ~/.consaved until restored.
([ -f ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved ] && crontab - < ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && rm ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > ${XDG_CONFIG_HOME:-$HOME/.config}/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.") ([ -f "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved ] && crontab - < "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && rm "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && notify-send "🕓 Cronjobs re-enabled.") || ( crontab -l > "${XDG_CONFIG_HOME:-$HOME/.config}"/cronsaved && crontab -r && notify-send "🕓 Cronjobs saved and disabled.")

View File

@ -3,11 +3,11 @@
# Set as a cron job to check for new RSS entries for newsboat. # Set as a cron job to check for new RSS entries for newsboat.
# If newsboat is open, sends it an "R" key to refresh. # If newsboat is open, sends it an "R" key to refresh.
ping -q -c 1 1.1.1.1 > /dev/null || exit ping -q -c 1 example.org > /dev/null || exit
/usr/bin/notify-send "📰 Updating RSS feeds..." /usr/bin/notify-send "📰 Updating RSS feeds..."
ps ax | grep -q newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit pgrep -f newsboat$ && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name newsboat)" R && exit
echo 🔃 > /tmp/newsupdate echo 🔃 > /tmp/newsupdate
pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}" pkill -RTMIN+6 "${STATUSBAR:-dwmblocks}"

View File

@ -18,10 +18,10 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
tail -n 1 | awk '{print $1}') tail -n 1 | awk '{print $1}')
res_ext_x=$(echo $res_external | sed 's/x.*//') res_ext_x=$(echo "$res_external" | sed 's/x.*//')
res_ext_y=$(echo $res_external | sed 's/.*x//') res_ext_y=$(echo "$res_external" | sed 's/.*x//')
res_int_x=$(echo $res_internal | sed 's/x.*//') res_int_x=$(echo "$res_internal" | sed 's/x.*//')
res_int_y=$(echo $res_internal | sed 's/.*x//') res_int_y=$(echo "$res_internal" | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l) scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l) scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
@ -59,7 +59,7 @@ onescreen() { # If only one output available or chosen.
postrun() { # Stuff to run to clean up. postrun() { # Stuff to run to clean up.
setbg # Fix background if screen size/arangement has changed. setbg # Fix background if screen size/arangement has changed.
remaps # Re-remap keys if keyboard added (for laptop bases) remaps # Re-remap keys if keyboard added (for laptop bases)
{ killall dunst ; setsid dunst & } >/dev/null 2>&1 # Restart dunst to ensure proper location on screen { killall dunst ; setsid -f dunst ;} >/dev/null 2>&1 # Restart dunst to ensure proper location on screen
} }
# Get all possible displays # Get all possible displays

View File

@ -5,12 +5,12 @@
case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube-dl\\nfeh\\nbrowser\\nw3m\\nmpv (float)" | dmenu -i -p "Open link with what program?")" in
"copy url") echo "$1" | xclip -selection clipboard ;; "copy url") echo "$1" | xclip -selection clipboard ;;
mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; mpv) setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
"mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;; "mpv (loop)") setsid -f mpv -quiet --loop "$1" >/dev/null 2>&1 ;;
"queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;;
"queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;;
browser) setsid "$BROWSER" "$1" >/dev/null 2>&1 & ;; browser) setsid -f "$BROWSER" "$1" >/dev/null 2>&1 ;;
feh) setsid feh "$1" >/dev/null 2>&1 & ;; feh) setsid -f feh "$1" >/dev/null 2>&1 ;;
w3m) w3m "$1" >/dev/null 2>&1 ;; w3m) w3m "$1" >/dev/null 2>&1 ;;
"mpv (float)") setsid mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 & ;; "mpv (float)") setsid -f mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$1" >/dev/null 2>&1 ;;
esac esac

View File

@ -49,7 +49,7 @@ asktype() { \
} }
anddrives=$(simple-mtpfs -l 2>/dev/null) anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$4==""{printf "%s (%s)\n",$1,$3}')" usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit

19
.local/bin/dmenumountcifs Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted local NAS shares.
# Requirements - "%wheel ALL=(ALL) NOPASSWD: ALL"
#
# Browse for mDNS/DNS-SD services using the Avahi daemon...
srvname=$(avahi-browse _smb._tcp -t | awk '{print $4}' | dmenu -i -p "Which NAS?") || exit 1
notify-send "Searching for network shares..." "Please wait..."
# Choose share disk...
share=$(smbclient -L "$srvname" -N | grep Disk | awk '{print $1}' | dmenu -i -p "Mount which share?") || exit 1
# Format URL...
share2mnt=//"$srvname".local/"$share"
sharemount() {
mounted=$(mount -v | grep "$share2mnt") || ([ ! -d /mnt/"$share" ] && mkdir /mnt/"$share")
[ -z "$mounted" ] && sudo mount -t cifs "$share2mnt" -o user=nobody,password="" /mnt/"$share" && notify-send "Netshare $share mounted" && exit 0
notify-send "Netshare $share already mounted"; exit 1
}
sharemount

14
.local/bin/getbib Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
if [ -f "$1" ]; then
# Try to get DOI from pdfinfo or pdftotext output.
doi=$(pdfinfo "$1" | grep -io "doi:.*") ||
doi=$(pdftotext "$1" 2>/dev/null - | grep -io "doi:.*" -m 1) ||
exit 1
else
doi="$1"
fi
# Check crossref.org for the bib citation.
curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n"

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
cat ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys/"$1" 2>/dev/null && exit cat "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys/"$1" 2>/dev/null && exit
echo "Run command with one of the following arguments for info about that program:" echo "Run command with one of the following arguments for info about that program:"
ls ${XDG_DATA_HOME:-$HOME/.local/share}/larbs/getkeys ls "${XDG_DATA_HOME:-$HOME/.local/share}"/larbs/getkeys

View File

@ -5,4 +5,7 @@
# it informs the user that they need that command to continue. This is used in # it informs the user that they need that command to continue. This is used in
# various other scripts for clarity's sake. # various other scripts for clarity's sake.
pacman -Qq "$1" >/dev/null || { notify-send "📦 $1" "must be installed for this function." && exit 1 ;} for x in "$@";do
pacman -Qq "$x" 2>/dev/null ||
{ notify-send "📦 $x" "must be installed for this function." && exit 1 ;}
done

View File

@ -11,12 +11,12 @@
case "$1" in case "$1" in
*mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*) *mkv|*webm|*mp4|*youtube.com/watch*|*youtube.com/playlist*|*youtu.be*|*hooktube.com*|*bitchute.com*)
setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; setsid -f mpv -quiet "$1" >/dev/null 2>&1 ;;
*png|*jpg|*jpe|*jpeg|*gif) *png|*jpg|*jpe|*jpeg|*gif)
curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;; curl -sL "$1" > "/tmp/$(echo "$1" | sed "s/.*\///")" && sxiv -a "/tmp/$(echo "$1" | sed "s/.*\///")" >/dev/null 2>&1 & ;;
*mp3|*flac|*opus|*mp3?source*) *mp3|*flac|*opus|*mp3?source*)
setsid tsp curl -LO "$1" >/dev/null 2>&1 & ;; setsid -f tsp curl -LO "$1" >/dev/null 2>&1 ;;
*) *)
if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR $1" if [ -f "$1" ]; then "$TERMINAL" -e "$EDITOR" "$1"
else setsid $BROWSER "$1" >/dev/null 2>&1 & fi ;; else setsid -f "$BROWSER" "$1" >/dev/null 2>&1; fi ;;
esac esac

View File

@ -1,28 +0,0 @@
#!/bin/sh
NUM="${2:-5}"
# Uncomment the following line to use Pulseaudio.
# PULSE=true
if [ "$PULSE" ]; then
toggle() { pulsemixer --toggle-mute ;}
mute() { pulsemixer --mute ;}
up() { pulsemixer --change-volume +"$NUM" ;}
down() { pulsemixer --change-volume -"$NUM" ;}
control() { pulsemixer ;}
else
toggle() { amixer sset Master toggle ;}
mute() { amixer sset Master mute ;}
up() { amixer sset Master "$NUM"%+ ;}
down() { amixer sset Master "$NUM"%- ;}
control() { alsamixer ;}
fi
case "$1" in
toggle) toggle ;;
mute) mute ;;
up) up ;;
down) down ;;
control) control ;;
esac

View File

@ -4,10 +4,10 @@
# usually the pdf of a compiled document. I find this useful especially # usually the pdf of a compiled document. I find this useful especially
# running from vim. # running from vim.
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')" basename="$(echo "${*}" | sed 's/\.[^\/.]*$//')"
case "$1" in case "${*}" in
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid xdg-open "$basename".pdf >/dev/null 2>&1 & ;; *.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid -f xdg-open "$basename".pdf >/dev/null 2>&1 ;;
*.html) setsid "$BROWSER" "$basename".html >/dev/null 2>&1 & ;; *.html) setsid -f "$BROWSER" "$basename".html >/dev/null 2>&1 ;;
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;; *.sent) setsid -f sent "$1" >/dev/null 2>&1 ;;
esac esac

View File

@ -6,5 +6,5 @@
# (with other things) by default and is used in some other places. # (with other things) by default and is used in some other places.
for i in $(ls /tmp/mpvSockets/*); do for i in $(ls /tmp/mpvSockets/*); do
echo '{ "command": ["set_property", "pause", true] }' | socat - $i; echo '{ "command": ["set_property", "pause", true] }' | socat - "$i";
done done

View File

@ -2,6 +2,6 @@
# entr command to run `queueandnotify` when newsboat queue is changed # entr command to run `queueandnotify` when newsboat queue is changed
[ "$(pgrep -x $(basename $0) | wc -l)" -gt 2 ] && exit [ "$(pgrep -x "$(basename "$0")" | wc -l)" -gt 2 ] && exit
echo ${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/queue | entr -p queueandnotify 2>/dev/null echo "${XDG_DATA_HOME:-$HOME/.local/share}"/newsboat/queue | entr -p queueandnotify 2>/dev/null

View File

@ -6,7 +6,7 @@ base="$(basename "$1")"
notify-send "⏳ Queuing $base..." notify-send "⏳ Queuing $base..."
cmd="$2" cmd="$2"
[ -z "$cmd" ] && cmd="youtube-dl --add-metadata" [ -z "$cmd" ] && cmd="youtube-dl --add-metadata"
idnum="$(tsp $cmd "$1")" idnum="$(tsp "$cmd" "$1")"
realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")" realname="$(echo "$base" | sed "s/?\(source\|dest\).*//;s/%20/ /g")"
tsp -D "$idnum" mv "$base" "$realname" tsp -D "$idnum" mv "$base" "$realname"
tsp -D "$idnum" notify-send "👍 $realname done." tsp -D "$idnum" notify-send "👍 $realname done."

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/bin/sh
# Output locations. Unactivated progs should go to /dev/null. # Output locations. Unactivated progs should go to /dev/null.
shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc" shell_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc"
@ -6,7 +6,7 @@ zsh_named_dirs="${XDG_CONFIG_HOME:-$HOME/.config}/zshnameddirrc"
ranger_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf" ranger_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/ranger/shortcuts.conf"
qute_shortcuts="/dev/null" qute_shortcuts="/dev/null"
fish_shortcuts="/dev/null" fish_shortcuts="/dev/null"
vifm_shortcuts="${XDG_CONFIG_HOME:-$HOME/.config}/vifm/vifmshortcuts" vifm_shortcuts="/dev/null"
# Remove, prepare files # Remove, prepare files
rm -f "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null rm -f "$ranger_shortcuts" "$qute_shortcuts" "$zsh_named_dirs" 2>/dev/null
@ -15,15 +15,17 @@ printf "# vim: filetype=sh\\nalias " > "$shell_shortcuts"
printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts" printf "\" vim: filetype=vim\\n" > "$vifm_shortcuts"
# Format the `directories` file in the correct syntax and sent it to all three configs. # Format the `directories` file in the correct syntax and sent it to all three configs.
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/directories" | tee >(awk '{print $1"=\"cd "$2" && ls -a\" \\"}' >> "$shell_shortcuts") \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
>(awk '{print "hash -d "$1"="$2}' >> "$zsh_named_dirs") \ printf(\"%s=\42cd %s && ls -a\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
>(awk '{print "abbr", $1, "\"cd " $2 "; and ls -a\""}' >> "$fish_shortcuts") \ printf(\"hash -d %s=%s \n\",\$1,\$2) >> \"$zsh_named_dirs\" ;
>(awk '{print "map g" $1, ":cd", $2 "<CR>\nmap t" $1, "<tab>:cd", $2 "<CR><tab>\nmap M" $1, "<tab>:cd", $2 "<CR><tab>:mo<CR>\nmap Y" $1, "<tab>:cd", $2 "<CR><tab>:co<CR>" }' >> "$vifm_shortcuts") \ printf(\"abbr %s \42cd %s; and ls -a\42\n\",\$1,\$2) >> \"$fish_shortcuts\" ;
>(awk '{print "config.bind(\";"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \ printf(\"map g%s :cd %s<CR>\nmap t%s <tab>:cd %s<CR><tab>\nmap M%s <tab>:cd %s<CR><tab>:mo<CR>\nmap Y%s <tab>:cd %s<CR><tab>:co<CR> \n\",\$1,\$2, \$1, \$2, \$1, \$2, \$1, \$2) >> \"$vifm_shortcuts\" ;
| awk '{print "map g"$1" cd "$2"\nmap t"$1" tab_new "$2"\nmap m"$1" shell mv -v %s "$2"\nmap Y"$1" shell cp -rv %s "$2}' >> "$ranger_shortcuts" printf(\"config.bind(';%s', \42set downloads.location.directory %s ;; hint links download\42) \n\",\$1,\$2) >> \"$qute_shortcuts\" ;
printf(\"map g%s cd %s\nmap t%s tab_new %s\nmap m%s shell mv -v %%s %s\nmap Y%s shell cp -rv %%s %s \n\",\$1,\$2,\$1,\$2, \$1, \$2, \$1, \$2) >> \"$ranger_shortcuts\" }" "${XDG_CONFIG_HOME:-$HOME/.config}/directories"
# Format the `files` file in the correct syntax and sent it to both configs. # Format the `files` file in the correct syntax and sent it to both configs.
sed "s/\s*#.*$//;/^\s*$/d" "${XDG_CONFIG_HOME:-$HOME/.config}/files" | tee >(awk '{print $1"=\"$EDITOR "$2"\" \\"}' >> "$shell_shortcuts") \ awk "!/^\s*#/ && !/^\s*\$/ {gsub(\"\\\s*#.*$\",\"\");
>(awk '{print "abbr", $1, "\"$EDITOR "$2"\""}' >> "$fish_shortcuts") \ printf(\"%s=\42\$EDITOR %s\42 \\\\\n\",\$1,\$2) >> \"$shell_shortcuts\" ;
>(awk '{print "map", $1, ":e", $2 "<CR>" }' >> "$vifm_shortcuts") \ printf(\"abbr %s \42\$EDITOR %s\42 \n\",\$1,\$2) >> \"$fish_shortcuts\" ;
| awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts" printf(\"map %s :e %s<CR> \n\",\$1,\$2) >> \"$vifm_shortcuts\" ;
printf(\"map %s shell \$EDITOR %s \n\",\$1,\$2) >> \"$ranger_shortcuts\" }" "${XDG_CONFIG_HOME:-$HOME/.config}/files"

View File

@ -1,10 +0,0 @@
#!/bin/sh
# Display contents of selection via dunst if running.
# Separate script for i3.
clip=$(xclip -o -selection clipboard)
prim=$(xclip -o -selection primary)
[ -n "$clip" ] && notify-send "Clipboard:" "$clip"
[ -n "$prim" ] && notify-send "Primary:" "$prim"

View File

@ -20,7 +20,7 @@ esac
for battery in /sys/class/power_supply/BAT? for battery in /sys/class/power_supply/BAT?
do do
# Get its remaining capacity and charge status. # Get its remaining capacity and charge status.
capacity=$(cat "$battery"/capacity) || break capacity=$(cat "$battery"/capacity 2>/dev/null) || break
status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status) status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/⚡/" "$battery"/status)
# If it is discharging and 25% or less, we will add a ❗ as a warning. # If it is discharging and 25% or less, we will add a ❗ as a warning.

View File

@ -20,7 +20,7 @@ esac
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;; 1) notify-send "This Month" "$(cal --color=always | sed "s/..7m/<b><span color=\"red\">/;s/..27m/<\/span><\/b>/")" && notify-send "Appointments" "$(calcurse -D ~/.config/calcurse -d3)" ;;
2) setsid "$TERMINAL" -e calcurse -D ~/.config/calcurse & ;; 2) setsid -f "$TERMINAL" -e calcurse ;;
3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` 3) notify-send "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\`
- Middle click opens calcurse if installed" ;; - Middle click opens calcurse if installed" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;

View File

@ -2,7 +2,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;; 1) notify-send "🖥 CPU hogs" "$(ps axch -o cmd:15,%cpu --sort=-%cpu | head)\\n(100% per core)" ;;
2) setsid "$TERMINAL" -e htop & ;; 2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send "🖥 CPU module " "\- Shows CPU temperature. 3) notify-send "🖥 CPU module " "\- Shows CPU temperature.
- Click to show intensive processes. - Click to show intensive processes.
- Middle click to open htop." ;; - Middle click to open htop." ;;

44
.local/bin/statusbar/cpubars Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# Module showing CPU load as a changing bars.
# Just like in polybar.
# Each bar represents amount of load on one core since
# last run.
# Cache in tmpfs to improve speed and reduce SSD load
cache=/tmp/cpubarscache
case $BLOCK_BUTTON in
2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send "🪨 CPU load module" "Each bar represents
one CPU core";;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
# id total idle
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
[ ! -f $cache ] && echo "$stats" > "$cache"
old=$(cat "$cache")
printf "🪨"
echo "$stats" | while read -r row; do
id=${row%% *}
rest=${row#* }
total=${rest%% *}
idle=${rest##* }
case "$(echo "$old" | awk '{if ($1 == id)
printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
id="$id" total="$total" idle="$idle")" in
"0") printf "▁";;
"1") printf "▂";;
"2") printf "▃";;
"3") printf "▄";;
"4") printf "▅";;
"5") printf "▆";;
"6") printf "▇";;
"7") printf "█";;
"8") printf "█";;
esac
done; printf "\\n"
echo "$stats" > "$cache"

View File

@ -28,7 +28,7 @@ printprices() { # Print/format all prices
for x in "$dir"/*; do for x in "$dir"/*; do
[ -f "$x" ] || break [ -f "$x" ] || break
info="$(cut -d';' -f-2 --output-delimiter=' ' "$x")" info="$(cut -d';' -f-2 --output-delimiter=' ' "$x")"
printf "%s$%0.2f " $info printf "%s$%0.2f " "$info"
done | sed 's/ $/\n/' done | sed 's/ $/\n/'
} }
@ -36,7 +36,7 @@ printprices() { # Print/format all prices
# If currencies haven't been updated today, try to update them. # If currencies haven't been updated today, try to update them.
[ "$(stat -c %x "$HOME/.local/share/crypto-prices" | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && [ "$(stat -c %x "$HOME/.local/share/crypto-prices" | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
{ ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && getprices || exit ;} { ping -q -c 1 example.org >/dev/null 2>&1 && getprices || exit ;}
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) uptime="$(date -d "$(stat -c %x "$dir")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" 1) uptime="$(date -d "$(stat -c %x "$dir")" '+%D at %T' | sed "s|$(date '+%D')|Today|")"

View File

@ -3,7 +3,7 @@
# The clickable help menu. Middle click to restart wm. # The clickable help menu. Middle click to restart wm.
# If dwm is running, use dwm's readme and restart. # If dwm is running, use dwm's readme and restart.
ps ax | grep -q "\sdwm$" && pidof dwm >/dev/null &&
READMEFILE=/usr/local/share/dwm/larbs.mom READMEFILE=/usr/local/share/dwm/larbs.mom
restartwm() { pkill -HUP dwm ;} || restartwm() { pkill -HUP dwm ;} ||
restartwm() { i3 restart ;} restartwm() { i3 restart ;}

16
.local/bin/statusbar/kbselect Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# works on any init system
# requirements: dmenu, xorg-setxkbmap, xkblayout-state (https://github.com/nonpop/xkblayout-state)
kb="$(xkblayout-state print "%s")" || exit 1
case $BLOCK_BUTTON in
1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
kb="$(echo "$kb_choice" | awk '{print $3}')"
setxkbmap "$kb"
pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";;
3) notify-send "⌨ Keyboard/language module" "$(xkblayout-state print "\- Current layout: %s (%n)")
- Left click to change keyboard.";;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
echo "$kb"

View File

@ -4,8 +4,8 @@
# When clicked, brings up `neomutt`. # When clicked, brings up `neomutt`.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e neomutt & ;; 1) setsid -f "$TERMINAL" -e neomutt ;;
2) setsid mailsync >/dev/null & ;; 2) setsid -f mailsync >/dev/null ;;
3) notify-send "📬 Mail module" "\- Shows unread mail 3) notify-send "📬 Mail module" "\- Shows unread mail
- Shows 🔃 if syncing mail - Shows 🔃 if syncing mail
- Left click opens neomutt - Left click opens neomutt

View File

@ -2,7 +2,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; 1) notify-send "🧠 Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
2) setsid "$TERMINAL" -e htop & ;; 2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total. 3) notify-send "🧠 Memory module" "\- Shows Memory Used/Total.
- Click to show memory hogs. - Click to show memory hogs.
- Middle click to open htop." ;; - Middle click to open htop." ;;

View File

@ -2,13 +2,13 @@
filter() { mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | paste -sd ' ';} filter() { mpc | sed "/^volume:/d;s/\\&/&amp;/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d" | paste -sd ' ';}
pidof -x mpdup >/dev/null 2>&1 || mpdup & pidof -x mpdup >/dev/null 2>&1 || mpdup >/dev/null 2>&1 &
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) mpc status | filter ; setsid "$TERMINAL" -e ncmpcpp & ;; # right click, pause/unpause 1) mpc status | filter ; setsid -f "$TERMINAL" -e ncmpcpp ;; # right click, pause/unpause
2) mpc toggle | filter ;; # right click, pause/unpause 2) mpc toggle | filter ;; # right click, pause/unpause
3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing. 3) mpc status | filter ; notify-send "🎵 Music module" "\- Shows mpd song playing.
- Italic when paused. - when paused.
- Left click opens ncmpcpp. - Left click opens ncmpcpp.
- Middle click pauses. - Middle click pauses.
- Scroll changes track.";; # right click, pause/unpause - Scroll changes track.";; # right click, pause/unpause

View File

@ -4,22 +4,25 @@
# transmitted (TX) since the previous time this script ran. So if run every # transmitted (TX) since the previous time this script ran. So if run every
# second, gives network traffic per second. # second, gives network traffic per second.
case "$BLOCK_BUTTON" in case $BLOCK_BUTTON in
3) notify-send "🌐 Network traffic module" "🔻: Traffic received 3) notify-send "🌐 Network traffic module" "🔻: Traffic received
🔺: Traffic transmitted" ;; 🔺: Traffic transmitted" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
rxfile="${XDG_CACHE_HOME:-$HOME/.cache}/rxlog" update() {
txfile="${XDG_CACHE_HOME:-$HOME/.cache}/txlog" sum=0
for arg; do
read -r i < "$arg"
sum=$(( sum + i ))
done
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
[ -f "$cache" ] && read -r old < "$cache" || old=0
printf %d\\n "$sum" > "$cache"
printf %d\\n $(( sum - old ))
}
rxcurrent="$(cat /sys/class/net/*/statistics/rx_bytes | paste -sd '+' | bc)" rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
txcurrent="$(cat /sys/class/net/*/statistics/tx_bytes | paste -sd '+' | bc)" tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
printf "🔻%sKiB 🔺%sKiB\\n" \ printf "🔻%4sB 🔺%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
"$(printf -- "(%s-%s)/1024\\n" "$rxcurrent" "$(cat "$rxfile")" | bc)" \
"$(printf -- "(%s-%s)/1024\\n" "$txcurrent" "$(cat "$txfile")" | bc)"
# Log the current values for next run.
echo "$rxcurrent" > "$rxfile"
echo "$txcurrent" > "$txfile"

View File

@ -5,7 +5,7 @@
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e newsboat ;; 1) setsid "$TERMINAL" -e newsboat ;;
2) setsid newsup >/dev/null & exit ;; 2) setsid -f newsup >/dev/null exit ;;
3) notify-send "📰 News module" "\- Shows unread news items 3) notify-send "📰 News module" "\- Shows unread news items
- Shows 🔃 if updating with \`newsup\` - Shows 🔃 if updating with \`newsup\`
- Left click opens newsboat - Left click opens newsboat
@ -14,4 +14,4 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ print "📰" $1}' | sed 's/^📰 0$//g')$(cat ${XDG_CONFIG_HOME:-$HOME/.config}/newsboat/.update 2>/dev/null)" cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "📰" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"

View File

@ -18,7 +18,7 @@
# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. # Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e popupgrade & ;; 1) setsid -f "$TERMINAL" -e popupgrade ;;
2) notify-send "$(/usr/bin/pacman -Qu)" ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages
- Left click to upgrade packages - Left click to upgrade packages

View File

@ -6,23 +6,25 @@
# When the name of the currency is multi-word, put it in quotes. # When the name of the currency is multi-word, put it in quotes.
[ -z "$3" ] && exit 1 [ -z "$3" ] && exit 1
interval="@7d" # History contained in chart preceded by '@' (7d = 7 days) interval="@14d" # History contained in chart preceded by '@' (7d = 7 days)
dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices" dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices"
pricefile="$dir/$1" pricefile="$dir/$1"
chartfile="$dir/$1-chart" chartfile="$dir/$1-chart"
updateprice() { ping -q -c 1 example.org >/dev/null 2>&1 &&
curl -s "rate.sx/1$1" > "$pricefile" &&
curl -s "rate.sx/$1$interval" > "$chartfile" ;}
[ -d "$dir" ] || mkdir -p "$dir" [ -d "$dir" ] || mkdir -p "$dir"
[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && [ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
{ ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && curl -s "rate.sx/1$1" > "$pricefile" || exit ;} updateprice "$1"
printf "$3$%0.2f" "$(cat "$pricefile")"
[ "$(stat -c %x "$chartfile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] &&
{ ping -q -c 1 1.1.1.1 >/dev/null 2>&1 && curl -s "rate.sx/$1$interval" > "$chartfile" || exit ;}
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e less -Sf "$chartfile" ;; 1) setsid "$TERMINAL" -e less -Sf "$chartfile" ;;
2) notify-send -u low "$3 Updating..." "Updating $2 price..."
updateprice "$1" && notify-send "$3 Update complete." "$2 price is now
\$$(cat "$pricefile")" ;;
3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")"
notify-send "$3 $2 module" "\- <b>Exact price: \$$(cat "$pricefile")</b> notify-send "$3 $2 module" "\- <b>Exact price: \$$(cat "$pricefile")</b>
- Left click for chart of changes. - Left click for chart of changes.
@ -32,3 +34,5 @@ case $BLOCK_BUTTON in
$uptime</b>" ;; $uptime</b>" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
printf "$3$%0.2f" "$(cat "$pricefile")"

View File

@ -17,7 +17,7 @@ transmission-remote -l | grep % |
s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' ' s/Z/🌱/g" | awk '{print $2 $1}' | paste -sd ' '
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e tremc & ;; 1) setsid -f "$TERMINAL" -e tremc ;;
2) td-toggle ;; 2) td-toggle ;;
3) notify-send "🌱 Torrent module" "\- Left click to open tremc. 3) notify-send "🌱 Torrent module" "\- Left click to open tremc.
- Middle click to toggle transmission. - Middle click to toggle transmission.

View File

@ -1,14 +1,9 @@
#!/bin/sh #!/bin/sh
# Prints the current volume or 🔇 if muted. Uses PulseAudio by default, # Prints the current volume or 🔇 if muted.
# uncomment the ALSA lines if you remove PulseAudio.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
# 1) setsid "$TERMINAL" -e alsamixer & ;; 1) setsid -f "$TERMINAL" -e pulsemixer ;;
# 2) amixer sset Master toggle ;;
# 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
# 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;;
1) setsid "$TERMINAL" -e pulsemixer & ;;
2) pamixer -t ;; 2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;; 4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;; 5) pamixer --allow-boost -d 1 ;;
@ -18,14 +13,9 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
volstat="$(pactl list sinks)" [ $(pamixer --get-mute) = true ] && echo 🔇 && exit
# volstat="$(amixer get Master)" # ALSA only equivalent.
echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit vol="$(pamixer --get-volume)"
# echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA
vol="$(echo "$volstat" | grep '[0-9]\+%' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA
if [ "$vol" -gt "70" ]; then if [ "$vol" -gt "70" ]; then
icon="🔊" icon="🔊"
@ -35,4 +25,4 @@ else
icon="🔉" icon="🔉"
fi fi
printf "%s%s%%\\n" "$icon" "$vol" echo "$icon$vol%"

View File

@ -6,17 +6,18 @@
# If we have internet, get a weather report from wttr.in and store it locally. # If we have internet, get a weather report from wttr.in and store it locally.
# You could set up a shell alias to view the full file in a pager in the # You could set up a shell alias to view the full file in a pager in the
# terminal if desired. This function will only be run once a day when needed. # terminal if desired. This function will only be run once a day when needed.
getforecast() { curl -sf "wttr.in/$LOCATION" > "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" || exit 1 ;} weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport"
getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;}
# Some very particular and terse stream manipulation. We get the maximum # Some very particular and terse stream manipulation. We get the maximum
# precipication chance and the daily high and low from the downloaded file and # precipication chance and the daily high and low from the downloaded file and
# display them with coresponding emojis. # display them with coresponding emojis.
showweather() { printf "%s" "$(sed '16q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')"
sed '13q;d' "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;} sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;}
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid "$TERMINAL" -e less -Srf "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" & ;; 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;
2) getforecast && showweather ;; 2) getforecast && showweather ;;
3) notify-send "🌈 Weather module" "\- Left click for full forecast. 3) notify-send "🌈 Weather module" "\- Left click for full forecast.
- Middle click to update forecast. - Middle click to update forecast.
@ -28,7 +29,7 @@ esac
# The test if our forcecast is updated to the day. If it isn't download a new # The test if our forcecast is updated to the day. If it isn't download a new
# weather report from wttr.in with the above function. # weather report from wttr.in with the above function.
[ "$(stat -c %y "${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || [ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
getforecast getforecast
showweather showweather

View File

@ -1,12 +1,17 @@
#!/bin/sh #!/bin/sh
# This gives the user a list of videos they can select and watch without a
# browser. If you want to check a tutorial video, it makes it easy. I'll
# add/remove videos from this list as I go on.
vidlist=" vidlist="
status bar https://www.youtube.com/watch?v=gKumet6b-WY dwm (window manager) https://www.youtube.com/watch?v=xnREqY-oyzM
pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs
status bar https://www.youtube.com/watch?v=UP2QpHmcgyk
sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs sxiv (image viewer) https://www.youtube.com/watch?v=GYW9i_u5PYs
st (terminal) https://www.youtube.com/watch?v=9H75enWM22k st (terminal) https://www.youtube.com/watch?v=9H75enWM22k
i3 (window manager) https://www.youtube.com/watch?v=GKviflL9XeI i3 (old window manager) https://www.youtube.com/watch?v=GKviflL9XeI
pacman (installing/managing programs) https://www.youtube.com/watch?v=-dEuXTMzRKs neomutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A
mutt (email) https://www.youtube.com/watch?v=2U3vRbF7v5A
ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U ncmpcpp (music player) https://www.youtube.com/watch?v=sZIEdI9TS2U
newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w newsboat (RSS reader) https://www.youtube.com/watch?v=dUFCRqs822w
ranger (file manager) https://www.youtube.com/watch?v=L6Vu7WPkoJo ranger (file manager) https://www.youtube.com/watch?v=L6Vu7WPkoJo

View File

@ -1 +1 @@
../../.config/wall.png thiemeyer_road_to_samarkand.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

View File

@ -34,6 +34,8 @@ export ANDROID_SDK_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/android"
export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo"
export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go"
export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg" export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg"
export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison"
export HISTFILE="${XDG_DATA_HOME:-$HOME/.local/share}/history"
# Other program settings: # Other program settings:
export DICS="/usr/share/stardict/dic/" export DICS="/usr/share/stardict/dic/"
@ -66,11 +68,15 @@ ex=🎯:\
*.me=✍:\ *.me=✍:\
*.ms=✍:\ *.ms=✍:\
*.png=🖼:\ *.png=🖼:\
*.webp=🖼:\
*.ico=🖼:\ *.ico=🖼:\
*.jpg=📸:\ *.jpg=📸:\
*.jpe=📸:\
*.jpeg=📸:\ *.jpeg=📸:\
*.gif=🖼:\ *.gif=🖼:\
*.svg=🗺:\ *.svg=🗺:\
*.tif=🖼:\
*.tiff=🖼:\
*.xcf=🖌:\ *.xcf=🖌:\
*.html=🌎:\ *.html=🌎:\
*.xml=📰:\ *.xml=📰:\
@ -87,6 +93,7 @@ ex=🎯:\
*.R=📊:\ *.R=📊:\
*.rmd=📊:\ *.rmd=📊:\
*.Rmd=📊:\ *.Rmd=📊:\
*.m=📊:\
*.mp3=🎵:\ *.mp3=🎵:\
*.opus=🎵:\ *.opus=🎵:\
*.ogg=🎵:\ *.ogg=🎵:\
@ -104,6 +111,9 @@ ex=🎯:\
*.z64=🎮:\ *.z64=🎮:\
*.v64=🎮:\ *.v64=🎮:\
*.n64=🎮:\ *.n64=🎮:\
*.gba=🎮:\
*.nes=🎮:\
*.gdi=🎮:\
*.1=:\ *.1=:\
*.nfo=:\ *.nfo=:\
*.info=:\ *.info=:\
@ -114,6 +124,8 @@ ex=🎯:\
*.ged=👪:\ *.ged=👪:\
*.part=💔:\ *.part=💔:\
*.torrent=🔽:\ *.torrent=🔽:\
*.jar=♨:\
*.java=♨:\
" "
[ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 & [ ! -f ${XDG_CONFIG_HOME:-$HOME/.config}/shortcutrc ] && shortcuts >/dev/null 2>&1 &

3
FUNDING.yml Normal file
View File

@ -0,0 +1,3 @@
github: lukesmithxyz
custom: ["https://lukesmith.xyz/donate", "https://paypal.me/lukemsmith", "https://lukesmith.xyz/crypto"]
patreon: lukesmith

View File

@ -42,4 +42,4 @@ Use [LARBS](https://larbs.xyz) to autoinstall everything:
curl -LO larbs.xyz/larbs.sh curl -LO larbs.xyz/larbs.sh
``` ```
or clone the repo files directly to your home directory and install [the prerequisite programs](https://github.com/LukeSmithxyz/LARBS/blob/master/progs.csv) or [those required for the i3 setup](https://github.com/LukeSmithxyz/LARBS/blob/master/legacy.csv). or clone the repo files directly to your home directory and install [the prerequisite programs](https://github.com/LukeSmithxyz/LARBS/blob/master/progs.csv).