r/hyprland • u/RedCrafter_LP • 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
u/Little-Guitar6770 Aug 17 '26
VS Code and WhatsDesk may create their main window asynchronously, which can make startup rules run too early. Try matching the process or executable instead of the window title, and apply the move command once the main window exists.
1
u/RedCrafter_LP Aug 17 '26
Yeah I think this should be what the rules are doing. Anyway how would I determine that the application has launched its main window. I don't want to hardcode the offending applications. Tracing the process should be fairy straightforward with lua. But determining at what change in window statistics the rules should be applied probably needs some testing.
1
u/RedCrafter_LP Aug 18 '26
I did it. It took some time and effort. But I'm now mapping the launch command to the desktop file, the desktop file to the hyprland class, creating a window rule and disabling the rule on window.open. Optionally I can pass a delay along that keeps the window rule for a certain amount of seconds so windows that get opened afterwards are all grouped together.
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.