Question: Which node name in gtk-key-theme should I use to set key bindings for copying text in Firefox

I’m trying to set key bindings theme for Gtk+ app (Firefox in this case) under Wayland using gtk-3.0 theme. I’m using Pop!_OS 20.04.

What I have so far:

```css
@binding-set gtk-mac-alt-arrows
{
  bind "<alt>Right"           { "move-cursor" (words, 1, 0) };
  bind "<alt>KP_Right"        { "move-cursor" (words, 1, 0) };
  bind "<alt>Left"            { "move-cursor" (words, -1, 0) };
  bind "<alt>KP_Left"         { "move-cursor" (words, -1, 0) };
  bind "<shift><alt>Right"    { "move-cursor" (words, 1, 1) };
  bind "<shift><alt>KP_Right" { "move-cursor" (words, 1, 1) };
  bind "<shift><alt>Left"     { "move-cursor" (words, -1, 1) };
  bind "<shift><alt>KP_Left"  { "move-cursor" (words, -1, 1) };
}

@binding-set gtk-mac-alt-delete
{
  bind "<alt>Delete" { "delete-from-cursor" (word-ends, 1) };
  bind "<alt>KP_Delete" { "delete-from-cursor" (word-ends, 1) };
  bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) };
}

@binding-set gtk-mac-clipboard
{
  bind "<super>c" { "copy-clipboard" () };
  bind "<super>x" { "cut-clipboard" () };
  bind "<super>v" { "paste-clipboard" () };
  unbind "<ctrl>c";
  unbind "<ctrl>x";
  unbind "<ctrl>v";
}

@binding-set gtk-mac-entry
{
  bind "<super>a" {
    "move-cursor" (buffer-ends, -1, 0)
    "move-cursor" (buffer-ends, 1, 1)
  };
  bind "<shift><super>a" { "move-cursor" (paragraph-ends, 0, 0) };
  unbind "<ctrl>a";
  unbind "<shift><ctrl>a";
}

@binding-set gtk-mac-text-view
{
  bind "<super>a" { "select-all" (1) };
  bind "<shift><super>a" { "select-all" (0) };
  unbind "<ctrl>a";
  unbind "<shift><ctrl>a";
}

@binding-set gtk-mac-label
{
  bind "<super>a" {
    "move-cursor" (paragraph-ends, -1, 0)
    "move-cursor" (paragraph-ends, 1, 1)
  };
  bind "<shift><super>a" { "move-cursor" (paragraph-ends, 0, 0) };
  bind "<super>c" { "copy-clipboard" () };
  unbind "<ctrl>a";
  unbind "<shift><ctrl>a";
  unbind "<ctrl>c";
}

@binding-set gtk-mac-tree-view
{
  bind "<super>a" { "select-all" () };
  bind "<shift><super>a" { "unselect-all" () };
  bind "<super>f" { "start-interactive-search" () };
  unbind "<ctrl>a";
  unbind "<shift><ctrl>a";
  unbind "<ctrl>f";
}

@binding-set gtk-mac-icon-view
{
  bind "<super>a" { "select-all" () };
  bind "<shift><super>a" { "unselect-all" () };
  unbind "<ctrl>a";
  unbind "<shift><ctrl>a";
}

entry
{
  -gtk-key-bindings: gtk-mac-alt-arrows, gtk-mac-alt-delete, gtk-mac-clipboard, gtk-mac-entry;
}

textview.view
{
  -gtk-key-bindings: gtk-mac-alt-arrows, gtk-mac-alt-delete, gtk-mac-clipboard, gtk-mac-text-view;
}

label
{
  -gtk-key-bindings: gtk-mac-alt-arrows, gtk-mac-label;
}

treeview
{
  -gtk-key-bindings: gtk-mac-tree-view;
}

iconview
{
  -gtk-key-bindings: gtk-mac-icon-view;
}
``` 

Basically the “copy-clipboard” key-bindings is working fine in textarea (set by textview node) and search box (set by entry node) of Firefox. I couldn’t figure out where can I set key-bindings copying text with “c” inside the web page (not editable text)

Please help me find the right node name/class to apply key bindings to.

One more question: I coundn’t find the signal to set key bindings for undo. I searched in the source code and there is only action text.undo, not signal, hence the bind property didn’t work.

  /**
   * GtkTextView|text.undo:
   *
   * Undoes the last change to the contents.
   */
  gtk_widget_class_install_action (widget_class, "text.undo", NULL, gtk_text_view_real_undo);

How can I set the key bindings for actions like this in gtk-key-theme?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.