Use long option names

This commit is contained in:
Ohad Livne 2025-12-18 22:27:14 +02:00
parent 38bf705a3c
commit 82cd587d18
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D
7 changed files with 23 additions and 23 deletions

View file

@ -3,7 +3,7 @@
set -euo pipefail
IFS=$'\n\t'
if ! PARSED_OPTIONS=$(getopt -o "" --long "offline,volatile" --name "$0" -- "$@"); then
if ! PARSED_OPTIONS=$(getopt --options "" --long "offline,volatile" --name "$0" -- "$@"); then
echo "Error parsing options." >&2
exit 1
fi

View file

@ -1,6 +1,6 @@
#! /usr/bin/sh
recordings=$(pgrep wf-recorder | wc -l)
recordings=$(pgrep wf-recorder | wc --lines)
if [ "${recordings}" = "0" ]; then
recs=""
else
@ -19,7 +19,7 @@ else
numlock="⮔"
fi
touchpad=$(swaymsg -t get_inputs | jq -r '[.[] | select(.type == "touchpad")][0] | .libinput.send_events')
touchpad=$(swaymsg --type get_inputs | jq --raw-output '[.[] | select(.type == "touchpad")][0] | .libinput.send_events')
if [ "${touchpad}" = "enabled" ]; then
touchpad_active="✅"
else
@ -29,8 +29,8 @@ fi
today=$(date +'%Y-%m-%d')
now=$(date +'%H:%M:%S')
hour=$(echo "${now}" | cut -d: -f1 -)
minute=$(echo "${now}" | cut -d: -f2 -)
hour=$(echo "${now}" | cut --delimiter ":" --fields 1 -)
minute=$(echo "${now}" | cut --delimiter ":" --fields 2 -)
if [ "${minute}" -lt 30 ]; then
case "${hour}" in
"00"|"12") clock_face="🕛";;
@ -64,7 +64,7 @@ else
fi
audio_mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
audio_volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -o '[0-9]\+%' | head -n 1 | tr -d %)
audio_volume=$(pactl get-sink-volume @DEFAULT_SINK@ | grep --only-matching '[0-9]\+%' | head --lines 1 | tr --delete %)
audio_symbol="❔"
if [ "${audio_mute}" = "yes" ]; then
audio_symbol="🔇"
@ -81,7 +81,7 @@ else
fi
mike_mute=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk '{print $2}')
mike_volume=$(pactl get-source-volume @DEFAULT_SOURCE@ | grep -o '[0-9]\+%' | head -n 1 | tr -d %)
mike_volume=$(pactl get-source-volume @DEFAULT_SOURCE@ | grep --only-matching '[0-9]\+%' | head --lines 1 | tr --delete %)
mike_symbol="❔"
if [ "${mike_mute}" = "yes" ]; then
mike_symbol="🍌"

View file

@ -37,15 +37,15 @@ else
fi
get_focused_monitor() {
swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name'
swaymsg --type get_outputs | jq --raw-output '.[] | select(.focused) | .name'
}
get_focused_window() {
swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'
swaymsg --type get_tree | jq --join-output '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"'
}
select_window() {
swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp
swaymsg --type get_tree | jq --raw-output '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp
}
case "${option}" in
@ -68,11 +68,11 @@ case "${option}" in
"📷 Select window → 📋")
grim -g "$(select_window)" - | wl-copy;;
"📽 Record focused monitor")
wf-recorder -o "$(get_focused_monitor)" -f "$(recording_filename)";;
wf-recorder --output "$(get_focused_monitor)" -f "$(recording_filename)";;
"📽 Record select region")
wf-recorder -g "$(slurp)" -f "$(recording_filename)";;
wf-recorder --geometry "$(slurp)" -f "$(recording_filename)";;
"📽 Record focused window")
wf-recorder -g "$(get_focused_window)" -f "$(recording_filename)";;
wf-recorder --geometry "$(get_focused_window)" -f "$(recording_filename)";;
"📽 Record select window")
wf-recorder -g "$(select_window)" -f "$(recording_filename)";;
wf-recorder --geometry "$(select_window)" -f "$(recording_filename)";;
esac

View file

@ -3,7 +3,7 @@
set -euo pipefail
IFS=$'\n\t'
podman --transient-store run --rm -ti \
podman --transient-store run --interactive --rm --tty \
--env WAYLAND_DISPLAY \
--env XDG_RUNTIME_DIR=/tmp \
--hostname localhost \