diff options
Diffstat (limited to '.local/bin')
| -rwxr-xr-x | .local/bin/choose-xrandr-gui | 36 | ||||
| -rwxr-xr-x | .local/bin/clear-dpms-state | 14 | ||||
| -rwxr-xr-x | .local/bin/toggle-dunst-notifications | 9 | ||||
| -rwxr-xr-x | .local/bin/toggle-lid-switch-handling | 26 |
4 files changed, 85 insertions, 0 deletions
diff --git a/.local/bin/choose-xrandr-gui b/.local/bin/choose-xrandr-gui new file mode 100755 index 0000000..826b05f --- /dev/null +++ b/.local/bin/choose-xrandr-gui @@ -0,0 +1,36 @@ +#!/bin/sh + +choice=$(printf "arandr (ARandR)\nlxrandr (LXDE Monitor \ +Settings)\nawesome-xrandr (reset screen layout)" | ~/.local/bin/dmenu-dunst -p \ +"choose xrandr gui:" -l 3 -i) + +case "$choice" in + "lxrandr (LXDE Monitor Settings)") + if command -v lxrandr > /dev/null; then + lxrandr + else + notify-send "choose-xrandr-gui" "lxrandr is not installed" + fi + ;; + "arandr (ARandR)") + if command -v arandr > /dev/null; then + arandr + else + notify-send "choose-xrandr-gui" "arandr is not installed" + fi + ;; + "awesome-xrandr (reset screen layout)") + if command -v ~/.local/bin/awesome-xrandr > /dev/null; then + ~/.local/bin/awesome-xrandr + else + notify-send "choose-xrandr-gui" "awesome-xrandr script is not found" + fi + ;; + "") + echo "no xrandr gui selected" + ;; + *) + echo "invalid option: $choice" + notify-send "choose-xrandr-gui" "invalid option: $choice" + ;; +esac diff --git a/.local/bin/clear-dpms-state b/.local/bin/clear-dpms-state new file mode 100755 index 0000000..ce6c99a --- /dev/null +++ b/.local/bin/clear-dpms-state @@ -0,0 +1,14 @@ +#!/bin/sh + +# Check if xset is available +if command -v xset > /dev/null; then + # Place all DPMS settings that you want + # to run on awesome-wm startup below: + xset s noblank + xset s noexpose + xset s off off + xset dpms 0 0 0 + xset -dpms +else + notify-send "error: xset binary not found." +fi diff --git a/.local/bin/toggle-dunst-notifications b/.local/bin/toggle-dunst-notifications new file mode 100755 index 0000000..12ad4ab --- /dev/null +++ b/.local/bin/toggle-dunst-notifications @@ -0,0 +1,9 @@ +#!/bin/sh + +current_state=$(dunstctl is-paused) + +if [ "$current_state" = "false" ]; then + dunstctl set-paused true +else + dunstctl set-paused false +fi diff --git a/.local/bin/toggle-lid-switch-handling b/.local/bin/toggle-lid-switch-handling new file mode 100755 index 0000000..00eb45b --- /dev/null +++ b/.local/bin/toggle-lid-switch-handling @@ -0,0 +1,26 @@ +#!/bin/sh + +CONFIG_FILE="/etc/systemd/logind.conf" + +if [ ! -f "$CONFIG_FILE" ]; then + echo "Error: $CONFIG_FILE not found" + exit 1 +fi + +CURRENT_VALUE=$(grep "^HandleLidSwitch=" "$CONFIG_FILE" | cut -d "=" -f 2-) + +if [ -z "$CURRENT_VALUE" ]; then + sudo sed -i "s/#HandleLidSwitch=suspend/HandleLidSwitch=suspend/" "$CONFIG_FILE" + echo "HandleLidSwitch set to suspend" + exit 0 +fi + +if [ "$CURRENT_VALUE" = "suspend" ]; then + NEW_VALUE="ignore" +else + NEW_VALUE="suspend" +fi + +sudo sed -i "s/^HandleLidSwitch=.*/HandleLidSwitch=$NEW_VALUE/" "$CONFIG_FILE" + +sudo systemctl restart systemd-logind && echo "HandleLidSwitch toggled to $NEW_VALUE" |
