Hi all,
I use XMonad and I have it configured so that the command discord --start-minimized
is run once on session start (spawnOnce "discord --start-minimized"
is a part of my startupHook
, for those familiar with XMonad).
This works fine and a Discord icon is present and functional in my systray. However, when I run the Discord desktop entry via Rofi, a new Discord process is started i.e. a whole new window opens, I get a duplicate icon in my taskbar, and a new entry in my process manager.
Expected behaviour is that Discord recognizes that there's a preexisting process, brings it to focus, and then dies rather than spawning a new, redundant process. Indeed, this works when I am spawning Discord via Rofi or my terminal. The unintended behaviour only occurs when Discord is launched on session start via XMonad.
I have confirmed that there is only one Discord executable in my PATH (and on my system as a whole). I have confirmed that nowhere (including its desktop entry) do I call Discord with the --multi-instance
flag. Inspecting the processes the only difference /appears/ to be that the original process has its parent listed as XMonad whereas any subsequent process launched via Rofi has its parent as systemd and any subsequent process launched via my terminal has its parent process as Fish (my shell). Notably, Discord instances launched via Fish and systemd can recognize one another in the way I expect.
Does anyone have any ideas for something I could try to get my desired behaviour i.e. launch Discord minimized on start-up via XMonad but be able to open the window of the pre-existing process via a Desktop entry in Rofi?
Thank you for reading.
EDIT:
Forgot to add that all aforementioned processes belong to my 'user' i.e. none of them are being run as root.
Reflecting on my first year running solely Linux (as opposed to dual-booting), I think that this culture comes from the fact that, on Linux, problems can more often than not be solved. If not solved, then at least understood. When you want to change something on Windows, or something breaks, you have far less room to maneuver.
When I was a Windows user, I'd barely ever submitted a bug report for anything, in spite of being very tech-literate. It felt hopeless, as my entire experience with the OS was that if a fix would come, it'd have to be done by someone else.
Linux treating its users like adults, produces users who are more confident and more willing to contribute.