From 7eed87f7f0910716d58b356148d9179469c23124 Mon Sep 17 00:00:00 2001 From: anaximeno Date: Fri, 20 Sep 2024 21:46:29 -0100 Subject: [PATCH] Set idle tracker feature for a future update --- .../5.4/extension.js | 45 ++++++++++--------- .../5.4/mouseMovementTracker.js | 26 +++-------- .../5.4/settings-schema.json | 2 +- 3 files changed, 30 insertions(+), 43 deletions(-) diff --git a/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/extension.js b/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/extension.js index c83eaccd..59992fe3 100644 --- a/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/extension.js +++ b/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/extension.js @@ -102,12 +102,13 @@ class MouseClickEffects { cb: () => { this.update_colored_icons(); if (this.mouse_movement_tracker) { + let icon = this.get_click_icon( + this.icon_mode, + ClickType.MOUSE_MOV, + this.mouse_movement_color, + ); this.mouse_movement_tracker.update({ - icon: this.get_click_icon( - this.icon_mode, - ClickType.MOUSE_MOV, - this.mouse_movement_color, - ), + icon: icon, }); } }, @@ -177,7 +178,7 @@ class MouseClickEffects { { key: "mouse-idle-watcher-enabled", value: "mouse_idle_watcher_enabled", - cb: null, + cb: null, // TODO }, { key: "left-click-color", @@ -200,12 +201,13 @@ class MouseClickEffects { cb: () => { this.update_colored_icons(); if (this.mouse_movement_tracker) { + let icon = this.get_click_icon( + this.icon_mode, + ClickType.MOUSE_MOV, + this.mouse_movement_color, + ); this.mouse_movement_tracker.update({ - icon: this.get_click_icon( - this.icon_mode, - ClickType.MOUSE_MOV, - this.mouse_movement_color, - ), + icon: icon, }); } }, @@ -347,16 +349,17 @@ class MouseClickEffects { this.mouse_movement_tracker.start(); } - if (this.mouse_idle_watcher_enabled) { - // XXX: only enable according w respective settings - // this.idleMonitor = new IdleMonitor({ - // idle_delay: IDLE_TIME, - // on_idle: this.on_idle_handler, - // on_active: this.on_active_handler, - // on_finish: this.on_finish_handler, - // }); - // this.idleMonitor.start(); - } + // TODO + // if (this.mouse_idle_watcher_enabled) { + // // XXX: only enable according w respective settings + // this.idleMonitor = new IdleMonitor({ + // idle_delay: IDLE_TIME, + // on_idle: this.on_idle_handler, + // on_active: this.on_active_handler, + // on_finish: this.on_finish_handler, + // }); + // this.idleMonitor.start(); + // } global.log(UUID, "activated"); } else { diff --git a/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/mouseMovementTracker.js b/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/mouseMovementTracker.js index a3b95ee7..9f95c984 100644 --- a/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/mouseMovementTracker.js +++ b/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/mouseMovementTracker.js @@ -39,35 +39,19 @@ var MouseMovementTracker = class MouseMovementTracker { update(params) { if (params.size) { this.size = params.size; - this.icon_actor.set_size(params.size); } if (params.opacity) { this.opacity = params.opacity; - this.icon_actor.set_opacity(params.opacity); } if (params.icon) { - Main.uiGroup.remove_child(this.icon_actor); - const [x, y, _] = global.get_pointer(); - this.icon_actor = new St.Icon({ - reactive: false, - can_focus: false, - track_hover: false, - icon_size: this.size, - opacity: this.opacity, - gicon: params.icon, - }); - this.move_to(x, y); - Main.uiGroup.add_child(this.icon_actor); - if (!this.persist_on_stopped) - this.icon_actor.hide(); + this.icon = params.icon; } - if (params.persist_on_stopped === true) { + if (params.persist_on_stopped === true || params.persist_on_stopped === false) { this.persist_on_stopped = params.persist_on_stopped; - this.icon_actor.show(); - } else if (params.persist_on_stopped === false) { - this.persist_on_stopped = params.persist_on_stopped; - this.icon_actor.hide(); } + + this.finalize(); + this.start(); } finalize() { diff --git a/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/settings-schema.json b/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/settings-schema.json index 2b3eea5d..7421b086 100644 --- a/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/settings-schema.json +++ b/mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/settings-schema.json @@ -209,7 +209,7 @@ "tooltip": "This is still experimental and may interfere when clicking on the panel or in some drag-and-drop operations." }, "mouse-idle-watcher-enabled": { - "type": "switch", + "type": "generic", "default": false, "description": "Mouse Idle Watcher" },