upd
This commit is contained in:
@@ -107,7 +107,8 @@
|
||||
"tooltip-format": "{desc}"
|
||||
},
|
||||
"clock": {
|
||||
"format": "{:%I:%M %p %a, %b %d}",
|
||||
"format": "{:%H:%M %a, %b %d}",
|
||||
"timezone": "America/New_York",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "<tt>{calendar}</tt>",
|
||||
"calendar": {
|
||||
@@ -151,7 +152,8 @@
|
||||
"sort-by-number": true
|
||||
},
|
||||
"clock#portrait": {
|
||||
"format": "{:%I:%M %p}",
|
||||
"format": "{:%H:%M}",
|
||||
"timezone": "America/New_York",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "<tt>{calendar}</tt>",
|
||||
"calendar": {
|
||||
|
||||
Binary file not shown.
@@ -4,15 +4,34 @@ import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def _shutdown_cmd() -> str:
|
||||
"""Clean logout command for this session.
|
||||
|
||||
The session runs under UWSM (hyprland-uwsm). There, `hyprctl dispatch exit`
|
||||
can leave SDDM on a black screen instead of logging out, while `uwsm stop`
|
||||
tears the session down cleanly. Fall back to the compositor dispatcher when
|
||||
UWSM is not in use.
|
||||
"""
|
||||
if shutil.which("uwsm"):
|
||||
return "uwsm stop"
|
||||
return "hyprctl dispatch exit"
|
||||
|
||||
|
||||
ENTRIES = [
|
||||
("Lock", "command -v hyprlock >/dev/null 2>&1 && exec hyprlock"),
|
||||
("Log out", "hyprctl dispatch exit"),
|
||||
("Lock", "hyprlock"),
|
||||
("Log out", _shutdown_cmd()),
|
||||
("Suspend", "systemctl suspend"),
|
||||
("Reboot", "systemctl reboot"),
|
||||
("Shut down", "systemctl poweroff"),
|
||||
]
|
||||
|
||||
|
||||
def _notify(message: str) -> None:
|
||||
if shutil.which("notify-send"):
|
||||
subprocess.Popen(["notify-send", "Session menu", message])
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if not shutil.which("fuzzel"):
|
||||
print("fuzzel not found", file=sys.stderr)
|
||||
@@ -27,9 +46,14 @@ def main() -> int:
|
||||
)
|
||||
choice = result.stdout.strip()
|
||||
for name, command in ENTRIES:
|
||||
if name == choice:
|
||||
subprocess.Popen(["sh", "-c", command])
|
||||
break
|
||||
if name != choice:
|
||||
continue
|
||||
program = command.split()[0]
|
||||
if not shutil.which(program):
|
||||
_notify(f"{program} not found")
|
||||
return 1
|
||||
subprocess.Popen(["sh", "-c", command])
|
||||
break
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user