summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-01-05 19:49:12 +0100
committerRaymaekers Luca <luca@spacehb.net>2025-01-05 19:49:12 +0100
commita7309ce61c093caeb554c20497f4e4b765073203 (patch)
tree6e7c9e559253f0f0584175c582624eec29a0d5cb /bin/extra
parent58bf86c706c5a442da4fb01ea26e06f1ed291d45 (diff)
parent112449dd19eaae6769ef95a70b3e52234256400c (diff)
checkpoint
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/20202021
-rwxr-xr-xbin/extra/cycleKB25
-rwxr-xr-xbin/extra/mtr2
-rwxr-xr-xbin/extra/notify-send81
-rwxr-xr-xbin/extra/p.sh2
5 files changed, 118 insertions, 13 deletions
diff --git a/bin/extra/202020 b/bin/extra/202020
index 1386058..35ce1c9 100755
--- a/bin/extra/202020
+++ b/bin/extra/202020
@@ -1,14 +1,23 @@
#!/bin/sh
-mpvwopts="mpv --no-resume-playback --volume=100"
+mpvCommand="mpv --no-resume-playback --volume=100"
sounds="$HOME/sync/share/sounds"
-while true
-do
+if [ "$1" ]; then
+ $mpvCommand "$sounds"/avert1.ogg &
+ herbe '202020' 'avert!' &
+ sleep 20s
+ $mpvCommand "$sounds"/avert2.ogg &
+ herbe '202020' 'stop averting' &
+
+ exit
+fi
+
+while true; do
sleep 20m
- $mpvwopts "$sounds"/avert1.ogg &
- herbe '202020' 'avert!'
+ $mpvCommand "$sounds"/avert1.ogg &
+ herbe '202020' 'avert!' &
sleep 20s
- $mpvwopts "$sounds"/avert2.ogg &
+ $mpvCommand "$sounds"/avert2.ogg &
herbe '202020' 'stop averting' &
done
diff --git a/bin/extra/cycleKB b/bin/extra/cycleKB
index 154f5a1..597f26f 100755
--- a/bin/extra/cycleKB
+++ b/bin/extra/cycleKB
@@ -1,6 +1,21 @@
#!/usr/bin/sh
-keyboards="$HOME/bin/keyboards.txt"
-kb="$(head -n 1 "$keyboards")"
-setxkbmap $kb &
-sed -i '1h;1d;$G' "$keyboards"
-notify-send -t 1000 "cycleKB" "${kb%% *}"
+
+list_layouts()
+{
+cat <<EOF
+us
+colemak -option ctrl:swapcaps,altwin:menu_win
+EOF
+}
+
+current_keymap()
+{
+ setxkbmap -print | awk -F '+' '/xkb_symbols/ {print $2}'
+}
+
+NumLayouts="$(list_layouts | wc -l)"
+IndexLayout="$(list_layouts | awk "/^$(current_keymap)/ {print NR}")"
+[ "$IndexLayout" -eq "$NumLayouts" ] && IndexLayout=1 || IndexLayout=$((IndexLayout + 1))
+Layout="$(list_layouts | sed -n "${IndexLayout}p" )"
+setxkbmap $Layout &
+herbe "_cycleKB" "*${Layout%% *}"
diff --git a/bin/extra/mtr b/bin/extra/mtr
index 486a9b8..68aac60 100755
--- a/bin/extra/mtr
+++ b/bin/extra/mtr
@@ -20,4 +20,4 @@ category="$(list_categories | commander -cl)"
transmission-remote debuc.com -a "$(clipo)" -w "/downloads/$category"
-notify-send "mtr" "added to <b>$category</b>"
+herbe "_mtr" "*added to $category"
diff --git a/bin/extra/notify-send b/bin/extra/notify-send
new file mode 100755
index 0000000..3a3872b
--- /dev/null
+++ b/bin/extra/notify-send
@@ -0,0 +1,81 @@
+#!/bin/sh
+# Shell script to redirect notify-send calls to herbe. The purpose is to ignore
+# options passed to notify-send.
+#
+# Option parser generated by getoptions
+# URL: https://github.com/ko1nksm/getoptions
+# LICENSE: Creative Commons Zero v1.0 Universal
+
+usage() {
+ printf '%s\n' "${0##*/}: notify-send replacement for herbe" "accepts but ignores all notify-send options."
+}
+
+REST=''
+parse() {
+ OPTIND=$(($#+1))
+ while [ $# -gt 0 ] && OPTARG=; do
+ case $1 in
+ --?*=*) OPTARG=$1; shift
+ eval 'set -- "${OPTARG%%\=*}" "${OPTARG#*\=}"' ${1+'"$@"'}
+ ;;
+ -[utich]?*) OPTARG=$1; shift
+ eval 'set -- "${OPTARG%"${OPTARG#??}"}" "${OPTARG#??}"' ${1+'"$@"'}
+ ;;
+ -[!-]?*) OPTARG=$1; shift
+ eval 'set -- "${OPTARG%"${OPTARG#??}"}" "-${OPTARG#??}"' ${1+'"$@"'}
+ OPTARG= ;;
+ esac
+ case $1 in
+ -u | --urgency)
+ [ $# -le 1 ] && set -- "$1" required && break
+ OPTARG=$2
+ _=$OPTARG
+ shift ;;
+ -t | --expire-time)
+ [ $# -le 1 ] && set -- "$1" required && break
+ OPTARG=$2
+ _=$OPTARG
+ shift ;;
+ -i | --icon)
+ [ $# -le 1 ] && set -- "$1" required && break
+ OPTARG=$2
+ _=$OPTARG
+ shift ;;
+ -c | --category)
+ [ $# -le 1 ] && set -- "$1" required && break
+ OPTARG=$2
+ _=$OPTARG
+ shift ;;
+ -h | --hint)
+ [ $# -le 1 ] && set -- "$1" required && break
+ OPTARG=$2
+ _=$OPTARG
+ shift ;;
+ -? | --help)
+ usage
+ exit 0 ;;
+ --) shift
+ while [ $# -gt 0 ]; do
+ REST="${REST} \"\${$(($OPTIND-$#))}\""
+ shift
+ done
+ break ;;
+ [-]?*) set -- "$1" unknown && break ;;
+ *) REST="${REST} \"\${$(($OPTIND-$#))}\""
+ esac
+ shift
+ done
+ [ $# -eq 0 ] && return 0
+ case $2 in
+ unknown) echo "unrecognized option '$1'" ;;
+ noarg) echo "option '$1' doesn't allow an argument" ;;
+ required) echo "option '$1' requires an argument" ;;
+ pattern) echo "option '$1' does not match the pattern ($3)" ;;
+ *) echo "option '$1' validation error: $2"
+ esac >&2
+ exit 1
+}
+
+parse "$@"
+eval set -- "$REST"
+herbe "$@" &
diff --git a/bin/extra/p.sh b/bin/extra/p.sh
index e33f5ba..681b9ab 100755
--- a/bin/extra/p.sh
+++ b/bin/extra/p.sh
@@ -671,7 +671,7 @@ case "$choice" in
curl -Ls "$url" > "$html"
level1="$(pup -p 'span.infocard:nth-child(2) > small:nth-child(2) text{}' < "$html")"
level2="$(pup -p 'span.infocard:nth-child(4) > small:nth-child(2) text{}' < "$html")"
- herbe "p.sh" "$level1" "$level2" &
+ herbe "_p.sh" "$level1" "$level2"
;;
# moves