Skip to content

Commit 6ec4d27

Browse files
authored
v7.3.7: Improved functionality (icons and album art) (#6716)
1 parent 4320d0e commit 6ec4d27

File tree

3 files changed

+82
-50
lines changed

3 files changed

+82
-50
lines changed

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

Lines changed: 78 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ class ControlButton {
210210
this.tooltip.destroy();
211211
this.button.remove_all_children();
212212
this.actor.remove_actor(this.button);
213+
this.button.disconnect("clicked");
213214
this.button.destroy();
214215
this.actor.destroy();
215216
}
@@ -563,7 +564,7 @@ class Seeker extends Slider.Slider {
563564
}, 100);
564565
});
565566

566-
this._seekChangedId = mediaServerPlayer.connectSignal("Seeked", (id, sender, value) => {
567+
this._seekChangedId = this._mediaServerPlayer.connectSignal("Seeked", (id, sender, value) => {
567568
if (this.destroyed) return;
568569
// Seek value sent by the player
569570
if (value > 0) {
@@ -1773,6 +1774,7 @@ class Sound150Applet extends Applet.TextIconApplet {
17731774
this.metadata = metadata;
17741775

17751776
this.oldPlayerIcon0 = null;
1777+
this._ownerChangedId = null;
17761778

17771779
this.title_text = "";
17781780

@@ -1940,15 +1942,16 @@ class Sound150Applet extends Applet.TextIconApplet {
19401942
this._recordingAppsNum = 0;
19411943

19421944
this._output = null;
1943-
this._outputMutedId = 0;
1945+
this._outputMutedId = null;
19441946
this._outputIcon = "audio-volume-muted-symbolic";
19451947

19461948
this._input = null;
1947-
this._inputMutedId = 0;
1949+
this._inputMutedId = null;
19481950

19491951
this._icon_name = '';
19501952
this._icon_path = null;
19511953
this._iconTimeoutId = null;
1954+
this._iconLooping = true;
19521955

19531956
this.actor.connect("scroll-event", (...args) => this._onScrollEvent(...args));
19541957
this.actor.connect("key-press-event", (...args) => this._onKeyPressEvent(...args));
@@ -2253,17 +2256,23 @@ class Sound150Applet extends Applet.TextIconApplet {
22532256
//~ }
22542257
//~ this.color0_100 = color;
22552258

2259+
this._iconLooping = true;
2260+
22562261
this.showOSD = this.showOSDonStartup && this.showMediaKeysOSD;
22572262

22582263
this._on_sound_settings_change();
22592264

22602265
this._loopArtId = null;
2261-
this.loopArt();
2266+
this._artLooping = true;
2267+
this._loopArtId = Mainloop.timeout_add_seconds(5, this.loopArt.bind(this));
2268+
//~ this.loopArt();
22622269

22632270
this.volume_near_icon()
22642271
}
22652272

22662273
on_applet_reloaded() {
2274+
this._iconLooping = false;
2275+
this._artLooping = false;
22672276
this.showOSD = this.showOSDonStartup && this.showMediaKeysOSD;
22682277
}
22692278

@@ -2272,7 +2281,7 @@ class Sound150Applet extends Applet.TextIconApplet {
22722281
this.old_volume = this.volume;
22732282
this._toggle_out_mute();
22742283
this.volume = this.old_volume;
2275-
this.volume_near_icon()
2284+
//~ this.volume_near_icon()
22762285
}
22772286

22782287
Main.keybindingManager.removeHotKey("sound-open-" + this.instance_id);
@@ -2299,25 +2308,27 @@ class Sound150Applet extends Applet.TextIconApplet {
22992308

23002309
if (this.hideSystray)
23012310
this.unregisterSystrayIcons();
2302-
if (this._iconTimeoutId) {
2303-
try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2304-
this._iconTimeoutId = null;
2305-
}
2306-
}
2307-
if (this._loopArtId) {
2308-
try {if (Mainloop.source_remove(this._loopArtId)) this._loopArtId = null;} catch(e) {} finally {
2309-
this._loopArtId = null;
2310-
}
2311-
}
2311+
this._iconLooping = false;
2312+
//~ if (this._iconTimeoutId) {
2313+
//~ try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2314+
//~ this._iconTimeoutId = null;
2315+
//~ }
2316+
//~ }
2317+
this._artLooping = false;
2318+
//~ if (this._loopArtId) {
2319+
//~ try {if (Mainloop.source_remove(this._loopArtId)) this._loopArtId = null;} catch(e) {} finally {
2320+
//~ this._loopArtId = null;
2321+
//~ }
2322+
//~ }
23122323
if (this._seeker && this._seeker._timeoutId) {
23132324
try {if (Mainloop.source_remove(this._seeker._timeoutId)) this._seeker._timeoutId = null;} catch(e) {} finally {
2314-
this._seeker._timeoutId = 0;
2325+
this._seeker._timeoutId = null;
23152326
}
23162327
}
23172328

23182329
if (this._ownerChangedId) {
23192330
this._dbus.disconnectSignal(this._ownerChangedId);
2320-
this._ownerChangedId = 0;
2331+
this._ownerChangedId = null;
23212332
}
23222333

23232334
for (let i in this._players)
@@ -2605,11 +2616,12 @@ class Sound150Applet extends Applet.TextIconApplet {
26052616

26062617
setIcon(icon, source) {
26072618
//~ log("setIcon("+icon+", "+source+")", true);
2608-
if (this._iconTimeoutId) {
2609-
try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2610-
this._iconTimeoutId = null;
2611-
}
2612-
}
2619+
2620+
//~ if (this._iconTimeoutId) {
2621+
//~ try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2622+
//~ this._iconTimeoutId = null;
2623+
//~ }
2624+
//~ }
26132625

26142626
// save the icon
26152627
if (source) {
@@ -2624,16 +2636,17 @@ class Sound150Applet extends Applet.TextIconApplet {
26242636
// if we have an active player, but are changing the volume, show the output icon and after three seconds change back to the player icon
26252637
this.set_applet_icon_symbolic_name(this._outputIcon);
26262638
if (this.stream && !this.stream.is_muted) {
2627-
if (this._iconTimeoutId) {
2628-
try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2629-
this._iconTimeoutId = null;
2630-
}
2631-
}
2639+
//~ if (this._iconTimeoutId) {
2640+
//~ try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2641+
//~ this._iconTimeoutId = null;
2642+
//~ }
2643+
//~ }
26322644
this._iconTimeoutId = Mainloop.timeout_add_seconds(OUTPUT_ICON_SHOW_TIME_SECONDS, () => {
2633-
try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2634-
this._iconTimeoutId = null;
2635-
}
2645+
//~ try {if (Mainloop.source_remove(this._iconTimeoutId)) this._iconTimeoutId = null;} catch(e) {} finally {
2646+
//~ this._iconTimeoutId = null;
2647+
//~ }
26362648
this.setIcon();
2649+
return this._iconLooping;
26372650
});
26382651
}
26392652
} else {
@@ -2681,13 +2694,13 @@ class Sound150Applet extends Applet.TextIconApplet {
26812694

26822695
loopArt() {
26832696
if (!this._playerctl) {
2684-
if (this._loopArtId) {
2685-
try {if (Mainloop.source_remove(this._loopArtId)) this._loopArtId = null;} catch(e) {} finally {
2686-
this._loopArtId = null;
2687-
}
2688-
}
2689-
this._loopArtId = Mainloop.timeout_add_seconds(5, this.loopArt.bind(this));
2690-
return
2697+
//~ if (this._loopArtId) {
2698+
//~ try {if (Mainloop.source_remove(this._loopArtId)) this._loopArtId = null;} catch(e) {} finally {
2699+
//~ this._loopArtId = null;
2700+
//~ }
2701+
//~ }
2702+
//~ this._loopArtId = Mainloop.timeout_add_seconds(5, this.loopArt.bind(this));
2703+
return this._artLooping;
26912704
}
26922705
let subProcess = Util.spawnCommandLineAsyncIO("bash -C %s/get_album_art.sh".format(PATH2SCRIPTS), Lang.bind(this, function(stdout, stderr, exitCode) {
26932706
if (exitCode === 0) {
@@ -2711,16 +2724,18 @@ class Sound150Applet extends Applet.TextIconApplet {
27112724
this._trackCoverFile = null;
27122725
}
27132726
} else {
2727+
this._icon_path = null; //???
27142728
this._trackCoverFile = null;
27152729
}
27162730
subProcess.send_signal(9);
27172731
}));
2718-
if (this._loopArtId) {
2719-
try {if (Mainloop.source_remove(this._loopArtId)) this._loopArtId = null;} catch(e) {} finally {
2720-
this._loopArtId = null;
2721-
}
2722-
}
2723-
this._loopArtId = Mainloop.timeout_add_seconds(5, this.loopArt.bind(this))
2732+
//~ if (this._loopArtId) {
2733+
//~ try {if (Mainloop.source_remove(this._loopArtId)) this._loopArtId = null;} catch(e) {} finally {
2734+
//~ this._loopArtId = null;
2735+
//~ }
2736+
//~ }
2737+
//~ this._loopArtId = Mainloop.timeout_add_seconds(5, this.loopArt.bind(this));
2738+
return this._artLooping;
27242739
}
27252740

27262741
setAppletIcon(player, path) {
@@ -2767,7 +2782,7 @@ class Sound150Applet extends Applet.TextIconApplet {
27672782
setAppletText(player) {
27682783
this.title_text = "";
27692784
if (this.isHorizontal && this.showtrack && player && player._playerStatus == "Playing") {
2770-
if (player._artist == _("Unknown Artist")) { // should it be translated?
2785+
if (player._artist == _("Unknown Artist")) {
27712786
this.title_text = player._title;
27722787
}
27732788
else {
@@ -3165,7 +3180,7 @@ class Sound150Applet extends Applet.TextIconApplet {
31653180
_readOutput() {
31663181
if (this._outputMutedId) {
31673182
this._output.disconnect(this._outputMutedId);
3168-
this._outputMutedId = 0;
3183+
this._outputMutedId = null;
31693184
}
31703185
this._output = this._control.get_default_sink();
31713186
if (this._output) {
@@ -3190,7 +3205,7 @@ class Sound150Applet extends Applet.TextIconApplet {
31903205
_readInput() {
31913206
if (this._inputMutedId) {
31923207
this._input.disconnect(this._inputMutedId);
3193-
this._inputMutedId = 0;
3208+
this._inputMutedId = null;
31943209
}
31953210
this._input = this._control.get_default_source();
31963211
if (this._input) {
@@ -3339,20 +3354,34 @@ class Sound150Applet extends Applet.TextIconApplet {
33393354
}
33403355

33413356
volume_near_icon() {
3357+
if (!this.actor.get_stage()) return;
33423358
let label = "";
33433359
if (this.showVolumeLevelNearIcon) {
33443360
//~ this._applet_label.set_text(""+this.volume+ (this.title_text.length>0) ? " - "+this.title_text : "");
33453361
label = ""+this.volume;
33463362
if (this.title_text.length>0)
33473363
label += " - "+this.title_text;
3348-
this.set_applet_label(label);
3364+
3365+
try {
3366+
this.set_applet_label(label);
3367+
} catch(e) {
3368+
logError("Can't set applet label: "+e);
3369+
}
33493370
} else {
33503371
//~ this._applet_label.set_text((this.title_text.length>0) ? ""+this.title_text : "");
33513372
if (this.title_text.length>0)
33523373
label = ""+this.title_text;
3353-
this.set_applet_label(label);
3374+
try {
3375+
this.set_applet_label(label);
3376+
} catch(e) {
3377+
logError("Can't set applet label: "+e);
3378+
}
3379+
}
3380+
try {
3381+
this.hide_applet_label(label.length === 0);
3382+
} catch(e) {
3383+
logError("Can't hide applet label: "+e);
33543384
}
3355-
this.hide_applet_label(label.length === 0);
33563385
}
33573386

33583387
_reset_colors() {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### v7.3.7~20211228
2+
* Improved functionality (icons and album art)
3+
14
### v7.3.6~20241227
25
* No error at start-up. Fixes a nasty bug!
36

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": "7.3.6",
8+
"version": "7.3.7",
99
"cinnamon-version": [
1010
"2.8",
1111
"3.0",

0 commit comments

Comments
 (0)