Open chailatent opened 1 year ago
@chailatent
Disclaimer: I am not the Kinto dev, just a user and minor contributor.
This functionality is not straightforward to implement for all Linux desktop environments (DEs). For one thing, it typically relies on a screenshot tool being installed, which isn't always available. If there is one, it differs between different DEs. GNOME, for instance, just wrote a whole new screenshot tool to replace the one they had for years before that. KDE desktops tend to use a completely different screenshot tool (Spectacle), with different shortcuts. And a lot of Linux users prefer to use the more powerful cross-platform Flameshot tool.
I wrote a script to attempt to make a somewhat "universal" solution for this, but it was very complicated and relied on the launch
capability of xkeysnail
, and that was stripped out of keyszer
, the fork of xkeysnail
, for good reasons.
So there are a few different ways that this can be solved, but it depends on the DE. With Ubuntu 22.04, you should have the newer GNOME screenshot tool built-in, so theoretically we can just remap the desired shortcuts onto the shortcuts that activate that built-in tool. These can be found in the keyboard settings control panel, when searching for "screenshot":
Take a screenshot - Shift+Print
Take a screenshot interactively - Print
Take a screenshot of a window - Alt+Print
So we'd want to remap things like this, I think:
Take a screenshot - Shift+Print - Cmd+Shift+3
Take a screenshot of a window - Alt+Print - Cmd+Shift+4
Take a screenshot interactively - Print - Cmd+Shift+5
Putting that at the top of the "General GUI" section should go something like this:
# None referenced here originally
# - but remote clients and VM software ought to be set here
# These are the typical remaps for ALL GUI based apps
define_keymap(lambda wm_class: wm_class.casefold() not in remotes,{
…
# Screenshot shortcuts for GNOME 42+
K("RC-Shift-Key_3"): K("Shift-Print"), # Take a screenshot immediately (gnome)
K("RC-Shift-Key_4"): K("Alt-Print"), # Take a screenshot of a window (gnome)
K("RC-Shift-Key_5"): K("Print"), # Take a screenshot interactively (gnome)
…
K("RC-Shift-Left_Brace"): K("C-Page_Up"), # Tab nav: Go to prior (left) tab
K("RC-Shift-Right_Brace"): K("C-Page_Down"), # Tab nav: Go to next (right) tab
K("RC-Space"): K("Alt-F1"), # Default SL - Launch Application Menu (gnome/kde)
K("RC-F3"):K("Super-d"), # Default SL - Show Desktop (gnome/kde,eos)
K("RC-Super-f"):K("Alt-F10"), # Default SL - Maximize app (gnome/kde)
The code above and below the ellipses (…
) are included just for reference about where to put the lines in between the ellipses.
Theoretically this should work on any Linux DE using GNOME 42 or later, with the built-in screenshot tool, but would not necessarily make sense for other DEs or other screenshot tools.
I'm using keyszer
and a highly modified config file, but a version of these shortcuts worked for me just now on Fedora 36, which is still using GNOME 42.9. The example above is from the current default Kinto config file.
On Mac/Apple keyboard, Cmd+Shift+3 takes screenshot of entire screen and Cmd+Shift+4 takes screenshot interactively.
That's not quite right, I believe that Shift+Cmd+3 takes a screenshot "immediately" (of the whole screen), Shift+Cmd+4 lets you either select a rectangle with a cross mouse cursor tool, or hit Space and select a window (the cursor changes into a "camera" icon), and Shift+Cmd+5 is the interactive tool that appeared in some recent version of macOS, that lets you choose various options like a delay before taking the screenshot.
Describe the bug On Mac/Apple keyboard, Cmd+Shift+3 takes screenshot of entire screen and Cmd+Shift+4 takes screenshot interactively.
I'm using Kinto on Ubuntu with Mac/Apple keyboard, but it doesn't seem to work.
Expected behavior Cmd+Shift+3 shold take screenhot
Install Type: Bare Metal Distro: Ubuntu 22.04 DE: Gnome Branch: master Commit: git rev-parse --short HEAD
Logs and status if relevant
Screenshots NA Additional context NA