How to bindsym app to open as floated (like one time rule)

In BSPWM I got couple of these bindings that can open some terminal apps as floating window.

Eg. ctrl shift delete opens htop on floating Window this way:
super + shift + Delete → bspc rule -a \* -o state=floating size=800x600 && $TERMINAL -e htop

I would like to do same thing in i3 but haven’t figured out the right ruleset.

for_window [class="floatterm"] floating enable

bindsym $mod+Shift+Mod4 exec $TERMINAL -e htop --class floatterm
1 Like

e: nevermind It seems that it does nothing if I add “–class floatterm” :frowning:

The ordering of the flags is wrong. The --class flag is supposed to apply to the terminal emulator, not htop. You need to put the --class term before the -e flag, otherwise, your terminal emulator will simply treat the entire string after the -e flag (including the --class flag) as a command string to be executed by the terminal. In other words, if you put --class after htop, the terminal will assume that the --class flag is meant for htop, not your terminal.

Do this, and it should work.

bindsym $mod+Shift+Mod4 exec $TERMINAL --class="floatterm" -e htop

oh yes i was not testing it here as i was on another install not on i3… i should have mention it…


No problem at all. Sometimes we tend to type too fast and things just slip.

This seems to work if I set my terminal to Alacritty.
If I use xfce4-terminal it says "xfce4-terminal: Unknown option “–class=floatterm”

But this is good enough because it spawns Htop floating window as I wanted

Thank you both @anthony93 and @joekamprad :v:


for_window [class="floatterm"] floating enable


bindsym $mod+Shift+Mod4 exec alacritty --class="floatterm" -e htop
1 Like

No problem at all. I’m glad you managed to get it working.

Oh, yeah. xfce4-terminal doesn’t support the --class option. However, if you prefer to use xfce4-terminal to launch your floating htop window, I think the WM_CLASS can be assigned with xdotool.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.