From 374ff56179df10989b216cfdcff2a78eec1ead11 Mon Sep 17 00:00:00 2001 From: Rachel Lambda Samuelsson Date: Tue, 24 Sep 2024 14:25:39 +0200 Subject: [PATCH] resizing generalized --- pkgs/eyezoom.nix | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkgs/eyezoom.nix b/pkgs/eyezoom.nix index 68ee2c9..3fb7d0c 100644 --- a/pkgs/eyezoom.nix +++ b/pkgs/eyezoom.nix @@ -1,17 +1,23 @@ { pkgs, ... }: pkgs.writeScript "eyezoom" '' -W=1920 -H=1080 +arg="$1" -offx=1600 -offy=0 +set -- $( + ${pkgs.xorg.xrandr}/bin/xrandr | + ${pkgs.gawk}/bin/awk -F "[x+ ]" '/primary/ { print $4" "$5" "$6" "$7 }' + ) + +W="$1" +H="$2" +offx="$3" +offy="$4" HFACTOR=10 WFACTOR=4 WIDEDIV=2 -case "$1" in +case "$arg" in eye) ${pkgs.wmctrl}/bin/wmctrl -R ':ACTIVE:' -e 0,$offx,$(( offy - (H * HFACTOR / 2) + (H / 2) )),$W,$((H*HFACTOR)) ;;