Browse Source

Made all scripts POSIX compliant

master
Micah Halter 1 year ago
parent
commit
826ba560d3
Signed by: mehalter GPG Key ID: 4224A6EA9A8CAAA8
  1. 4
      CHANGELOG.md
  2. 8
      cmus/.local/bin/nowplaying
  3. 6
      ranger/.config/ranger/pinrunner.sh
  4. 8
      ranger/.config/ranger/scope.sh
  5. 4
      scripts/.local/bin/autocomp
  6. 2
      scripts/.local/bin/bemenubluetooth
  7. 13
      scripts/.local/bin/bemenucolor
  8. 18
      scripts/.local/bin/bemenuexpand
  9. 4
      scripts/.local/bin/bemenui3
  10. 4
      scripts/.local/bin/bemenulatex
  11. 18
      scripts/.local/bin/bemenumount
  12. 5
      scripts/.local/bin/bemenushutdown
  13. 8
      scripts/.local/bin/bemenuumount
  14. 4
      scripts/.local/bin/bemenuunicode
  15. 8
      scripts/.local/bin/bemenuwpg
  16. 6
      scripts/.local/bin/bemenuyubiauth
  17. 10
      scripts/.local/bin/compiler
  18. 2
      scripts/.local/bin/criticalbattery
  19. 18
      scripts/.local/bin/displayctrl
  20. 18
      scripts/.local/bin/displayselect
  21. 6
      scripts/.local/bin/dunstbar
  22. 2
      scripts/.local/bin/dunstcolor
  23. 2
      scripts/.local/bin/extract
  24. 18
      scripts/.local/bin/genshortcuts
  25. 4
      scripts/.local/bin/getbib
  26. 4
      scripts/.local/bin/gohome
  27. 4
      scripts/.local/bin/i3-camtoggle
  28. 4
      scripts/.local/bin/i3-cliprog
  29. 56
      scripts/.local/bin/i3-maim
  30. 2
      scripts/.local/bin/i3-powersaver
  31. 10
      scripts/.local/bin/i3-resize
  32. 2
      scripts/.local/bin/i3-runner
  33. 12
      scripts/.local/bin/limitlog
  34. 2
      scripts/.local/bin/linkhandler
  35. 11
      scripts/.local/bin/lmount
  36. 29
      scripts/.local/bin/lock
  37. 2
      scripts/.local/bin/lofi
  38. 9
      scripts/.local/bin/lumount
  39. 2
      scripts/.local/bin/magnet2torrent
  40. 2
      scripts/.local/bin/mailto
  41. 6
      scripts/.local/bin/notifymail
  42. 4
      scripts/.local/bin/nvimdiff
  43. 2
      scripts/.local/bin/opout
  44. 16
      scripts/.local/bin/pins
  45. 25
      scripts/.local/bin/rangerpicker
  46. 2
      scripts/.local/bin/remaps
  47. 14
      scripts/.local/bin/screencast
  48. 7
      scripts/.local/bin/sendmail
  49. 8
      scripts/.local/bin/setbackground
  50. 2
      scripts/.local/bin/statusbar/battery
  51. 2
      scripts/.local/bin/statusbar/clock
  52. 2
      scripts/.local/bin/statusbar/date
  53. 4
      scripts/.local/bin/statusbar/ethernet
  54. 20
      scripts/.local/bin/statusbar/fullbar
  55. 4
      scripts/.local/bin/statusbar/i3
  56. 6
      scripts/.local/bin/statusbar/layout
  57. 6
      scripts/.local/bin/statusbar/mail
  58. 6
      scripts/.local/bin/statusbar/music
  59. 4
      scripts/.local/bin/statusbar/network
  60. 2
      scripts/.local/bin/statusbar/powersaver
  61. 8
      scripts/.local/bin/statusbar/volume
  62. 6
      scripts/.local/bin/statusbar/vpn
  63. 4
      scripts/.local/bin/statusbar/wifi
  64. 2
      scripts/.local/bin/statusbar/workspaces
  65. 2
      scripts/.local/bin/stopwatch
  66. 16
      scripts/.local/bin/sxiveh
  67. 2
      scripts/.local/bin/texclear
  68. 2
      scripts/.local/bin/tmpopen
  69. 20
      scripts/.local/bin/tmuxiplex
  70. 8
      scripts/.local/bin/toggleservice
  71. 6
      scripts/.local/bin/toggletrackpad
  72. 16
      scripts/.local/bin/transfer
  73. 6
      scripts/.local/bin/ufetch
  74. 12
      scripts/.local/bin/vim-anywhere
  75. 2
      scripts/.local/bin/vpnc-script
  76. 2
      scripts/.local/bin/wal-set
  77. 10
      sxiv/.config/sxiv/exec/key-handler
  78. 4
      vdirsyncer/.config/vdirsyncer/password.sh

4
CHANGELOG.md

@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added git config
- Added yubikey authentication
### Changed
- Went through and made scripts more portable and nearly all POSIX compliant
## [0.7.0] - 2020-03-25
### Added

8
cmus/.local/bin/nowplaying

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# SETTINGS
NOW_PLAYING_PIPE="$XDG_CACHE_HOME/nowplaying"
@ -7,7 +7,6 @@ NOW_PLAYING_PIPE="$XDG_CACHE_HOME/nowplaying"
title=""
artist=""
stat="stopped"
url=""
while [ "$1" '!=' "" ]
do
@ -24,9 +23,6 @@ do
file)
file="$2"
;;
url)
url="$2"
;;
*)
;;
esac
@ -49,7 +45,7 @@ else
else
if [ -n "$file" ]
then
msg="$msg `basename "$file"`"
msg="$msg $(basename "$file")"
else
msg="$msg <noname>"
fi

6
ranger/.config/ranger/pinrunner.sh

@ -1,5 +1,5 @@
#!/bin/bash
#!/bin/sh
source $HOME/.local/bin/pins
. "$HOME"/.local/bin/pins
$1 $2 2> /dev/null
"$1" "$2" 2> /dev/null

8
ranger/.config/ranger/scope.sh

@ -80,7 +80,7 @@ case "$extension" in
# PDF documents:
pdf)
try pdftotext -l 10 -nopgbrk -q "$path" - && \
{ dump | trim | fmt -s -w $width; exit 0; } || exit 1;;
{ dump | trim | fmt -s -w "$width"; exit 0; } || exit 1;;
# BitTorrent Files
torrent)
try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;;
@ -89,9 +89,9 @@ case "$extension" in
try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;;
# HTML Pages:
htm|html|xhtml)
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 elinks -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 elinks -dump "$path" && { dump | trim | fmt -s -w "$width"; exit 4; }
;; # fall back to highlight/cat if the text browsers fail
esac

4
scripts/.local/bin/autocomp

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/env sh
if [[ $2 = "stop" ]]; then
if [ "$2" = "stop" ]; then
pkill -f "entr compiler $1";
exit
fi

2
scripts/.local/bin/bemenubluetooth

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env bash
_bluetoothctl() {
LC_ALL=C timeout 30 bluetoothctl

13
scripts/.local/bin/bemenucolor

@ -1,17 +1,18 @@
#!/bin/bash
#!/bin/env sh
source ~/.cache/wal/colors.sh
. "$HOME"/.cache/wal/colors.sh
command=bemenu
if [[ "$1" == "-c" ]]; then
if [ "$1" = "-c" ]; then
while getopts 'c:' option; do
case $option in
case "$option" in
c) command=$OPTARG && break;;
*) exit ;;
esac
done
shift $(($OPTIND - 1))
shift $(("$OPTIND" - 1))
fi
$command -p "" --nb=$background --nf=$foreground --hb=$foreground --hf=$background --sb=$foreground --sf=$background --tb=$foreground --tf=$background --ff=$foreground --fb=$background --scb=$background --scf=$foreground --fn="mono 9" $@
"$command" -p "" --nb="$background" --nf="$foreground" --hb="$foreground" --hf="$background" --sb="$foreground" --sf="$background" --tb="$foreground" --tf="$background" --ff="$foreground" --fb="$background" --scb="$background" --scf="$foreground" --fn="mono 9" "$@"

18
scripts/.local/bin/bemenuexpand

@ -1,15 +1,15 @@
#!/bin/bash
#!/bin/env sh
lookup=$1
action=$2
prompt=$3
alternate=$4
lookup="$1"
action="$2"
prompt="$3"
alternate="$4"
chosen=$(sed -n 's/^\([^:]*\):.*$/\1/p' $lookup|bemenucolor -i -p "$prompt")
chosen=$(sed -n 's/^\([^:]*\):.*$/\1/p' "$lookup"|bemenucolor -i -p "$prompt")
expanded=$(sed -n "s/^${chosen}:\(.*\)$/\1/p" $lookup)
expanded=$(sed -n "s/^${chosen}:\(.*\)$/\1/p" "$lookup")
if [ "$expanded" != "" ]; then
$action $expanded
"$action" "$expanded"
elif [ "$alternate" != "" ] && [ "$chosen" != "" ]; then
$alternate "$chosen"
"$alternate" "$chosen"
fi

4
scripts/.local/bin/bemenui3

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
i3-msg "$(cat $XDG_CONFIG_HOME/i3/config | sed -E 's/^bindsym\s*(\S*)\s*(\S.*$)/\1|\2/;t;d'|column -s'|' -t | bemenucolor -l 30 | cut -d' ' -f2- | xargs -0)"
i3-msg "$(sed -E 's/^bindsym\s*(\S*)\s*(\S.*$)/\1|\2/;t;d' "$XDG_CONFIG_HOME"/i3/config |column -s'|' -t | bemenucolor -l 30 | cut -d' ' -f2- | xargs -0)"

4
scripts/.local/bin/bemenulatex

@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/env sh
xclip -h >/dev/null || exit
chosen=$(grep -v "#" -h $XDG_DATA_HOME/latexchars | bemenucolor -l 20)
chosen=$(grep -v "#" -h "$XDG_DATA_HOME"/latexchars | bemenucolor -l 20)
[ "$chosen" != "" ] || exit

18
scripts/.local/bin/bemenumount

@ -1,25 +1,25 @@
#!/bin/bash
#!/bin/env sh
pgrep -x bemenu && exit
mountable=$(lsblk -lp -o NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT|grep 'part\|lvm'|grep -v "\(part\|lvm\)[[:space:]]\+/\|t[[:space:]]\+\[SWAP\]\|crypto_LUKS"|awk '{print $1, "(" $3 ")"}')
[[ "$mountable" = "" ]] && exit 1
[ "$mountable" = "" ] && exit 1
chosen=$(echo "$mountable"|bemenucolor -i -p "Unmounted Drives:"|awk '{print $1}')
[[ "$chosen" = "" ]] && exit 1
[ "$chosen" = "" ] && exit 1
sudo mount "$chosen" && exit 0
already_mounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}')
dirs=$(find /mnt /media /mount /home -type d -maxdepth 5 $already_mounted 2>/dev/null)
dirs=$(find /mnt /media /mount /home -type d -maxdepth 5 "$already_mounted" 2>/dev/null)
mountpoint=$(echo "$dirs"|bemenucolor -i -p "Mount Point:")
[[ "$mountpoint" = "" ]] && exit 1
if [[ ! -d "$mountpoint" ]]; then
mkdiryn=$(echo -e "No\nYes" | bemenucolor -i -p "Create?")
[[ "$mkdiryn" = Yes ]] && sudo mkdir -p "$mountpoint"
[ "$mountpoint" = "" ] && exit 1
if [ ! -d "$mountpoint" ]; then
mkdiryn=$(printf "No\nYes" | bemenucolor -i -p "Create?")
[ "$mkdiryn" = Yes ] && sudo mkdir -p "$mountpoint"
fi
sudo mount $chosen $mountpoint && notify-send "$chosen mounted to $mountpoint"
sudo mount "$chosen" "$mountpoint" && notify-send "$chosen mounted to $mountpoint"

5
scripts/.local/bin/bemenushutdown

@ -1,7 +1,6 @@
#!/bin/bash
#!/bin/env sh
MESSAGE="lock\\nexit\\nreboot\\nshutdown\\n"
ACTION="$(printf "$MESSAGE" | bemenucolor -i -p "Power:")"
ACTION="$(printf "lock\\nexit\\nreboot\\nshutdown\\n" | bemenucolor -i -p "Power:")"
case "$ACTION" in
"lock") lock ;;

8
scripts/.local/bin/bemenuumount

@ -1,10 +1,10 @@
#!/bin/bash
#!/bin/env sh
pgrep -x bemenu && exit
exclusionregex="\(/boot\|/home\|/\)$"
drives=$(lsblk -lp | grep "\(part\|lvm\)[[:space:]]\+/" | grep -v "$exclusionregex" | awk '{print $1, "(" $4 ")", "on", $7}')
[[ "$drives" = "" ]] && exit
[ "$drives" = "" ] && exit
chosen=$(echo "$drives" | bemenucolor -i -p "Unmount:" | awk '{print $1}')
[[ "$chosen" = "" ]] && exit
sudo umount $chosen && notify-send "$chosen unmounted."
[ "$chosen" = "" ] && exit
sudo umount "$chosen" && notify-send "$chosen unmounted."

4
scripts/.local/bin/bemenuunicode

@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/env sh
xclip -h >/dev/null || exit
chosen=$(grep -v "#" -h $XDG_DATA_HOME/emoji $XDG_DATA_HOME/unicode | bemenucolor -i -l 20)
chosen=$(grep -v "#" -h "$XDG_DATA_HOME"/emoji "$XDG_DATA_HOME"/unicode | bemenucolor -i -l 20)
[ "$chosen" != "" ] || exit

8
scripts/.local/bin/bemenuwpg

@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/env sh
pgrep -x bemenu && exit
walls=$(wpg -l)
[[ "$walls" = "" ]] && exit 1
[ "$walls" = "" ] && exit 1
chosen=$(echo "$walls"|bemenucolor -l 20-i -p "Wallpapers:"|awk '{print $1}')
[[ "$chosen" = "" ]] && exit 1
setbackground $chosen wal
[ "$chosen" = "" ] && exit 1
setbackground "$chosen" wal

6
scripts/.local/bin/bemenuyubiauth

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env bash
pgrep -x bemenu && exit
shopt -s nullglob globstar
@ -13,9 +13,9 @@ chosen=$(ykman oath list|awk -F':' '{print $1}'|bemenucolor -i -p "oauth:"|awk '
[[ -n $chosen ]] || exit
if [[ $typeit -eq 0 ]]; then
ykman oath code -s $chosen | xclip -selection clipboard
ykman oath code -s "$chosen" | xclip -selection clipboard
else
ykman oath code -s $chosen |
ykman oath code -s "$chosen" |
{ IFS= read -r code; printf %s "$code"; } |
xdotool type --clearmodifiers --file -
fi

10
scripts/.local/bin/compiler

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/env sh
# gv files: Compile to png
# roff files: Compile to pdf, including bibliography if necessary
@ -16,8 +16,8 @@ base="${file%.*}"
cd "$dir" || exit
function pdfpcCleanup {
[[ -e "$base".pdfpc ]] && sed -i 's/\\\\/\n/g' "$base".pdfpc && sed -i 's/\\par/\n\n/g' "$base".pdfpc
pdfpcCleanup() {
[ -e "$base".pdfpc ] && sed -i 's/\\\\/\n/g' "$base".pdfpc && sed -i 's/\\par/\n\n/g' "$base".pdfpc
}
case "$file" in
@ -26,8 +26,8 @@ case "$file" in
*\.ms) refer -PS -e "$file" | groff -me -ms -kejpt -T pdf > "$base".pdf ;;
*\.mom) refer -PS -e "$file" | groff -mom -kejpt -T pdf > "$base".pdf ;;
*\.rmd) echo "require(rmarkdown);rmarkdown::render('$file', quiet=TRUE)" | R -q --vanilla && pdfpcCleanup ;;
*\.tex) latexmk -synctex=1 --pdf "$file" && [[ -e "$base".pdfpc ]] && pdfpcCleanup ;;
*\.md) if [[ -e "$base"_template.tex ]] ; then pandoc --template "$base"_template.tex "$file" --filter pandoc-citeproc --variable urlcolor=blue -o "$base".pdf; else pandoc "$file" --filter pandoc-citeproc --variable urlcolor=blue -o "$base".pdf; fi ;;
*\.tex) latexmk -synctex=1 --pdf "$file" && [ -e "$base".pdfpc ] && pdfpcCleanup ;;
*\.md) if [ -e "$base"_template.tex ] ; then pandoc --template "$base"_template.tex "$file" --filter pandoc-citeproc --variable urlcolor=blue -o "$base".pdf; else pandoc "$file" --filter pandoc-citeproc --variable urlcolor=blue -o "$base".pdf; fi ;;
*config.h) make && sudo make install ;;
*\.c) gcc "$file" -o "$base" && "$base" ;;
*\.py) python "$file" ;;

2
scripts/.local/bin/criticalbattery

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
capacity=$(cat /sys/class/power_supply/BAT0/capacity)
status=$(cat /sys/class/power_supply/BAT0/status)

18
scripts/.local/bin/displayctrl

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env bash
showusage() {
echo "Usage:"
@ -58,14 +58,14 @@ middle="$1"
cmd="xrandr "
if [[ "$script" == "" ]]; then
if [[ ("$middle" != "") && ($(xrandr -q |grep $middle\ con)) ]]; then
if [[ ("$middle" != "") && ($(xrandr -q |grep "$middle"\ con)) ]]; then
cmd="$cmd --output $middle --auto --rotate normal"
if [[ ("$left" != "") && ($(xrandr -q |grep $left\ con)) ]]; then
if [[ ("$left" != "") && ($(xrandr -q |grep "$left"\ con)) ]]; then
cmd="$cmd --output $left --auto --rotate $rotate --left-of $middle"
fi
if [[ ("$right" != "") && ($(xrandr -q |grep $right\ con)) ]]; then
if [[ ("$right" != "") && ($(xrandr -q |grep "$right"\ con)) ]]; then
cmd="$cmd --output $right --auto --rotate $rotate --right-of $middle"
fi
@ -77,21 +77,21 @@ if [[ "$script" == "" ]]; then
cmd=$(disablerest "$cmd")
if [[ ("$left" != "") && ($(xrandr -q |grep $left\ con)) ]]; then
if [[ ("$left" != "") && ($(xrandr -q |grep "$left"\ con)) ]]; then
cmd="$cmd --output $left --off"
fi
if [[ ("$right" != "") && ($(xrandr -q |grep $right\ con)) ]]; then
if [[ ("$right" != "") && ($(xrandr -q |grep "$right"\ con)) ]]; then
cmd="$cmd --output $right --off"
fi
cmd="$cmd --output LVDS-1 --auto"
fi
echo $cmd
eval $cmd
echo "$cmd"
eval "$cmd"
else
bash $script
bash "$script"
fi
setbackground

18
scripts/.local/bin/displayselect

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/env sh
# A UI for detecting and selecting all displays.
# Probes xrandr for connected displays and lets user select one to use.
@ -21,10 +21,10 @@ twoscreen() { # If multi-monitor is selected and there are two screens.
res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \
tail -n 1 | awk '{print $1}')
res_ext_x=$(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_y=$(echo $res_internal | sed 's/.*x//')
res_ext_x=$(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_y=$(echo "$res_internal" | sed 's/.*x//')
scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l)
scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l)
@ -52,7 +52,7 @@ morescreen() { # If multi-monitor is selected and there are more than two screen
multimon() { # Multi-monitor handler.
case "$(echo "$screens" | wc -l)" in
1) xrandr $(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
1) xrandr "$(echo "$allposs" | grep -v "$screens" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ')" ;;
2) twoscreen ;;
*) morescreen ;;
esac ;}
@ -62,15 +62,15 @@ allposs=$(xrandr -q | grep "connected")
# Get all connected screens.
screens=$(echo "$allposs" | grep " connected" | awk '{print $1}')
layouts=$(find $layoutloc -type f -name "*.sh" -printf "%f\n")
layouts=$(find "$layoutloc" -type f -name "*.sh" -printf "%f\n")
# Get user choice including multi-monitor and manual selection:
chosen=$(printf "%s\\nmulti-monitor\\nmanual selection\\n%s\\n" "$screens" "$layouts" | bemenucolor -i -p "Display:") &&
case "$chosen" in
"manual selection") arandr ; exit ;;
"multi-monitor") multimon ;;
*.sh) $layoutloc/$chosen ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 $(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ') ;;
*.sh) "$layoutloc"/"$chosen" ;;
*) xrandr --output "$chosen" --auto --scale 1.0x1.0 "$(echo "$allposs" | grep -v "$chosen" | awk '{print "--output", $1, "--off"}' | tr '\n' ' ')" ;;
esac
setbackground

6
scripts/.local/bin/dunstbar

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
scripts="$HOME/.local/bin/statusbar"
time=3000
@ -28,7 +28,7 @@ while getopts "t:s:ih" option; do
[ -f "$scripts/$OPTARG" ] && script="$scripts/$OPTARG"
;;
i )
body="$($scripts/i3)"
body="$("$scripts"/i3)"
;;
h )
showusage
@ -46,4 +46,4 @@ out="$($script)"
[ -z "$out" ] && out="off"
dunstify -t $time -r 800 "$out" "$body"
dunstify -t "$time" -r 800 "$out" "$body"

2
scripts/.local/bin/dunstcolor

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/env sh
. "$XDG_CACHE_HOME/wal/colors.sh"

2
scripts/.local/bin/extract

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
if [ -f "$1" ] ; then
case "$1" in

18
scripts/.local/bin/genshortcuts

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env bash
# Config locations
folders="$XDG_CONFIG_HOME/folders"
@ -10,20 +10,18 @@ ranger_shortcuts="$XDG_CONFIG_HOME/ranger/shortcuts.conf"
qute_shortcuts="$XDG_CONFIG_HOME/qutebrowser/shortcuts.py"
#Delete old shortcuts
rm -f $zsh_shortcuts $ranger_shortcuts $qute_shortcuts
message="Download to $2"
rm -f "$zsh_shortcuts" "$ranger_shortcuts" "$qute_shortcuts"
# directory shortcuts
sed "/^#/d" $folders | tee \
>(awk '{print "alias "$1"=\"cd "$2" && ls -a\""}' >> $zsh_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) \
sed "/^#/d" "$folders" | tee \
>(awk '{print "alias "$1"=\"cd "$2" && ls -a\""}' >> "$zsh_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") \
>(awk '{print "config.bind(\"\\\\"$1"\", \"set downloads.location.directory "$2" ;; hint links download\")"}' >> "$qute_shortcuts") \
>(awk '{print "config.bind(\"|"$1"\", \"clear-messages ;; set downloads.location.directory "$2" ;; message-info '\''Download set to "$2"'\'' \")"}' >> "$qute_shortcuts") \
> /dev/null
# dotfile shortcuts
sed "/^#/d" $configs | tee \
>(awk '{print "alias "$1"=\"$EDITOR "$2"\""}' >> $zsh_shortcuts) \
>(awk '{print "map "$1" shell $EDITOR "$2}' >> $ranger_shortcuts) \
sed "/^#/d" "$configs" | tee \
>(awk '{print "alias "$1"=\"$EDITOR "$2"\""}' >> "$zsh_shortcuts") \
>(awk '{print "map "$1" shell $EDITOR "$2}' >> "$ranger_shortcuts") \
> /dev/null

4
scripts/.local/bin/getbib

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/env sh
[ -z "$1" ] && echo "Give either a pdf file or a DOI as an argument." && exit
if [ -f "$1" ]; then
@ -13,7 +13,7 @@ fi
# Check crossref.org for the bib citation.
citation=$(curl -s "http://api.crossref.org/works/$doi/transform/application/x-bibtex" -w "\\n")
[ "$citation" == "Resource not found." ] && \
[ "$citation" = "Resource not found." ] && \
citation=$(curl -s "https://arxiv2bibtex.org/?q=$doi&outputformat=raw")
command -v xclip > /dev/null && echo "$citation" | xclip -selection clipboard;

4
scripts/.local/bin/gohome

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/env sh
pass OpenVpn/micah | sudo openvpn --config $XDG_CONFIG_HOME/openvpn/micah.ovpn --askpass /dev/stdin --script-security 2 \
pass OpenVpn/micah | sudo openvpn --config "$XDG_CONFIG_HOME"/openvpn/mhalter3-gtri.ovpn --askpass /dev/stdin --script-security 2 \
--setenv PATH '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' \
--up /etc/openvpn/scripts/update-systemd-resolved \
--down /etc/openvpn/scripts/update-systemd-resolved \

4
scripts/.local/bin/i3-camtoggle

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/env sh
if [[ -e /dev/video2 ]]; then
if [ -e /dev/video2 ]; then
cam=/dev/video2
else
cam=/dev/video0

4
scripts/.local/bin/i3-cliprog

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
INSTANCE=$1
COMMAND=$2
@ -8,4 +8,4 @@ if ! xdotool search --classname "$INSTANCE" > /dev/null; then
sleep .4
fi
i3-msg "[instance="$INSTANCE"] scratchpad show; [instance="$INSTANCE"] move position center"
i3-msg "[instance=\"$INSTANCE\"] scratchpad show; [instance=\"$INSTANCE\"] move position center"

56
scripts/.local/bin/i3-maim

@ -1,40 +1,40 @@
#!/bin/sh
#!/bin/env sh
maim_dir=$HOME
maim_dir="$HOME"
DATE="$(date '+%Y-%m-%d_%H:%M:%S')"
maim_file="${DATE}_screenshot.png"
if ! [ -d $maim_dir ]; then
mkdir -p $maim_dir
if ! [ -d "$maim_dir" ]; then
mkdir -p "$maim_dir"
fi
if ! [ -z "$2" ]; then
if [ -n "$2" ]; then
cmd="maim -m 3 -d $2"
else
cmd='maim -m 3'
fi
case "$1" in
--desk|-d|$NULL)
cd $maim_dir
$cmd $maim_file &&
sleep .5 &&
notify-send "screenshot has been saved in $maim_dir"
;;
--window|-w)
cd $maim_dir
$cmd -i $(xdotool getactivewindow) $maim_file &&
sleep .5 &&
notify-send "screenshot has been saved in $maim_dir"
;;
--select|-s)
cd $maim_dir
notify-send 'select an area for the screenshot' &
$cmd -s $maim_file &&
sleep .5 && notify-send "screenshot has been saved in $maim_dir"
;;
--help|-h)
echo "
--desk|-d|$NULL)
cd "$maim_dir" || exit
$cmd "$maim_file" &&
sleep .5 &&
notify-send "screenshot has been saved in $maim_dir"
;;
--window|-w)
cd "$maim_dir" || exit
$cmd -i "$(xdotool getactivewindow)" "$maim_file" &&
sleep .5 &&
notify-send "screenshot has been saved in $maim_dir"
;;
--select|-s)
cd "$maim_dir" || exit
notify-send 'select an area for the screenshot' &
$cmd -s "$maim_file" &&
sleep .5 && notify-send "screenshot has been saved in $maim_dir"
;;
--help|-h)
echo "
available options:
-d | --desk full screen
-w | --window active window
@ -50,9 +50,9 @@ Default option is 'full screen'.
The file destination can be set in ${_conf}.
Default is $maim_dir
"
;;
*)
echo "
;;
*)
echo "
== ! i3-maim: missing or wrong argument ! ==
available options:

2
scripts/.local/bin/i3-powersaver

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
if xset -q | grep -q "DPMS is Enabled"; then
xset -dpms; xset s off

10
scripts/.local/bin/i3-resize

@ -1,13 +1,13 @@
#!/bin/bash
#!/bin/env sh
# This script was made by `goferito` on Github.
distanceStr="2 px or 2 ppt"
[ -z $1 ] && echo "No direction provided" && exit 1
[ -z "$1" ] && echo "No direction provided" && exit 1
function moveChoice {
i3-msg resize $1 $2 "$distanceStr" | grep '"success":true' || \
i3-msg resize $3 $4 "$distanceStr"
moveChoice() {
i3-msg resize "$1" "$2" "$distanceStr" | grep '"success":true' || \
i3-msg resize "$3" "$4" "$distanceStr"
}
case $1 in

2
scripts/.local/bin/i3-runner

@ -1,4 +1,4 @@
#!/usr/bin/zsh
#!/usr/bin/env zsh
. $ZDOTDIR/.zshrc

12
scripts/.local/bin/limitlog

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
LIMIT=5000000
LINES=10000
@ -36,14 +36,14 @@ shift $((OPTIND - 1))
file=$1
[[ ! -e "$(dirname $file)" ]] && mkdir -p $(dirname $file)
[ ! -e "$(dirname "$file")" ] && mkdir -p "$(dirname "$file")"
while read input; do
echo $input >> $file
while read -r input; do
echo "$input" >> "$file"
done < /dev/stdin
SIZE=$(wc -c $file|awk '{print $1}')
SIZE=$(wc -c "$file"|awk '{print $1}')
if [ "$SIZE" -gt "$LIMIT" ]; then
sed -i "1,${LINES}d" $file
sed -i "1,${LINES}d" "$file"
fi

2
scripts/.local/bin/linkhandler

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
# Feed script a url.
# If an image, it will view in sxiv,

11
scripts/.local/bin/lmount

@ -1,10 +1,9 @@
#!/bin/bash
#!/bin/env sh
DRIVE="$1"
DRIVE_NAME="$(basename $DRIVE)"
DRIVE_NAME="$(basename "$DRIVE")"
sudo cryptsetup luksOpen $DRIVE ${DRIVE_NAME}-OPEN
if [ $? == 0 ]; then
sudo mkdir -p /media/$DRIVE_NAME
sudo mount /dev/mapper/${DRIVE_NAME}-OPEN /media/$DRIVE_NAME
if sudo cryptsetup luksOpen "$DRIVE" "$DRIVE_NAME"-OPEN; then
sudo mkdir -p /media/"$DRIVE_NAME"
sudo mount /dev/mapper/"$DRIVE_NAME"-OPEN /media/"$DRIVE_NAME"
fi

29
scripts/.local/bin/lock

@ -1,27 +1,24 @@
#!/bin/bash
#!/bin/env bash
ps cax|grep i3lock > /dev/null
if [ $? -eq 0 ]; then
exit 0
fi
pgrep i3lock > /dev/null && exit 0
lock() {
. $XDG_CACHE_HOME/wal/colors.sh
. "$XDG_CACHE_HOME/wal/colors.sh"
killall -SIGUSR1 dunst
i3lock -n -e -B 8 \
--radius=110 --ring-width=5 \
--insidecolor=${color0:1:6}ff --line-uses-inside \
--insidevercolor=${color0:1:6}ff \
--insidewrongcolor=${color0:1:6}ff \
--ringcolor=${color7:1:6}ff \
--separatorcolor=${color0:1:6}ff \
--keyhlcolor=${color0:1:6}ff \
--bshlcolor=${color7:1:6}ff \
--ringvercolor=${color7:1:6}ff \
--ringwrongcolor=${color2:1:6}ff \
--timecolor=${color7:1:6}ff \
--insidecolor="${color0:1:6}ff" --line-uses-inside \
--insidevercolor="${color0:1:6}ff" \
--insidewrongcolor="${color0:1:6}ff" \
--ringcolor="${color7:1:6}ff" \
--separatorcolor="${color0:1:6}ff" \
--keyhlcolor="${color0:1:6}ff" \
--bshlcolor="${color7:1:6}ff" \
--ringvercolor="${color7:1:6}ff" \
--ringwrongcolor="${color2:1:6}ff" \
--timecolor="${color7:1:6}ff" \
--time-font="monospace" \
--timesize=50 \
--timestr="%H:%M" \

2
scripts/.local/bin/lofi

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
mpv --no-video "https://www.youtube.com/watch?v=NEmIPDs9CZw"

9
scripts/.local/bin/lumount

@ -1,9 +1,6 @@
#!/bin/bash
#!/bin/env sh
DRIVE="$1"
DRIVE_NAME="$(basename $DRIVE)"
DRIVE_NAME="$(basename "$DRIVE")"
sudo umount /media/$DRIVE_NAME
if [ $? == 0 ]; then
sudo cryptsetup luksClose ${DRIVE_NAME}-OPEN
fi
sudo umount /media/"$DRIVE_NAME" && sudo cryptsetup luksClose "$DRIVE_NAME"-OPEN

2
scripts/.local/bin/magnet2torrent

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
aria2c --bt-metadata-only=true --bt-save-metadata=true --listen-port=6881 "$@"

2
scripts/.local/bin/mailto

@ -1,3 +1,3 @@
#!/usr/bin/zsh
#!/usr/bin/env zsh
exec $TERMINAL -e "i3-runner neomutt \"$@\""

6
scripts/.local/bin/notifymail

@ -1,8 +1,8 @@
#!/bin/sh
#!/bin/env sh
MAILHOME="$XDG_DATA_HOME/Mail"
if [[ -d $MAILHOME ]]; then
out=$(find $MAILHOME/Gatech/INBOX/new $MAILHOME/Gmail/INBOX/new $MAILHOME/Gatech/INBOX/new -type f|wc -l)
if [ -d "$MAILHOME" ]; then
out=$(find "$MAILHOME"/Gatech/INBOX/new "$MAILHOME"/Gmail/INBOX/new "$MAILHOME"/Gatech/INBOX/new -type f|wc -l)
if [ -f /tmp/mailsync ] || [ "$out" != "0" ]; then
dunstbar -s mail -t 3000

4
scripts/.local/bin/nvimdiff

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
nvim -d $@
nvim -d "$@"

2
scripts/.local/bin/opout

@ -6,7 +6,7 @@ case "$1" in
*.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid zathura "$basename".pdf >/dev/null 2>&1 & ;;
*.gv|*.dot|*.uml|*.pu) setsid sxiveh "$basename".png >/dev/null 2>&1 & ;;
*.[0-9]) setsid zathura "$basename".pdf >/dev/null 2>&1 & ;;
*.html) setsid $BROWSER "$basename".html >/dev/null 2>&1 & ;;
*.html) setsid "$BROWSER" "$basename".html >/dev/null 2>&1 & ;;
*.py) setsid jupyter qtconsole >/dev/null 2>&1 & ;;
*.jl) setsid jupyter qtconsole --kernel=julia-default >/dev/null 2>&1 & ;;
esac

16
scripts/.local/bin/pins

@ -9,31 +9,31 @@ alias pl='if [ -f $pinfile ]; then
fi'
pa() {
if [ "$1" != "" ] && ([ ! -f $pinfile ] || ! grep -Pq "^$1\t" $pinfile); then
touch $pinfile
echo -e "$1\t$PWD" >> $pinfile
sort -o $pinfile $pinfile
if [ "$1" != "" ] && ([ ! -f "$pinfile" ] || ! grep -Pq "^$1\t" "$pinfile"); then
touch "$pinfile"
echo -e "$1\t$PWD" >> "$pinfile"
sort -o "$pinfile" "$pinfile"
pl
fi
}
pd() {
if [ "$1" != "" ] && grep -Pq "^$1\t" $pinfile; then
if [ "$1" != "" ] && grep -Pq "^$1\t" "$pinfile"; then
sed -i --follow-symlinks "/^$1\t/d" "$pinfile"
pl
fi
}
pe() {
if [ "$1" != "" ] && grep -Pq "^$1\t" $pinfile; then
if [ "$1" != "" ] && grep -Pq "^$1\t" "$pinfile"; then
sed -i --follow-symlinks "s~^$1\t.*~$1\t$PWD~" "$pinfile"
pl
fi
}
pg() {
if [ "$1" != "" ] && grep -Pq "^$1\t" $pinfile; then
cd `sed "s/^$1\t\(.*\)$/\1/;t;d" $pinfile`
if [ "$1" != "" ] && grep -Pq "^$1\t" "$pinfile"; then
cd "$(sed "s/^$1\t\(.*\)$/\1/;t;d" "$pinfile")" || exit
ls
fi
}

25
scripts/.local/bin/rangerpicker

@ -1,24 +1,25 @@
#!/bin/bash
#!/bin/env sh
tmpfile=/tmp/rangerpick
if [[ "$1" == "get" ]]; then
cat $tmpfile 2>/dev/null
if [ "$1" = "get" ]; then
cat "$tmpfile" 2>/dev/null
exit
elif [[ "$1" == "save" ]]; then
[ -f $tmpfile ] && cat > "`cat $tmpfile`"
elif [ "$1" = "save" ]; then
[ -f "$tmpfile" ] && cat > "$(cat "$tmpfile")"
exit
fi
rm -f /tmp/rangerpick
if [[ "$1" == "dir" ]]; then
ranger --choosedir $tmpfile
elif [[ "$1" == "single" ]]; then
ranger --choosefile $tmpfile
if [ "$1" = "dir" ]; then
ranger --choosedir "$tmpfile"
elif [ "$1" = "single" ]; then
ranger --choosefile "$tmpfile"
else
ranger --choosefiles $tmpfile
ranger --choosefiles "$tmpfile"
fi
if [ -f $tmpfile ]; then
[[ "$1" == "attach" ]] && echo "$(awk 'BEGIN {printf "%s", "push "} {printf "%s", "<attach-file>"$0"<enter>"}' $tmpfile)" > $tmpfile
if [ -f "$tmpfile" ]; then
midtmp="$(mktemp)"
[ "$1" = "attach" ] && awk 'BEGIN {printf "%s", "push "} {printf "%s", "<attach-file>"$0"<enter>"}' "$tmpfile" > "$midtmp" && mv "$midtmp" "$tmpfile"
fi

2
scripts/.local/bin/remaps

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
xset r rate 300 50
setxkbmap -option ctrl:nocaps

14
scripts/.local/bin/screencast

@ -1,15 +1,15 @@
#!/bin/bash
#!/bin/env sh
while [[ -f $HOME/screencast$n.mp4 ]]
while [ -f "$HOME/screencast$n.mp4" ]
do
n=$((n+1))
n=$((n+1))
done
filename="$HOME/screencast$n.mp4"
ffmpeg -y \
-f x11grab \
-s $(xdpyinfo | grep dimensions | awk '{print $2;}') \
-s "$(xdpyinfo | grep dimensions | awk '{print $2;}')" \
-i :0.0 \
-f alsa -i default \
-c:v libx264 -r 30 -c:a flac $filename
# -c:v libx264 -r 30 $filename
-c:v libx264 -r 30 "$filename"
# -f alsa -i default \
# -c:v libx264 -r 30 -c:a flac $filename

7
scripts/.local/bin/sendmail

@ -1,4 +1,5 @@
#!/bin/bash
#!/bin/env sh
ACCOUNT=$1
MIMEmbellish | msmtpq -a "$1" "${@:2}"
ACCOUNT="$1"
shift
MIMEmbellish | msmtpq -a "$ACCOUNT" "$@"

8
scripts/.local/bin/setbackground

@ -1,15 +1,15 @@
#!/bin/bash
#!/bin/env bash
file="$1"
base="${file##*/}"
if [ ! -z "$2" ]; then
if [ -n "$2" ]; then
wpg -a "$1"
file="$XDG_CONFIG_HOME/wpg/wallpapers/${base//\ /_}"
fi
[ ! -z "$file" ] && cp "$file" $XDG_CONFIG_HOME/wall && notify-send "Wallpaper changed"
[ -n "$file" ] && cp "$file" "$XDG_CONFIG_HOME"/wall && notify-send "Wallpaper changed"
xwallpaper --zoom "$XDG_CONFIG_HOME/wall"
[ ! -z "$2" ] && wpg -s "${base//\ /_}"
[ -n "$2" ] && wpg -s "${base//\ /_}"

2
scripts/.local/bin/statusbar/battery

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
capacity=$(cat /sys/class/power_supply/BAT0/capacity) || exit
status=$(cat /sys/class/power_supply/BAT0/status)

2
scripts/.local/bin/statusbar/clock

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
echo " $(date '+%H:%M:%S')"

2
scripts/.local/bin/statusbar/date

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
echo " $(date '+%b %d, %Y')"

4
scripts/.local/bin/statusbar/ethernet

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/env sh
device="enp*"
device="ens*"
ip="$(ip -4 addr show|grep "$device"|grep -oP '(?<=inet )\d*(\.\d*){3}')"
if [ "$ip" != "" ]; then
echo " $ip"

20
scripts/.local/bin/statusbar/fullbar

@ -1,13 +1,13 @@
#!/bin/bash
#!/bin/env sh
scripts="$HOME/.local/bin/statusbar"
echo "$({ $scripts/mail;
$scripts/volume;
$scripts/network;
$scripts/powersaver;
$scripts/battery;
$scripts/date;
$scripts/clock;
$scripts/layout;
} | tr '\n' ' ')"
{ "$scripts"/mail;
"$scripts"/volume;
"$scripts"/network;
"$scripts"/powersaver;
"$scripts"/battery;
"$scripts"/date;
"$scripts"/clock;
"$scripts"/layout;
} | tr '\n' ' '

4
scripts/.local/bin/statusbar/i3

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
echo "$(i3-msg -t get_workspaces|jq 'group_by(.rect.x, .rect.y)|map(map(if .focused then "<b>"+.name+"</b>" else "<small>"+.name+"</small>" end))|.[]|.[]' | tr '\n' ' '|sed 's/"//g')"
i3-msg -t get_workspaces|jq 'group_by(.rect.x, .rect.y)|map(map(if .focused then "<b>"+.name+"</b>" else "<small>"+.name+"</small>" end))|.[]|.[]' | tr '\n' ' '|sed 's/"//g'

6
scripts/.local/bin/statusbar/layout

@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/env sh
layout=`i3-msg -t get_tree | jq -r 'recurse(.nodes[]) | select(.nodes[].focused == true) | .layout'`
if [[ "$layout" == "splitv" ]]; then
layout=$(i3-msg -t get_tree | jq -r 'recurse(.nodes[]) | select(.nodes[].focused == true) | .layout')
if [ "$layout" = "splitv" ]; then
echo ""
else
echo ""

6
scripts/.local/bin/statusbar/mail

@ -1,8 +1,8 @@
#!/bin/bash
#!/bin/env sh
MAILHOME="$XDG_DATA_HOME/Mail"
if [[ -d $MAILHOME ]]; then
out=$(find $MAILHOME/Gatech/INBOX/new $MAILHOME/Gmail/INBOX/new -type f|wc -l)
if [ -d "$MAILHOME" ]; then
out=$(find "$MAILHOME"/Gatech/INBOX/new "$MAILHOME"/Gmail/INBOX/new "$MAILHOME"/Gatech/INBOX/new -type f|wc -l)
if [ -f /tmp/mailsync ]; then
echo " $(cat /tmp/mailsync)"

6
scripts/.local/bin/statusbar/music

@ -1,5 +1,3 @@
#!/bin/bash
#!/bin/env sh
if [[ -f $XDG_CACHE_HOME/nowplaying ]]; then
echo " $(cat $XDG_CACHE_HOME/nowplaying)"
fi
[ -f "$XDG_CACHE_HOME"/nowplaying ] && echo " $(cat "$XDG_CACHE_HOME"/nowplaying)"

4
scripts/.local/bin/statusbar/network

@ -1,5 +1,5 @@
#!/bin/bash
#!/bin/env sh
scripts="$HOME/.local/bin/statusbar"
echo "$({ $scripts/vpn; $scripts/wifi; $scripts/ethernet; } | tr '\n' ' ')"
{ "$scripts"/vpn; "$scripts"/wifi; "$scripts"/ethernet; } | tr '\n' ' '

2
scripts/.local/bin/statusbar/powersaver

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env sh
if xset -q | grep -q "DPMS is Enabled"; then
echo ""

8
scripts/.local/bin/statusbar/volume

@ -1,11 +1,11 @@
#!/bin/bash
#!/bin/env sh
line="$(amixer sget Master | grep 'Right:')"
stat="$(echo $line | awk -F'[][]' '{ print $4 }')"
level="$(echo $line | awk -F'[][]' '{ print $2 }')"
stat="$(echo "$line" | awk -F'[][]' '{ print $4 }')"
level="$(echo "$line" | awk -F'[][]' '{ print $2 }')"
if [[ "$stat" == "off" ]]; then
if [ "$stat" = "off" ]; then
echo "婢 0%"
else
echo "墳 $level"

6
scripts/.local/bin/statusbar/vpn

@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/env sh
if ip addr|grep -q tun0; then
echo -e '\uf817'
printf '\uf817 '
else
echo ''
printf ''
fi

4
scripts/.local/bin/statusbar/wifi

@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/env sh
device=wlp3s0
device=wlp59s0
ssid="$(iw dev $device info|grep -oP '(?<=ssid ).*')"
if [ "$ssid" != "" ]; then
echo "說 $ssid"

2
scripts/.local/bin/statusbar/workspaces

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/env sh
echo "Workspaces:"

2
scripts/.local/bin/stopwatch

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env bash
secondtodate() {

16
scripts/.local/bin/sxiveh

@ -1,15 +1,15 @@
#!/usr/bin/bash
#!/bin/env sh
case $@ in
case "$@" in
http*://*)
folder="/tmp/$(date '+%Y%m%d%H%M%S%N')-sxevimages"
mkdir $folder
for url in $@; do
mkdir "$folder"
for url in "$@"; do
name="$folder/${url##*/}"
curl -L -o $name -s $url
curl -L -o "$name" -s "$url"
done
sxiv -ba $folder/*
rm -r $folder
sxiv -ba "$folder"/*
rm -r "$folder"
;;
*) sxiv -b $@;;
*) sxiv -b "$@";;
esac

2
scripts/.local/bin/texclear

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env bash
[[ "$1" == *.tex ]] || exit

2
scripts/.local/bin/tmpopen

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/env sh
opener="setsid xdg-open"
mkdir -p "/tmp/$USER-mutt-tmp"

20
scripts/.local/bin/tmuxiplex

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/env sh
set -euC
@ -11,9 +11,11 @@ s_name=$1
# attach or switch to tmux session
att() {
[ -n "${TMUX:-}" ] &&
$tmux switch-client -t "=${s_name}" ||
$tmux attach-session -t "=${s_name}"
if [ -n "${TMUX:-}" ]; then
$tmux switch-client -t "=${s_name}"
else
$tmux attach-session -t "=${s_name}"
fi
}
# if session exists, go to it
@ -22,16 +24,16 @@ if $tmux has-session -t "=${s_name}" 2> /dev/null; then
exit 0
fi
if [ "$s_name" == "scratchpad" ]; then
if [ "$s_name" = "scratchpad" ]; then
w1_name="default"
$tmux new-session -d -s ${s_name} -n ${w1_name}
$tmux new-session -d -s "${s_name}" -n "${w1_name}"
w2_name="vpn"
$tmux new-window -d -t "=${s_name}" -n ${w2_name}
$tmux send-keys -t "=${s_name}:=${w2_name}" "gohome"
$tmux new-window -d -t "=${s_name}" -n "${w2_name}"
$tmux send-keys -t "=${s_name}:=${w2_name}.1" " gtrivpn"
w3_name="music"
$tmux new-window -d -t "=${s_name}" -n ${w3_name}
$tmux new-window -d -t "=${s_name}" -n "${w3_name}"
$tmux split-window -d -t "=${s_name}:=${w3_name}"
$tmux resize-pane -t "=${s_name}:=${w3_name}" -D 6
$tmux send-keys -t "=${s_name}:=${w3_name}.2" "cava" Enter

8
scripts/.local/bin/toggleservice

@ -1,7 +1,7 @@
#!/bin/bash
#!/bin/env sh
service=$1
service="$1"
systemctl --user is-active $service 2&> /dev/null && systemctl --user stop $service && notify-send "$service off" && exit
systemctl --user is-active "$service" >/dev/null 2>&1 && systemctl --user stop "$service" && notify-send "$service off" && exit
systemctl --user start $service && notify-send "$service on"
systemctl --user start "$service" && notify-send "$service on"

6
scripts/.local/bin/toggletrackpad

@ -1,9 +1,9 @@
#!/bin/bash
#!/bin/env sh
device="SynPS/2 Synaptics TouchPad"
state=`xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$"`
state=$(xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$")
if [ $state == '1' ]; then
if [ "$state" = "1" ]; then
xinput disable "$device"
else
xinput enable "$device"

16
scripts/.local/bin/transfer

@ -1,18 +1,18 @@
#!/bin/bash
#!/bin/env sh
if [ $# -eq 0 ]; then
echo -e "No arguments specified. Usage:\ntransfer /tmp/test.md";
printf "No arguments specified. Usage:\ntransfer /tmp/test.md\n";
exit 1;
fi
tmpfile=$( mktemp -t transferXXX );
if tty -s; then
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g');
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile;
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> "$tmpfile";
else
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ;
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> "$tmpfile";
fi;
cat $tmpfile;
command -v xclip > /dev/null && cat $tmpfile | xclip -selection clipboard;
command -v qrencode > /dev/null && cat $tmpfile | qrencode -t UTF8i;
rm -f $tmpfile;
cat "$tmpfile";
command -v xclip > /dev/null && xclip -selection clipboard "$tmpfile";
command -v qrencode > /dev/null && qrencode -t UTF8i <"$tmpfile";
rm -f "$tmpfile";

6
scripts/.local/bin/ufetch

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/env sh
#
# ufetch-arch - tiny system info for arch linux
#
@ -11,11 +11,11 @@ os='Arch Linux'
kernel="$(uname -sr)"
uptime="$(uptime -p | sed 's/up //')"
packages="$(pacman -Q | wc -l)"
shell="$(basename ${SHELL})"
shell="$(basename "${SHELL}")"
DE=$DESKTOP_SESSION
birthday="$(head -n 1 /var/log/pacman.log | grep -oP '\d{4}(-\d{2}){2}')"
birthday="$(date -d $birthday +'%b %d, %Y' )"
birthday="$(date -d "$birthday" +'%b %d, %Y' )"
## DEFINE COLORS

12
scripts/.local/bin/vim-anywhere

@ -1,17 +1,17 @@
#!/bin/bash
#!/bin/env sh
function setclip {
setclip() {
xclip -selection c
}
function getclip {
getclip() {
xclip -selection clipboard -o
}
file=$(mktemp).md
$TERMINAL -e 'i3-runner "$EDITOR '$file'"' # replace with your favorite terminal
$TERMINAL -e "i3-runner \"$EDITOR '$file'\"" # replace with your favorite terminal
cat $file | setclip
rm $file
setclip <"$file"
rm "$file"
xdotool key ctrl+v

2
scripts/.local/bin/vpnc-script

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/env sh
#
# Originally part of vpnc source code:
# © 2005-2012 Maurice Massar, Jörg Mayer, Antonio Borneo et al.

2
scripts/.local/bin/wal-set

@ -1,4 +1,4 @@
#!/usr/bin/bash
#!/usr/bin/env sh
i3-msg reload > /dev/null
systemctl --user restart dunst.service

10
sxiv/.config/sxiv/exec/key-handler

@ -1,5 +1,5 @@
#!/bin/sh
while read file
while read -r file
do
fullpath="$(pwd)/$file"
case "$1" in
@ -12,12 +12,12 @@ do
notify-send "Wallpaper changed."
;;
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" $XDG_CONFIG_HOME/folders | awk '{print $2}' | bemenucolor -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" "$XDG_CONFIG_HOME"/folders | awk '{print $2}' | bemenucolor -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
cp "$file" "$destdir" && notify-send -i "$fullpath" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" $XDG_CONFIG_HOME/folders | awk '{print $2}' | bemenucolor -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" "$XDG_CONFIG_HOME"/folders | awk '{print $2}' | bemenucolor -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
cp "$file" "$destdir" && notify-send -i "$fullpath" "$file moved to $destdir." &
;;
@ -32,10 +32,10 @@ do
"T")
convert "$file" -fuzz 50% -transparent white "$file" ;;
"y")
echo -n "$file" | xclip -selection clipboard &&
printf %s "$file" | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;
"Y")
echo -n "$fullpath" | xclip -selection clipboard &&
printf %s "$fullpath" | xclip -selection clipboard &&
notify-send "$fullpath copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | bemenucolor -i -p "Delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;

4
vdirsyncer/.config/vdirsyncer/password.sh

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/sh
pass vdirsyncer/$1
pass vdirsyncer/"$1"

Loading…
Cancel
Save