From 2baa20b478117f69c217366be071a71505aa313d Mon Sep 17 00:00:00 2001 From: Myned Date: Tue, 24 Sep 2024 11:01:49 -0500 Subject: [PATCH] zoom: initial script Signed-off-by: Myned --- options/custom/scripts/default.nix | 6 ++++++ options/custom/scripts/zoom.sh | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 options/custom/scripts/zoom.sh diff --git a/options/custom/scripts/default.nix b/options/custom/scripts/default.nix index f1f0130..75ad8ef 100644 --- a/options/custom/scripts/default.nix +++ b/options/custom/scripts/default.nix @@ -166,6 +166,12 @@ in { swww tailscale ]) + (bash "zoom" [ + argc + bc + hyprland + jq + ]) ] ++ (with pkgs.python3Packages; [ # Python files with extension .py diff --git a/options/custom/scripts/zoom.sh b/options/custom/scripts/zoom.sh new file mode 100644 index 0000000..97ae79f --- /dev/null +++ b/options/custom/scripts/zoom.sh @@ -0,0 +1,22 @@ +#! /usr/bin/env bash + +# @describe Wrapper for zooming display +# +# https://github.com/sigoden/argc + +# @arg factor=1 Absolute or relative factor to zoom to, empty to reset + +eval "$(argc --argc-eval "$0" "$@")" + +factor="$(hyprctl -j getoption cursor:zoom_factor | jq -r .float)" # Current factor + +if [[ "${argc_factor:-}" =~ ^[+|-][1-9]\.*[0-9]*$ ]]; then + factor="$(bc <<< "$factor ${argc_factor}")" +elif [[ "${argc_factor:-}" =~ ^[1-9]\.*[0-9]*$ ]]; then + factor="${argc_factor:-}" +else + echo "Factor must be an absolute or relative decimal between 1 and 9" + exit 1 +fi + +hyprctl keyword cursor:zoom_factor "$factor"