Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

feat: add keyboard shortcuts (#776) #777

Merged
merged 3 commits into from
May 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/gradience.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<file preprocess="xml-stripblanks">ui/theming_empty_group.ui</file>
<file preprocess="xml-stripblanks">ui/welcome_window.ui</file>
<file preprocess="xml-stripblanks">ui/window.ui</file>
<file preprocess="xml-stripblanks" alias="gtk/help-overlay.ui">ui/help_overlay.ui</file>

<file>images/welcome.svg</file>
<file>style.css</file>
</gresource>
Expand Down
44 changes: 44 additions & 0 deletions data/ui/help_overlay.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Gtk 4.0;

ShortcutsWindow help_overlay {
modal: true;

ShortcutsSection {
section-name: "shortcuts";
max-height: 10;

ShortcutsGroup {
title: C_("shortcut window", "General");

ShortcutsShortcut {
title: C_("shortcut window", "Show Shortcuts");
action-name: "win.show-help-overlay";
}

ShortcutsShortcut {
title: C_("shortcut window", "Show Apply Dialog");
action-name: "app.apply_color_scheme";
}

ShortcutsShortcut {
title: C_("shortcut window", "Manage Presets");
action-name: "app.manage_presets";
}

ShortcutsShortcut {
title: C_("shortcut window", "Save Preset");
action-name: "app.save_preset";
}

ShortcutsShortcut {
title: C_("shortcut window", "Preferences");
action-name: "app.preferences";
}

ShortcutsShortcut {
title: C_("shortcut window", "Quit");
action-name: "app.quit";
}
}
}
}
1 change: 1 addition & 0 deletions data/ui/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ blueprints = custom_target('blueprints',
'preset_row.blp',
'builtin_preset_row.blp',
'explore_preset_row.blp',
'help_overlay.blp',
'save_dialog.blp',
'shell_prefs_window.blp',
'shell_theming_group.blp',
Expand Down
5 changes: 5 additions & 0 deletions data/ui/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ menu main-menu {
action: "app.preferences";
}

item {
label: _("Keyboard Shortcuts");
action: "win.show-help-overlay";
}

item {
label: _("About Gradience");
action: "app.about";
Expand Down
11 changes: 7 additions & 4 deletions gradience/frontend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,19 @@ def do_activate(self):
self.open_preset_directory)

self.actions.create_action("apply_color_scheme",
self.show_apply_color_scheme_dialog)
self.show_apply_color_scheme_dialog, ["<primary>Return"])

self.actions.create_action("manage_presets",
self.show_presets_manager)
self.show_presets_manager, ["<primary>m"])

self.actions.create_action("preferences",
self.show_preferences)
self.show_preferences, ["<primary>comma"])

self.actions.create_action("save_preset",
self.show_save_preset_dialog)
self.show_save_preset_dialog, ["<primary>s"])

self.actions.create_action("quit",
self.win.on_close_request, ["<primary>q"])

self.actions.create_action("about",
self.show_about_window)
Expand Down