Skip to content

Add Systray helper/support - #1336

Open
shelterx wants to merge 11 commits into
sezanzeb:mainfrom
shelterx:detatched-systray
Open

shelterx wants to merge 11 commits into
sezanzeb:mainfrom
shelterx:detatched-systray

Conversation

@shelterx

@shelterx shelterx commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Here's an attempt to implement optional systray support as discussed in PR #1333
The current implementation is that systray can be ran standalone or it can be toggled to run from the GUI, the end results are the same, just different ways of doing it.

I tried to keep systray behavior how the users generally expect systray implementaions to behave.
The logic was the hardest part.

EDIT:
Regarding the ruff warnings, it seems like ruff was bumped from 0.15.22 -> 0.16.0.

@shelterx
shelterx force-pushed the detatched-systray branch 2 times, most recently from 4b40603 to 68b43a8 Compare July 25, 2026 08:10
@shelterx

shelterx commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Memory usage comparison, it seems to be quite normal compared to a similar tray implementation:

   Process                        | VSZ (Virtual Memory)           | RSS (Physical RAM Used)
  --------------------------------|--------------------------------|----------------------------
   arch-update/lib/tray.py        | 430,016 KB (~430 MB)           | 80,844 KB (~80.8 MB)
   input-remapper-tray            | 679,700 KB (~680 MB)           | 79,744 KB (~79.7 MB)

@sezanzeb

sezanzeb commented Aug 3, 2026

Copy link
Copy Markdown
Owner

I'll look at this soon, sorry for the delay

@sezanzeb

Copy link
Copy Markdown
Owner

I just pushed tons of changes to fix all ruff issues to main, this should fix the pipeline.

@sezanzeb sezanzeb left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started this review weeks ago but I think I didn't finish reviewing all the changes back then. I'll make another pass soon, once these are addressed.

Comment thread inputremapper/gui/user_interface.py Outdated
Comment thread inputremapper/gui/user_interface.py Outdated
Comment thread inputremapper/bin/process_utils.py Outdated
Comment thread inputremapper/bin/input_remapper_tray.py Outdated
Comment thread inputremapper/bin/input_remapper_tray.py Outdated
Comment thread inputremapper/bin/input_remapper_tray.py Outdated
@shelterx

Copy link
Copy Markdown
Contributor Author

Done. Rebased too, hope it went well... :P

@sezanzeb

Copy link
Copy Markdown
Owner

The tray process is logging

08:43:18.500734 7112 tray ERROR groups.py:493: Did not find any input device, possibly due to missing permissions

on my system. Are you in the input group?

My devices submenu is empty and says "No presets configured"

Comment thread inputremapper/gui/user_interface.py Outdated
pass
return mtimes

def _refresh_groups_silently(self) -> None:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it important to silence discovery prints?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to reduce log spam, not sure if you want it visible during normal operartion.

@shelterx shelterx Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logger.update_verbosity is true for systray, what we can do is hide it behind a debug flag?
Though with the dbus change that log will be moved.

@sezanzeb sezanzeb Sep 14, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think _poll_state would only be important as long as the menu is open, right? If yes, this would also reduce log spam.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll hold this open for now, I want dbus the change to land first.

Comment thread bin/input-remapper-tray

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about a .desktop file to autostart the tray?

@shelterx shelterx Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will the user expect?
If we just add it as is with a shortcut, it will always start the tray, however it will disappear when the user closes the GUI IF close to systray is disabled.
Perhaps we should sync that "state" instead, if close to systray is disabled it should never fire up the systray.
And rename it to "Enable systray" instead?

Comment thread inputremapper/bin/input_remapper_tray.py Outdated
@shelterx

Copy link
Copy Markdown
Contributor Author

Are you in the input group?

Yeah, I'm in the input group... and /etc/udev/rules.d/60-uinput.rules sets:
KERNEL=="uinput", GROUP="input", MODE="0660"

It was early on I messed around with input permissions, but I think I added the above myself.
error: No package owns /etc/udev/rules.d/60-uinput.rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants