aeghn

Untitled

Oct 8th, 2020
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.48 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # -*- mode: sh-mode; -*-
  3.  
  4. TERMINAL_WID=$(xdotool getactivewindow)
  5.  
  6. i3-msg "[id=${TERMINAL_WID}] split toggle, layout tabbed" &> /dev/null
  7.  
  8. "$@" &
  9.  
  10. DERIVED_PID=$!
  11. DERIVED_WID=
  12. i=0
  13.  
  14. while [ -z ${DERIVED_WID} ] && [ $i -lt 3 ]; do
  15.     DERIVED_WID=$(xdotool search --pid ${DERIVED_PID=$$} | tail -1)
  16.     ((i++))
  17. done
  18.  
  19. [ -z ${DERIVED_WID} ] && exit
  20.  
  21. i3-msg "[id=] focus;  [id=${TERMINAL_WID}] move scratchpad, scratchpad show, floating toggle" &> /dev/null
Advertisement
Add Comment
Please, Sign In to add comment