18

I just saw a weird shortcut in dconf-editor:

<Primary><Alt>KP_End

What is <Primary>?

I also saw an Above-Tab key. I completely understand what that is referring to, but were are those key names defined?

14

<Primary> is a gtk+ thing.
gtk+ 2.24.7 & gtk+ 3.2.1 introduced the concept of a platform-agnostic accelerator modifier, <Primary>, which can be used instead of <Control>:

a new facility is provided in Gtk+ (as of this writing it is in Git for Gtk+-2.24, and released in Gtk+-3.2.0) to use the <Primary> descriptor in place of <Control> for accelerators and bindings. This will map the accelerator to Command on OSX and to Control for anything else.1

As per this commit:

gtk: allow to specify accelerators in a platform-independent way. Introduce <Primary> in accelerator strings, which resolves to GDK_CONTROL_MASK on X11/Win23, and to GDK_META_MASK on quartz.

it is defined (along with other accelerators) in gtkaccelgroup.c

gtk_accelerator_name (guint accelerator_key,
                     GdkModifierType accelerator_mods)
{
  static const gchar text_release[] = "<Release>";
  static const gchar text_primary[] = "<Primary>";
  static const gchar text_shift[] = "<Shift>";
  static const gchar text_control[] = "<Control>";
  static const gchar text_mod1[] = "<Alt>";
  static const gchar text_mod2[] = "<Mod2>";
  static const gchar text_mod3[] = "<Mod3>";
  static const gchar text_mod4[] = "<Mod4>";
  static const gchar text_mod5[] = "<Mod5>";
  static const gchar text_meta[] = "<Meta>";
  static const gchar text_super[] = "<Super>";
  static const gchar text_hyper[] = "<Hyper>";

<Above_tab> is a window manager thing.
As per this commit in metacity:

We want switching between the windows of an application to be an easily accessible operation. The convenient and memorable keybinding is the key above the tab key - but the keysym for that key isn't consistent across different keyboard layouts. Add code that figures out the key from the XKB geometry and a magic keysym name "Above_Tab" that refers to this key and switch the default binding for cycle_group to Above_Tab

See also this commit in mutter and source files meta-accel-parse.c and meta-accel-parse.h

  • Gosh, how confusing. Do you mean it’s normally a GNOME thing, except that Above-Tab and Primary are mutter-only?? (I.e. only mutter can understand shortcut descriptions containing those?) – Robert Siemer Nov 17 '14 at 22:09
5

<Primary> usually means Ctrl Super (aka Windows button), but can be redefined (I have seen it mapped to CtrlShift in some places). The GNOME wiki says:

The primary system modifier key should be (Super/Windows/Command key).

Argh. There is some confusion here. Though the GNOME Wiki says the "primary system modifier key", this may in fact be different from the "primary key". Two forum posts note that Primary is Ctrl, as I originally thought. There's a two-year-old (fixed) bug about confusion in Ctrl and Primary filed against compiz in Ubuntu, which says:

Previously we used to call the control key <Control> but this has now been changed in GNOME so when the control key is pressed <primary> is returned. In compiz we set keyboard shortcuts as (for example) <Control><Alt><Left>.

I'm left with trial-and-error: try Ctrl first, then Super.

  • 2
    <Primary> is not Super, as you realised; that's just unfortunately ambiguous wording. Still, it's very much not defined as Ctrl - i.e. it isn't on OS X. Its purpose is to map to the host system's main modifier key, which on OS X is Command. This lets applications using GTK+ automatically get shortcuts that match native OS X applications (e.g. Command+Z to undo) and aren't unusual/jarring (as Ctrl is used for different things there). – underscore_d Mar 8 '17 at 22:43
  • This answer is very muddled! <Primary> certainly does mean <Control> (Ctrl) in Gtk context on non-Macs and Command () on Mac machines. For example quit Ctrl+q now automatically mapped to ⌘+q. Also the wiki page you quoted is only talking about <Super> nothing to do with <Primary>. – Cas Jun 26 '17 at 20:24
  • @Cas well, good to know they updated the wiki. – muru Jun 26 '17 at 20:29
  • Would it be possible to remap Primary to Super on non-quartz (without rebuilding)? – Edoardo Vacchi Nov 25 '18 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.