Skip to content

Commit

Permalink
Make sure xinput is run silently
Browse files Browse the repository at this point in the history
Users of XWayland/Wayland that has xinput installed will be receiving warning/errors
due to xinput being used in a wayland sesison, it's safe to ignore it.
We could also try to find if we're in a wayland session by using Xlibs, but I think
this would've been overkill
  • Loading branch information
Paiusco committed Nov 2, 2024
1 parent 7d78656 commit 7b3e859
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Daemon/ydotoold.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,21 +357,21 @@ int main(int argc, char **argv) {
const char *xinput_path = "/usr/bin/xinput";

if (getenv("DISPLAY")) {
if (getenv("WAYLAND_DISPLAY")) {

}
else if (stat(xinput_path, &sbuf) == 0) {
if (stat(xinput_path, &sbuf) == 0) {
pid_t npid = vfork();

if (npid == 0) {
// Make sure we don't warning unnecessarily if user is on XWayland session
freopen("/dev/null", "w", stderr);

execl(xinput_path, "xinput", "--set-prop", "pointer:ydotoold virtual device", "libinput Accel Profile Enabled", "0,", "1", NULL);
perror("failed to run xinput command");
printf("failed to run xinput command\n");
_exit(2);
} else if (npid == -1) {
perror("failed to fork");
}
} else {
printf("xinput command not found in `%s', not disabling mouser pointer acceleration", xinput_path);
printf("xinput command not found in `%s', not disabling mouser pointer acceleration\n", xinput_path);
}
}

Expand Down

0 comments on commit 7b3e859

Please sign in to comment.