mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-06-13 09:56:56 +00:00
feat: add keyboard shortcuts (#777)
This commit is contained in:
parent
24a51e876e
commit
2f9f8791ed
|
@ -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>
|
||||
|
|
59
data/ui/help_overlay.blp
Normal file
59
data/ui/help_overlay.blp
Normal file
|
@ -0,0 +1,59 @@
|
|||
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", "Go to the Colors Section");
|
||||
action-name: "app.switch_to_colors_page";
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Go to the Theming Section");
|
||||
action-name: "app.switch_to_theming_page";
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Go to the Advanced Section");
|
||||
action-name: "app.switch_to_advanced_page";
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Preferences");
|
||||
action-name: "app.preferences";
|
||||
}
|
||||
|
||||
ShortcutsShortcut {
|
||||
title: C_("shortcut window", "Quit");
|
||||
action-name: "app.quit";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -130,16 +130,28 @@ class GradienceApplication(Adw.Application):
|
|||
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("switch_to_colors_page",
|
||||
self.win.switch_to_colors_page, ["<alt>1"])
|
||||
|
||||
self.actions.create_action("switch_to_theming_page",
|
||||
self.win.switch_to_theming_page, ["<alt>2"])
|
||||
|
||||
self.actions.create_action("switch_to_advanced_page",
|
||||
self.win.switch_to_advanced_page, ["<alt>3"])
|
||||
|
||||
self.actions.create_action("about",
|
||||
self.show_about_window)
|
||||
|
|
|
@ -43,6 +43,8 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
|||
content_theming = Gtk.Template.Child("content-theming")
|
||||
content_plugins = Gtk.Template.Child("content-plugins")
|
||||
|
||||
view_stack = Gtk.Template.Child()
|
||||
|
||||
toast_overlay = Gtk.Template.Child()
|
||||
|
||||
save_preset_button = Gtk.Template.Child("save-preset-button")
|
||||
|
@ -79,6 +81,16 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
|||
self.connect("unrealize",
|
||||
self.save_window_props)
|
||||
|
||||
def switch_to_colors_page(self, *args):
|
||||
self.view_stack.set_visible_child_name("colors")
|
||||
|
||||
def switch_to_theming_page(self, *args):
|
||||
self.view_stack.set_visible_child_name("theming")
|
||||
|
||||
def switch_to_advanced_page(self, *args):
|
||||
self.view_stack.set_visible_child_name("plugins")
|
||||
|
||||
|
||||
def setup(self):
|
||||
# Set devel style
|
||||
if build_type == "debug":
|
||||
|
|
|
@ -5,6 +5,7 @@ data/ui/app_type_dialog.blp
|
|||
data/ui/builtin_preset_row.blp
|
||||
data/ui/custom_css_group.blp
|
||||
data/ui/explore_preset_row.blp
|
||||
data/ui/help_overlay.blp
|
||||
data/ui/monet_theming_group.blp
|
||||
data/ui/log_out_dialog.blp
|
||||
data/ui/no_plugin_window.blp
|
||||
|
|
Loading…
Reference in a new issue