Skip to content

Commit 47133e9

Browse files
authored
mouse-click-effects@anaximeno: Version 1.0.2 (#754)
* Suppress unnecessary logs in production and fix typo in settings
1 parent abd85b0 commit 47133e9

File tree

14 files changed

+62
-50
lines changed

14 files changed

+62
-50
lines changed

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
*/
1818
'use strict';
1919

20+
const DEBUG = false;
21+
2022
const UUID = "mouse-click-effects@anaximeno";
2123

2224
const PAUSE_EFFECTS_KEY = `${UUID}-bind-pause-effects`;

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/extension.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Gettext = imports.gettext;
2424
const ByteArray = imports.byteArray;
2525
const { Atspi, GLib, Gio } = imports.gi;
2626
const { ClickAnimationFactory, ClickAnimationModes } = require("./clickAnimations.js");
27-
const { Debouncer } = require("./helpers.js");
27+
const { Debouncer, logInfo, logError } = require("./helpers.js");
2828
const { UUID, PAUSE_EFFECTS_KEY, CLICK_DEBOUNCE_MS, POINTER_WATCH_MS, IDLE_TIME } = require("./constants.js");
2929
const { IdleMonitor } = require("./idleMonitor.js");
3030
const { MouseMovementTracker } = require("./mouseMovementTracker.js");
@@ -76,7 +76,7 @@ class MouseClickEffects {
7676
let data_dir = `${GLib.get_user_cache_dir()}/${uuid}`;
7777

7878
if (GLib.mkdir_with_parents(`${data_dir}/icons`, 0o777) < 0) {
79-
global.logError(`Failed to create cache dir at ${data_dir}`);
79+
logError(`Failed to create cache dir at ${data_dir}`);
8080
throw new Error(`Failed to create cache dir at ${data_dir}`);
8181
}
8282

@@ -255,14 +255,14 @@ class MouseClickEffects {
255255
this._enable_on_drag_end = true;
256256
this.set_active(false);
257257
}
258-
}).bind(this)
258+
}).bind(this);
259259

260260
dragDrop = ((event) => {
261261
if (this._enable_on_drag_end) {
262262
this._enable_on_drag_end = false;
263263
this.set_active(true);
264264
}
265-
}).bind(this)
265+
}).bind(this);
266266

267267
enable() {
268268
this.update_colored_icons();
@@ -372,9 +372,9 @@ class MouseClickEffects {
372372
// this.idleMonitor.start();
373373
// }
374374

375-
global.log(UUID, "activated");
375+
logInfo("activated");
376376
} else {
377-
global.log(UUID, "deactivated");
377+
logInfo("deactivated");
378378
}
379379
}
380380

@@ -397,17 +397,18 @@ class MouseClickEffects {
397397

398398
let [r_success, tag] = dest.replace_contents(contents, null, false, Gio.FileCreateFlags.REPLACE_DESTINATION, null);
399399

400-
if (r_success) global.log(UUID, `created colored icon cache for ${name}`);
400+
if (r_success) logInfo(`created colored icon cache for ${name}`);
401+
401402
return r_success;
402403
}
403404

404405
display_click = (new Debouncer()).debounce((...args) => {
405406
if (this.deactivate_in_fullscreen && global.display.focus_window && global.display.focus_window.is_fullscreen()) {
406-
// global.log(UUID, "Click effects not displayed due to being disabled for fullscreen focused windows");
407+
logInfo("Click effects not displayed due to being disabled for fullscreen focused windows");
407408
return;
408409
}
409410
this.animate_click(...args);
410-
}, CLICK_DEBOUNCE_MS)
411+
}, CLICK_DEBOUNCE_MS);
411412

412413
animate_click(click_type, color) {
413414
this.update_animation_mode();
@@ -432,7 +433,7 @@ class MouseClickEffects {
432433
timeout: this.animation_time,
433434
});
434435
} else {
435-
global.logError(`${UUID}: Couldn't get Click Icon (mode = ${this.icon_mode}, type = ${click_type}, color = ${color})`)
436+
logError(`Couldn't get Click Icon (mode = ${this.icon_mode}, type = ${click_type}, color = ${color})`)
436437
}
437438
}
438439

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/helpers.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919

2020
const Util = imports.misc.util;
2121

22+
const { UUID, DEBUG } = require('./constants.js');
23+
24+
2225
var Debouncer = class Debouncer {
2326
_sourceId;
2427

@@ -43,3 +46,12 @@ var Debouncer = class Debouncer {
4346
}).bind(this);
4447
}
4548
}
49+
50+
51+
function logInfo(...args) {
52+
if (DEBUG) global.log(`${UUID}: ${args.join(' ')}`);
53+
}
54+
55+
function logError(...args) {
56+
global.logError(`${UUID}: ${args.join(' ')}`);
57+
}

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/mouseMovementTracker.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@ const Main = imports.ui.main;
33

44
const PointerWatcher = require("./pointerWatcher.js").getPointerWatcher();
55
const { POINTER_WATCH_MS, UUID, MOUSE_PARADE_DELAY_MS } = require("./constants.js");
6-
const { Debouncer } = require("./helpers.js");
6+
const { Debouncer, logInfo } = require("./helpers.js");
77

88

99
var MouseMovementTracker = class MouseMovementTracker {
1010
constructor(icon, size, opacity, persist_on_stopped) {
1111
this.size = size;
1212
this.opacity = opacity;
1313
this.icon = icon;
14+
this.persist_on_stopped = persist_on_stopped;
1415
this.icon_actor = null;
1516
this.listener = null;
16-
this.persist_on_stopped = persist_on_stopped;
17-
this.handle_parade = (new Debouncer()).debounce(
18-
this.on_parade.bind(this),
19-
MOUSE_PARADE_DELAY_MS,
20-
);
2117
}
2218

2319
start() {
@@ -34,7 +30,7 @@ var MouseMovementTracker = class MouseMovementTracker {
3430
this.move_to(x, y);
3531
Main.uiGroup.add_child(this.icon_actor);
3632
this.listener = PointerWatcher.addWatch(POINTER_WATCH_MS, this.move_to.bind(this));
37-
global.log(UUID, "mouse movement tracker started");
33+
logInfo("mouse movement tracker started");
3834
}
3935

4036
update(params) {
@@ -59,19 +55,21 @@ var MouseMovementTracker = class MouseMovementTracker {
5955
Main.uiGroup.remove_child(this.icon_actor);
6056
this.listener.remove();
6157
this.icon_actor.destroy();
62-
global.log(UUID, "mouse movement tracker finalized");
58+
logInfo("mouse movement tracker finalized");
6359
}
6460

6561
move_to(x, y) {
66-
this.icon_actor.show();
67-
this.icon_actor.set_position(
68-
x - (this.size * global.ui_scale / 2),
69-
y - (this.size * global.ui_scale / 2));
70-
if (!this.persist_on_stopped)
71-
this.handle_parade();
62+
if (this.icon_actor) {
63+
this.icon_actor.show();
64+
this.icon_actor.set_position(
65+
x - (this.size * global.ui_scale / 2),
66+
y - (this.size * global.ui_scale / 2));
67+
if (!this.persist_on_stopped)
68+
this.handle_parade();
69+
}
7270
}
7371

74-
on_parade() {
75-
this.icon_actor.hide();
76-
}
72+
handle_parade = (new Debouncer()).debounce(() => {
73+
if (this.icon_actor) this.icon_actor.hide();
74+
}, MOUSE_PARADE_DELAY_MS);
7775
}

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/5.4/settings-schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"style-section": {
5151
"type": "section",
52-
"title": "Colors",
52+
"title": "Style",
5353
"keys": [
5454
"icon-mode",
5555
"size",

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"uuid": "mouse-click-effects@anaximeno",
33
"name": "Mouse Click Effects",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"description": "Display mouse click effects on Cinnamon.",
66
"url": "https://github.com/anaximeno/mouse-click-effects",
77
"website": "https://github.com/anaximeno/mouse-click-effects",

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/po/ca.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: mouse-click-effects@anaximeno 0.4.0\n"
99
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
1010
"extensions/issues\n"
11-
"POT-Creation-Date: 2024-09-20 22:01-0100\n"
11+
"POT-Creation-Date: 2024-09-22 17:02-0100\n"
1212
"PO-Revision-Date: 2024-09-21 22:17+0200\n"
1313
"Last-Translator: Odyssey <odysseyhyd@gmail.com>\n"
1414
"Language-Team: \n"
@@ -32,14 +32,14 @@ msgid "General"
3232
msgstr "General"
3333

3434
#. 5.4->settings-schema.json->style-page->title
35+
#. 5.4->settings-schema.json->style-section->title
3536
msgid "Style"
3637
msgstr "Estil"
3738

3839
#. 5.4->settings-schema.json->effects-section->title
3940
msgid "Effects"
4041
msgstr "Efectes"
4142

42-
#. 5.4->settings-schema.json->style-section->title
4343
#. 5.4->settings-schema.json->colors-section->title
4444
msgid "Colors"
4545
msgstr "Colors"

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/po/es.po

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgstr ""
77
"Project-Id-Version: mouse-click-effects@anaximeno 0.1.0\n"
88
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
99
"extensions/issues\n"
10-
"POT-Creation-Date: 2024-09-20 22:01-0100\n"
10+
"POT-Creation-Date: 2024-09-22 17:02-0100\n"
1111
"PO-Revision-Date: 2024-09-21 12:19-0300\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"
@@ -31,14 +31,14 @@ msgid "General"
3131
msgstr "General"
3232

3333
#. 5.4->settings-schema.json->style-page->title
34+
#. 5.4->settings-schema.json->style-section->title
3435
msgid "Style"
3536
msgstr "Estilo"
3637

3738
#. 5.4->settings-schema.json->effects-section->title
3839
msgid "Effects"
3940
msgstr "Efectos"
4041

41-
#. 5.4->settings-schema.json->style-section->title
4242
#. 5.4->settings-schema.json->colors-section->title
4343
msgid "Colors"
4444
msgstr "Colores"
@@ -225,14 +225,13 @@ msgid ""
225225
"This is still experimental and may interfere when clicking on the panel or "
226226
"in some drag-and-drop operations."
227227
msgstr ""
228-
"Esto es todavía experimental y puede interferir al hacer clic en el panel "
229-
"o en algunas operaciones de arrastrar y soltar."
228+
"Esto es todavía experimental y puede interferir al hacer clic en el panel o "
229+
"en algunas operaciones de arrastrar y soltar."
230230

231231
#. 5.4->settings-schema.json->mouse-movement-tracker-persist-on-stopped-
232232
#. enabled->description
233233
msgid "Persist Movement Tracker On Stopped (experimental)"
234-
msgstr ""
235-
"Rastreador de movimiento persistente en estado detenido (experimental)"
234+
msgstr "Rastreador de movimiento persistente en estado detenido (experimental)"
236235

237236
#. 5.4->settings-schema.json->mouse-idle-watcher-enabled->description
238237
msgid "Mouse Idle Watcher"

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/po/eu.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: mouse-click-effects@anaximeno 0.1.0\n"
99
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
1010
"extensions/issues\n"
11-
"POT-Creation-Date: 2024-09-20 22:01-0100\n"
11+
"POT-Creation-Date: 2024-09-22 17:02-0100\n"
1212
"PO-Revision-Date: 2024-05-30 9:50+1\n"
1313
"Last-Translator: Muxutruk <muxutruk2@users.noreply.github.com>\n"
1414
"Language-Team: Basque <muxutruk2@users.noreply.github.com>\n"
@@ -31,14 +31,14 @@ msgid "General"
3131
msgstr "Orokorra"
3232

3333
#. 5.4->settings-schema.json->style-page->title
34+
#. 5.4->settings-schema.json->style-section->title
3435
msgid "Style"
3536
msgstr ""
3637

3738
#. 5.4->settings-schema.json->effects-section->title
3839
msgid "Effects"
3940
msgstr ""
4041

41-
#. 5.4->settings-schema.json->style-section->title
4242
#. 5.4->settings-schema.json->colors-section->title
4343
msgid "Colors"
4444
msgstr "Koloreak"

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/po/hu.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgstr ""
77
"Project-Id-Version: mouse-click-effects@anaximeno 0.4.0\n"
88
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
99
"extensions/issues\n"
10-
"POT-Creation-Date: 2024-09-20 22:01-0100\n"
10+
"POT-Creation-Date: 2024-09-22 17:02-0100\n"
1111
"PO-Revision-Date: 2024-07-26 07:08-0400\n"
1212
"Last-Translator: \n"
1313
"Language-Team: \n"
@@ -32,14 +32,14 @@ msgid "General"
3232
msgstr "Általános"
3333

3434
#. 5.4->settings-schema.json->style-page->title
35+
#. 5.4->settings-schema.json->style-section->title
3536
msgid "Style"
3637
msgstr ""
3738

3839
#. 5.4->settings-schema.json->effects-section->title
3940
msgid "Effects"
4041
msgstr ""
4142

42-
#. 5.4->settings-schema.json->style-section->title
4343
#. 5.4->settings-schema.json->colors-section->title
4444
msgid "Colors"
4545
msgstr "Színek"

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/po/mouse-click-effects@anaximeno.pot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#, fuzzy
66
msgid ""
77
msgstr ""
8-
"Project-Id-Version: mouse-click-effects@anaximeno 1.0.0\n"
8+
"Project-Id-Version: mouse-click-effects@anaximeno 1.0.2\n"
99
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
1010
"extensions/issues\n"
11-
"POT-Creation-Date: 2024-09-20 22:01-0100\n"
11+
"POT-Creation-Date: 2024-09-22 17:02-0100\n"
1212
"PO-Revision-Date: \n"
1313
"Last-Translator: \n"
1414
"Language-Team: \n"
@@ -31,14 +31,14 @@ msgid "General"
3131
msgstr ""
3232

3333
#. 5.4->settings-schema.json->style-page->title
34+
#. 5.4->settings-schema.json->style-section->title
3435
msgid "Style"
3536
msgstr ""
3637

3738
#. 5.4->settings-schema.json->effects-section->title
3839
msgid "Effects"
3940
msgstr ""
4041

41-
#. 5.4->settings-schema.json->style-section->title
4242
#. 5.4->settings-schema.json->colors-section->title
4343
msgid "Colors"
4444
msgstr ""

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/po/nl.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgstr ""
77
"Project-Id-Version: mouse-click-effects@anaximeno 0.4.0\n"
88
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
99
"extensions/issues\n"
10-
"POT-Creation-Date: 2024-09-20 22:01-0100\n"
10+
"POT-Creation-Date: 2024-09-22 17:02-0100\n"
1111
"PO-Revision-Date: 2024-07-23 20:25+0200\n"
1212
"Last-Translator: qadzek\n"
1313
"Language-Team: \n"
@@ -30,14 +30,14 @@ msgid "General"
3030
msgstr "Algemeen"
3131

3232
#. 5.4->settings-schema.json->style-page->title
33+
#. 5.4->settings-schema.json->style-section->title
3334
msgid "Style"
3435
msgstr ""
3536

3637
#. 5.4->settings-schema.json->effects-section->title
3738
msgid "Effects"
3839
msgstr ""
3940

40-
#. 5.4->settings-schema.json->style-section->title
4141
#. 5.4->settings-schema.json->colors-section->title
4242
msgid "Colors"
4343
msgstr "Kleuren"

mouse-click-effects@anaximeno/files/mouse-click-effects@anaximeno/po/pt.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: mouse-click-effects@anaximeno 0.1.0\n"
99
"Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-"
1010
"extensions/issues\n"
11-
"POT-Creation-Date: 2024-09-20 22:01-0100\n"
11+
"POT-Creation-Date: 2024-09-22 17:02-0100\n"
1212
"PO-Revision-Date: 2024-09-20 22:03-0100\n"
1313
"Last-Translator: \n"
1414
"Language-Team: \n"
@@ -32,14 +32,14 @@ msgid "General"
3232
msgstr "Geral"
3333

3434
#. 5.4->settings-schema.json->style-page->title
35+
#. 5.4->settings-schema.json->style-section->title
3536
msgid "Style"
3637
msgstr "Estilo"
3738

3839
#. 5.4->settings-schema.json->effects-section->title
3940
msgid "Effects"
4041
msgstr "Efeitos"
4142

42-
#. 5.4->settings-schema.json->style-section->title
4343
#. 5.4->settings-schema.json->colors-section->title
4444
msgid "Colors"
4545
msgstr "Cores"

0 commit comments

Comments
 (0)