Add notify scripts

This commit is contained in:
Aleksey Samoilov 2023-08-06 00:21:58 +04:00
parent b43c4905cc
commit 33768e8e91
5 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#!/bin/sh
VALUE=$(light -G | cut -d'.' -f1)
TEXT="Brightness: ${VALUE}%"
notify-send \
--expire-time 800 \
--hint string:x-canonical-private-synchronous:brightness \
--hint "int:value:$VALUE" \
--hint "int:transient:1" \
"${TEXT}"

View file

@ -0,0 +1,15 @@
#!/bin/bash
COUNT=$(dunstctl count waiting)
ENABLED=
DISABLED=
if [ $COUNT != 0 ]; then
DISABLED="$COUNT"
fi
if dunstctl is-paused | grep -q "false" ; then
echo $ENABLED
else
echo $DISABLED
fi

View file

@ -0,0 +1,6 @@
#!/usr/bin/env sh
HASH="$(echo "$@" | shasum | cut -f1 -d" " | cut -c1-7)"
mkdir -p "$HOME/.local/state"
flock --verbose -n "$HOME/.local/state/${HASH}.lock" "$@"

View file

@ -0,0 +1,8 @@
#!/bin/sh
set -e
DIR=${XDG_PICTURES_DIR:-$HOME/Pictures}
while true; do
mkdir -p "$DIR" && inotifywait -q -e create "$DIR" --format '%w%f' | xargs notify-send "Screenshot saved"
done

View file

@ -0,0 +1,22 @@
#!/bin/sh
VOLUME=$(pulsemixer --get-volume)
# get first percent value
VOLUME=${VOLUME%%%*}
VOLUME=${VOLUME##* }
TEXT="Volume: ${VOLUME}%"
case $(pulsemixer --get-mute) in
*1)
TEXT="Volume: muted"
VOLUME=0
;;
esac
notify-send \
--app-name sway \
--expire-time 800 \
--hint string:x-canonical-private-synchronous:volume \
--hint "int:value:$VOLUME" \
--hint "int:transient:1" \
"${TEXT}"