commit after getting everything working on desktop hyprland
This commit is contained in:
BIN
desktop/waybar/scripts/__pycache__/logout-menu.cpython-314.pyc
Normal file
BIN
desktop/waybar/scripts/__pycache__/logout-menu.cpython-314.pyc
Normal file
Binary file not shown.
37
desktop/waybar/scripts/logout-menu.py
Executable file
37
desktop/waybar/scripts/logout-menu.py
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Waybar power button: a small session menu driven by fuzzel."""
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
ENTRIES = [
|
||||
("Lock", "command -v hyprlock >/dev/null 2>&1 && exec hyprlock"),
|
||||
("Log out", "hyprctl dispatch exit"),
|
||||
("Suspend", "systemctl suspend"),
|
||||
("Reboot", "systemctl reboot"),
|
||||
("Shut down", "systemctl poweroff"),
|
||||
]
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if not shutil.which("fuzzel"):
|
||||
print("fuzzel not found", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
menu = "\n".join(name for name, _ in ENTRIES) + "\n"
|
||||
result = subprocess.run(
|
||||
["fuzzel", "--dmenu", "--prompt", "Session: "],
|
||||
input=menu,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
choice = result.stdout.strip()
|
||||
for name, command in ENTRIES:
|
||||
if name == choice:
|
||||
subprocess.Popen(["sh", "-c", command])
|
||||
break
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
21
desktop/waybar/scripts/notifications.sh
Executable file
21
desktop/waybar/scripts/notifications.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# Waybar "custom/notifications" module (return-type: json).
|
||||
# Counts active mako notifications and degrades gracefully when mako is absent.
|
||||
|
||||
count=0
|
||||
if command -v makoctl >/dev/null 2>&1; then
|
||||
count=$(makoctl list 2>/dev/null | grep -c '"id"')
|
||||
fi
|
||||
case "$count" in ''|*[!0-9]*) count=0 ;; esac
|
||||
|
||||
if [ "$count" -gt 0 ]; then
|
||||
text=$(printf '\357\203\263 %s' "$count")
|
||||
tooltip="$count notification(s)"
|
||||
class=unread
|
||||
else
|
||||
text=$(printf '\357\203\263')
|
||||
tooltip="No notifications"
|
||||
class=empty
|
||||
fi
|
||||
|
||||
printf '{"text":"%s","tooltip":"%s","class":"%s"}\n' "$text" "$tooltip" "$class"
|
||||
Reference in New Issue
Block a user