Lua: Start program at boot, but have it minimized?

With my old hyprlang config, I had it set to open my music player (Tauon) on boot, but have it minimized with the following line:

exec-once = [workspace 2; silent] tauonmb

I’m having a brutal time trying to figure out how to accomplish this in Lua. I’m not even sure how many different things I’ve tried. Anyone have a solution?

So what have you tried when using Lua that’s not working?

hl.exec_cmd() takes rules.

Right now I have two programs I want to start up like this: Steam and Tauon. Steam works perfectly with:

hl.exec_cmd(“[workspace 2] steam -silent”)

But if I use the same structure for Tauon, it doesn’t work. Tauon opens, but full size on my secondary monitor which is set to Workspace 2. At this point, I can’t remember the other lines I’ve tried because I do some searching, find a possible solution, try it, and if it doesn’t work, I simply delete it.

I don’t know anything about either of those apps (is -silent a flag they both accept?), or your config, or desired workspaces, but how about something like…

hl.on("hyprland.start", function ()
    hl.exec_cmd("tauonmb", { workspace = "1" })
    hl.exec_cmd("steam", { workspace = "2" })
end)

That works as far as opening the apps to a specific workspace, but not whether they’re minimized or not.

It looks like the -silent flag only works with Steam. So far, it’s looking like starting Tauon minimized does not want to work at the moment unfortunately. It’s not really a big deal as I don’t actually reboot all that often, but just one of the last annoyances left after converting over to lua.

Do you mean that they then are in tray? I belief, only some apps support minimizing them. I like to put music in its own special workspace, so you can access it from any workspace, and it’s kinda like it’s minimized.

hl.unbind("SUPER + M") --as this normally quits hyprland
hl.bind("SUPER + M",         hl.dsp.workspace.toggle_special("music"))
hl.bind("SUPER + SHIFT + M", hl.dsp.window.move({ workspace = "special:music" })) --not necessary

and then in hl.on() sth like:

hl.dsp.exec_cmd("tauonmb", { workspace = "special:music silent" })

The lua version of [workspace 2 silent] is

hl.on("hyprland.start", function ()
    hl.exec_cmd("tauonmb", { workspace = "2 silent" })
end)

Unfortunately, this didn’t work. Tauon starts on the correct monitor, but remains visible. I think that at the moment, Tauon simply won’t play nice with the lua config in terms of opening silently. Using Claude (I know.. I know..) I did get the following to work. It’s not 100% the way I want as Tauon is visible for a moment on boot, but at least it does get closed properly and remains in the tray.

hl.exec_cmd(“tauonmb”, { workspace = “2” })
hl.timer(function()
hl.exec_cmd(“pkill -f tauonmb”)
end, { timeout = 1000, type = “oneshot” })

Since hyprland doens’t have a taskbar or anything like that, it has no concept of “minimized”. It’s a window manager, so it only displays windows. If the application say: Hey i want a window, and rule say; windows go to workspace 2. It will put window on workspace 2.

Not a hyprland problem, but a application problem. ( which is why steam -silent works, since that doesn’t say hey i want a window )

Edit: And i should clarify, the silent in the windowrule is just telling hyprland; “when window open, don’t focus that workspace”, it has been renamed to follow to be more descriptive.

I get that, but the odd thing is that prior to 55, it worked perfectly; launching Tauon on boot, but minimizing, or I guess more accurately, closing it immediately, making it available in Noctalia’s tray.