aboutsummaryrefslogtreecommitdiff
path: root/common/home/mosder/.config/hypr/scripts
diff options
context:
space:
mode:
authorMosder <xmosder12@gmail.com>2026-06-10 02:24:31 +0200
committerMosder <xmosder12@gmail.com>2026-06-10 02:24:31 +0200
commit1f2824b912b22a687fb0f1c56f82198128bef1ca (patch)
treea22c4425c43fcd111c441531b21e275b1fd97f3f /common/home/mosder/.config/hypr/scripts
parenta7fab53f802c8bacfce66fb3455145835e231460 (diff)
added and updated a lot of configs + refactored it to be more accessible
Diffstat (limited to 'common/home/mosder/.config/hypr/scripts')
-rwxr-xr-xcommon/home/mosder/.config/hypr/scripts/equalize-windows.sh87
-rwxr-xr-xcommon/home/mosder/.config/hypr/scripts/zoom.sh9
2 files changed, 96 insertions, 0 deletions
diff --git a/common/home/mosder/.config/hypr/scripts/equalize-windows.sh b/common/home/mosder/.config/hypr/scripts/equalize-windows.sh
new file mode 100755
index 0000000..cd43729
--- /dev/null
+++ b/common/home/mosder/.config/hypr/scripts/equalize-windows.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+ITERS=3
+
+# get address of the window to return to
+address=$(hyprctl activewindow | awk -F" " 'NR==1 {print $2}')
+
+# define move directions
+dir1=$1
+dir2=r
+if [[ $dir1 == u ]]; then
+ dir2=d
+fi
+
+# move max to the left/top
+prev_window=""
+window=$(hyprctl activewindow | awk -F" " 'NR==1 {print $2}')
+while [[ $window != $prev_window ]]; do
+ hyprctl dispatch movefocus $dir1
+ prev_window=$window
+ window=$(hyprctl activewindow | awk -F" " 'NR==1 {print $2}')
+done
+
+# get start location
+at=$(hyprctl activewindow | awk -F" " 'NR==4 {print $2}')
+if [[ $dir1 == l ]]; then
+ start_location=$(echo $at | awk -F"," '{print $1}')
+else
+ start_location=$(echo $at | awk -F"," '{print $2}')
+fi
+
+# count windows in the line
+window_count=0
+prev_window=""
+while [[ $window != $prev_window ]]; do
+ hyprctl dispatch movefocus $dir2
+ prev_window=$window
+ window=$(hyprctl activewindow | awk -F" " 'NR==1 {print $2}')
+ window_count=$(($window_count+1))
+done
+
+# get end location
+at=$(hyprctl activewindow | awk -F" " 'NR==4 {print $2}')
+size=$(hyprctl activewindow | awk -F" " 'NR==5 {print $2}')
+if [[ $dir1 == l ]]; then
+ at=$(echo $at | awk -F"," '{print $1}')
+ size=$(echo $size | awk -F"," '{print $1}')
+else
+ at=$(echo $at | awk -F"," '{print $2}')
+ size=$(echo $size | awk -F"," '{print $2}')
+fi
+end_location=$(($at+$size))
+
+# calculate full size and size per window
+full_size=$(($end_location - $start_location))
+size_per_window=$(($full_size / $window_count))
+
+# set sizes
+i=0
+while [[ $i -lt $ITERS ]]; do
+ i=$(($i+1))
+ window=0
+ while [[ $window -lt $window_count ]]; do
+ window=$(($window+1))
+ size=$(hyprctl activewindow | awk -F" " 'NR==5 {print $2}')
+ if [[ $dir1 == l ]]; then
+ #other_side=$(echo $size | awk -F"," '{print $2}')
+ #hyprctl dispatch resizeactive exact $size_per_window $other_side
+ size=$(echo $size | awk -F"," '{print $1}')
+ diff=$(($size_per_window - $size))
+ hyprctl dispatch resizeactive $diff 0
+ else
+ #other_side=$(echo $size | awk -F"," '{print $1}')
+ #hyprctl dispatch resizeactive exact $other_side $size_per_window
+ size=$(echo $size | awk -F"," '{print $2}')
+ diff=$(($size_per_window - $size))
+ hyprctl dispatch resizeactive 0 $diff
+ fi
+ hyprctl dispatch movefocus $dir1
+ done
+ temp=$dir1
+ dir1=$dir2
+ dir2=$temp
+done
+
+# return to starting window
+hyprctl dispatch focuswindow address:0x$address
diff --git a/common/home/mosder/.config/hypr/scripts/zoom.sh b/common/home/mosder/.config/hypr/scripts/zoom.sh
new file mode 100755
index 0000000..433f899
--- /dev/null
+++ b/common/home/mosder/.config/hypr/scripts/zoom.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+ZOOM=$(hyprctl getoption cursor:zoom_factor | grep float | awk -F" " '{print $2}')
+ZOOM=$(echo "scale=0; ($ZOOM+1)/1" | bc)
+if [[ $ZOOM -gt $MAX_ZOOM ]]; then
+ ZOOM=1
+fi
+
+hyprctl -q keyword cursor:zoom_factor $ZOOM