From 6e18d2760f9d938e7e54cfb33def20df116ca72c Mon Sep 17 00:00:00 2001 From: edwark43 <97860398+edwark43@users.noreply.github.com> Date: Mon, 8 Jan 2024 09:03:17 -0500 Subject: [PATCH] Shorten externalrules --- misc/bin/externalrules | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/misc/bin/externalrules b/misc/bin/externalrules index 3f8e038..a47ebb3 100755 --- a/misc/bin/externalrules +++ b/misc/bin/externalrules @@ -6,28 +6,22 @@ class=$2 instance=$3 consequences=$4 - case "$class" in - floaterm) - eval "$consequences" - [ "$state" ] || echo "state=floating center=on" - ;; - updating) - eval "$consequences" - [ "$state" ] || echo "state=floating sticky=on center=on" - ;; - mpv) - eval "$consequences" - [ "$state" ] || echo "state=pseudo_tiled focus=on rectangle=849x477+0+0 center=on" - ;; - virt-manager) - eval "$consequences" - [ "$state" ] || echo "state=floating desktop=^5 follow=on center=on" - ;; - esac +outcome() { + eval "$consequences" + [ "$state" ] || echo "$1" +} - case "$instance" in - Toolkit) - eval "$consequences" - [ "$state" ] || echo "state=floating sticky=on rectangle=500x290+1054+593" - ;; - esac \ No newline at end of file +case "$class" in + floaterm) + outcome "state=floating center=on" + ;; + updating) + outcome "state=floating sticky=on center=on" + ;; + mpv) + outcome "state=pseudo_tiled focus=on rectangle=849x477+0+0 center=on" + ;; + virt-manager) + outcome "state=floating center=on" + ;; +esac