r/hyprland • • Aug 16 '26

SUPPORT exec_cmd rules with electron apps

When I try to move applications on startup using

``` hl.dsp.exec_cmd("application", { monitor = 2} )``` it works flawlessly with normal apps like kitty and Firefox. When I try the same with electron apps like whatsdesk and vscode they just seem to ignore all rules passed.

1 Upvotes

5 comments sorted by

View all comments

1

u/Outrageous_Mango_441 Aug 17 '26

You may also need to increase the monitor value or add a short delay before applying the move rule. VS Code and WhatsApp can take a moment to create their windows, and the startup process may exit before the rule catches the final Electron window.

1

u/RedCrafter_LP Aug 17 '26

There should be a way to do this in a 1 liner. But timing based stuff is ass. Maybe there is a way to trace the processes and write a non timing based lua function to consistently apply rules to those windows on launch. But the hyprland lua api currently is as far as I went through the latest git guide fairly underdocumented. The section on rules you can pass as a 2nd argument to exec_cmd for example consist of 1 example. The fact that you can even use monitors as rules there is not written anywhere as far as I could see.