rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.25k stars 213 forks source link

Generic way to do OS triggered features via keymapper #720

Open joshgoebel opened 2 years ago

joshgoebel commented 2 years ago

Is your feature request related to a problem? Please describe.

Yes, the desire to build in "common OS level" system functionality via keystrokes. Things like:

Describe the solution you'd like

Kinto should ship default scripts (if there is a common case for said functionality) or provide a common API (script names) to allow users to provide scripts for their own environ and then they magically just start working.

I'm also unsure how much behavior some DEs provide out of the box, since I'm using only a window manager myself (and I get none). It's even possible if the amount of sniffing (for env) was small the scripts itself could handle this by trying to detect the appropriate tools to call. I'm not sure how much of this Kinto would want to take on...

So I'm imagining adding ALL the common OS short-cut keys to the keymapper paired with named utility scripts (on the Kinto side) that could grow over time.

Some code:

keymap("OS", 
   K("brightnessup"): launch("brightness-up")
)

~/.config/kinto/scripts/brightness-up

Describe alternatives you've considered

None.

Additional context

None.


@rbreaves Are you interested in shipping cross-environments scripts for these sort of things and recommending that users install certain tools - or perhaps doing that installation yourself? Thoughts?

joshgoebel commented 2 years ago

First question: How much of this is already solved by KDE/Gnome, or do we even care - since we can't be certain what environ a user is going to use Kinto in. I'm running it (the key mappings) with Awesome WM - though it's possible I'm an unsupported scenario.

rbreaves commented 2 years ago

Am interested but the issue has been I sorta figure most laptops top row have iconography already for many of these things & that most users will visually go by that vs touch typing based on a prior Mac.

Apple doesn’t even keep the order of their F row consistent beyond a few years at a time or they switch to the touch bar even. It’s one of those things that I feel like I’d have to provide multiple layouts if touch typists are wanting.

Adding all the screenshot combos consistently does need to happen regardless.

joshgoebel commented 2 years ago

Am interested but the issue has been I sorta figure most laptops top row have iconography already

Right, as does my keyboard - but iconography is not functionality...

& that most users will visually go by that vs touch typing based on a prior Mac.

Right, no disagreement... In my testing evtest maps to the iconography exactly (though I suppose one could argue over SCALE for F3) (looks like expose)... I'm talking about adding the right functionality to those keys - the same functionality they'd have if they were running Mac OS.

Apple doesn’t even keep the order of their F row consistent

I would expect for most common keys this would mapped in the keyboard hardware, am I wrong? Functionality does change over time... like the Dashboard key on my old full-size keyboard is now Launchpad on my newer keyboard... but in that case the functionality has literally moved on, so I'm not bothered if we mapped F4 (Dashboard/Launchpad) to an equivalent of Launchpad on Linux.

Are there really some keyboards where the "Play" key maps to "Brightness up"??

joshgoebel commented 2 years ago

There are also combos like Cmd-Space / Spotlight that we could map to a generic spotlight script, etc... which a user could then replace with their favorite launcher, etc...

For cases where there were no immediate defaults you could probably ship a small script with Kinto that popped up a GUI explaining to users how to configure the scripts for their system, etc...

joshgoebel commented 2 years ago

I guess minimally here I'm asking:

Whether or not you ship some or all of the scripts or not... so once someone has Kinto working they could just drop scripts into a folder and then the functionality immediately works... that was the idea.

On my end this is associated with https://github.com/joshgoebel/keyszer/issues/44... so in the config you might just specify the script names/api:

keymap("default OS", {
  mac("Cmd-space"): kinto_launch("spotlight"),
  mac("volumeup"): kinto_launch("raise-volume"),
  mac("volumedown"): kinto_launch("lower-volume"),
})
rbreaves commented 2 years ago

Yea setting it up that way does make sense.. using aliased names would help w/ clarity a lot. Things start to look messy when logic is added in w/ the simple 1:1 configs. Keeping the logic in a separate file or at the top would help a lot.

joshgoebel commented 2 years ago

So, do modern DEs already handle any of this functionality - or is that not relevant? I assume though if KDE (say) already had an amazing Cmd-space macro/finder built-in that we might not want to trample over that?

rbreaves commented 2 years ago

I mean it sorta just varies ime, and everyone has their preferences on some things. I normally try and default to whatever the DE has as far as an equivalent. I kinda don't like defaulting the whatever the default screenshot utility is though as I find DEs to be inconsistent on offering that or a good utility for it.

I think one or 2 of them have improved their screenshot utility since I started kinto though, in response to flameshot, and that's a good thing imo. Flameshot is pretty awesome, but yea it is generally out of scope for Kinto to start installing 3rd party apps like flameshot for screenshots, or Albert for spotlight.

I do have my sorun.me project that is largely built for the out-of-scope matters that I won't do inside Kinto itself, it is mostly just a script and now quasi distro for me to have an up and running dev environment in just a few minutes. I am actually planning on renaming it soon and making it look a lot nicer... much cleaner, spaced out and simple looking than it looks now.

joshgoebel commented 2 years ago

I kinda don't like defaulting the whatever the default screenshot utility is though

Oh I fully agree. I don't think you necessarily have to provide/endorse any single tooling or individual program - I'm more interested in Kinto possibly providing the foundation layer... the keymapper combos and secure launch infrastructure that "just works" out of the box, all someone has to do is drop in a few scripts - and perhaps people will step up to build and maintain those sets on their own?

...of course I suppose technically that could be yet another project that builds on Kinto... I'm really not a believer that any one project needs to "do it all"... I'm still not even sure launching needs to be in the core keymapper, but I am interested in having a story for how someone could configure it securely if they wished.


It might even be that what people share is a customized keymap block (perhaps some DEs we'd just pass some keycombos thru to DE functionality, etc) and then a list of scripts to match... the part that's missing then is the glue that hooks up the keymapper and the launchers... and personally I think it'd be nice if we had a somewhat "semi-canonical" solution for that - vs everyone going off and inventing their own.