aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores
diff options
context:
space:
mode:
authorLibravatar vantezzen <hello@vantezzen.io>2019-10-13 11:40:22 +0200
committerLibravatar vantezzen <hello@vantezzen.io>2019-10-13 11:40:22 +0200
commiteb71f7118644846b7b443bd632a7ebef71d8db1f (patch)
tree6ababc500e7f7e183e84c25475fccd89e1dbb4df /src/stores
parentPartly fixing #115 (diff)
downloadferdium-app-eb71f7118644846b7b443bd632a7ebef71d8db1f.tar.gz
ferdium-app-eb71f7118644846b7b443bd632a7ebef71d8db1f.tar.zst
ferdium-app-eb71f7118644846b7b443bd632a7ebef71d8db1f.zip
Sort services in QuickSwitch by last used
Diffstat (limited to 'src/stores')
-rw-r--r--src/stores/ServicesStore.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js
index 076ecc204..6120ae023 100644
--- a/src/stores/ServicesStore.js
+++ b/src/stores/ServicesStore.js
@@ -34,6 +34,11 @@ export default class ServicesStore extends Store {
34 34
35 @observable filterNeedle = null; 35 @observable filterNeedle = null;
36 36
37 // Array of service IDs that have recently been used
38 // [0] => Most recent, [n] => Least recent
39 // No service ID should be in the list multiple times, not all service IDs have to be in the list
40 @observable lastUsedServices = [];
41
37 constructor(...args) { 42 constructor(...args) {
38 super(...args); 43 super(...args);
39 44
@@ -325,6 +330,10 @@ export default class ServicesStore extends Store {
325 }); 330 });
326 service.isActive = true; 331 service.isActive = true;
327 332
333 // Update list of last used services
334 this.lastUsedServices = this.lastUsedServices.filter(id => id !== serviceId);
335 this.lastUsedServices.unshift(serviceId);
336
328 this._focusActiveService(); 337 this._focusActiveService();
329 } 338 }
330 339