From fee99a081b8ca23dfb73c4fa0b1ca07cded0c12b Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 9 Mar 2021 13:37:54 +0100 Subject: [PATCH] :bug: Fix problem with system shortcuts and application --- CHANGES.md | 1 + frontend/src/app/main/data/shortcuts.cljs | 20 +++++++++++++++++++ .../app/main/data/workspace/shortcuts.cljs | 16 +++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 9288f3516..c0c979feb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,6 +20,7 @@ - Fix problem with rotated blur [Taiga #1370](https://tree.taiga.io/project/penpot/issue/1370) - Disables buttons in view mode for users without permissions [Taiga #1328](https://tree.taiga.io/project/penpot/issue/1328) - Fix issue when undo after changing the artboard of a shape [Taiga #1304](https://tree.taiga.io/project/penpot/issue/1304) +- Fix problem with system shortcuts and application [#737](https://github.com/penpot/penpot/issues/737) ### :heart: Community contributions by (Thank you!) diff --git a/frontend/src/app/main/data/shortcuts.cljs b/frontend/src/app/main/data/shortcuts.cljs index 03800e992..36b77b32d 100644 --- a/frontend/src/app/main/data/shortcuts.cljs +++ b/frontend/src/app/main/data/shortcuts.cljs @@ -39,6 +39,16 @@ (str "command+" shortcut) (str "ctrl+" shortcut))) +(defn a-mod + "Adds the alt/option modifier to a shortcuts depending on the + operating system for the user" + [shortcut] + (str "alt+" shortcut)) + +(defn ca-mod + [shortcut] + (c-mod (a-mod shortcut))) + (defn bind-shortcuts [shortcuts bind-fn cb-fn] (doseq [[key {:keys [command disabled fn]}] shortcuts] (when-not disabled @@ -61,9 +71,19 @@ "Shift+") key)) +(defn alt [key] + (str + (if (cfg/check-platform? :macos) + mac-option + "Alt+") + key)) + (defn meta-shift [key] (-> key meta shift)) +(defn meta-alt [key] + (-> key meta alt)) + (defn supr [] (if (cfg/check-platform? :macos) mac-delete diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index cefc68be7..9a2302ee3 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -44,20 +44,20 @@ (rx/empty)))))) (def shortcuts - {:toggle-layers {:tooltip (ds/meta "L") - :command (ds/c-mod "l") + {:toggle-layers {:tooltip (ds/alt "L") + :command (ds/a-mod "l") :fn #(st/emit! (dw/go-to-layout :layers))} - :toggle-assets {:tooltip (ds/meta "I") - :command (ds/c-mod "i") + :toggle-assets {:tooltip (ds/alt "I") + :command (ds/a-mod "i") :fn #(st/emit! (dw/go-to-layout :assets))} - :toggle-history {:tooltip (ds/meta "H") - :command (ds/c-mod "h") + :toggle-history {:tooltip (ds/alt "H") + :command (ds/a-mod "h") :fn #(st/emit! (dw/go-to-layout :document-history))} - :toggle-palette {:tooltip (ds/meta "P") - :command (ds/c-mod "p") + :toggle-palette {:tooltip (ds/alt "P") + :command (ds/a-mod "p") :fn #(st/emit! (dw/toggle-layout-flags :colorpalette))} :toggle-rules {:tooltip (ds/meta-shift "R")