-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyboard Shortcut Improvements #2683
base: main
Are you sure you want to change the base?
Changes from all commits
5e4be2a
965f8e7
bf20e18
d808f46
a7a8119
54b60a6
0b9ead7
4f9609d
8b6c6e3
ac9cf19
252334f
eb2bfa5
8d2e990
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,6 +91,10 @@ def __init__(self): | |
self.__create_action('import', self.__show_importer_view, ['<primary>i']) | ||
self.__create_action('preferences', self.__show_preferences, ['<primary>comma']) | ||
self.__create_action('help', self.__help, ['F1']) | ||
self.__create_action('new', self.__new_bottle, ['<primary>n']) | ||
self.__create_action('switch_to_bottles_page', self.__show_bottles_view, ['<alt>1']) | ||
self.__create_action('switch_to_library_page', self.__show_library_view, ['<alt>2']) | ||
self.__create_action('go_back', self.__go_back, ['<alt>Left']) | ||
|
||
self.__register_arguments() | ||
|
||
|
@@ -265,6 +269,9 @@ def __show_preferences(self, *args): | |
preferences_window = PreferencesWindow(self.win) | ||
preferences_window.present() | ||
|
||
def __new_bottle(self, *args): | ||
self.win.show_add_view() | ||
|
||
def __show_importer_view(self, widget=False, *args): | ||
self.win.main_leaf.set_visible_child(self.win.page_importer) | ||
|
||
|
@@ -336,6 +343,15 @@ def __show_about_window(self, *_args): | |
about_window.set_transient_for(self.win) | ||
about_window.present() | ||
|
||
def __show_library_view(self, *_args): | ||
self.win.stack_main.set_visible_child_name("page_library") | ||
|
||
def __show_bottles_view(self, *_args): | ||
self.win.stack_main.set_visible_child_name("page_list") | ||
|
||
def __go_back(self, *_args): | ||
self.win.main_leaf.navigate(Adw.NavigationDirection.BACK) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tested it locally and it doesn't work well in practice. Instead of going back a page, it goes to the main page when I press Alt+Left: 2023-06-24.08-39-24.mp4There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noted this too, thats why i didn't add this once to the keyboard shortcuts window, the reason for this being we have two separate leaflets, this should be fixed automatically when we switch to AdwNavigationView. |
||
|
||
def __create_action(self, name, callback, shortcuts=None, param=None): | ||
"""Add an application action. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
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", "New Bottle"); | ||
action-name: "app.new"; | ||
} | ||
|
||
ShortcutsShortcut { | ||
title: C_("shortcut window", "Import Bottle"); | ||
action-name: "app.import"; | ||
} | ||
|
||
ShortcutsShortcut { | ||
title: C_("shortcut window", "Preferences"); | ||
action-name: "app.preferences"; | ||
} | ||
|
||
ShortcutsShortcut { | ||
title: C_("shortcut window", "Documentation"); | ||
action-name: "app.help"; | ||
} | ||
|
||
ShortcutsShortcut { | ||
title: C_("shortcut window", "Show Shortcuts"); | ||
action-name: "win.show-help-overlay"; | ||
} | ||
|
||
ShortcutsShortcut { | ||
title: C_("shortcut window", "Quit"); | ||
action-name: "app.quit"; | ||
} | ||
|
||
ShortcutsShortcut { | ||
title: C_("shortcut window", "Switch to Bottles view"); | ||
action-name: "app.switch_to_bottles_page"; | ||
} | ||
|
||
ShortcutsShortcut { | ||
title: C_("shortcut window", "Switch to Library view"); | ||
action-name: "app.switch_to_library_page"; | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding Escape would help.