1

After having been a Mac user since the classic MacOS days, I recently switched to Debian / Gnome. I knew it would involve major adjustments getting used to the new UI and that's fine. One thing I have trouble getting used to though with 20+ years of muscle memory are the keyboard shortcuts.

The Cmd key on the Mac serves the functions of both Ctrl and Super keys on Linux. Also, many keyboard shortcuts are implemented on the system level and work in all apps. Some examples:

Linux Mac
cycle apps Sup-Tab Cmd-Tab
switch keyboard language layout Sup-Spc Cmd-Spc
close window Ctrl-w Cmd-w
quit app ??? Cmd-q
copy/cut/paste Ctrl-c/x/v Cmd-c/x/v
new doc/win Ctrl-n Cmd-n
Prefs/Settings ??? Cmd-,
jump word Ctrl-le/ri Opt-le/ri
line start/end ??? Cmd-le/ri

The lines with ??? are interesting. To quit an app on Linux, sometimes it's Ctrl-q, sometimes Alt-F4. App Preferences / Settings are all over the place. Libre Office uses Alt-F12. Evolution uses Shift-Ctrl-s. Other apps don't have a shortcut for settings at all. To jump to the beginning or end of a line you could use Home / End on single-line text fields, but I haven't found a way to do this in multi-line text editors.

So I have two questions:

  1. How do these shortcuts conceptually work on Linux? Does every app implement them separately and things like copy/paste just happen to be implemented the same (Ctrl-c/v) in each app? The different keys for Preferences seem to say so. But Gnome does have a section for Keyboard Shortcuts in Settings. So is there also a system-level way to define shortcuts and kind of "force it onto" apps?

  2. Is there a way to remap keys to create a uniform system-wide behavior like on the Mac and also match the Apple Cmd key locations?

Linux modifier keys Apple modifier keys

It would have to involve mapping both the Super and the Ctrl keys to Alt as modifier for certain combinations, see table above, i.e. pressing the physical Alt key plus Tab would act like Super-Tab to cycle through apps and Alt key plus w would act like Ctrl-w to close a window.

Again, I'm using Gnome, which I've learned works with Wayland (not sure yet exactly what that is, but it makes several solutions not work). I've seen solutions like Input Remapper, but it allows only remapping one source and target key. I can switch Alt and Super or Alt and Ctrl but not combine the two. I've also read about xmodmap but it's one of those that apparently doesn't work with Wayland. Kinto looks promising but also doesn't work with Wayland. I've also seen xset and xev mentioned, but I'm not sure if they work in this case and how to use them.

1
  • Jump to beginning/end of the whole text field is often accomplished via [Ctrl]+[Home] and [Ctrl]+[End]. So if you're using Input Remapper, you can set those actions up on a relatively universal level.
    – hife
    Commented Feb 5 at 15:29

1 Answer 1

0

You're asking about two different kinds of shortcuts, which are implemented in different places.

Things like switching between apps or windows are handled by a central component – the window manager – in practically all operating systems. As the window manager ultimately decides the position and stacking order of all windows, it's also where shortcuts like Alt-Tab (switching between windows) or Alt-F4 (closing a window) are implemented as well, allowing them to be globally configurable.

(At least these two particular shortcuts are shared with Windows and the old IBM CUA standard.)

On the other hand, things like copy/paste or text cursor movement must be implemented by the app, as only the app knows what kind of data it's dealing with, and what's currently selected. Most commonly, however, apps are built using an existing UI toolkit such as GTK or Qt which takes care of implementing copy/paste for its standard widgets. This is similar to AppKit or UIKit in macOS.

Among those toolkits, Qt has deliberate integration with the global KDE settings, being able to load various toolkit-level keybindings from global configuration (allowing you to change e.g. the copy/paste keys in theory), but other toolkits generally don't do that. For example, there are no global GNOME settings that a GTK app would use, and it will not care about KDE's either.

(Alongside the traditional ones, it's worth mentioning the issues with cross-platform toolkits which try to adapt to multiple operating systems with varying levels of success – such as Electron, the "web browser pretending it's an app" toolkit that e.g. VSCode uses on both Linux and macOS. Similarly, LibreOffice runs on several operating systems and uses its "VCL" toolkit that can masquerade as either GTK or Qt or as the Windows UI. Web browsers such as Firefox and Chrome also use their own UI toolkits, they're just making a bit more effort at adapting to each individual OS.)

The concept of "preferences" or "settings" is also app-specific – each app has its own way to store settings and its own dialogs; it's not something provided by the OS. The difference is simply that macOS has a bit of stronger push towards its standard HIG guidelines (e.g. Ctrl-, and the "Preferences" terminology) so that developers are more likely to agree on the same set of shortcuts. (GNOME has been slowly improving on this front, adopting a somewhat macOS-inspired style; I'm not familiar with what KDE is like these days.)

...and of course macOS has one desktop environment with one set of guidelines, whereas in Linux you have at least two major environments (GNOME and KDE) with sometimes conflicting ideals. Running something like Kate (the main KDE editor) in a GNOME environment, or vice versa, will always feel a little out-of-place. Not to mention the various Electron-based apps like VSCode.

To quit an app on Linux, sometimes it's Ctrl-q, sometimes Alt-F4

Alt-F4 is implemented as a window manager shortcut (most WMs using it by convention), so it's configurable globally and can operate on any window regardless of the app. However, it's not a "quit app" shortcut, it really just closes the single window.

Ctrl-Q, on the other hand, is an app-specific shortcut.

To jump to the beginning or end of a line you could use Home / End on single-line text fields, but I haven't found a way to do this in multi-line text editors.

While each toolkit (and especially the custom widgets within apps) might have different shortcuts, I haven't seen one that wouldn't support Home/End – it's pretty much universal. To jump to the start of the first line, or to the end of the last line, the shortcut is Ctrl-Home/End (just like in Windows).

1
  • Thank you, that really helps with my first question! It's much clearer now why it is the way it is. I wish I could upvote your answer, but I'm still new here and it says: "You need at least 15 reputation to cast a vote".
    – Stacker
    Commented Mar 23, 2023 at 10:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .