Hi Frank,

Excerpts from Frank Haun's message of 2012-01-28 23:35:08 +0000:
> You can completely script such tasks. I use 'xdotool' for such
> jobs. Look your i3 config for the related keys to resize (shrink and
> grow) windows.
A better way than sending commands to X11 which sends them to i3 is to directly
execute i3 commands, for example with i3-msg. In your example, you can use:

> xdotool key Super_L+a  # focus the parent container
i3-msg focus parent
> xdotool key Super_L+h  # split in horizontal orientation
i3-msg split horizontal
> jabberclient &         # run program
> sleep 1                # FIXME maybe longer [1]
> xdotool key Super_L+r  # initiate resizing
> xdotool key j          # shrink the new window
> xdotool key j          # "" 
> xdotool key Escape     # end resizing
i3-msg resize shrink left

> #---------------------------------------------------#
> wait_for () {
>     n=0
>     while true
>     do
>     if $1; then
>         break
>     else
>         # 20 seconds timeout
>         if [ $n -eq 20 ]; then
>         xmessage "Error executing: $1"
>         break
>         else
>         n=`expr $n + 1`
>         sleep 1
>         fi
>     fi
>     done
> }
> 
> wait_for "xdotool search --name emacs"
> #---------------------------------------------------#
Hm, basically you could use the for_window configuration directive here:

    for_window [class="emacs"] exec ~/.bin/my_script_for_emacs.sh

(I didn’t test whether emacs actually sets its class to 'emacs'.)
If you only want to have this match the first time such a window appears you
might want to some configuration file tricks, like keeping the for_window
directives in a separate file and your other configuration in another file,
then cat them together in your xsession and after all your windows have
appeared, only write your base configuration to the config file and reload i3.

Best regards,
Michael

Reply via email to