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

Scripting a floating window

asked 2013-01-27 18:04:38 +0000

Mr Green gravatar image

I am struggling a little with alsamixer, have a small script that I can run from dmenu

  $TERMINAL --command="alsamixer"
  i3-msg floating enable
  i3-msg move absolute position center

It does work but not how I wanted it, need a terminal window to open in the middle of workspace free form tiling [floating]

Or would it be easier with a simple key bind?

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2013-01-28 07:49:34 +0000

Michael gravatar image

It’s a better idea to launch your terminal with a property that you can identify in the i3 config, like so:

i3-msg exec urxvt -name alsamixer

Then, in your i3 config, place the commands you want to use:

for_window [instance="^alsamixer$" class="^URxvt$"] floating enable, move absolute position center
edit flag offensive delete link more

Comments

See my comment above

Mr Green gravatar imageMr Green ( 2013-01-28 16:44:57 +0000 )edit

Please don’t post comments as answers, that’s what comments are for.

Michael gravatar imageMichael ( 2013-01-29 09:28:23 +0000 )edit

If you need to use (?i)alsamixer that means your capitalization is different from mine. i means case insensitive.

Michael gravatar imageMichael ( 2013-01-29 09:28:48 +0000 )edit

Sorry I meant to post a comment not an answer. As for having a `for_window` line for every instance of a script that needs to be run in a terminal, am thinking could I use a variable? or a mode like function so I do not need to specify that it needs to run in a terminal each time? As I already have

Mr Green gravatar imageMr Green ( 2013-01-29 11:58:45 +0000 )edit
0

answered 2013-01-29 04:16:52 +0000

dkeg gravatar image

updated 2013-01-29 04:17:24 +0000

Curious, why the need to specify an absolute position of center? Floating windows position themselves centered automatically.

edit flag offensive delete link more

Comments

No its not required if you do not need it, still new to i3 so working my way through the options

Mr Green gravatar imageMr Green ( 2013-01-29 08:41:29 +0000 )edit

that's okay, we'll all learning. It was just as much a question as a statement. I just figured out how to force position elsewhere besides center for floaters!

dkeg gravatar imagedkeg ( 2013-01-29 12:48:16 +0000 )edit

Question Tools

Stats

Asked: 2013-01-27 18:04:38 +0000

Seen: 1,413 times

Last updated: Jan 29 '13