aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-09-28 18:58:29 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2021-09-28 18:58:29 +0300
commitdec85ad80a0e7b0b49c354280e1ee3ff4157b9a3 (patch)
tree6cf597704c909d7fd0866d43c18a28af632b0db6
parent919a26f95787a163800e9505fc4c8cd0c9098f31 (diff)
downloadswayrice-dec85ad80a0e7b0b49c354280e1ee3ff4157b9a3.tar.gz
swayrice-dec85ad80a0e7b0b49c354280e1ee3ff4157b9a3.zip
workspace script
A quick script to quickly open several terminal windows, in a layout that I often use, all in the specified directory.
-rwxr-xr-xdotfiles/.local/bin/workspace40
1 files changed, 40 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/workspace b/dotfiles/.local/bin/workspace
new file mode 100755
index 0000000..bfc2357
--- /dev/null
+++ b/dotfiles/.local/bin/workspace
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# Yaroslav de la Peña Smirnov 2021
+#
+# A quick script to quickly open several terminal windows, in a layout that I
+# often use, all in the specified directory. The layout looks something like
+# this:
+#
+# ┌──────────────────┬──────────────────────────────────────────────┐
+# │ │ │
+# │ │ │
+# │ lf │ │
+# │ │ │
+# │ │ │
+# ├──────────────────┤ │
+# │ │ shell │
+# │ │ │
+# │ │ │
+# │ shell │ │
+# │ │ │
+# │ │ │
+# │ │ │
+# └──────────────────┴──────────────────────────────────────────────┘
+
+if [ -z "$1" ]; then
+ echo "Specify working directory"
+ exit 1
+fi
+
+swaymsg "gaps inner current set 0; gaps outer current set 0"
+
+cd "$1"
+setsid $TERMINAL -a "$TERMINAL lf:$1" "lf" >/dev/null 2>&1 & sleep 0.1
+setsid $TERMINAL -a "$TERMINAL edit:$1" >/dev/null 2>&1 & sleep 0.1
+
+sleep 0.2
+swaymsg "[app_id=\"$TERMINAL lf:$1\"] focus; resize set width 27ppt; split v"
+setsid $TERMINAL >/dev/null 2>&1 & sleep 0.2
+swaymsg "resize set height 60ppt" && sleep 0.1
+swaymsg "[app_id=\"$TERMINAL edit:$1\"] focus"