Scratchpad-terminal changes

Open the scratchpad-terminal in the same working directory as the
current window. This makes sense since I use it for small and quick
tasks that often need to take place in the same place.

Start the terminal in a separate workspace before switching back so that
the window does not break the workspaces layout or its content.
The script has to wait shortly so that the window is "done" (made
floating, sticky, etc.). This is a very dirty hack and should be
replaced in the future.
This commit is contained in:
2020-07-03 02:51:05 +02:00
parent 6e9dc46fab
commit c4d4721c0c
2 changed files with 8 additions and 4 deletions

View File

@@ -42,9 +42,13 @@ fi
if [ $SHOW ]; then
if [ $EXIST_NOT ]; then
# terminal does not exist yet
# WORKSPACE="$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true).name' | tr -d '"')"
# i3-msg "workspace $W_NAME, exec env SCRATCHPAD_TERMINAL=1 $COMMAND, workspace $WORKSPACE"
env SCRATCHPAD_TERMINAL=1 $COMMAND
WORKSPACE="$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true).name' | tr -d '"')"
i3-msg "workspace $W_NAME"
eval env SCRATCHPAD_TERMINAL=1 $COMMAND &
# Sleep for a very short time until the window is ready (floating, etc.)
# TODO: Dirty hack! Find something better.
sleep 0.1
i3-msg "workspace $WORKSPACE"
elif [ $HIDDEN ]; then
# terminal is "hidden" in scratchpad
i3-msg "[class=\"$W_CLASS\" title=\"^${W_NAME}$\"] scratchpad show"