14

How to lock a HID device to a specific window or screen?

On kde/wayland

i want to lock a keyboard and controller so they are only seen by one window, as in inputs only go that window and it cant move elsewhere.

Also using nixos.

top 5 comments
sorted by: hot top controversial new old
[-] bjoern_tantau@swg-empire.de 2 points 2 days ago* (last edited 2 days ago)

Don't know if this is possible. What's your endgoal? Maybe there's a workaround.

One way of running multiple monitors used to be that you'd actually run two X sessions. Maybe you could do something similar where you assigned the devices to different X sessions. Of course that wouldn't fit your Wayland requirement.

[-] SpiderUnderUrBed@lemmy.zip 1 points 2 days ago

My use case is an expo, we have a game people can play on display and I'm doing things on my main screen, ideally I can continue doing work while people try the game but at the bare minimum I would like the keyboard to he restricted to that app.

[-] bjoern_tantau@swg-empire.de 5 points 2 days ago

I wouldn't entrust such an important display to some hacky solution a bunch of Lemmy users can come up with. Set up a normal kiosk environment and do your work on a second machine. You can ssh or even Sunshine/Moonlight into the gaming machine if you have to do something there.

But you don't want something a potential customer does on the game to crash your work or vice versa. Or even worse something goes wrong and the customers can suddenly see your work on their screen. Best to separate those things as much as possible.

[-] yardy_sardley@lemmy.ca 1 points 2 days ago

There's a kiosk-style compositor called cage that would work, at least for your main concern.

Then maybe use waypipe over ssh to do your work in the background. Alternatively, you can research setting up a multi-seat display manager, but I think you would need at least 2 GPUs to implement that properly.

[-] bjoern_tantau@swg-empire.de 1 points 2 days ago

Stupid idea I just had. Maybe you could try restricting the respective devices to a single user or group and run that application as a different user. No idea if that would work or how Wayland reacts to apps started as a different user.

this post was submitted on 13 Jul 2026
14 points (100.0% liked)

Linux

66426 readers
336 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS