WootingKb / wooting-macros

The official Wooting Macros software.
GNU General Public License v3.0
166 stars 17 forks source link

Linux version has to be run as root to grab inputs #54

Open medzernik opened 1 year ago

medzernik commented 1 year ago

May be related to spawning threads. Panics at spawning a thread.

medzernik commented 1 year ago

image

medzernik commented 1 year ago

image

medzernik commented 1 year ago

image

medzernik commented 1 year ago

It appears to be some sort of a library or permissions issue, i'll investigate later. sudo works well tho.

Kitt3120 commented 1 year ago

Same here, but it also does not work for me with sudo. If I run it with sudo, I get even more errors because it can't determine the dbus address.

Without root: running Wootomation without root

With root and Rust backtrace: running Wootomation with root

I made an AUR package for Arch-based distros which extracts the contents of the AppImage file and installs it on the host natively. That version is also affected by this.

Edit:

So I made an interesting discovery: My Plasma desktop crashed and restarted itself. After restarting, the input handling actually worked with AND WITHOUT root.

Without root: running Wootomation without root after desktop crashed

With root: running Wootomation with root after desktop crashed

However, none of the actions I defined were working. It did not actually run any of my macros. I tried it with simple macros that type a characters and I tried the "open folder" and "open website" options, none worked. The dbus warnings when running with root are also still there.

Kitt3120 commented 1 year ago

@medzernik did you put any further work into this? Edit: I see you're working on a library/update branch. Has the problem been addressed there? :)

medzernik commented 1 year ago

not yet, i've been working on other projects + had a lot of uni (finals). I will take a look soon though, just need to think up what should go into the next version.

Kitt3120 commented 1 year ago

not yet, i've been working on other projects + had a lot of uni (finals). I will take a look soon though, just need to think up what should go into the next version.

Alright, I'm happy just knowing that development is still ongoing. :) Hope your finals went well, mine will be next month. I also tried reading a bit into rust and cloned the project, but I was unable to fix it. If I am able to fix it, I'll open up a pull request upstream for you.

medzernik commented 1 year ago

Thanks, i think there might be an issue in regards to the process thread forking and such. Not sure yet as macos is a bigger pain to solve and also involves some permissions & thread stuff. I set up a proper Linux machine last week, might look into it there.

Kitt3120 commented 1 year ago

If you need to run something on arch and don't want to set up a vm or a container, I can also try out some builds for you. ;) But setting up containers to test in is probably the better option.

medzernik commented 1 year ago

If you need to run something on arch and don't want to set up a vm or a container, I can also try out some builds for you. ;) But setting up containers to test in is probably the better option.

I'm doing mostly VMs but arch is definitely nice to try get going.

Ideally I'd want feedback on both Wayland and X11, i'm running KDE Neon stable in a VM as for myself.

Kitt3120 commented 1 year ago

I'm also a fan of KDE in general. I think KDE Neon is a good system to test stuff on. Also, yes, Wayland is the way to go. Especially in the past 2 years, many users switched over to Wayland because Plasma, GNOME, and many Window Managers improved their Wayland implementations. So it's good that you have Wayland in mind.

nmcbride commented 8 months ago

Has there been any progress on this?

If I run as a regular user I get nothing but:

[2024-03-19][05:29:45][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-03-19][05:29:45][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-03-19][05:29:45][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-03-19][05:29:45][ERROR][wooting_macro_backend] Failed to receive an event!

And no shortcuts are recognized.

If I run as a regular user I do get some errors but at least it works somewhat:

(wootomation:36418): libappindicator-WARNING **: 01:30:17.805: Unable to get the session bus: Failed to execute child process “dbus-launch” (No such file or directory)

(wootomation:36418): LIBDBUSMENU-GLIB-WARNING **: 01:30:17.805: Unable to get session bus: Failed to execute child process “dbus-launch” (No such file or directory)

** (wootomation:36418): WARNING **: 01:30:42.806: atk-bridge: get_device_events_reply: unknown signature
[2024-03-19][05:31:24][INFO][wooting_macro_backend] 
EXECUTING A SINGLE MACRO: "Macro 0"
[2024-03-19][05:31:31][INFO][wooting_macro_backend] 
EXECUTING A SINGLE MACRO: "Macro 0"
[2024-03-19][05:31:46][INFO][wooting_macro_backend] 
EXECUTING A SINGLE MACRO: "Macro 0"

Are you guys using the user dbus?

➜  ~ echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus

Or only the system DBUS?

nmcbride commented 8 months ago

After looking at the code and looking at the docs for rdev I saw this and was hopefull:

Linux

The grab function use the evdev library to intercept events, so they will work with both X11 and Wayland In order for this to work, the process runnign the listen or grab loop needs to either run as root (not recommended), or run as a user who’s a member of the input group (recommended) Note: on some distros, the group name for evdev access is called plugdev, and on some systems, both groups can exist. When in doubt, add your user to both groups if they exist.

But after adding myself to the group (I only had input not plugdev) nothing changed.

Kitt3120 commented 8 months ago

Hi after all this time!

I finally got the time to update the AUR package I maintain for Wootomation. Since the update, the bugs I described back in February 2023 in this issue are gone. It doesn't crash anymore on startup, as a normal user and as root. But root is not needed. The program is working fine for me on wayland with KDE Plasma 6.0.2! 🎉

Thank you so much for your work.

The package displays a warning mentioning this issue and explains that the program could not work for some Linux users. I'll leave that message in there as long as this issue is still open.

nmcbride commented 8 months ago

For me currently on Fedora you still have to run it as root for it to work.

f0s3 commented 3 months ago

2024-07-27_23:58:53 I have this issue launching wootomation in the terminal, I'm in the input group indeed. dark-colored window appears and nothing happens afterwards. closing it from Tray ->Quit closes it but hangs my system (cannot even move the cursor) for 2 seconds. Using endeavouros with i3 and no compositor. Let me know If I should try something or provide more info.

Martmists-GH commented 3 months ago

Just tried this on KDE Plasma 6 Wayland, pressing a macro triggers a popup, and after clicking "Share" on the popup, my entire KDE session seems to freeze.

popup

ShayBox commented 3 months ago

Could polkit/pkexec be integrated to self prompt for privileges? It could be as simple as adding pkexec to the desktop file, or adding polkit integration to the program at startup.

Oroborius commented 2 months ago

If you need to run something on arch and don't want to set up a vm or a container, I can also try out some builds for you. ;) But setting up containers to test in is probably the better option.

I'm doing mostly VMs but arch is definitely nice to try get going.

Ideally I'd want feedback on both Wayland and X11, i'm running KDE Neon stable in a VM as for myself.

User:

[2024-09-11][11:51:46][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-09-11][11:51:46][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-09-11][11:51:46][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-09-11][11:51:46][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-09-11][11:51:46][ERROR][wooting_macro_backend] Failed to receive an event!
[2024-09-11][11:51:46][ERROR][wooting_macro_backend] Failed to receive an event!
...

^ Fires indefinitely... Had a log of 200MB before I killed it.

Root:

[oroborius@archlinux ~]$ sudo "/home/oroborius/Downloads/wootomation_1.1.0_amd64.AppImage"
Could not determine the accessibility bus address

(wootomation:3459428): libappindicator-WARNING **: 07:52:50.021: Unable to get the session bus: Error spawning command line “dbus-launch --autolaunch=3b7ac8c86a884882a9c0421bcd9c7bee --binary-syntax --close-stderr”: Child process exited with code 1

(wootomation:3459428): LIBDBUSMENU-GLIB-WARNING **: 07:52:50.021: Unable to get session bus: Error spawning command line “dbus-launch --autolaunch=3b7ac8c86a884882a9c0421bcd9c7bee --binary-syntax --close-stderr”: Child process exited with code 1
Could not create EGL context.
^C^C^C^C^C^C^C^C^C^C^C
[oroborius@archlinux ~]$ 

^ Hangs so I ended up killing it.

Arch KDE Plasma Wayland

TheOverpassArsonist commented 1 month ago

I'm running an uptodate garuda installation (arch derivative but pulls from stock arch repos) on KDE with Wayland and am having this issue as well. All I see are endless "Failed to receive an event" errors in the terminal, and the window itself is just a grey box. Running as root doesn't seem to change anything, and when I try to install the AUR package mentioned by @Kitt3120 with Yay I get to "Parsinc SRCINFO: wootomation-appimage" but then the next line says "Failed to install layer, rolling up to next layer.error:error installing repo packages" then the next line says "error installing repo packages" and the next line says, again, "error installing repo packages". (I have tried a clean build, same results)

Before the stream of infinite "Failed to recieve an event!" errors however, I get the following errors

Could not determine the accessibility bus address

(wootomation:3474619): libappindicator-WARNING **: 22:20:35.715: Unable to get the session bus: Error spawningcommand line “dbus-launch --autolaunch=2032f5a2e00847619b2c95b19744f552 --binary-syntax --close-stderr”: Child process exited with code 1

(wootomation:3474619): LIBDBUSMENU-GLIB-WARNING **: 22:20:35.715: Unable to get session bus: Error spawning command line “dbus-launch --autolaunch=2032f5a2e00847619b2c95b19744f552 --binary-syntax --close-stderr”: Child process exited with code 1

Not sure how helpful this is as it seems like everyone here is having slightly different issues, but I figure it's more likely to be helpful saying it than not.