From 201bedcc268f008b164cef6babb54a39b059ecec Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Thu, 14 Dec 2023 18:24:40 +0100 Subject: [PATCH] Add Idle Inhibitor --- .install/version.sh | 2 +- .settings/swayidle.sh | 2 ++ CHANGELOG | 7 +++++++ README.md | 2 +- hypr/scripts/lockscreentime.sh | 4 +--- hypr/scripts/swayidle.sh | 11 +++++++++++ version | 2 +- waybar/modules.json | 9 +++++++++ waybar/themes/ml4w-blur-bottom/config | 1 + waybar/themes/ml4w-blur/config | 1 + waybar/themes/ml4w-blur/style.css | 22 ++++++++++++++++++++++ waybar/themes/ml4w-bottom/config | 1 + waybar/themes/ml4w/config | 1 + waybar/themes/ml4w/style.css | 23 ++++++++++++++++++++++- 14 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 .settings/swayidle.sh create mode 100755 hypr/scripts/swayidle.sh diff --git a/.install/version.sh b/.install/version.sh index a6bab78..a3c6bdd 100644 --- a/.install/version.sh +++ b/.install/version.sh @@ -1 +1 @@ -version="2.6.1" +version="2.6.2" diff --git a/.settings/swayidle.sh b/.settings/swayidle.sh new file mode 100644 index 0000000..8db8fe7 --- /dev/null +++ b/.settings/swayidle.sh @@ -0,0 +1,2 @@ +timeswaylock=60 +timeoff=70 \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index 6ccf08d..db54ba6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +Version 2.6.2 +https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.6.1 +-------------------------------------------------------- +Hyprland: +- New Waybar Module Idle Inhibitor to deactivate the automatic start of swaylock e.g. to watch videos or for online meetings +- Create own customization of ML4W waybar themes: README.md + Version 2.6.1 https://gitlab.com/stephan-raabe/dotfiles/-/releases/2.6.1 -------------------------------------------------------- diff --git a/README.md b/README.md index 6889908..f5c2be7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ML4W dotfiles 2.6.1 +# ML4W dotfiles 2.6.2 DEV This is my configuration of Hyprland (Wayland) and Qtile (Xorg & Wayland) for Arch. This package includes an installation script to install and setup the required components. diff --git a/hypr/scripts/lockscreentime.sh b/hypr/scripts/lockscreentime.sh index 07ea43e..4026efb 100755 --- a/hypr/scripts/lockscreentime.sh +++ b/hypr/scripts/lockscreentime.sh @@ -9,9 +9,7 @@ # by Stephan Raabe (2023) # ----------------------------------------------------- -timeswaylock=600 -timeoff=660 - +source ~/dotfiles/.settings/swayidle.sh if [ -f "/usr/bin/swayidle" ]; then echo "swayidle is installed." swayidle -w timeout $timeswaylock 'swaylock -f' timeout $timeoff 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' diff --git a/hypr/scripts/swayidle.sh b/hypr/scripts/swayidle.sh new file mode 100755 index 0000000..529d962 --- /dev/null +++ b/hypr/scripts/swayidle.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +pgrep_output=$(pgrep swayidle) +pgrep_arr=($pgrep_output) +if [[ "${#pgrep_arr[@]}" == "1" ]] || [[ "${#pgrep_arr[@]}" == "0" ]]; then + echo "Swayidle is not running. Starting Swayidle." + ./lockscreentime.sh +else + echo "Swayidle is running. Killing swayidle." + killall swayidle +fi diff --git a/version b/version index b8d12d7..d5724cd 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.6.1 \ No newline at end of file +2.6.2 \ No newline at end of file diff --git a/waybar/modules.json b/waybar/modules.json index 0112923..9058c92 100644 --- a/waybar/modules.json +++ b/waybar/modules.json @@ -339,5 +339,14 @@ "format": "{user}", "interval": 60, "icon": false, + }, + + "idle_inhibitor": { + "format": "{icon}", + "tooltip": false, + "format-icons":{ + "activated": "Auto lock OFF", + "deactivated": "ON" + } } } diff --git a/waybar/themes/ml4w-blur-bottom/config b/waybar/themes/ml4w-blur-bottom/config index 21d05ce..8fbccf6 100644 --- a/waybar/themes/ml4w-blur-bottom/config +++ b/waybar/themes/ml4w-blur-bottom/config @@ -52,6 +52,7 @@ "group/hardware", "group/settings", "custom/cliphist", + "idle_inhibitor", "custom/exit", "clock" ] diff --git a/waybar/themes/ml4w-blur/config b/waybar/themes/ml4w-blur/config index f450dfa..5234742 100644 --- a/waybar/themes/ml4w-blur/config +++ b/waybar/themes/ml4w-blur/config @@ -54,6 +54,7 @@ "network", "group/hardware", "custom/cliphist", + "idle_inhibitor", "custom/exit", "clock" ] diff --git a/waybar/themes/ml4w-blur/style.css b/waybar/themes/ml4w-blur/style.css index a283ba0..8dddc42 100644 --- a/waybar/themes/ml4w-blur/style.css +++ b/waybar/themes/ml4w-blur/style.css @@ -175,6 +175,28 @@ window#waybar.empty #window { margin-right:15px; } +/* ----------------------------------------------------- + * Idle Inhibator + * ----------------------------------------------------- */ + + #idle_inhibitor { + margin-right: 15px; + font-size: 16px; + font-weight: bold; + opacity: 0.8; + color: @iconcolor; +} + +#idle_inhibitor.activated { + background-color: #dc2f2f; + font-size: 16px; + color: #FFFFFF; + border-radius: 15px; + padding: 2px 10px 0px 10px; + margin: 8px 15px 8px 0px; + opacity:0.8; +} + /* ----------------------------------------------------- * Custom Modules * ----------------------------------------------------- */ diff --git a/waybar/themes/ml4w-bottom/config b/waybar/themes/ml4w-bottom/config index 6e6467a..2a1ebca 100644 --- a/waybar/themes/ml4w-bottom/config +++ b/waybar/themes/ml4w-bottom/config @@ -54,6 +54,7 @@ "network", "group/hardware", "custom/cliphist", + "idle_inhibitor", "custom/exit", "clock" ] diff --git a/waybar/themes/ml4w/config b/waybar/themes/ml4w/config index 1bded4d..55c1a15 100644 --- a/waybar/themes/ml4w/config +++ b/waybar/themes/ml4w/config @@ -54,6 +54,7 @@ "network", "group/hardware", "custom/cliphist", + "idle_inhibitor", "custom/exit", "clock" ] diff --git a/waybar/themes/ml4w/style.css b/waybar/themes/ml4w/style.css index 63c87b9..85ebdf0 100644 --- a/waybar/themes/ml4w/style.css +++ b/waybar/themes/ml4w/style.css @@ -176,6 +176,27 @@ window#waybar.empty #window { margin-right:15px; } +/* ----------------------------------------------------- + * Idle Inhibator + * ----------------------------------------------------- */ + +#idle_inhibitor { + margin-right: 15px; + font-size: 16px; + font-weight: bold; + opacity: 0.8; + color: @iconcolor; +} + +#idle_inhibitor.activated { + background-color: #dc2f2f; + font-size: 16px; + color:#ffffff; + border-radius: 15px; + padding: 2px 10px 0px 10px; + margin: 5px 15px 5px 0px; + opacity:0.8; +} /* ----------------------------------------------------- * Custom Modules @@ -196,7 +217,7 @@ window#waybar.empty #window { * Custom Exit * ----------------------------------------------------- */ -#custom-exit, #custom-exitwlr { +#custom-exit { margin: 0px 20px 0px 0px; padding:0px; font-size:20px;