From 4ce511c902f99b9d032b5a6e726ac364e082a616 Mon Sep 17 00:00:00 2001 From: Adrien Bouvais Date: Mon, 3 Nov 2025 12:46:04 +0000 Subject: [PATCH] Update TODO.md --- TODO.md | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index e747d85..ce48945 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,5 @@ Add swayidle to make the screen go dark +And add adrien user to uinput --- @@ -106,4 +107,95 @@ Log out of your niri session and log back in. The `idle.sh` script will now be r * **Customizing swaylock:** You can make `swaylock` look nicer. For example, to set a solid color: `swaylock -f -c 000000` (for black). - You can edit this command directly in your `idle.sh` script. Check `man swaylock` for all options. \ No newline at end of file + You can edit this command directly in your `idle.sh` script. Check `man swaylock` for all options. + +--- + +Of course! Let's break down what `uinput` is, why you're getting a "permission denied" error, and exactly how to fix it on your Arch Linux system. + +### What is `uinput`? (The Simple Explanation) + +Think of `uinput` (User Input) as a special module in the Linux kernel. Its job is to let a regular program **pretend to be a physical input device**. + +When you move your real mouse, the hardware sends a signal to the kernel, and the kernel tells your desktop environment, "The mouse just moved to coordinates X, Y." + +`uinput` allows a program, like Sunshine, to do the exact same thing, but in software. Sunshine can tell the `uinput` module, "Hey, pretend a mouse just moved to coordinates X, Y," and the kernel will treat it exactly as if a real mouse did it. + +This is essential for applications like: +* **Sunshine/Moonlight:** To inject mouse, keyboard, and gamepad inputs coming from your client device over the network. +* **Steam:** For the Steam Input feature, which can make a controller look like a keyboard and mouse to a game. +* **Input Remappers:** Tools that change what your keyboard keys or controller buttons do. + +### The Permission Problem + +For security reasons, you don't want just *any* application to be able to create fake keyboard presses or mouse movements. If any program could do this, it would be trivial to create a keylogger or malware that could take control of your computer. + +Because this is a powerful and potentially dangerous feature, Linux protects it with file permissions. The `uinput` functionality is exposed through a special device file: `/dev/uinput`. + +Let's look at the permissions on that file. If you run this command in your terminal: + +```bash +ls -l /dev/uinput +``` + +You will likely see something like this: + +``` +crw-rw---- 1 root uinput 10, 223 Dec 15 10:30 /dev/uinput +``` + +Let's break that down: +* `c`: It's a character device file. +* `rw-`: The **owner** (`root`) has read and write permissions. +* `rw-`: The **group** (`uinput`) has read and write permissions. +* `---`: **Everyone else** has no permissions at all. + +When you run Sunshine, it runs as *your* user account (e.g., `myuser`), not as `root`. By default, your user is not in the `uinput` group. Therefore, when Sunshine tries to access `/dev/uinput` to create a virtual mouse or keyboard, the kernel sees that your user is in the "everyone else" category and says **"Permission Denied"**. + +### The Solution: The `uinput` Group + +The forum's advice is exactly correct. The `uinput` group was created specifically for this purpose: to grant trusted users the ability to access the `uinput` device without giving them full `root` privileges. + +By adding your user to the `uinput` group, you are telling the system, "I trust this user account to run programs (like Sunshine) that need to create virtual input devices." + +--- + +### How to Fix It: Step-by-Step + +Here are the commands to solve your problem on Arch Linux. + +**1. Add Your User to the `uinput` Group** + +Open a terminal and run the following command. Make sure to replace `your_username` with your actual username. If you're not sure, you can run the command `whoami` to see it. + +```bash +sudo gpasswd -a your_username uinput +``` +* `sudo`: Run this command with administrator privileges. +* `gpasswd`: A command to manage group memberships. +* `-a your_username`: The action is to **a**dd the specified user. +* `uinput`: The group you are adding the user to. + +**2. Apply the Changes** + +Group membership changes only take effect when you start a new login session. The current session you are in will not have the new permissions. You have two options: + +* **Log Out and Log Back In:** This is the cleanest and most recommended way. Log out of your Niri session completely and then log back in. +* **Reboot:** A full reboot will also work. + +**3. Verify the Change (Optional)** + +After you have logged back in, you can verify that you are now a member of the group by running: + +```bash +groups +``` + +You should see `uinput` listed in the output, along with your other groups. + +``` +# Example output +wheel audio video input uinput myuser +``` + +Once you've done this, Sunshine should have the necessary permissions to create virtual input devices, and your mouse, keyboard, and controller should start working correctly on your Niri desktop \ No newline at end of file