The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
1

Automatically stack mplayer/mpv

asked May 16 '14

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

When I open a terminal and run mpv, I usually don't need to see the terminal anymore. It would be neat if i3 would automatically put those two windows into stacked or tabbed mode.

I tried for_window [class="^mpv$"] layout tabbed for a while, but it's too annoying:

  • If there are any other windows around, they get pulled into stacked mode, too, and I have to untangle everything.

  • I only want the "parent window" of mpv to be stacked. For example, I have a shortcut that runs youtube-dl on the URL in the clipboard. If I'm browsing the web and hit that shortcut, nothing should be stacked because mpv doesn't have a parent window.

2 answers

Sort by » oldest newest most voted
0

answered May 25 '14

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

There’s multiple approaches:

You could use a function in your ~/.zshrc that closes the shell but still runs the command:

function e() {
    eval "$* &|"
    exit
}

Then, just run e mpv foo.mp4

You could also build a script using the IPC interface: http://build.i3wm.org/docs/ipc.html

In that script, you’d send the commands to create a new stacked/tabbed container before running mpv. It’s probably a bit tricky to do this in a generic fashion (i.e. working for every layout), but maybe you can get it to work for the layout(s) you typically use.

0

answered May 19 '14

this post is marked as community wiki

This post is a wiki. Anyone with karma >100 is welcome to improve it.

I think that should do. I tested it on my mplayer.

for_window [class="M(?i)Player"] focus right; splitv; focus left, move right; layout tabbed

Question Tools

Stats

Asked: May 16 '14

Seen: 408 times

Last updated: May 25 '14