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 2014-05-16 16:45:40 +0000

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.

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

answered 2014-05-25 18:06:32 +0000

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.

edit flag offensive delete link more
0

answered 2014-05-19 18:17:25 +0000

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
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-05-16 16:45:40 +0000

Seen: 408 times

Last updated: May 25 '14