linuxmint / linuxmint/cinnamon
Applet settings window, widgets cannot update other widgets
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 915
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 3
Description
Distribution
Mint 22
Package version
6.2.9
Graphics hardware in use
No response
Frequency
Always
Bug description
I will refer the settings window of an Applet as UI.
-
In the UI, any action initiated by any non-
buttonwidget cannot update another widget'svalueshown. -
While the inner
valueis well changed, the UI is like a new instance of thevalueand any subsequent change from the UI accounts for the shownvalue, while any other procedure in the Applet accounts for the innervalue. -
While a
buttoncan update another widget's shownvalue, if a non-buttonwidget has set a widget'svalue(incl. itself), the button won't be able to control the widget's shownvalueanymore.
Steps to reproduce
metadata.json:
{
"uuid": "ui-cant-modify-itself@you",
"name": "Bug demo: UI can't modify itself",
"description": "-",
"version": "1.0.0",
"max-instances": "1"
}
settings_schema.json:
{
"switch-master": {
"type": "switch",
"description": "Switch master",
"default": false
},
"switch-slave": {
"type": "switch",
"description": "Switch slave, controlled by `Switch master` and `on_applet_clicked`",
"default": false
},
"button-apply-master-to-slave": {
"callback": "apply_false_to_slave",
"type": "button",
"description": "Apply `false` to slave"
},
"button-show-slave": {
"callback": "show_slave_state",
"type": "button",
"description": "Show slave state"
},
"dull-switch-show-slave": {
"type": "switch",
"description": "Dull switch, executes `show_slave_state` on change",
"default": false
}
}
applet.js:
const Applet = imports.ui.applet;
const AppletSettings = imports.ui.settings.AppletSettings;
const Main = imports.ui.main;
class ThisApplet extends Applet.TextApplet {
constructor(metadata, orientation, panel_height, instance_id) {
super(orientation, panel_height, instance_id);
this.set_applet_label("Open settings...");
this.metadata = metadata;
this.settings = new AppletSettings(this, metadata.uuid, instance_id);
this.settings.bind('switch-master', "master", () => {
this.slave = this.master;
this.show_slave_state();
});
this.settings.bind('switch-slave', "slave");
this.settings.bind('dull-switch-show-slave', null, this.show_slave_state);
}
apply_false_to_slave() {
this.slave = false;
this.show_slave_state();
}
show_slave_state() {
Main.notify("Info", "Switch slave is " + this.slave);
}
on_applet_clicked() {
this.slave = !this.slave;
this.show_slave_state();
}
}
function main(metadata, orientation, panel_height, instance_id) {
return new ThisApplet(metadata, orientation, panel_height, instance_id);
}
Expected behavior
The UI should always have its widgets' shown value up to date according to the inner value.
Additional information
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the applet.js reproduction, especially AppletSettings, settings.bind, and the switch and button callbacks; use metadata.json and settings_schema.json to install the example. Compare the inner values with the values shown in the settings window while following the reproduction steps. Done means every widget's displayed value stays synchronized with its inner value after changes from switches, buttons, and applet procedures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100