feat(hypr): add some event notifications
This commit is contained in:
parent
6f9c089268
commit
68c7c3d761
@ -5,3 +5,5 @@ source=~/.config/hypr/wm/monitors.conf
|
|||||||
exec=~/.config/hypr/scripts/launch-waybar.bash
|
exec=~/.config/hypr/scripts/launch-waybar.bash
|
||||||
exec-once=sudo modprobe uinput && sudo kbct remap --config ~/.config/kbct/config.yml
|
exec-once=sudo modprobe uinput && sudo kbct remap --config ~/.config/kbct/config.yml
|
||||||
exec=mako
|
exec=mako
|
||||||
|
exec-once=~/.config/hypr/scripts/events-monitor.bash
|
||||||
|
exec-once=udiskie
|
||||||
|
34
dots/.config/hypr/scripts/events-monitor.bash
Executable file
34
dots/.config/hypr/scripts/events-monitor.bash
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
monitor-dir() {
|
||||||
|
local event="${1}"
|
||||||
|
local directory="${2}"
|
||||||
|
local message_title="${3}"
|
||||||
|
|
||||||
|
inotifywait -m -e "${event}" --format '%w%f' "${directory}" | while read -r NEWFILE; do
|
||||||
|
notify-send "${message_title}" "${NEWFILE}" -a "Device Monitor"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor-ssid() {
|
||||||
|
local notify_title="Wifi State Changed"
|
||||||
|
local notify_app="Wifi State"
|
||||||
|
local previous_ssid=""
|
||||||
|
local ssid
|
||||||
|
while :; do
|
||||||
|
ssid="$(iwctl station wlan0 show | grep 'Connected network' | awk '{$1=$2=""; print $0}')"
|
||||||
|
ssid="$(printf "%s" "${ssid}" | xargs)"
|
||||||
|
if [[ "${ssid}" != "${previous_ssid}" ]]; then
|
||||||
|
if [[ -z "${ssid// /}" ]]; then
|
||||||
|
notify-send "${notify_title}" "Wifi Disconnected" -a "${notify_app}"
|
||||||
|
else
|
||||||
|
notify-send "${notify_title}" "Wifi Connected to ${ssid}" -a "${notify_app}"
|
||||||
|
fi
|
||||||
|
previous_ssid="${ssid}"
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor-ssid &
|
||||||
|
wait
|
Loading…
Reference in New Issue
Block a user