Skip to content

Commit

Permalink
Set idle tracker feature for a future update
Browse files Browse the repository at this point in the history
  • Loading branch information
anaximeno committed Sep 20, 2024
1 parent 4d0f6be commit 7eed87f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
},
Expand Down Expand Up @@ -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",
Expand All @@ -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,
});
}
},
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 7eed87f

Please sign in to comment.