Re: [dev] [dwm] How do I launch a window in floating mode without using `Rules rules[]`?

From: Felix Van der Jeugt <felix.vanderjeugt_AT_gmail.com>
Date: Tue, 14 May 2019 18:01:55 +0200

Dear Enan Ajmain,

Quoting Enan Ajmain (2019-05-14 13:00:34)
> I want to add a keybinding to launch my terminal emulator in floating
> mode, and I want it to be separate from my regular keybinding to
> launch terminal in the currently active mode. If I wanted to launch
> the terminal window always in floating mode, I could have used rules.
>
> I've looked through config file and have a guess that the NULL entry
> in the following list of strings might be used to indicate what mode I
> want the window to open in.
> ```
> static const char *termcmd[] = { "st", NULL };
> ```
>
> But after looking at the union Arg and the function spawn, I am
> feeling lost. So, if anyone could point me in the right direction, it
> would be great.

This list of strings is the command passed to the spawn function.

It'd be hard to set a window to floating before that window is actually
created. When spawning a new terminal, there's no handle for that
window yet. This handle is only created when X notifies dwm there's a
new window.

I guess you could modify the spawn function to set some variable
indicating the next spawned window should float, and check this
variable when that window actually appears. But I'd advise a
workaround:

You could add a second termcmd, bound to another key. This term would
have a different window title/class (st has options for this), so you
could add a rule for it.

Sincerely,
Felix
Received on Tue May 14 2019 - 18:01:55 CEST

This archive was generated by hypermail 2.3.0 : Tue May 14 2019 - 22:12:08 CEST