You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pet window shows in the taskbar on Linux and closing it removes the pet (#228 side effect) #233
Since the rebuilt v4.0.0 Linux packages (which include #228), the default pet shows up as a normal window on Linux: it gets a taskbar entry ("electron / OpenPets Default Pet"), appears in Alt+Tab and the pager, and closing it from the taskbar destroys the pet. This happens even with the chat button turned off, which is the v4 default.
Reproduce
Install the current OpenPets-4.0.0-linux-x86_64.AppImage (SHA256 7004d8c7fb67be02a6f50d68c56dcd5c39b609e8408c2c73d869bfbfc6c6f49a) on KDE Plasma.
Launch it. The pet appears as expected, but there is also a taskbar entry for it.
Close that taskbar entry. The pet disappears.
A build from the v4.0.0 tag (before #228) does not have a taskbar entry.
Cause
#228 changed shouldPetWindowBeFocusable() so the pet window is always focusable on X11/XWayland. In Electron on Linux, a window created with focusable: false isn't managed by the window manager at all, and that was the only thing keeping the pet out of the taskbar. The skipTaskbar: true option in pet-window.ts has never had any effect on Linux: Electron 42 documents both skipTaskbar and setSkipTaskbar() as macOS/Windows only.
KWin confirms it. On a build from the v4.0.0 tag the pet window is unmanaged (managed: false). On the rebuilt AppImage it's a normal managed window with skipTaskbar: false and demandsAttention: true. pet-window.ts is identical between the tag and main; wayland-backend.ts is the only non-fix change in between.
Since OpenPets forces --ozone-platform=x11 on Linux by default, I'd expect this to affect most Linux setups regardless of desktop. I've only verified it on KDE Plasma, though.
What I tried
On a dev build from main:
Calling window.setSkipTaskbar(true) after the window is shown: no effect (as the docs say).
type: "toolbar" on Linux X11: still in the taskbar. It did clear the attention flag, and chat input still worked.
A throwaway Electron test with focusable windows of every Linux window type (normal, toolbar, dock, splash, notification): all of them appear in the Plasma taskbar.
So there doesn't seem to be an Electron-options fix. Hiding the pet at the window-manager level does work, though, and chat input still takes typing with it hidden. Staying out of the taskbar and accepting keyboard focus aren't in conflict; Electron just can't request it on Linux.
Keep the pet unfocusable on X11 and host the chat input in its own small focusable window.
Set _NET_WM_STATE_SKIP_TASKBAR on the X11 window before it's first mapped. That needs native code.
At minimum: make closing the pet harmless
Even if the taskbar entry stays for now, closing it shouldn't destroy the pet. Right now the default pet window's close handler in pet-window.ts only saves the pet's position and then lets the close go through, so the window is gone until OpenPets restarts.
The usual Electron pattern would fix that:
In the pet window's close handler, call event.preventDefault() and hide the pet instead, the same way the tray's "Hide Default Pet" does (hideDefaultPet()).
Set an "app is quitting" flag in app.on("before-quit") and only cancel the close when it isn't set, so the tray's Quit, logging out and shutting down still close the app normally. OpenPets' own teardown uses destroy(), which doesn't fire close, so it wouldn't be affected.
With that, closing the pet's taskbar entry (or pressing Alt+F4 while the pet has focus) would just hide the pet. Its taskbar entry goes away with it, and "Show Default Pet" in the tray brings it back. It doesn't remove the taskbar entry while the pet is visible, but it turns an easy accident into something harmless.
One thing to decide: hideDefaultPet() also turns off showing the pet at the next launch, so a close would be remembered across restarts. A plain window.hide() would only hide it until OpenPets restarts. I'm not sure which you'd prefer.
Workaround (KDE only)
A KWin window rule restores the old behavior without breaking chat input: System Settings > Window Management > Window Rules > Add New, match window class open-pets-desktop (exact) and window title OpenPets Default Pet (exact), then force "Skip taskbar", "Skip pager", and "Skip switcher" to Yes. The title match matters because Control Center uses the same window class. This doesn't cover extra agent/plugin pets, which have other titles.
Environment
CachyOS Linux (rolling), kernel 7.2.7-1-cachyos
KDE Plasma 6.7.5, KWin 6.7.5
OpenPets v4.0.0 (rebuilt Linux packages), Electron 42.0.0
Summary
Since the rebuilt v4.0.0 Linux packages (which include #228), the default pet shows up as a normal window on Linux: it gets a taskbar entry ("electron / OpenPets Default Pet"), appears in Alt+Tab and the pager, and closing it from the taskbar destroys the pet. This happens even with the chat button turned off, which is the v4 default.
Reproduce
OpenPets-4.0.0-linux-x86_64.AppImage(SHA2567004d8c7fb67be02a6f50d68c56dcd5c39b609e8408c2c73d869bfbfc6c6f49a) on KDE Plasma.A build from the
v4.0.0tag (before #228) does not have a taskbar entry.Cause
#228 changed
shouldPetWindowBeFocusable()so the pet window is always focusable on X11/XWayland. In Electron on Linux, a window created withfocusable: falseisn't managed by the window manager at all, and that was the only thing keeping the pet out of the taskbar. TheskipTaskbar: trueoption inpet-window.tshas never had any effect on Linux: Electron 42 documents bothskipTaskbarandsetSkipTaskbar()as macOS/Windows only.KWin confirms it. On a build from the
v4.0.0tag the pet window is unmanaged (managed: false). On the rebuilt AppImage it's a normal managed window withskipTaskbar: falseanddemandsAttention: true.pet-window.tsis identical between the tag andmain;wayland-backend.tsis the only non-fix change in between.Since OpenPets forces
--ozone-platform=x11on Linux by default, I'd expect this to affect most Linux setups regardless of desktop. I've only verified it on KDE Plasma, though.What I tried
On a dev build from
main:window.setSkipTaskbar(true)after the window is shown: no effect (as the docs say).type: "toolbar"on Linux X11: still in the taskbar. It did clear the attention flag, and chat input still worked.So there doesn't seem to be an Electron-options fix. Hiding the pet at the window-manager level does work, though, and chat input still takes typing with it hidden. Staying out of the taskbar and accepting keyboard focus aren't in conflict; Electron just can't request it on Linux.
Possible directions
setFocusable()change (as fix(desktop): keep X11/XWayland pet windows focusable to fix chat input (#227) #228 found)._NET_WM_STATE_SKIP_TASKBARon the X11 window before it's first mapped. That needs native code.At minimum: make closing the pet harmless
Even if the taskbar entry stays for now, closing it shouldn't destroy the pet. Right now the default pet window's
closehandler inpet-window.tsonly saves the pet's position and then lets the close go through, so the window is gone until OpenPets restarts.The usual Electron pattern would fix that:
closehandler, callevent.preventDefault()and hide the pet instead, the same way the tray's "Hide Default Pet" does (hideDefaultPet()).app.on("before-quit")and only cancel the close when it isn't set, so the tray's Quit, logging out and shutting down still close the app normally. OpenPets' own teardown usesdestroy(), which doesn't fireclose, so it wouldn't be affected.With that, closing the pet's taskbar entry (or pressing Alt+F4 while the pet has focus) would just hide the pet. Its taskbar entry goes away with it, and "Show Default Pet" in the tray brings it back. It doesn't remove the taskbar entry while the pet is visible, but it turns an easy accident into something harmless.
One thing to decide:
hideDefaultPet()also turns off showing the pet at the next launch, so a close would be remembered across restarts. A plainwindow.hide()would only hide it until OpenPets restarts. I'm not sure which you'd prefer.Workaround (KDE only)
A KWin window rule restores the old behavior without breaking chat input: System Settings > Window Management > Window Rules > Add New, match window class
open-pets-desktop(exact) and window titleOpenPets Default Pet(exact), then force "Skip taskbar", "Skip pager", and "Skip switcher" to Yes. The title match matters because Control Center uses the same window class. This doesn't cover extra agent/plugin pets, which have other titles.Environment
--ozone-platform=x11(XWayland)