You are not logged in.
Was looking for a way to change xfce4-terminal paste from control + shift + v to super + v.
Searching I've found this topic
Then I thought, is there a way to change Primary for GTK, so swap most of command I do using control to use super?
If anyone is interested, my work computer is a Mac and I think I can make my life easier if both have same shortcut, as I use same keyboard for both computers, personal and work.
thought about try to get in the code, as I found a mention to it in this Stack Overflow Answer.
By looking into the source file linked in the answer, I've found that the mention code had changed a lot since this answer print.
By searching for "primary" in GitHub "this repository" search, found a really bit amount of code. Some defining hotkeys using primary and others with something that looks to be a primary color.
Does anyone has any idea of how to change it?
As they introduced it as "<Primary>" instead of just control, the reason may be to change it easily system wide.
Just remember, I also grep for primary in /etc/ and .config/. Just listing the file names, didn't find anything promising.
Update:
Just checkout GTK3, the same tag as a have installed in my system, found using pacman -Qi gtk3.
Didn't find any "attribution" to "<Primary>".
$ rg '<Primary>'
examples/bp/bloatpad.c: { "app.new", { "<Primary>n", NULL } },
examples/bp/bloatpad.c: { "app.quit", { "<Primary>q", NULL } },
examples/bp/bloatpad.c: { "win.copy", { "<Primary>c", NULL } },
examples/bp/bloatpad.c: { "win.paste", { "<Primary>p", NULL } },
examples/bp/bloatpad.c: { "win.justify::left", { "<Primary>l", NULL } },
examples/bp/bloatpad.c: { "win.justify::center", { "<Primary>m", NULL } },
examples/bp/bloatpad.c: { "win.justify::right", { "<Primary>r", NULL } }
examples/bp/bloatpad.c: const gchar *new_accels[] = { "<Primary>n", "<Primary>t", NULL };
testsuite/gtk/accel.c: test_one_accel ("<Primary><Alt>z", "Ctrl+Alt+Z", TRUE);
testsuite/gtk/accel.c: test_one_accel ("<Primary>KP_7", "Ctrl+7", TRUE);
NEWS: - Support '<Primary>' in accelerator strings
demos/widget-factory/widget-factory.c: { "app.quit", { "<Primary>q", NULL } },
demos/widget-factory/widget-factory.c: { "win.dark", { "<Primary>d", NULL } },
demos/widget-factory/widget-factory.c: { "win.search", { "<Primary>s", NULL } },
demos/widget-factory/widget-factory.c: { "win.background", { "<Primary>b", NULL } },
demos/widget-factory/widget-factory.c: { "win.open", { "<Primary>o", NULL } },
demos/widget-factory/widget-factory.c: { "win.record", { "<Primary>r", NULL } },
demos/widget-factory/widget-factory.c: { "win.lock", { "<Primary>l", NULL } },
gtk/gtkapplication-quartz.c: const gchar *pref_accel[] = {"<Primary>comma", NULL};
gtk/gtkapplication-quartz.c: const gchar *hide_others_accel[] = {"<Primary><Alt>h", NULL};
gtk/gtkapplication-quartz.c: const gchar *hide_accel[] = {"<Primary>h", NULL};
gtk/gtkapplication-quartz.c: const gchar *quit_accel[] = {"<Primary>q", NULL};
gtk/gtkaccelgroup.c: static const gchar text_primary[] = "<Primary>";
gtk/gtkapplication.c: const gchar * const accels[] = { "<Primary>F1", "<Primary>question", NULL };
gtk/gtkapplication.c: * e.g. "<Primary>q" or “<Control><Alt>p”.Last edited by wviana (2022-03-25 04:29:01)
Offline
I'm not sure I understand all of this as I don't use GTK, but it sounds like you'd be better of just using an override for the keyboard map to make the changes you want.
And if you really just want to swap keys to mimic a OSX layout it's likely even easier as there are XKB_DEFAULT_OPTIONS settings for just that purpose. I think the goal you are describing is what is acheived with the ctrl:swap_lwin_lctl setting (see `man xkeyboard-config`).
Last edited by Trilby (2022-03-25 04:20:34)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
And if you really just want to swap keys to mimic a OSX layout it's likely even easier as there are XKB_DEFAULT_OPTIONS settings for just that purpose. I think the goal you are describing is what is acheived with the ctrl:swap_lwin_lctl setting (see `man xkeyboard-config`).
Thanks for answering.
Don't think that will get me nice results as it would swap keys for everything. A nice thing I have on mac for using command it that I can use control + c to terminal sigtem and command + c to copy into clipboard.
Last edited by wviana (2022-03-25 14:06:34)
Offline
Then I think you'll need to clarify your goal, as in your initial post you did say you wanted to swap control and "super":
Then I thought, is there a way to change Primary for GTK, so swap most of command I do using control to use super?
Admittedly you did say for "most commands", but we - and more importantly your computer - cannot read your mind to know what you'd want swapped and what you don't. So what is your actual goal?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
https://gitlab.gnome.org/GNOME/gtk/-/issues/1669
Also from the Qt docs:
Note: On macOS, references to "Ctrl", Qt::CTRL, Qt::Key_Control and Qt::ControlModifier correspond to the Command keys on the Macintosh keyboard, and references to "Meta", Qt::META, Qt::Key_Meta and Qt::MetaModifier correspond to the Control keys. Developers on macOS can use the same shortcut descriptions across all platforms, and their applications will automatically work as expected on macOS.
I'd swap the keys and configure the terminal to use a different combo (meta or super + c) for sigint, https://unix.stackexchange.com/question … o-send-sig (no idea for xfce4-terminal)
Offline
I have a similar problem. I'm running Thunar with i3, but no desktop managers. I want to change the <Primary> key in Thunar, which is used in ~/.config/Thunar/accels.scm, for example,
$ cat .config/Thunar/accels.scm
; thunar GtkAccelMap rc-file -*- scheme -*-
; this file is an automated accelerator map dump
;
; (gtk_accel_path "<Actions>/ThunarLauncher/delete-3" "<Shift>KP_Delete")
; (gtk_accel_path "<Actions>/ThunarLauncher/delete" "")
; (gtk_accel_path "<Actions>/ThunarStandardView/invert-selection" "")
; (gtk_accel_path "<Actions>/ThunarLauncher/open-in-new-tab" "<Primary><Shift>p")
; (gtk_accel_path "<Actions>/ThunarLauncher/delete-2" "<Shift>Delete")
...but I can't figure out how. Nothing from gsettings list-recursively, xfconf-query -c xfce4-keyboard-shortcuts -l -v, nor gtk-query-settings seems helpful. Instead I'm just changing <Primary> to <Super> which works for what I need. If anyone knows how, that would be nice.
Offline
Hi, this topic is of interest to me. I mostly stick to GNOME, and I also use a Mac frequently enough that switching keyboard layouts and xkb configs isn't the best solution for me. I've taken some recent steps in exploring the source code for Nautilus (a.k.a. GNOME Files) to see what it would take to make it expect <Super> instead of <Control> and came up with a patch that mostly gets the job done. I'll link it here in case others would find it useful.
I also started looking at the gtk-3.0 source to see what it would take to make <Primary> be treated as GDK_SUPER_MASK rather than GDK_CONTROL_MASK, and it does seem straightforward enough to patch gdk/gdkkeys.c and recompile (look for "case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:"). However, the unfortunate reality is many apps (including Nautilus) do still explicitly refer to <control> or even GDK_CONTROL_MASK rather than <primary> which means not all apps will respect this preference without additional patching.
Last edited by dctucker (2025-08-13 19:24:17)
Offline