Skip to content

Commit

Permalink
Add link to custom shortcuts (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored May 23, 2023
1 parent 167352a commit 018a8c3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/Plug.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class Pantheon.Keyboard.Plug : Switchboard.Plug {
settings.set ("input/keyboard/behavior", "Behavior");
settings.set ("input/keyboard/inputmethod", "Input Method");
settings.set ("input/keyboard/shortcuts", "Shortcuts");
settings.set ("input/keyboard/shortcuts/custom", "Custom Shortcuts");
Object (category: Category.HARDWARE,
code_name: "io.elementary.switchboard.keyboard",
display_name: _("Keyboard"),
Expand Down Expand Up @@ -82,6 +83,10 @@ public class Pantheon.Keyboard.Plug : Switchboard.Plug {
public override void search_callback (string location) {
switch (location) {
default:
case "Custom Shortcuts":
stack.visible_child_name = "shortcuts";
((Keyboard.Shortcuts.Page) stack.get_child_by_name ("shortcuts")).open_custom_shortcuts ();
break;
case "Shortcuts":
stack.visible_child_name = "shortcuts";
break;
Expand Down
13 changes: 11 additions & 2 deletions src/Views/Shortcuts.vala
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,26 @@ namespace Pantheon.Keyboard.Shortcuts {
}

class Page : Gtk.Grid {
private Gtk.ListBox section_switcher;
private SwitcherRow custom_shortcuts_row;

construct {
CustomShortcutSettings.init ();

list = new List ();
settings = new Shortcuts.Settings ();

var section_switcher = new Gtk.ListBox ();
section_switcher = new Gtk.ListBox ();
section_switcher.add (new SwitcherRow (list.windows_group));
section_switcher.add (new SwitcherRow (list.workspaces_group));
section_switcher.add (new SwitcherRow (list.screenshot_group));
section_switcher.add (new SwitcherRow (list.launchers_group));
section_switcher.add (new SwitcherRow (list.media_group));
section_switcher.add (new SwitcherRow (list.a11y_group));
section_switcher.add (new SwitcherRow (list.system_group));
section_switcher.add (new SwitcherRow (list.custom_group));

custom_shortcuts_row = new SwitcherRow (list.custom_group);
section_switcher.add (custom_shortcuts_row);

section_switcher.select_row (section_switcher.get_row_at_index (0));

Expand Down Expand Up @@ -144,6 +149,10 @@ namespace Pantheon.Keyboard.Shortcuts {
});
}

public void open_custom_shortcuts () {
section_switcher.select_row (custom_shortcuts_row);
}

public bool system_shortcut_conflicts (Shortcut shortcut, out string name, out string group) {
name = "";
group = "";
Expand Down

0 comments on commit 018a8c3

Please sign in to comment.