Unix3r

Build. Break. Learn. Repeat.

Starting0%
Skip to content

unix3r/dotfiles

Public
main
U Unix3r Initial commit: sway + waybar dotfiles (Catppuccin Mocha) eb290df
24 lines · 906 B Raw History
1#!/usr/bin/env bash
2# dnd.sh toggle|status — Do Not Disturb for mako. `status` prints JSON for waybar.
3source "$(dirname "$0")/_lib.sh"
4
5is_dnd() { makoctl mode 2>/dev/null | grep -qx do-not-disturb; }
6
7case ${1:-toggle} in
8 toggle)
9 if is_dnd; then
10 makoctl mode -r do-not-disturb >/dev/null
11 notify dnd notifications "Notifications on"
12 else
13 notify dnd notifications-disabled "Do Not Disturb on"
14 sleep 1
15 makoctl mode -a do-not-disturb >/dev/null
16 fi
17 pkill -RTMIN+8 waybar 2>/dev/null ;;
18 status)
19 if is_dnd; then
20 printf '{"text":"","class":"dnd","tooltip":"Do Not Disturb\\nclick: toggle · right-click: restore last"}\n'
21 else
22 printf '{"text":"","class":"normal","tooltip":"Notifications on\\nclick: toggle · right-click: restore last"}\n'
23 fi ;;
24esac