From 59fd10c296ee5fda22226ffd71707ca597f85ed7 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Wed, 25 Dec 2024 14:55:37 +0000 Subject: Add bin --- bin/.install.yml | 22 ---------------------- bin/exit-menu-sway.sh | 22 ++++++++++++++++++++++ bin/exit-menu.sh | 22 ---------------------- bin/get-inhibit-idle-status.sh | 17 +++++++++++++++++ bin/inhibit-idle.sh | 14 ++++++++++++++ 5 files changed, 53 insertions(+), 44 deletions(-) delete mode 100644 bin/.install.yml create mode 100755 bin/exit-menu-sway.sh delete mode 100755 bin/exit-menu.sh create mode 100755 bin/get-inhibit-idle-status.sh create mode 100755 bin/inhibit-idle.sh (limited to 'bin') diff --git a/bin/.install.yml b/bin/.install.yml deleted file mode 100644 index e71e0ea..0000000 --- a/bin/.install.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Copy scripts -steps: - - !Link - from: "battery-notify.sh" - to: "~/bin/battery-notify.sh" - recursive: false - - !Link - from: "exit-menu.sh" - to: "~/bin/exit-menu.sh" - recursive: false - - !Link - from: "hyprctl-zoom-daemon.sh" - to: "~/bin/hyprctl-zoom-daemon.sh" - recursive: false - - !Link - from: "hyprctl-zoom.sh" - to: "~/bin/hyprctl-zoom.sh" - recursive: false - - !Link - from: "swayidle.sh" - to: "~/bin/swayidle.sh" - recursive: false diff --git a/bin/exit-menu-sway.sh b/bin/exit-menu-sway.sh new file mode 100755 index 0000000..9c9f7ab --- /dev/null +++ b/bin/exit-menu-sway.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +entries=" Lock\n󰹆 Suspend\n󰹆 Suspend-then-Hibernate\n󰒲 Hibernate\n󰍃 Logout\n󰜉 Reboot\n󰐥 Shutdown" + +selected=$(echo -e $entries|wofi --width 100 --height 212 --dmenu --cache-file /dev/null --define content_halign=center --define prompt="Exit menu" | awk '{print tolower($2)}') + +case $selected in + lock) + swaylock;; + logout) + hyprctl dispatch exit;; + suspend-then-hibernate) + exec systemctl suspend-then-hibernate;; + suspend) + exec systemctl suspend;; + hibernate) + exec systemctl hibernate;; + reboot) + exec systemctl reboot;; + shutdown) + exec systemctl poweroff -i;; +esac diff --git a/bin/exit-menu.sh b/bin/exit-menu.sh deleted file mode 100755 index 9c9f7ab..0000000 --- a/bin/exit-menu.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -entries=" Lock\n󰹆 Suspend\n󰹆 Suspend-then-Hibernate\n󰒲 Hibernate\n󰍃 Logout\n󰜉 Reboot\n󰐥 Shutdown" - -selected=$(echo -e $entries|wofi --width 100 --height 212 --dmenu --cache-file /dev/null --define content_halign=center --define prompt="Exit menu" | awk '{print tolower($2)}') - -case $selected in - lock) - swaylock;; - logout) - hyprctl dispatch exit;; - suspend-then-hibernate) - exec systemctl suspend-then-hibernate;; - suspend) - exec systemctl suspend;; - hibernate) - exec systemctl hibernate;; - reboot) - exec systemctl reboot;; - shutdown) - exec systemctl poweroff -i;; -esac diff --git a/bin/get-inhibit-idle-status.sh b/bin/get-inhibit-idle-status.sh new file mode 100755 index 0000000..9c74c4e --- /dev/null +++ b/bin/get-inhibit-idle-status.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -uo pipefail + +changescript="$(pidof "inhibit-idle.sh" || true)" +if [ -n "$changescript" ]; then + wait "$changescript" +fi + +idleprog="hypridle" + +isactive="$(systemctl --user is-active $idleprog)" +if [ "$isactive" = "active" ]; then + echo "{\"text\": \"running\", \"alt\": \"running\", \"tooltip\": \"$idleprog is running\", \"class\": \"running\" }" +else + echo "{\"text\": \"suspended\", \"alt\": \"suspended\", \"tooltip\": \"$idleprog is suspended\", \"class\": \"suspended\" }" +fi + diff --git a/bin/inhibit-idle.sh b/bin/inhibit-idle.sh new file mode 100755 index 0000000..c52ff41 --- /dev/null +++ b/bin/inhibit-idle.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -uo pipefail + +idleprog="hypridle" + +isactive="$(systemctl --user is-active $idleprog)" +if [ "$isactive" = "active" ]; then + systemctl --user stop $idleprog + notify-send "Idle Inhibitor" "$idleprog suspended (systemd)" +else + systemctl --user start $idleprog + notify-send "Idle Inhibitor" "$idleprog resumed (systemd)" +fi + -- cgit v1.2.3-70-g09d2