diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-09-24 05:01:20 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-09-24 05:01:20 +0200 |
| commit | 553cb2204b0bf27afe13c6332f5679bbd47172a0 (patch) | |
| tree | 75c86ff018122a682e0afd7a0e2a0228a63e44bd /toggle-control | |
| parent | b20e4e004be74884cc72c57a3128e36fd5177d7a (diff) | |
| download | dotfiles-553cb2204b0bf27afe13c6332f5679bbd47172a0.tar.gz dotfiles-553cb2204b0bf27afe13c6332f5679bbd47172a0.zip | |
Update/Overhaul
Diffstat (limited to 'toggle-control')
| -rwxr-xr-x | toggle-control | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/toggle-control b/toggle-control deleted file mode 100755 index 8de5200..0000000 --- a/toggle-control +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -EWW=$(which eww) -STATE_FILE="$HOME/.eww_module_state" - -# Function to close the control module -close_control_module() { - "$EWW" close control & -} - -# Function to open the control module -open_control_module() { - touch "$STATE_FILE" - "$EWW" open control & -} - -# Function to check if the cursor is inside the control window -is_cursor_inside_control() { - local mouse_x=$(xdotool getmouselocation --shell | awk -F '=' '/X/{print $2}') - local mouse_y=$(xdotool getmouselocation --shell | awk -F '=' '/Y/{print $2}') - - local control_x=1110 - local control_y=0 - local control_width=240 - local control_height=360 - - [ "$mouse_x" -ge "$control_x" -a "$mouse_x" -le "$((control_x + control_width))" -a \ - "$mouse_y" -ge "$control_y" -a "$mouse_y" -le "$((control_y + control_height))" ] -} - -# Function to close the control module if cursor is outside the control window -close_control_on_leave() { - while true; do - sleep 0.1 - if [ -e "$STATE_FILE" ] && ! is_cursor_inside_control; then - close_control_module - rm "$STATE_FILE" - break - fi - done -} - -# Check if the module is currently running -if [ -e "$STATE_FILE" ]; then - # If the file exists, the module is running, so close it when cursor leaves - close_control_on_leave -else - # If the file doesn't exist, the module is not running, so start it - open_control_module - - # Start monitoring cursor position to close the control window if it leaves - close_control_on_leave & -fi |
