Skip to content

Commit 7a6f833

Browse files
authored
sound150 v13.3.4: Uses Digital-Numbers font-family in menu. Gets real ui_scale, when scaling is set to other values than 100% or 200%. (#7921)
1 parent dce933d commit 7a6f833

File tree

6 files changed

+82
-18
lines changed

6 files changed

+82
-18
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class Sound150Applet extends Applet.TextIconApplet {
198198
constructor(metadata, orientation, panel_height, instanceId) {
199199
super(orientation, panel_height, instanceId);
200200

201-
Util.spawnCommandLineAsync("/usr/bin/env bash -c 'cd %s && chmod 755 *.sh'".format(PATH2SCRIPTS));
201+
Util.spawnCommandLineAsync("/usr/bin/env bash -c 'cd %s && chmod 755 *.sh *.py'".format(PATH2SCRIPTS));
202202
Util.spawnCommandLineAsync("/usr/bin/env bash -c '[[ -d %s ]] || mkdir -p %s'".format(ALBUMART_PICS_DIR, ALBUMART_PICS_DIR));
203203
Util.spawnCommandLineAsync("/usr/bin/env bash -c '[[ -d %s ]] || mkdir -p %s'".format(ICONDIR, ICONDIR));
204204
Util.spawnCommandLineAsync("/usr/bin/env bash -C '" + PATH2SCRIPTS + "/rm_tmp_files.sh'");
@@ -209,6 +209,13 @@ class Sound150Applet extends Applet.TextIconApplet {
209209

210210
this.metadata = metadata;
211211

212+
this.real_ui_scale = 1.0;
213+
Util.spawnCommandLineAsyncIO(PATH2SCRIPTS + "/get-real-scale.py", (stdout, stderr, exitCode) => {
214+
if (exitCode === 0) {
215+
this.real_ui_scale = parseFloat(stdout);
216+
}
217+
}, {});
218+
212219
this.players_without_seek_support = original_players_without_seek_support;
213220
this.players_with_seek_support = original_players_with_seek_support;
214221
this.PERCENT_CHAR = _("%");
@@ -430,7 +437,6 @@ class Sound150Applet extends Applet.TextIconApplet {
430437
this.menuManager = new PopupMenu.PopupMenuManager(this);
431438
this.menu = new Applet.AppletPopupMenu(this, orientation);
432439
this.menuManager.addMenu(this.menu);
433-
this.menu.actor.set_width(450);
434440

435441
this.set_applet_icon_symbolic_name("audio-x-generic");
436442

@@ -1073,6 +1079,7 @@ class Sound150Applet extends Applet.TextIconApplet {
10731079
}
10741080

10751081
on_applet_added_to_panel() {
1082+
this.menu.actor.set_width(Math.round(450 * this.real_ui_scale));
10761083
this.title_text_old = "";
10771084
this.startingUp = true;
10781085
if (this._playerctl)

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

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class Player extends PopupMenu.PopupMenuSection {
244244
// Cover art
245245
this.cover = new St.Icon({
246246
icon_name: "media-optical",
247-
icon_size: Math.trunc(300 * global.ui_scale),
247+
icon_size: Math.trunc(300 * this._applet.real_ui_scale),
248248
//icon_type: St.IconType.FULLCOLOR
249249
icon_type: St.IconType.SYMBOLIC
250250
});
@@ -819,7 +819,7 @@ class Player extends PopupMenu.PopupMenuSection {
819819
style_class: "sound-player-generic-coverart",
820820
important: true,
821821
icon_name: "media-optical",
822-
icon_size: Math.trunc(300 * global.ui_scale),
822+
icon_size: Math.trunc(300 * this._applet.real_ui_scale),
823823
//icon_type: St.IconType.FULLCOLOR
824824
icon_type: St.IconType.SYMBOLIC
825825
});
@@ -849,8 +849,8 @@ class Player extends PopupMenu.PopupMenuSection {
849849
this._applet.setAppletIcon(this._applet.player, cover_path); // Added
850850
this._cover_load_handle = St.TextureCache.get_default().load_image_from_file_async(
851851
cover_path,
852-
Math.trunc(300 * global.ui_scale),
853-
Math.trunc(300 * global.ui_scale),
852+
Math.trunc(300 * this._applet.real_ui_scale),
853+
Math.trunc(300 * this._applet.real_ui_scale),
854854
(cache, handle, actor) => {
855855
this._on_cover_loaded(cache, handle, actor)
856856
}
@@ -862,8 +862,8 @@ class Player extends PopupMenu.PopupMenuSection {
862862
try {
863863
let pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
864864
this._cover_path,
865-
Math.trunc(300 * global.ui_scale),
866-
Math.trunc(300 * global.ui_scale)
865+
Math.trunc(300 * this._applet.real_ui_scale),
866+
Math.trunc(300 * this._applet.real_ui_scale)
867867
);
868868
if (pixbuf) {
869869
let image = new Clutter.Image();
@@ -879,7 +879,7 @@ class Player extends PopupMenu.PopupMenuSection {
879879
if (this._applet.keepAlbumAspectRatio) {
880880
//TODO: Replace Texture by Image.
881881
this.cover = new Clutter.Texture({
882-
width: Math.trunc(300 * global.ui_scale),
882+
width: Math.trunc(300 * this._applet.real_ui_scale),
883883
keep_aspect_ratio: true,
884884
//filter_quality: 2,
885885
filter_quality: Clutter.Texture.QUALITY_HIGH,
@@ -888,8 +888,8 @@ class Player extends PopupMenu.PopupMenuSection {
888888
} else {
889889
//TODO: Replace Texture by Image.
890890
this.cover = new Clutter.Texture({
891-
width: Math.trunc(300 * global.ui_scale),
892-
height: Math.trunc(300 * global.ui_scale),
891+
width: Math.trunc(300 * this._applet.real_ui_scale),
892+
height: Math.trunc(300 * this._applet.real_ui_scale),
893893
keep_aspect_ratio: false,
894894
filter_quality: Clutter.Texture.QUALITY_HIGH,
895895
filename: cover_path
@@ -919,10 +919,33 @@ class Player extends PopupMenu.PopupMenuSection {
919919
// (and move the player controls as a result).
920920
//~ log("actor size (wxh): "+actor.width+"x"+actor.height);
921921
//~ actor.set_margin_bottom(Math.max(0, Math.trunc(300 * global.ui_scale - actor.height)));
922-
let mb = (this._applet.viewFullAlbumArt) ? 110 : 55;
922+
let mb = 55;
923+
if (this._applet.viewFullAlbumArt) {
924+
switch (this._applet.real_ui_scale) {
925+
case 0.75:
926+
mb = 100;
927+
break;
928+
case 1.0:
929+
mb = 110;
930+
break;
931+
case 1.25:
932+
mb = 140;
933+
break;
934+
case 1.5:
935+
mb = 165;
936+
break;
937+
case 1.75:
938+
mb = 195;
939+
break;
940+
default:
941+
mb = 220;
942+
}
943+
}
944+
//~ let mb = (this._applet.viewFullAlbumArt) ? 110 : 55;
945+
//~ mb = Math.round(mb * this._applet.real_ui_scale);
923946
actor.set_margin_bottom(mb);
924947

925-
actor.set_margin_left(Math.max(0, Math.round(300 * global.ui_scale - actor.width * global.ui_scale)));
948+
actor.set_margin_left(Math.max(0, Math.round(300 * this._applet.real_ui_scale - actor.width)));
926949

927950
this.cover = actor;
928951

@@ -1003,15 +1026,17 @@ class Seeker extends Slider.Slider {
10031026

10041027

10051028
this.posLabel = new St.Label({
1006-
text: " 00:00 "
1029+
text: " 00:00 ",
1030+
style: "font-family: 'Digital Numbers',monospace; "
10071031
});
10081032
this.posLabel.x_align = St.Align.START;
10091033
//~ logDebug("this.posLabel: "+this.posLabel);
10101034
//~ this.posLabel.clutterText.line_wrap = false;
10111035
//~ this.posLabel.clutterText.line_wrap_mode = Pango.WrapMode.WORD_CHAR;
10121036
//~ this.posLabel.clutterText.ellipsize = Pango.EllipsizeMode.NONE;
10131037
this.durLabel = new St.Label({
1014-
text: " 00:00 "
1038+
text: " 00:00 ",
1039+
style: "font-family: 'Digital Numbers',monospace; "
10151040
});
10161041
this.durLabel.x_align = St.Align.END;
10171042
//~ logDebug("this.durLabel: "+this.durLabel);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ class VolumeSlider extends PopupMenu.PopupSliderMenuItem {
6262
this.icon = new St.Icon({
6363
icon_name: this.iconName,
6464
icon_type: St.IconType.SYMBOLIC,
65-
icon_size: Math.trunc(16 * global.ui_scale)
65+
icon_size: Math.trunc(16 * this.applet.real_ui_scale)
6666
});
6767
} else {
6868
this.icon = new St.Icon({
6969
icon_name: this.app_icon,
7070
icon_type: St.IconType.FULLCOLOR,
71-
icon_size: Math.trunc(16 * global.ui_scale)
71+
icon_size: Math.trunc(16 * this.applet.real_ui_scale)
7272
});
7373
}
7474

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.3.4~20251028
2+
* Gets real ui_scale, when scaling is set to other values than 100% or 200%.
3+
* Uses "font-family: 'Digital Numbers',monospace" to display counters in menu.
4+
15
### v13.3.3~20251028
26
* Avoids menu shaking.
37

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.3",
8+
"version": "13.3.4",
99
"cinnamon-version": [
1010
"2.8",
1111
"3.0",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python3
2+
# -*- coding:Utf-8 -*-
3+
4+
# Author : Claude CLERC <[email protected]> <[email protected]>
5+
import sys
6+
import dbus
7+
bus = dbus.SessionBus()
8+
9+
display_config_well_known_name = "org.cinnamon.Muffin.DisplayConfig"
10+
display_config_object_path = "/org/cinnamon/Muffin/DisplayConfig"
11+
12+
display_config_proxy = bus.get_object(display_config_well_known_name, display_config_object_path)
13+
display_config_interface = dbus.Interface(display_config_proxy, dbus_interface=display_config_well_known_name)
14+
15+
serial, physical_monitors, logical_monitors, properties = display_config_interface.GetCurrentState()
16+
17+
18+
for x, y, scale, transform, primary, linked_monitors_info, props in logical_monitors:
19+
# ~ physical_monitors_config = []
20+
for linked_monitor_connector, linked_monitor_vendor, linked_monitor_product, linked_monitor_serial in linked_monitors_info:
21+
for monitor_info, monitor_modes, monitor_properties in physical_monitors:
22+
monitor_connector, monitor_vendor, monitor_product, monitor_serial = monitor_info
23+
if linked_monitor_connector == monitor_connector:
24+
for mode_id, mode_width, mode_height, mode_refresh, mode_preferred_scale, mode_supported_scales, mode_properties in monitor_modes:
25+
if mode_properties.get("is-current", False): # ( mode_properties provides is-current, is-preferred, is-interlaced, and more)
26+
# ~ physical_monitors_config.append(dbus.Struct([monitor_connector, mode_id, {}]))
27+
# ~ print(monitor_properties.get("display-name"))
28+
print(scale, end="")

0 commit comments

Comments
 (0)