Skip to content

Commit bbbe3b9

Browse files
authored
sound150 v13.9.0 :Many improvements (#8182)
1 parent af1074f commit bbbe3b9

File tree

19 files changed

+1673
-1015
lines changed

19 files changed

+1673
-1015
lines changed

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

Lines changed: 177 additions & 37 deletions
Large diffs are not rendered by default.

sound150@claudiux/files/sound150@claudiux/6.4/lib/s150PopupMenu.js

Lines changed: 65 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const ALBUMART_ON = TMP_ALBUMART_DIR + "/ON";
1313
const ALBUMART_PICS_DIR = TMP_ALBUMART_DIR + "/song-art";
1414
const ALBUMART_TITLE_FILE = TMP_ALBUMART_DIR + "/title.txt";
1515

16+
const ARTS_DIR = XDG_RUNTIME_DIR + "/sound150/arts";
17+
1618
const MPV_RADIO_PID = XDG_RUNTIME_DIR + "/mpv_radio_PID";
1719

1820
const PopupMenu = imports.ui.popupMenu;
@@ -119,6 +121,8 @@ class StreamMenuSection extends PopupMenu.PopupMenuSection {
119121
iconName = "banshee";
120122
} else if (name === "Spotify") {
121123
iconName = "spotify";
124+
} else if (name === "Strawberry") {
125+
iconName = "strawberry";
122126
} else if (name === "VBox") {
123127
name = "Virtualbox";
124128
iconName = "virtualbox";
@@ -380,7 +384,8 @@ class Player extends PopupMenu.PopupMenuSection {
380384
//~ Util.spawnCommandLine("/usr/bin/env bash -c '%s'".format(DEL_SONG_ARTS_SCRIPT));
381385

382386
if (this._seeker) {
383-
if (this._seeker.status === "Playing" && this._seeker.posLabel) this._seeker.posLabel.set_text(" 00:00 ");
387+
if (this._seeker.status === "Playing" && this._seeker.posLabel)
388+
this._seeker.posLabel.set_text(" 00:00:00 ");
384389
this._seeker.startingDate = Date.now();
385390
this._seeker._setPosition(0);
386391
}
@@ -534,7 +539,8 @@ class Player extends PopupMenu.PopupMenuSection {
534539
}
535540

536541
_setName(status) {
537-
this.playerLabel.set_text(this._name + " - " + _(status));
542+
if (this.playerLabel != null)
543+
this.playerLabel.set_text(this._name + " - " + _(status));
538544
}
539545

540546
_updateControls() {
@@ -615,7 +621,8 @@ class Player extends PopupMenu.PopupMenuSection {
615621
} else
616622
this._artist = _("Unknown Artist");
617623

618-
this.artistLabel.set_text(this._artist);
624+
if (this.artistLabel != null)
625+
this.artistLabel.set_text(this._artist);
619626

620627
if (metadata["xesam:album"])
621628
this._album = metadata["xesam:album"].unpack();
@@ -647,7 +654,8 @@ class Player extends PopupMenu.PopupMenuSection {
647654
if (json_artist) {
648655
//~ this._artist = capitalize_each_word(json_artist);
649656
this._artist = json_artist.capitalize();
650-
this.artistLabel.set_text(this._artist);
657+
if (this.artistLabel != null)
658+
this.artistLabel.set_text(this._artist);
651659
} else {
652660
this._artist = _("Unknown Artist");
653661
}
@@ -659,7 +667,8 @@ class Player extends PopupMenu.PopupMenuSection {
659667
}
660668
} else if (this._title.includes(" - ") && this._artist == _("Unknown Artist")) {
661669
[this._artist, this._title] = this._title.split(" - ");
662-
this.artistLabel.set_text(this._artist);
670+
if (this.artistLabel != null)
671+
this.artistLabel.set_text(this._artist);
663672
}
664673
} else {
665674
this._title = _("Unknown Title");
@@ -677,7 +686,8 @@ class Player extends PopupMenu.PopupMenuSection {
677686
Util.spawnCommandLine("/usr/bin/env bash -c %s/get_album_art.sh".format(PATH2SCRIPTS));
678687
}
679688

680-
this.titleLabel.set_text(this._title);
689+
if (this.titleLabel != null)
690+
this.titleLabel.set_text(this._title);
681691
this._seeker.setTrack(trackid, trackLength, old_title != this._title);
682692

683693
if (metadata["xesam:url"]) {
@@ -840,7 +850,7 @@ class Player extends PopupMenu.PopupMenuSection {
840850
//~ this._applet.setAppletTextIcon(this, false);
841851
this._applet.setAppletTextIcon(this, true);
842852
this._seeker.pause();
843-
this._applet.volume_near_icon();
853+
this._applet.volume_near_icon("s150PopupMenu - seeker paused");
844854
} else if (status == "Stopped") {
845855
this._playButton.setData("media-playback-start", _("Play"));
846856
this.playerIcon.set_icon_name("media-playback-stop");
@@ -895,7 +905,7 @@ class Player extends PopupMenu.PopupMenuSection {
895905
}
896906

897907
_showCover(cover_path) {
898-
let rnd;
908+
let rnd, baseName;
899909
if (!cover_path || !GLib.file_test(cover_path, GLib.FileTest.EXISTS)) {
900910
del_song_arts();
901911
this.cover = new St.Icon({
@@ -907,27 +917,49 @@ class Player extends PopupMenu.PopupMenuSection {
907917
icon_type: St.IconType.SYMBOLIC
908918
});
909919
cover_path = null;
920+
this._cover_path = null;
921+
this._applet.setAppletTextIcon(this, null);
910922
} else {
911-
let dir = Gio.file_new_for_path(ALBUMART_PICS_DIR);
923+
//~ global.log("typeof(cover_path): " + typeof(cover_path) );
924+
baseName = (typeof(cover_path) === "string") ? cover_path.split("/").pop() : "";
925+
//~ let dir = Gio.file_new_for_path(ALBUMART_PICS_DIR);
926+
let dir = Gio.file_new_for_path(ARTS_DIR);
912927
let dir_children = dir.enumerate_children("standard::name,standard::type,standard::icon,time::modified", Gio.FileQueryInfoFlags.NONE, null);
913928
if ((dir_children.next_file(null)) == null) { // dir does not contain any file.
914929
if (GLib.file_test(cover_path, GLib.FileTest.EXISTS)) {
915-
rnd = randomIntegerInInterval(0, superRND).toString();
916-
if (this._applet.runAsync)
917-
Util.spawnCommandLineAsync(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
918-
else
919-
Util.spawnCommandLine(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
930+
if (! baseName.startsWith("R3SongArt")) {
931+
rnd = randomIntegerInInterval(0, superRND).toString();
932+
if (this._applet.runAsync) {
933+
Util.spawnCommandLineAsync(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
934+
Util.spawnCommandLineAsync(`cp -a "${cover_path}" ${ARTS_DIR}/R3SongArt${rnd}`);
935+
} else {
936+
Util.spawnCommandLine(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
937+
Util.spawnCommandLine(`cp -a "${cover_path}" ${ARTS_DIR}/R3SongArt${rnd}`);
938+
}
939+
//~ cover_path = `${ALBUMART_PICS_DIR}/R3SongArt${rnd}`;
940+
//~ this._cover_path = `${ALBUMART_PICS_DIR}/R3SongArt${rnd}`;
941+
cover_path = `${ARTS_DIR}/R3SongArt${rnd}`;
942+
this._cover_path = `${ARTS_DIR}/R3SongArt${rnd}`;
943+
}
920944
} else {
921945
cover_path = null;
946+
this._cover_path = null;
922947
}
923948
} else if (!GLib.file_test(MPV_RADIO_PID, GLib.FileTest.EXISTS)) { // Radio3.0 is not running.
924949
//del_song_arts();
925950
if (GLib.file_test(cover_path, GLib.FileTest.EXISTS)) {
926-
rnd = randomIntegerInInterval(0, superRND).toString();
927-
if (this._applet.runAsync)
928-
Util.spawnCommandLineAsync(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
929-
else
930-
Util.spawnCommandLine(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
951+
if (! baseName.startsWith("R3SongArt")) {
952+
rnd = randomIntegerInInterval(0, superRND).toString();
953+
if (this._applet.runAsync) {
954+
Util.spawnCommandLineAsync(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
955+
Util.spawnCommandLineAsync(`cp -a "${cover_path}" ${ARTS_DIR}/R3SongArt${rnd}`);
956+
} else {
957+
Util.spawnCommandLine(`cp -a "${cover_path}" ${ALBUMART_PICS_DIR}/R3SongArt${rnd}`);
958+
Util.spawnCommandLine(`cp -a "${cover_path}" ${ARTS_DIR}/R3SongArt${rnd}`);
959+
}
960+
cover_path = `${ARTS_DIR}/R3SongArt${rnd}`;
961+
this._cover_path = `${ARTS_DIR}/R3SongArt${rnd}`;
962+
}
931963
} else {
932964
cover_path = null;
933965
}
@@ -1094,7 +1126,7 @@ class Seeker extends Slider.Slider {
10941126
this.actor.set_direction(St.TextDirection.LTR); // Do not invert on RTL layout
10951127
//~ this.actor.expand = true;
10961128
//~ this.actor.set_draw_value(true);
1097-
this.tooltipText = "00:00";
1129+
this.tooltipText = "00:00:00";
10981130
this.tooltip = new Tooltips.Tooltip(this.actor, this.tooltipText);
10991131

11001132
this.canSeek = true;
@@ -1122,7 +1154,7 @@ class Seeker extends Slider.Slider {
11221154

11231155

11241156
this.posLabel = new St.Label({
1125-
text: " 00:00 ",
1157+
text: " 00:00:00 ",
11261158
style: "font-family: 'Digital Numbers',monospace; "
11271159
});
11281160
this.posLabel.x_align = St.Align.START;
@@ -1131,7 +1163,7 @@ class Seeker extends Slider.Slider {
11311163
//~ this.posLabel.clutterText.line_wrap_mode = Pango.WrapMode.WORD_CHAR;
11321164
//~ this.posLabel.clutterText.ellipsize = Pango.EllipsizeMode.NONE;
11331165
this.durLabel = new St.Label({
1134-
text: " 00:00 ",
1166+
text: " 00:00:00 ",
11351167
style: "font-family: 'Digital Numbers',monospace; "
11361168
});
11371169
this.durLabel.x_align = St.Align.END;
@@ -1230,12 +1262,8 @@ class Seeker extends Slider.Slider {
12301262
time_for_label(sec) {
12311263
let milliseconds = 1000 * sec;
12321264
var date = new Date(milliseconds);
1233-
var timeString;
1234-
if (milliseconds < 3600000)
1235-
timeString = date.toISOString().substring(14, 19);
1236-
else
1237-
timeString = date.toISOString().substring(11, 19);
1238-
return " " + timeString + " ";
1265+
let timeString = date.toISOString().substring(11, 19);
1266+
return ` ${timeString} `;
12391267
}
12401268

12411269
play() {
@@ -1298,7 +1326,7 @@ class Seeker extends Slider.Slider {
12981326
this._trackid = trackid;
12991327
}
13001328
this._length = length;
1301-
if (this.status !== "Stopped" && this.durLabel) this.durLabel.set_text(this.time_for_label(length));
1329+
if (this.status !== "Stopped" && this.durLabel != null) this.durLabel.set_text(this.time_for_label(length));
13021330
this._wantedSeekValue = 0;
13031331
this._updateValue();
13041332
}
@@ -1314,15 +1342,16 @@ class Seeker extends Slider.Slider {
13141342
this.startingDate = Date.now() - this._wantedSeekValue * 1000;
13151343
this.setValue(this._wantedSeekValue / this._length);
13161344
this._currentTime = this._wantedSeekValue;
1317-
if (this.status === "Playing" && this.posLabel) this.posLabel.set_text(this.time_for_label(this._currentTime));
1345+
if (this.status === "Playing" && this.posLabel != null) this.posLabel.set_text(this.time_for_label(this._currentTime));
13181346
this._wantedSeekValue = 0;
13191347
} else if (!this._dragging) {
13201348
if (this._length > 0 && this._currentTime > 0) {
1321-
if (this.status === "Playing" && this.posLabel) this.posLabel.set_text(this.time_for_label(this._currentTime));
1349+
if (this.status === "Playing" && this.posLabel != null) this.posLabel.set_text(this.time_for_label(this._currentTime));
13221350
this.setValue(this._currentTime / this._length);
13231351
} else {
13241352
this.setValue(0);
1325-
if (this.status === "Playing" && this.posLabel) this.posLabel.set_text(" 00:00 ");
1353+
if (this.status === "Playing" && this.posLabel != null)
1354+
this.posLabel.set_text(" 00:00:00 ");
13261355
}
13271356
}
13281357
} else {
@@ -1334,10 +1363,10 @@ class Seeker extends Slider.Slider {
13341363
this.startingDate = Date.now() - this._wantedSeekValue * 1000;
13351364
this.setValue(this._wantedSeekValue / this._length);
13361365
this._currentTime = this._wantedSeekValue;
1337-
if (this.status === "Playing" && this.posLabel) this.posLabel.set_text(this.time_for_label(this._currentTime));
1366+
if (this.status === "Playing" && this.posLabel != null) this.posLabel.set_text(this.time_for_label(this._currentTime));
13381367
this._wantedSeekValue = 0;
13391368
} else if (!this._dragging) {
1340-
if (this.status === "Playing" && this.posLabel) this.posLabel.set_text(this.time_for_label(this._currentTime));
1369+
if (this.status === "Playing" && this.posLabel != null) this.posLabel.set_text(this.time_for_label(this._currentTime));
13411370
this.setValue(this._currentTime / this._length);
13421371
if (this._timeoutId != null) {
13431372
source_remove(this._timeoutId);
@@ -1361,7 +1390,8 @@ class Seeker extends Slider.Slider {
13611390
}
13621391
} else {
13631392
this.setValue(0);
1364-
if (!this.destroyed && this.status === "Playing" && this.posLabel) this.posLabel.set_text(" 00:00 ");
1393+
if (!this.destroyed && this.status === "Playing" && this.posLabel != null)
1394+
this.posLabel.set_text(" 00:00:00 ");
13651395
this.hideAll();
13661396
}
13671397
}

sound150@claudiux/files/sound150@claudiux/6.4/settings-schema.json

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"title": "Menus",
1414
"sections": [
1515
"sectionMenu1",
16-
"sectionMenu2"
16+
"sectionMenu2",
17+
"sectionMenu3",
18+
"sectionMenu4"
1719
]
1820
},
1921
"page_behavior": {
@@ -57,6 +59,7 @@
5759
"type": "section",
5860
"title": "Menu",
5961
"keys": [
62+
"userMenuWidth",
6063
"playerControl",
6164
"extendedPlayerControl",
6265
"keepPlayerListOpen",
@@ -79,6 +82,22 @@
7982
"keepCommandListOpen"
8083
]
8184
},
85+
"sectionMenu3": {
86+
"type": "section",
87+
"title": "Output Devices Not Displayed In The Context Menu",
88+
"keys": [
89+
"labelIgnoredOutputDevices",
90+
"ignoredOutputDevices"
91+
]
92+
},
93+
"sectionMenu4": {
94+
"type": "section",
95+
"title": "Input Devices Not Displayed In The Context Menu",
96+
"keys": [
97+
"labelIgnoredInputDevices",
98+
"ignoredInputDevices"
99+
]
100+
},
82101
"sectionBehavior1": {
83102
"type": "section",
84103
"title": "External commands and scripts",
@@ -222,6 +241,15 @@
222241
]
223242
}
224243
},
244+
"userMenuWidth": {
245+
"type": "scale",
246+
"default": 450,
247+
"min": 450,
248+
"max": 600,
249+
"step": 10,
250+
"description": "Menu width (in pixels)",
251+
"show-value": true
252+
},
225253
"playerControl": {
226254
"type": "switch",
227255
"default": true,
@@ -305,6 +333,42 @@
305333
"default": false,
306334
"description": "Keep the Command selector open"
307335
},
336+
"labelIgnoredOutputDevices": {
337+
"type": "label",
338+
"description": "In the list below, add a line containing part of its name (case sensitive) for each unwanted device."
339+
},
340+
"ignoredOutputDevices": {
341+
"type": "list",
342+
"description": "Unwanted devices",
343+
"default": [],
344+
"columns": [
345+
{
346+
"id": "partOfName",
347+
"title": "Part of the device name",
348+
"type": "string",
349+
"default": "",
350+
"expand-width": true
351+
}
352+
]
353+
},
354+
"labelIgnoredInputDevices": {
355+
"type": "label",
356+
"description": "In the list below, add a line containing part of its name (case sensitive) for each unwanted device."
357+
},
358+
"ignoredInputDevices": {
359+
"type": "list",
360+
"description": "Unwanted devices",
361+
"default": [],
362+
"columns": [
363+
{
364+
"id": "partOfName",
365+
"title": "Part of the device name",
366+
"type": "string",
367+
"default": "",
368+
"expand-width": true
369+
}
370+
]
371+
},
308372
"keyOpen": {
309373
"type": "keybinding",
310374
"description": "Show menu",
@@ -331,7 +395,8 @@
331395
"org.gnome.Totem",
332396
"mullvad browser",
333397
"io.gitlab.librewolf-community",
334-
"LibreWolf"
398+
"LibreWolf",
399+
"org.strawberrymusicplayer.strawberry"
335400
]
336401
},
337402
"runAsync": {

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.9.0~20251228
2+
* Also displays OSD with commands like "pactl set-sink-volume ...".
3+
* Fixes [#8045](https://github.com/linuxmint/cinnamon-spices-applets/issues/8045)
4+
15
### v13.8.2~20251225
26
* Fixes a nasty bug.
37
* Fixes [#8115](https://github.com/linuxmint/cinnamon-spices-applets/issues/8115)

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

0 commit comments

Comments
 (0)