From 80270a45ee79ed26e6588f1097f2daef964a51c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Genov=C3=A9s?= Date: Sat, 6 Apr 2019 20:19:53 +0200 Subject: [PATCH 1/2] Fix and improve shortcuts --- data/media/css/_gtk_base.css | 6 -- data/ui/Shortcuts.ui | 119 ++++++++++++++++++++++++++--------- uberwriter/application.py | 3 + 3 files changed, 92 insertions(+), 36 deletions(-) diff --git a/data/media/css/_gtk_base.css b/data/media/css/_gtk_base.css index 399e8c2..fdbf0cf 100644 --- a/data/media/css/_gtk_base.css +++ b/data/media/css/_gtk_base.css @@ -4,11 +4,6 @@ inclusion in templates */ -@binding-set window-bindings { - bind "w" { "close-window" () }; - bind "b" { "toggle-bibtex" () }; -} - @binding-set editor-bindings { bind "i" { "insert-italic" () }; bind "b" { "insert-bold" () }; @@ -25,7 +20,6 @@ /* Main window and text colors */ .uberwriter_window { - -gtk-key-bindings: window-bindings; /*border-radius: 7px 7px 3px 3px;*/ background: @background_color; caret-color: @foreground_color; diff --git a/data/ui/Shortcuts.ui b/data/ui/Shortcuts.ui index 3234844..4929669 100644 --- a/data/ui/Shortcuts.ui +++ b/data/ui/Shortcuts.ui @@ -46,6 +46,12 @@ <Primary>w + + + + + True + Modes True @@ -60,13 +66,6 @@ <Primary>t - - - True - Fullscreen - F11 - - True @@ -74,6 +73,19 @@ <Primary>p + + + True + Fullscreen + F11 + + + + + + + True + Search True @@ -84,9 +96,9 @@ - + True - Editor + Markdown True @@ -115,6 +127,13 @@ <Primary>b + + + True + Strikeout + <Shift><Primary>D + + True @@ -122,27 +141,6 @@ <Primary>h - - - True - Cut - <Primary>x - - - - - True - Copy - <Primary>c - - - - - True - Paste - <Primary>v - - True @@ -152,6 +150,67 @@ + + + True + Copy and paste + + + True + Copy selected text to clipboard + <Primary>C + + + + + True + Cut selected text to clipboard + <Primary>X + + + + + True + Paste selected text from clipboard + <Primary>V + + + + + + + True + Undo and redo + + + True + Undo previous command + <Primary>Z + + + + + True + Redo previous command + <Shift><Primary>Z + + + + + + + True + Selection + + + True + Select all text + <Primary>A + + + + + diff --git a/uberwriter/application.py b/uberwriter/application.py index 5123b01..304fed1 100644 --- a/uberwriter/application.py +++ b/uberwriter/application.py @@ -148,6 +148,8 @@ class Application(Gtk.Application): # Shortcuts + # TODO: be aware that a couple of shortcuts are defined in _gtk_base.css + self.set_accels_for_action("app.focus_mode", ["d"]) self.set_accels_for_action("app.hemingway_mode", ["t"]) self.set_accels_for_action("app.fullscreen", ["F11"]) @@ -159,6 +161,7 @@ class Application(Gtk.Application): self.set_accels_for_action("app.open", ["o"]) self.set_accels_for_action("app.save", ["s"]) self.set_accels_for_action("app.save_as", ["s"]) + self.set_accels_for_action("app.quit", ["w", "q"]) self.apply_current_theme() From 23c1b2e42a37a10ebb377e84d8aacc7cca0e9702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Genov=C3=A9s?= Date: Sat, 6 Apr 2019 20:19:53 +0200 Subject: [PATCH 2/2] Fix and improve shortcuts --- data/media/css/_gtk_base.css | 6 -- data/ui/Shortcuts.ui | 128 ++++++++++++++++++++++++++--------- uberwriter/application.py | 3 + 3 files changed, 100 insertions(+), 37 deletions(-) diff --git a/data/media/css/_gtk_base.css b/data/media/css/_gtk_base.css index 399e8c2..fdbf0cf 100644 --- a/data/media/css/_gtk_base.css +++ b/data/media/css/_gtk_base.css @@ -4,11 +4,6 @@ inclusion in templates */ -@binding-set window-bindings { - bind "w" { "close-window" () }; - bind "b" { "toggle-bibtex" () }; -} - @binding-set editor-bindings { bind "i" { "insert-italic" () }; bind "b" { "insert-bold" () }; @@ -25,7 +20,6 @@ /* Main window and text colors */ .uberwriter_window { - -gtk-key-bindings: window-bindings; /*border-radius: 7px 7px 3px 3px;*/ background: @background_color; caret-color: @foreground_color; diff --git a/data/ui/Shortcuts.ui b/data/ui/Shortcuts.ui index 3234844..d955337 100644 --- a/data/ui/Shortcuts.ui +++ b/data/ui/Shortcuts.ui @@ -42,10 +42,23 @@ True - Quit + Close document <Primary>w + + + True + Quit application + <Primary>q + + + + + + + True + Modes True @@ -60,13 +73,6 @@ <Primary>t - - - True - Fullscreen - F11 - - True @@ -74,6 +80,19 @@ <Primary>p + + + True + Fullscreen + F11 + + + + + + + True + Search True @@ -84,9 +103,9 @@ - + True - Editor + Markdown True @@ -115,6 +134,13 @@ <Primary>b + + + True + Strikeout + <Shift><Primary>D + + True @@ -122,27 +148,6 @@ <Primary>h - - - True - Cut - <Primary>x - - - - - True - Copy - <Primary>c - - - - - True - Paste - <Primary>v - - True @@ -152,6 +157,67 @@ + + + True + Copy and paste + + + True + Copy selected text to clipboard + <Primary>C + + + + + True + Cut selected text to clipboard + <Primary>X + + + + + True + Paste selected text from clipboard + <Primary>V + + + + + + + True + Undo and redo + + + True + Undo previous command + <Primary>Z + + + + + True + Redo previous command + <Shift><Primary>Z + + + + + + + True + Selection + + + True + Select all text + <Primary>A + + + + + diff --git a/uberwriter/application.py b/uberwriter/application.py index 5123b01..304fed1 100644 --- a/uberwriter/application.py +++ b/uberwriter/application.py @@ -148,6 +148,8 @@ class Application(Gtk.Application): # Shortcuts + # TODO: be aware that a couple of shortcuts are defined in _gtk_base.css + self.set_accels_for_action("app.focus_mode", ["d"]) self.set_accels_for_action("app.hemingway_mode", ["t"]) self.set_accels_for_action("app.fullscreen", ["F11"]) @@ -159,6 +161,7 @@ class Application(Gtk.Application): self.set_accels_for_action("app.open", ["o"]) self.set_accels_for_action("app.save", ["s"]) self.set_accels_for_action("app.save_as", ["s"]) + self.set_accels_for_action("app.quit", ["w", "q"]) self.apply_current_theme()