summary refs log tree commit diff
path: root/bin/swx
diff options
context:
space:
mode:
Diffstat (limited to 'bin/swx')
-rwxr-xr-xbin/swx14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/swx b/bin/swx
index 1536ad0..87a98d5 100755
--- a/bin/swx
+++ b/bin/swx
@@ -99,11 +99,15 @@ if [ -n "${rotate}" ]; then
 fi
 
 if [ -n "${autotile}" ]; then
-	if [ "$(swq current con | jq '.rect | .width > .height')" = "true" ]; then
-		swaymsg splith
-	else
-		swaymsg splitv
-	fi
+	case "$(swq current workspace | jq -r '.layout')" in
+	split*)
+		if [ "$(swq current con | jq '.rect | .width > .height')" = "true" ]; then
+			swaymsg splith
+		else
+			swaymsg splitv
+		fi
+		;;
+	esac
 fi
 
 swaymsg exec "${command}" >/dev/null