AutoYADM commit: 2025-01-22 13:45:06

This commit is contained in:
Daniel Fichtinger 2025-01-22 13:45:06 -05:00
parent e0a4daea1f
commit 5e452a1408

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
WL_PRESENT_DMENU="tofi"
usage() { usage() {
echo "usage: wl-present [options] <command> [argument]" echo "usage: wl-present [options] <command> [argument]"
echo echo
@ -80,7 +80,11 @@ pipectl-shim() {
opt="$1" opt="$1"
shift shift
case "$opt" in case "$opt" in
-n|--name) arg="$1"; shift; PIPENAME="pipectl.$(id -u).$arg.pipe";; -n | --name)
arg="$1"
shift
PIPENAME="pipectl.$(id -u).$arg.pipe"
;;
-i | --in) MODE=in ;; -i | --in) MODE=in ;;
-o | --out) MODE=out ;; -o | --out) MODE=out ;;
-f | --force) FORCE=1 ;; -f | --force) FORCE=1 ;;
@ -102,7 +106,13 @@ pipectl-shim() {
return 1 return 1
else else
[[ "$FORCE" -eq 1 ]] && rm -f "$PIPE" [[ "$FORCE" -eq 1 ]] && rm -f "$PIPE"
mkfifo "$PIPE"; (tail -f "$PIPE" & echo > "$PIPE"; wait); rm -f "$PIPE" mkfifo "$PIPE"
(
tail -f "$PIPE" &
echo >"$PIPE"
wait
)
rm -f "$PIPE"
fi ;; fi ;;
esac esac
} }
@ -170,7 +180,13 @@ ask-output-or-region() {
} }
ask-scaling() { ask-scaling() {
(echo fit; echo cover; echo exact; echo linear; echo nearest) | $DMENU -p "wl-present scaling" (
echo fit
echo cover
echo exact
echo linear
echo nearest
) | $DMENU -p "wl-present scaling"
[[ $? -ne 0 ]] && exit 1 [[ $? -ne 0 ]] && exit 1
} }
@ -206,7 +222,11 @@ while [[ $# -gt 0 && "${1:0:1}" == "-" ]]; do
opt="$1" opt="$1"
shift shift
case "$opt" in case "$opt" in
-n|--name) arg="$1"; shift; PRESENT_PIPE_NAME="$arg";; -n | --name)
arg="$1"
shift
PRESENT_PIPE_NAME="$arg"
;;
-h | --help) usage ;; -h | --help) usage ;;
--) break ;; --) break ;;
esac esac
@ -218,7 +238,10 @@ fi
case "$1" in case "$1" in
help) usage ;; help) usage ;;
mirror) shift; mirror "$@";; mirror)
shift
mirror "$@"
;;
set-output) set-output "${2:-$(ask-output)}" ;; set-output) set-output "${2:-$(ask-output)}" ;;
set-region) set-region "${2:-$(ask-region)}" ;; set-region) set-region "${2:-$(ask-region)}" ;;
unset-region | no-region) mirror-cmd --no-region ;; unset-region | no-region) mirror-cmd --no-region ;;