aboutsummaryrefslogtreecommitdiffstats
path: root/bin/hyprctl-zoom-daemon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/hyprctl-zoom-daemon.sh')
-rwxr-xr-xbin/hyprctl-zoom-daemon.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/hyprctl-zoom-daemon.sh b/bin/hyprctl-zoom-daemon.sh
new file mode 100755
index 0000000..7752279
--- /dev/null
+++ b/bin/hyprctl-zoom-daemon.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+zoom=1
+
+izoom () {
+ if [ $(echo "scale=0;$zoom/1" | bc) -eq 4 ];
+ then
+ zoom=4
+ return
+ fi
+ zoom=$(echo "$zoom + 0.2" | bc)
+}
+
+dzoom () {
+ if [ $(echo "scale=0;$zoom/1" | bc) -eq 0 ];
+ then
+ zoom=1
+ return
+ fi
+ zoom=$(echo "$zoom - 0.2" | bc)
+}
+
+while :
+do
+ message=$(nc -lU /tmp/hyprctl-zoom.sock)
+ case $message in
+ plus)
+ izoom
+ hyprctl keyword misc:cursor_zoom_factor $zoom
+ ;;
+ minus)
+ dzoom
+ hyprctl keyword misc:cursor_zoom_factor $zoom
+ ;;
+ *)
+ echo "Invalid message received"
+ ;;
+ esac
+done
+