diff options
author | Stefan Malzner <stefan@adlk.io> | 2017-10-30 10:41:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-30 10:41:28 +0100 |
commit | c8d97d1ec83ffe9efcc77618a2d72a66e099f9dc (patch) | |
tree | 3c72287bf9b4ce34efde0d8665b793cc3fe53805 /src | |
parent | Merge pull request #150 from meetfranz/feature/menu (diff) | |
parent | Merge branch 'develop' into feature/shortcuts (diff) | |
download | ferdium-app-c8d97d1ec83ffe9efcc77618a2d72a66e099f9dc.tar.gz ferdium-app-c8d97d1ec83ffe9efcc77618a2d72a66e099f9dc.tar.zst ferdium-app-c8d97d1ec83ffe9efcc77618a2d72a66e099f9dc.zip |
Merge pull request #151 from meetfranz/feature/shortcuts
Improve shortcuts
Diffstat (limited to 'src')
-rw-r--r-- | src/environment.js | 11 | ||||
-rw-r--r-- | src/lib/Menu.js | 6 | ||||
-rw-r--r-- | src/stores/AppStore.js | 4 |
3 files changed, 15 insertions, 6 deletions
diff --git a/src/environment.js b/src/environment.js index e185120c0..7bb2db134 100644 --- a/src/environment.js +++ b/src/environment.js | |||
@@ -8,7 +8,16 @@ export const isMac = process.platform === 'darwin'; | |||
8 | export const isWindows = process.platform === 'win32'; | 8 | export const isWindows = process.platform === 'win32'; |
9 | export const isLinux = process.platform === 'linux'; | 9 | export const isLinux = process.platform === 'linux'; |
10 | 10 | ||
11 | export const ctrlKey = isMac ? '⌘' : 'Ctrl'; | 11 | let ctrlShortcutKey; |
12 | if (isMac) { | ||
13 | ctrlShortcutKey = '⌘'; | ||
14 | } else if (isWindows) { | ||
15 | ctrlShortcutKey = 'Ctrl'; | ||
16 | } else { | ||
17 | ctrlShortcutKey = 'Alt'; | ||
18 | } | ||
19 | |||
20 | export const ctrlKey = ctrlShortcutKey; | ||
12 | 21 | ||
13 | let api; | 22 | let api; |
14 | if (!isDevMode || (isDevMode && useLiveAPI)) { | 23 | if (!isDevMode || (isDevMode && useLiveAPI)) { |
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index c29cd00ae..6bbf302ca 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -1,7 +1,7 @@ | |||
1 | import { remote, shell } from 'electron'; | 1 | import { remote, shell } from 'electron'; |
2 | import { autorun, computed, observable, toJS } from 'mobx'; | 2 | import { autorun, computed, observable, toJS } from 'mobx'; |
3 | 3 | ||
4 | import { isMac } from '../environment'; | 4 | import { isMac, isLinux } from '../environment'; |
5 | 5 | ||
6 | const { app, Menu, dialog } = remote; | 6 | const { app, Menu, dialog } = remote; |
7 | 7 | ||
@@ -133,7 +133,6 @@ export default class FranzMenu { | |||
133 | }, | 133 | }, |
134 | }); | 134 | }); |
135 | 135 | ||
136 | |||
137 | tpl[1].submenu.unshift({ | 136 | tpl[1].submenu.unshift({ |
138 | label: 'Reload Service', | 137 | label: 'Reload Service', |
139 | id: 'reloadService', | 138 | id: 'reloadService', |
@@ -277,9 +276,10 @@ export default class FranzMenu { | |||
277 | const services = this.stores.services.enabled; | 276 | const services = this.stores.services.enabled; |
278 | 277 | ||
279 | if (this.stores.user.isLoggedIn) { | 278 | if (this.stores.user.isLoggedIn) { |
279 | const systemAcceleratorKey = isLinux ? 'Alt' : 'CmdOrCtrl'; | ||
280 | return services.map((service, i) => ({ | 280 | return services.map((service, i) => ({ |
281 | label: service.name, | 281 | label: service.name, |
282 | accelerator: i <= 9 ? `CmdOrCtrl+${i + 1}` : null, | 282 | accelerator: i <= 9 ? `${systemAcceleratorKey}+${i + 1}` : null, |
283 | type: 'radio', | 283 | type: 'radio', |
284 | checked: service.isActive, | 284 | checked: service.isActive, |
285 | click: () => { | 285 | click: () => { |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 4cfe6d0b5..f608a689e 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -114,13 +114,13 @@ export default class AppStore extends Store { | |||
114 | 114 | ||
115 | // Set active the next service | 115 | // Set active the next service |
116 | key( | 116 | key( |
117 | '⌘+pagedown, ctrl+pagedown, ⌘+shift+tab, ctrl+shift+tab', () => { | 117 | '⌘+pagedown, ctrl+pagedown, ⌘+tab, ctrl+tab', () => { |
118 | this.actions.service.setActiveNext(); | 118 | this.actions.service.setActiveNext(); |
119 | }); | 119 | }); |
120 | 120 | ||
121 | // Set active the prev service | 121 | // Set active the prev service |
122 | key( | 122 | key( |
123 | '⌘+pageup, ctrl+pageup, ⌘+tab, ctrl+tab', () => { | 123 | '⌘+pageup, ctrl+pageup, ⌘+shift+tab, ctrl+shift+tab', () => { |
124 | this.actions.service.setActivePrev(); | 124 | this.actions.service.setActivePrev(); |
125 | }); | 125 | }); |
126 | 126 | ||