Re: [i3] question about layout

  • From: Frank Haun <fh@xxxxxxxx>
  • To: Discussions/Questions about the i3 window manager <i3-discuss@xxxxxxxxxxxxx>
  • Date: Sun, 29 Jan 2012 11:47:08 +0100

Michael Stapelberg <michael+i3@xxxxxxxxxxxxx> writes:

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

Ah, thx for the hint. That's much better. I've used i3-msg only to set
borders to none. Sorry. :-)

Wow, and with this I can define how much to shrink, great!

i3-msg resize shrink left 15 px or 15 ppt



[Waiting for a program]

#---------------------------------------------------#
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'.)

The class name of emacs is Emacs, I think.

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.

Ops, that sounds much complicated. But I'll investigate more time using
this or other methods.

My goal was to have only _one_ clean autostart file for i3 with a
_special_ layout. That was something I missed when I start using i3.


Just an example, this works for me with my autostart.


|emacs--------|ding(no border---|
| | |
| | |
| |pdf--------------|
| |browser----------|
| |fileman----------|
| | |
|xterm--------| |
| | |
| | |
|-------------|-----------------|


Thanks very much,
Frank


Other related posts: