Skip to content

Commit fa2269d

Browse files
authored
sound150 v13.4.0: Improved tooltip duration (#7924)
1 parent 7a6f833 commit fa2269d

File tree

3 files changed

+55
-21
lines changed

3 files changed

+55
-21
lines changed

sound150@claudiux/files/sound150@claudiux/6.4/applet.js

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ const {
4646
timeout_add_seconds,
4747
setTimeout,
4848
clearTimeout,
49+
setInterval,
50+
clearInterval,
4951
source_remove,
5052
remove_all_sources
5153
} = require("./lib/mainloopTools");
@@ -532,9 +534,13 @@ class Sound150Applet extends Applet.TextIconApplet {
532534
this.keypressEventId = this.actor.connect("key-press-event", (...args) => this._onKeyPressEvent(...args));
533535
this.enterEventId = this.actor.connect("enter-event", (actor, event) => this.on_enter_event(actor, event));
534536
this.leaveEventId = this.actor.connect("leave-event", (actor, event) => this.on_leave_event(actor, event));
535-
this.notifyHoverId = this.actor.connect('notify::hover', () => {
536-
this._applet_tooltip.show();
537-
});
537+
//~ this.notifyHoverId = this.actor.connect('notify::hover', () => {
538+
//~ if (this.actor.hover) {
539+
//~ this._applet_tooltip.show()
540+
//~ } else {
541+
//~ //this._applet_tooltip.hide()
542+
//~ }
543+
//~ });
538544

539545
this._outputApplicationsMenu = new PopupMenu.PopupSubMenuMenuItem(_("Applications"));
540546
this._selectOutputDeviceItem = new PopupMenu.PopupSubMenuMenuItem(_("Output device"));
@@ -668,9 +674,8 @@ class Sound150Applet extends Applet.TextIconApplet {
668674
}
669675

670676
on_enter_event(actor, event) {
677+
this.isActorEntered = true;
671678
this.on_icon_dir_changed();
672-
this.setAppletTooltip();
673-
this._applet_tooltip.show();
674679
if (this.context_menu_item_configDesklet)
675680
this.context_menu_item_configDesklet.actor.visible = this.show_desklet;
676681
if (this.context_menu_item_showDesklet)
@@ -699,15 +704,36 @@ class Sound150Applet extends Applet.TextIconApplet {
699704
else
700705
this._selectInputDeviceItem.menu.close();
701706
}
707+
708+
this.onEnterEventInterval = setInterval( () => {
709+
this.setAppletTooltip();
710+
//~ this.setAppletTooltip();
711+
this._applet_tooltip.show();
712+
713+
return this.isActorEntered;
714+
},
715+
3000
716+
);
702717
}
703718

704719
on_leave_event(actor, event) {
720+
this.isActorEntered = false;
705721
if (this.playerControl && this._activePlayer)
706722
this.setAppletTextIcon(this._players[this._activePlayer], true);
707723
else
708724
this.setAppletTextIcon();
709725

710-
this.set_applet_tooltip("");
726+
727+
if (this.onEnterEventInterval != null) {
728+
clearInterval(this.onEnterEventInterval);
729+
this.onEnterEventInterval = false;
730+
}
731+
this.isActorEntered = false;
732+
//~ this._applet_tooltip.hide();
733+
//~ let _to = setTimeout( () => {
734+
//~ clearTimeout(_to);
735+
//~ this.set_applet_tooltip("");
736+
//~ }, 1000);
711737
}
712738

713739
_on_context_menu_item_showDesklet_toggled() {
@@ -920,12 +946,14 @@ class Sound150Applet extends Applet.TextIconApplet {
920946
});
921947

922948
Main.keybindingManager.addHotKey("raise-volume-" + this.instance_id, "AudioRaiseVolume", () => {
923-
this.set_applet_tooltip("");
949+
//~ this.set_applet_tooltip("");
924950
this._volumeChange(Clutter.ScrollDirection.UP);
951+
this.setAppletTooltip();
925952
});
926953
Main.keybindingManager.addHotKey("lower-volume-" + this.instance_id, "AudioLowerVolume", () => {
927-
this.set_applet_tooltip("");
954+
//~ this.set_applet_tooltip("");
928955
this._volumeChange(Clutter.ScrollDirection.DOWN);
956+
this.setAppletTooltip();
929957
});
930958
Main.keybindingManager.addHotKey("volume-mute-" + this.instance_id, "AudioMute", () => this._toggle_out_mute());
931959
Main.keybindingManager.addHotKey("pause-" + this.instance_id, "AudioPlay", () => this._players[this._activePlayer]._mediaServerPlayer.PlayPauseRemote());
@@ -1214,13 +1242,13 @@ class Sound150Applet extends Applet.TextIconApplet {
12141242
this.actor.disconnect(this.enterEventId);
12151243
if (this.leaveEventId)
12161244
this.actor.disconnect(this.leaveEventId);
1217-
if (this.notifyHoverId)
1218-
this.actor.disconnect(this.notifyHoverId);
1245+
//~ if (this.notifyHoverId)
1246+
//~ this.actor.disconnect(this.notifyHoverId);
12191247
this.scrollEventId = null;
12201248
this.keypressEventId = null;
12211249
this.enterEventId = null;
12221250
this.leaveEventId = null;
1223-
this.notifyHoverId = null;
1251+
//~ this.notifyHoverId = null;
12241252

12251253
this.settings.setValue("volume", old_volume);
12261254
remove_all_sources();
@@ -1344,7 +1372,7 @@ class Sound150Applet extends Applet.TextIconApplet {
13441372
}
13451373

13461374
_onScrollEvent(actor, event) {
1347-
this._applet_tooltip.show();
1375+
//~ this._applet_tooltip.show();
13481376
let _event = event;
13491377
let modifiers = Cinnamon.get_event_state(event);
13501378
let shiftPressed = (modifiers & Clutter.ModifierType.SHIFT_MASK);
@@ -1353,7 +1381,7 @@ class Sound150Applet extends Applet.TextIconApplet {
13531381
this._inputVolumeSection._onScrollEvent(this._inputVolumeSection.actor, _event);
13541382
return
13551383
}
1356-
this._applet_tooltip.show();
1384+
//~ this._applet_tooltip.show();
13571385
let direction = event.get_scroll_direction();
13581386
if (this.reverseScrolling) {
13591387
if (direction == Clutter.ScrollDirection.DOWN)
@@ -1367,7 +1395,7 @@ class Sound150Applet extends Applet.TextIconApplet {
13671395
}
13681396

13691397
this._volumeChange(direction);
1370-
this.volume_near_icon()
1398+
//~ this.volume_near_icon()
13711399
}
13721400

13731401
_volumeChange(direction) {
@@ -1480,8 +1508,8 @@ class Sound150Applet extends Applet.TextIconApplet {
14801508
intervalId = setTimeout(() => {
14811509
clearTimeout(intervalId);
14821510
this.allowChangeArt = true;
1483-
if (this._applet_tooltip)
1484-
this._applet_tooltip.hide();
1511+
//~ if (this._applet_tooltip)
1512+
//~ this._applet_tooltip.hide();
14851513
if (this.playerControl && this._activePlayer) {
14861514
let dir = Gio.file_new_for_path(ALBUMART_PICS_DIR);
14871515
let dir_children = dir.enumerate_children("standard::name,standard::type,standard::icon,time::modified", Gio.FileQueryInfoFlags.NONE, null);
@@ -1497,11 +1525,13 @@ class Sound150Applet extends Applet.TextIconApplet {
14971525
}
14981526
}, 1000 * this.showalbumDelay);
14991527
} else {
1500-
if (this._applet_tooltip)
1501-
this._applet_tooltip.hide();
1528+
1529+
//~ if (this._applet_tooltip)
1530+
//~ this._applet_tooltip.hide();
15021531
}
15031532

15041533
this.volume_near_icon();
1534+
this.setAppletTooltip();
15051535
}
15061536

15071537
_onButtonPressEvent(actor, event) {
@@ -1778,9 +1808,9 @@ class Sound150Applet extends Applet.TextIconApplet {
17781808
tooltips.push(_("Please select 'Install imagemagick' in this menu"));
17791809
}
17801810

1781-
this.set_applet_tooltip(this._clean_str(tooltips.join("\n")), true);
1782-
this._applet_tooltip.preventShow = false;
1811+
//~ this._applet_tooltip.preventShow = false;
17831812
this.volume_near_icon();
1813+
this.set_applet_tooltip(this._clean_str(tooltips.join("\n")), true);
17841814
}
17851815

17861816
_clean_str(str) {

sound150@claudiux/files/sound150@claudiux/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### v13.4.0~20251029
2+
* Improves tooltip duration.
3+
* Fixes [#7922](https://github.com/linuxmint/cinnamon-spices-applets/issues/7922)
4+
15
### v13.3.4~20251028
26
* Gets real ui_scale, when scaling is set to other values than 100% or 200%.
37
* Uses "font-family: 'Digital Numbers',monospace" to display counters in menu.

sound150@claudiux/files/sound150@claudiux/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"max-instances": "1",
66
"description": "Enhanced sound applet",
77
"hide-configuration": false,
8-
"version": "13.3.4",
8+
"version": "13.4.0",
99
"cinnamon-version": [
1010
"2.8",
1111
"3.0",

0 commit comments

Comments
 (0)