Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sound150@claudiux] v7.0.0 - Compatible with Cinnamon 6.4 #6483

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -338,6 +338,7 @@ class VolumeSlider extends PopupMenu.PopupSliderMenuItem {
let icon = Gio.Icon.new_for_string(this._volumeToIcon(this._value));

if (this.applet.showOSD) {
//~ logDebug("volume: "+volume);
Main.osdWindowManager.show(-1, icon, Math.round(volume/this.applet._volumeNorm * 100), null);
}

Expand Down Expand Up @@ -1796,6 +1797,7 @@ class Sound150Applet extends Applet.TextIconApplet {
this.settings.bind("magnetic25On", "magnetic25On", () => this._on_sound_settings_change());

this.settings.bind("adaptColor", "adaptColor", () => this._on_sound_settings_change());
this.settings.bind("color0_100", "color0_100", () => this._on_sound_settings_change());
this.settings.bind("color101_115", "color101_115", () => this._on_sound_settings_change());
this.settings.bind("color116_130", "color116_130", () => this._on_sound_settings_change());
this.settings.bind("color131_150", "color131_150", () => this._on_sound_settings_change());
Expand All @@ -1812,6 +1814,7 @@ class Sound150Applet extends Applet.TextIconApplet {
this.settings.bind("volumeSoundFile", "volumeSoundFile", this.on_volumeSoundFile_changed);
this.settings.setValue("volumeSoundEnabled", this._sounds_settings.get_boolean(VOLUME_SOUND_ENABLED_KEY));
this.settings.bind("volumeSoundEnabled", "volumeSoundEnabled", this.on_volumeSoundEnabled_changed);
this.settings.bind("maxVolume", "maxVolume", (value) => this._on_maxVolume_changed(value));

this.settings.setValue("showMediaKeysOSD", global.settings.get_string(SHOW_MEDIA_KEYS_OSD_KEY));
this.settings.bind("showMediaKeysOSD", "showMediaKeysOSD", this.on_showMediaKeysOSD_changed);
Expand Down Expand Up @@ -1903,8 +1906,9 @@ class Sound150Applet extends Applet.TextIconApplet {
this._control.connect("stream-added", (...args) => this._onStreamAdded(...args));
this._control.connect("stream-removed", (...args) => this._onStreamRemoved(...args));

//~ this._sound_settings = new Gio.Settings({ schema_id: CINNAMON_DESKTOP_SOUNDS });
this._sound_settings = new Gio.Settings({ schema_id: CINNAMON_DESKTOP_SOUNDS });
this._volumeNorm = this._control.get_vol_max_norm();
//~ logDebug("this._volumeNorm: "+this._volumeNorm);
this._volumeMax = this._volumeNorm;

this._streams = [];
Expand Down Expand Up @@ -1986,10 +1990,10 @@ class Sound150Applet extends Applet.TextIconApplet {
appsys.connect("installed-changed", () => this._updateLaunchPlayer());

this._sound_settings.connect("changed::" + OVERAMPLIFICATION_KEY, () => this._on_sound_settings_change());
this._on_sound_settings_change();
//~ this._on_sound_settings_change();

this._loopArtId = null;
this.loopArt();
//~ this._loopArtId = null;
//~ this.loopArt();
}

on_volumeSoundFile_changed() {
Expand Down Expand Up @@ -2163,14 +2167,31 @@ class Sound150Applet extends Applet.TextIconApplet {
});
} // End of _setKeybinding

_on_maxVolume_changed(value) {
if (value > 100) {
this._sound_settings.set_boolean(OVERAMPLIFICATION_KEY, true);
} else {
this._sound_settings.set_boolean(OVERAMPLIFICATION_KEY, false);
}
this._on_sound_settings_change();
}

_on_sound_settings_change() {
if (this._sound_settings.get_boolean(OVERAMPLIFICATION_KEY)) {
this._volumeMax = 1.5 * this._volumeNorm;
this._outputVolumeSection.set_mark(1/1.5);
if (!this._sound_settings.get_boolean(OVERAMPLIFICATION_KEY) && this.maxVolume > 100) {
this.maxVolume = 100;
}
this._volumeMax = this.maxVolume / 100 * this._volumeNorm;
if (this.maxVolume > 100)
this._outputVolumeSection.set_mark(100/this.maxVolume);
else {
this._volumeMax = this._volumeNorm;
this._outputVolumeSection.set_mark(0);
if (this.maxVolume === 100)
this._volumeMax = this._volumeNorm;
}
if (parseInt(this.volume.slice(0, -1)) > this.maxVolume) {
this.volume = "" + this.maxVolume + "%";
this._volumeChange(Clutter.ScrollDirection.DOWN);
this._volumeChange(Clutter.ScrollDirection.UP);
}
this._outputVolumeSection._update();
}
Expand All @@ -2196,6 +2217,11 @@ class Sound150Applet extends Applet.TextIconApplet {

on_applet_added_to_panel() {
this.showOSD = this.showOSDonStartup && (this.showMediaKeysOSD != "disabled");
this._on_sound_settings_change();

this._loopArtId = null;
this.loopArt();

this.volume_near_icon()
}

Expand Down Expand Up @@ -2412,7 +2438,9 @@ class Sound150Applet extends Applet.TextIconApplet {
this.set_applet_icon_symbolic_name(icon_name);
if (this.showOSD) {
//~ Main.osdWindowManager.hideAll();
Main.osdWindowManager.show(-1, icon, volume, null);
try {
Main.osdWindowManager.show(-1, icon, volume, null);
} catch(e) {}
//Main.osdWindowManager.show(0, icon, volume, true);
}
var intervalId = null;
Expand Down Expand Up @@ -2989,6 +3017,10 @@ class Sound150Applet extends Applet.TextIconApplet {
color = this.color101_115; //Default is "yellow";
changeColor = true;
}
else {
color = this.color0_100; //Default is "#e4e4e4";
changeColor = true;
}
}
let _style = "color: %s;".format(color);

Expand Down Expand Up @@ -3182,9 +3214,9 @@ class Sound150Applet extends Applet.TextIconApplet {
Extension.reloadExtension(UUID, Extension.Type.APPLET);
}

_onSetApmlificationPressed() {
let command = "cinnamon-settings sound -t 4";
Util.spawnCommandLine(command);
_onSystemSoundSettingsPressed() {
let command = "cinnamon-settings sound";
Util.spawnCommandLineAsync(command);
}

volume_near_icon() {
Expand All @@ -3205,6 +3237,7 @@ class Sound150Applet extends Applet.TextIconApplet {
}

_reset_colors() {
this.color0_100 = "#e4e4e4";
this.color101_115 = "yellow";
this.color116_130 = "orange";
this.color131_150 = "red";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"showMicMutedOnIcon",
"showMicUnmutedOnIcon",
"adaptColor",
"color0_100",
"color101_115",
"color116_130",
"color131_150",
Expand All @@ -95,7 +96,8 @@
"type": "section",
"title": "Sound Settings",
"keys": [
"setAmplification",
"openSystemSoundSettings",
"maxVolume",
"stepVolume",
"magneticOn",
"magnetic25On",
Expand Down Expand Up @@ -291,10 +293,18 @@
"default": false,
"description": "Display icon indicating that the microphone is activated, if applicable"
},
"setAmplification": {
"openSystemSoundSettings": {
"type": "button",
"description": "Maximum volume control",
"callback": "_onSetApmlificationPressed"
"description": "System Sound Settings",
"callback": "_onSystemSoundSettingsPressed"
},
"maxVolume": {
"type": "scale",
"description": "Maximum volume (%)",
"default": 100,
"min": 30,
"max": 150,
"step": 5
},
"stepVolume": {
"type": "combobox",
Expand Down Expand Up @@ -331,6 +341,12 @@
"description": "Adjust the color of the icon to the volume",
"default": true
},
"color0_100": {
"type": "colorchooser",
"dependency": "adaptColor",
"default": "#e4e4e4",
"description": "Icon color: 0%-100%"
},
"color101_115": {
"type": "colorchooser",
"dependency": "adaptColor",
Expand Down
4 changes: 4 additions & 0 deletions sound150@claudiux/files/sound150@claudiux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### v7.0.0~20241011
* Compatible with Cinnamon 6.4.


### v6.18.1~20240907
* Fixes #6301.

Expand Down
5 changes: 3 additions & 2 deletions 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": "6.18.1",
"version": "7.0.0",
"cinnamon-version": [
"2.8",
"3.0",
Expand All @@ -24,7 +24,8 @@
"5.6",
"5.8",
"6.0",
"6.2"
"6.2",
"6.4"
],
"author": "claudiux"
}
Loading