Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I did edit the post you responsed to a few times in the last few minutes, so heads up there.

> > Unless you're suggesting that the DE comes with a preconfigured set of global hotkeys and cannot be altered or extended

> Yes that's what I'm suggesting.

Okay, let's use the example of music playback. If your DE handles music playback controls, how does it tell the music player when to stop and start, or skip to next track?

Does it hardcode a list of music players, each of which provides its own bespoke API, and the DE calls into the application?

Or does it provide a way for any music player to call into the DE, and listen for those play/pause/skip events?

And if it does that, then why are the list of events hardcoded? Why not allow the music player to say "I also play podcasts, and I want to provide a hotkey to speed up/slow down the playback speed, or provide a separate hotkey to skip ahead 30 seconds that's distinct from skipping the entire episode."? Why not allow Discord to provide a push-to-talk hotkey so that people on a group call can actually hear each other without dogs barking and keys clacking and people coughing?

---

Look at the VSCode Extension API for instance:

* Extensions are at least partially isolated from the main process and each other. I don't know how far this goes or how secure, but for our purposes they could be as isolated as you want.

* They can register a command which when activated, performs some action from within the extension.

* Those commands show up in the command list at the top of the screen when you hit "Control + Shift + P" (which is itself a command subject to all the same rules) and users can select whichever command they want to run.

* Those commands can also be assigned to a hotkey.

* Extensions can suggest a default binding for this hotkey, but users can go into the VSCode settings page and assign whatever keycombo they desire.

* Users can remove keybindings for commands that have them by default.

* Users can assign keybindings to commands that don't have them by default.

* All keybind editing is performed through the same UI, which is owned by VSCode and not the extension.

* VSCode itself is the thing listening to those key events, and it calls into the extension to activate it.

* There is a concept of context for when these keybinds apply, such as when a markdown document is active in the editor. Extensions provide these contexts by default and users can override them as they choose.

* Extensions themselves don't even start up until an activation event is met. These can be opening a file of a certain language, running a command, etc...

What about this model is objectionable in your mind? Who benefits from the lockdown you propose where no new ideas can be tried until the DE authority deigns to allow it?



All of your concerns regarding music players are actually already addressed by the MPRIS spec: https://specifications.freedesktop.org/mpris-spec/latest/

This problem has been solved in the DEs for quite some time now, global hotkeys is probably the very last thing you want to reach for, when all other options are exhausted.

And when that happens, I don't know about other DEs, but the way you're describing with extensions is mostly how GNOME Wayland already works. If you want to intercept a key, you ship an extension for that, and display a UI to rebind the keys, or you can place additional entries in the system's keyboard settings panel. What you can't do is have random unprivileged processes intercept keys without the user's permission.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: