The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

How to open a program's child processes in tabbed view?

asked 2015-01-08 22:56:30 +0000

luke gravatar image

A lot of the time I work from a terminal and when I need to use a graphical application to edit a file in the current directory it's so much faster to type prog-name [filename] instead of launching it from dmenu then attempting to navigate to the file.

My problem is when launching graphical applications, logically, half my screen gets wasted, covered with stdout (of which I rarely need) causing me to waste time rearranging windows. It would be great if once launched, a graphical application used the full space of the terminal and sticks the terminal in a new tab. It can be done manualy, $mod + v before launching and $mod + w after, creates a tabbed container displaying the launched program and hiding the terminal in the other tab, it's just irritating and time-wasting to repeat this every single time.

So, Is there anyway this could be automated?

Can I set i3 to automatically display windows of xfce4-terminal's child processes this way? If not, could I even just use a script (e.g.script-name prog-name [filename]) to achieve this?

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2015-01-09 10:46:24 +0000

cee gravatar image

You could define an alias tab='i3-msg layout tabbed && ' that can be prepended to your command to start any GUI program.
Of course you could also wrap it in a shell script for some more advanced features.

edit flag offensive delete link more

answered 2015-01-13 19:39:21 +0000

Ternary gravatar image

This isn't exactly what you're asking for, but it sounds like you might want these 'gui' programs to always open in floating mode by default.

Here are two example lines from my i3/config that do this for gimp (and all of its associated windows) and audacious respectively:

for_window [class="gimp"] floating enable
for_window [title="Audacious"] floating enable
edit flag offensive delete link more

answered 2015-01-10 23:30:53 +0000

luke gravatar image

updated 2015-01-10 23:32:21 +0000

I have been able to achieve this using cee's suggestion of aliases and i3-msg. However, cee's suggestion alone did not work when additional windows existed in the terminals container. To fix this I needed to run additional commands to ensure a new container was created and then later removed.

My final solution was to add this to my shell's rc file:

    # Create tabbed container.
    i3-msg split v > /dev/null
    i3-msg layout tabbed > /dev/null

    # Run program.

    # Remove container.
    i3-msg move up > /dev/null
    i3-msg move down > /dev/null
# Aliases for programs with a gui.
alias feh="i3-gui feh"
alias gimp="i3-gui gimp"
alias mpv="i3-gui mpv"
alias libreoffice="i3-gui libreoffice"

This is still not the best answer to the question as it does not automatically do this for child processes of the terminal like asked. However seems to solve my problem the best as for some programs this behavour may not be desired.

edit flag offensive delete link more

Question Tools


Asked: 2015-01-08 22:56:30 +0000

Seen: 403 times

Last updated: Jan 13