Skip to content

Commit

Permalink
v7.3.3 - Improves compatibility with Cinnamon 6.4 (#6679)
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiux authored Dec 12, 2024
1 parent 7c58280 commit 0165a7e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 13 deletions.
57 changes: 45 additions & 12 deletions sound150@claudiux/files/sound150@claudiux/6.4/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class ControlButton {
this.icon = new St.Icon({
icon_type: St.IconType.SYMBOLIC,
icon_name: icon,
style_class: (small) ? "popup-menu-icon" : ""
style_class: (small) ? "popup-menu-icon" : null
});
this.button.set_child(this.icon);
this.actor.add_actor(this.button);
Expand Down Expand Up @@ -994,7 +994,8 @@ class StreamMenuSection extends PopupMenu.PopupMenuSection {

if (name != "Muffin") { // This test is it really necessary?
this.slider = new VolumeSlider(applet, stream, name, iconName);
this.slider._slider.style = "min-width: 6em;";
//FIXME: which line? is this useful? it seems DEPRECATED.
//~ this.slider._slider.style = "min-width: 6em;";
//~ this.slider._slider.style = "width: 6em;";
this.addMenuItem(this.slider);
} else {
Expand Down Expand Up @@ -2236,6 +2237,21 @@ class Sound150Applet extends Applet.TextIconApplet {
}

on_applet_added_to_panel() {
//~ this.actor.set_style(null);
//~ this._applet_label.set_style(null);

//~ let color;
//~ try {
//~ if (!this.themeNode) {
//~ this.themeNode = this.actor.get_theme_node();
//~ }
//~ let defaultColor = this.themeNode.get_foreground_color();
//~ color = "rgba(" + defaultColor.red + "," + defaultColor.green + "," + defaultColor.blue + "," + defaultColor.alpha + ")";
//~ } catch(e) {
//~ color = this.color0_100;
//~ }
//~ this.color0_100 = color;

this.showOSD = this.showOSDonStartup && this.showMediaKeysOSD;
this._on_sound_settings_change();

Expand Down Expand Up @@ -2326,12 +2342,12 @@ class Sound150Applet extends Applet.TextIconApplet {
if (!this._output)
return;
let iconName = "audio-volume-";
let icon;
let icon, volume;
if (this._output.is_muted) {
this._output.change_is_muted(false);
this.mute_out_switch.setToggleState(false);

let volume = Math.round(this._output.volume/this._volumeNorm*100);
volume = Math.round(this._output.volume/this._volumeNorm*100);
//~ logDebug("VOLUME: "+volume);
if (volume < 1)
iconName += "muted";
Expand Down Expand Up @@ -2367,7 +2383,15 @@ class Sound150Applet extends Applet.TextIconApplet {
this.set_applet_icon_symbolic_name(this._outputIcon);
if (this.showMediaKeysOSD) {
icon = Gio.Icon.new_for_string(this._outputIcon);
Main.osdWindowManager.show(-1, icon, ""+this.volume.slice(0,-1), null);
if (typeof(this.volume) == "string") {
if (this.volume.endsWith("%"))
volume = parseInt(this.volume.slice(0,-1));
else
volume = parseInt(this.volume);
} else {
volume = this.volume;
}
Main.osdWindowManager.show(-1, icon, ""+volume, null);
}
}
}
Expand Down Expand Up @@ -2477,7 +2501,7 @@ class Sound150Applet extends Applet.TextIconApplet {
this._notifyVolumeChange(this._output);
this.setAppletTooltip();
this._applet_tooltip.show();
let volume = this.volume.slice(0, -1);
let volume = parseInt(this.volume.slice(0, -1));
let icon_name = "audio-volume";
if (volume > 100) icon_name += "-overamplified";
else if (volume <1) {
Expand Down Expand Up @@ -3068,13 +3092,22 @@ class Sound150Applet extends Applet.TextIconApplet {
this.volume = percentage;
this.setAppletTooltip();

if (!this.themeNode) {
this.themeNode = this.actor.get_theme_node();
}
let defaultColor = this.themeNode.get_foreground_color();
let color = "rgba(" + defaultColor.red + "," + defaultColor.green + "," + defaultColor.blue + "," + defaultColor.alpha + ")";

let color;
let changeColor = false;

//~ try {
//~ if (!this.themeNode) {
//~ this.themeNode = this.actor.get_theme_node();
//~ }
//~ let defaultColor = this.themeNode.get_foreground_color();
//~ color = "rgba(" + defaultColor.red + "," + defaultColor.green + "," + defaultColor.blue + "," + defaultColor.alpha + ")";
//~ } catch(e) {
//~ color = this.color0_100;
//~ changeColor = true;
//~ }
color = this.color0_100;
changeColor = true;

if (this.adaptColor) {
let pc = Math.round(percentage.split("%")[0]);
if (pc > 130) {
Expand Down
3 changes: 3 additions & 0 deletions sound150@claudiux/files/sound150@claudiux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### v7.3.3~20241212
* Improves compatibility with Cinnamon 6.4 removing "%" after volume level.

### v7.3.2~20241206
* Fixes OSD problems.
* Fixes #6669.
Expand Down
2 changes: 1 addition & 1 deletion sound150@claudiux/files/sound150@claudiux/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"max-instances": "1",
"description": "Enhanced sound applet",
"hide-configuration": false,
"version": "7.3.2",
"version": "7.3.3",
"cinnamon-version": [
"2.8",
"3.0",
Expand Down

0 comments on commit 0165a7e

Please sign in to comment.