# Minimize to tray feature for arbitrary app

**URL:** <https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808>\
**Category:** Sponsored Work\
**Created:** [January 4, 2025, 1:12pm UTC](https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808 "2025-01-04T13:12:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dion](https://discuss-cdn.kde.org/letter_avatar_proxy/v4/letter/d/cab0a1/32.png) [@dion](https://discuss.kde.org/u/dion)\
**Post date:** [January 4, 2025, 1:12pm UTC](https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808/1 "2025-01-04T13:12:10Z")

</div>

Something similar to `KDocker`. KDocker still can be used (by forcing X11), but it’s fragile.

Requirements:

- Should work on Plasma Wayland out of the box (without extra third-party scripts/hacks). Adding ‘KWin’ rule is fine
- No ‘support’ from app itself. It should be possible to apply this for any app like KCalc or firefox. All apps including non-Qt. I think it’s fine to have it for Wayland apps only but I don’t see why X11 apps can’t work same way. But no need to support X11 session (Kdocker still works)
- Minimized app has no Task Manager icon. When app is restored – I don’t care. I think that restored app should have task manger icon (unless ‘Skip taskbar’ quirk is applied)
- Popup menu may just show usual window decoration items.
- Ability to assign global hotkey to restore app (if it’s standard `StatusNotifierItem` then it already can be scripted).
- Huge plus: ability to change item visibility in usual tray settings including ‘requires attention’ feature.
- Huge plus: catch “close window” button/shortcut and minimize to tray instead.

**Possible implementation:**

- KWin rule like ‘Skip Taskbar’

**Less ideal implementations but still better than nothing:** add second ‘Icon only Task Manager’ to panel and somehow configure it to show only such special windows. It could be any of:

1. Windows tagging and hiding
  - KWin rule to ‘tag’ window somehow
  - Task manager option to show only ‘tagged’ windows

2. Task manger option to show only ‘Pinned’ apps and at the same time option to "never show apps pinned by other task manager (or make it default)

I’ve found multiple discussions about this:

- [Minimise any window to system tray](https://discuss.kde.org/t/minimise-any-window-to-system-tray/24899)
- ["Always show as icon only" option for pinning apps (#100) · Issues · Plasma / Plasma Desktop · GitLab](https://invent.kde.org/plasma/plasma-desktop/-/issues/100)
- [Wayland-compatibility · Issue #95 · user-none/KDocker · GitHub](https://github.com/user-none/KDocker/issues/95)

I can offer $100 USD for `KDocker`-like solution that requires certain manual actions (like extra KWin/shell script that can be installed to `$HOME`, or launching app via ‘wrapper’ that have no performance impact). But without patching/rebuilding Plasma source.

Or $200 for fully out of the box experience with `StatusNotifierItem` and controlled visibility

---

<div class="post-metadata">

**Author:** ![luisbocanegra](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/luisbocanegra/32/2730_2.png) [@luisbocanegra](https://discuss.kde.org/u/luisbocanegra)\
**Post date:** [March 21, 2025, 3:51pm UTC](https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808/2 "2025-03-21T15:51:12Z")

</div>

I started working on a third party KWin script [GitHub - luisbocanegra/kwin-minimize2tray: Hide windows to the system tray, similar to KDocker but in the form of a KWin Script that works on Wayland](https://github.com/luisbocanegra/kwin-minimize2tray)

> Minimized app has no Task Manager icon

Currently works like that

> No ‘support’ from app itself. It should be possible to apply this for any app like KCalc or firefox. All apps including non-Qt. I think it’s fine to have it for Wayland apps only but I don’t see why X11 apps can’t work same way. But no need to support X11 session (Kdocker still works)

Works for any window, not grouping per app, each window gets its own tray icon

> Popup menu may just show usual window decoration items.

Just the basics for now

 ![preview](https://discuss-cdn.kde.org/uploads/default/original/3X/c/1/c157133a670b62dd3b9dae7ea67fd90447cdc1e3.png)

> Ability to assign global hotkey to restore app (if it’s standard `StatusNotifierItem` then it already can be scripted).

Not yet, no idea how or if possible

> Huge plus: ability to change item visibility in usual tray settings including ‘requires attention’ feature.

Seems doable

> Huge plus: catch “close window” button/shortcut and minimize to tray instead.

Not sure if the KWin scripting API allows this, will have to try

---

<div class="post-metadata">

**Author:** ![dion](https://discuss-cdn.kde.org/letter_avatar_proxy/v4/letter/d/cab0a1/32.png) [@dion](https://discuss.kde.org/u/dion)\
**Post date:** [March 24, 2025, 11:46am UTC](https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808/3 "2025-03-24T11:46:48Z")

</div>

Wow. Thanks a lot for this. It looks very promising!

I would say that I like slightly more static configuration so that you explicitly tell plugin somehow that certain apps are always minimized ‘minimize to tray’.

Surely we can combine this with current fully dynamic behavior where any window can be minimized to tray using extra hotkey.

If you’ve other things to do (most likely yes) I’ll contribute this ‘static’ thing. I really like idea and it looks very simple.

I don’t like fact that this thing is extra kwin plugin with C++ code.. But I understand why it can’t be done other way.

PS. My $100 offer is still valid. I know that it’s just small bonus 🙂 Can I donate it to your github account?

---

<div class="post-metadata">

**Author:** ![luisbocanegra](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/luisbocanegra/32/2730_2.png) [@luisbocanegra](https://discuss.kde.org/u/luisbocanegra)\
**Post date:** [March 24, 2025, 2:32pm UTC](https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808/4 "2025-03-24T14:32:48Z")

</div>

> [@dion](#):
>
> I would say that I like slightly more static configuration so that you explicitly tell plugin somehow that certain apps are always minimized ‘minimize to tray’.
> 
> Surely we can combine this with current fully dynamic behavior where any window can be minimized to tray using extra hotkey.
> 
> If you’ve other things to do (most likely yes) I’ll contribute this ‘static’ thing. I really like idea and it looks very simple.

It could be implemented like [Kröhnkite](https://github.com/anametologin/krohnkite) tiling script does with a comma separated list of the window properties to match, they do it by class, title, or role.

> [@dion](#):
>
> I don’t like fact that this thing is extra kwin plugin with C++ code.. But I understand why it can’t be done other way.

Yeah, I found that to be the simplest way to implement it. Maybe one day I (when more experienced) or someone else could make this built-in if it’s something they want.

---

<div class="post-metadata">

**Author:** ![luisbocanegra](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/luisbocanegra/32/2730_2.png) [@luisbocanegra](https://discuss.kde.org/u/luisbocanegra)\
**Post date:** [March 24, 2025, 2:39pm UTC](https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808/5 "2025-03-24T14:39:28Z")

</div>

> [@dion](#):
>
> PS. My $100 offer is still valid. I know that it’s just small bonus 🙂 Can I donate it to your github account?

I have multiple donation methods linked in the project readme, feel free to use whichever you prefer.

---

<div class="post-metadata">

**Author:** ![luisbocanegra](https://discuss-cdn.kde.org/user_avatar/discuss.kde.org/luisbocanegra/32/2730_2.png) [@luisbocanegra](https://discuss.kde.org/u/luisbocanegra)\
**Post date:** [March 24, 2025, 2:47pm UTC](https://discuss.kde.org/t/minimize-to-tray-feature-for-arbitrary-app/27808/6 "2025-03-24T14:47:16Z")

</div>

Currently working in the [Unity LauncherAPI](https://wiki.ubuntu.com/Unity/LauncherAPI) support similar to what the Task manager widget has and this is how it will look

![Screenshot_20250324_084038](https://discuss-cdn.kde.org/uploads/default/original/3X/c/0/c0f1c26c1352aaa979ae87a1ec292963b240c7fa.png)
