[gnome] Update gnome extensions
This commit is contained in:
@ -310,4 +310,30 @@ other: Other
|
||||
### Other
|
||||
- Update translations (Italian)
|
||||
### Added
|
||||
- Gnome 48 support
|
||||
- Gnome 48 support
|
||||
|
||||
## [v52] - 2025-07-12
|
||||
### Added
|
||||
- Suggestion [#30](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/30): The notification indicating inconsistencies between the values configured in the extension and the currently applied values now has action buttons that allow you to use the current values or use the configured ones (or defaults if they have never been configured).
|
||||
|
||||
### Removed
|
||||
- Support for versions older than Gnome 46 is removed.
|
||||
|
||||
### Other
|
||||
- Refactoring some code.
|
||||
|
||||
## [v53] - 2025-07-13
|
||||
### Fixed
|
||||
- Issue [#30](https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension/-/issues/30): The notification indicating inconsistencies between configured and currently applied values is now persistent and must be dismissed using the close button or one of the action buttons.
|
||||
|
||||
## [v54] - 2025-07-18
|
||||
### Other
|
||||
- Update translations
|
||||
|
||||
## [v55] - 2025-07-18
|
||||
### Other
|
||||
- The warning message when thresholds do not match has been modified.
|
||||
|
||||
## [v56] - 2025-09-30
|
||||
### Added
|
||||
- Gnome 49 support
|
||||
@ -238,6 +238,13 @@ export const ThresholdIndicator = GObject.registerClass({
|
||||
|
||||
this._updateIndicator();
|
||||
|
||||
this._notificationSource = new MessageTray.Source({
|
||||
'title': this._name,
|
||||
'icon': getIcon('threshold-app', false)
|
||||
});
|
||||
|
||||
Main.messageTray.add(this._notificationSource);
|
||||
|
||||
// Driver signals
|
||||
this._driver.connectObject(
|
||||
'notify', () => this._updateIndicator(),
|
||||
@ -314,6 +321,8 @@ export const ThresholdIndicator = GObject.registerClass({
|
||||
);
|
||||
|
||||
this.connect('destroy', () => {
|
||||
this._notificationSource.destroy();
|
||||
this._notificationSource = null;
|
||||
this.quickSettingsItems.forEach(item => item.destroy());
|
||||
this._settings.disconnectObject(this);
|
||||
this._settings = null;
|
||||
@ -324,13 +333,7 @@ export const ThresholdIndicator = GObject.registerClass({
|
||||
});
|
||||
|
||||
// Pending changes alert
|
||||
this._driver.batteries.every(battery => {
|
||||
if (battery.pendingChanges && battery.isActive) {
|
||||
this._notify(_('Battery Threshold'), _('The currently set thresholds do not match the configured ones'), 'threshold-active-warning', false);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
this._pendingChangesAlert();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -375,36 +378,20 @@ export const ThresholdIndicator = GObject.registerClass({
|
||||
/**
|
||||
* Show notification.
|
||||
*
|
||||
* @param {string} msg Title
|
||||
* @param {string} details Message
|
||||
* @param {string} iconName Icon name
|
||||
* @param {boolean} [transient=true] Transient notification
|
||||
*/
|
||||
_notify(msg, details, iconName, transient = true) {
|
||||
_notify(details, iconName, transient = true) {
|
||||
if (!this._settings.get_boolean('show-notifications')) return;
|
||||
if (SHELL_VERSION === 45) {
|
||||
const source = new MessageTray.Source(this._name);
|
||||
Main.messageTray.add(source);
|
||||
const notification = new MessageTray.Notification(
|
||||
source,
|
||||
msg,
|
||||
details,
|
||||
{ gicon: getIcon(iconName, true) }
|
||||
);
|
||||
notification.setTransient(transient);
|
||||
source.showNotification(notification);
|
||||
} else {
|
||||
const source = new MessageTray.Source({ 'title': this._name });
|
||||
Main.messageTray.add(source);
|
||||
const notification = new MessageTray.Notification({
|
||||
source: source,
|
||||
title: msg,
|
||||
body: details,
|
||||
isTransient: transient,
|
||||
gicon: getIcon(iconName, true)
|
||||
});
|
||||
source.addNotification(notification);
|
||||
}
|
||||
const notification = new MessageTray.Notification({
|
||||
source: this._notificationSource,
|
||||
title: _('Battery Threshold'),
|
||||
body: details,
|
||||
isTransient: transient,
|
||||
gicon: getIcon(iconName, true)
|
||||
});
|
||||
this._notificationSource.addNotification(notification);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -413,7 +400,7 @@ export const ThresholdIndicator = GObject.registerClass({
|
||||
* @param {string} message Message
|
||||
*/
|
||||
_notifyError(message) {
|
||||
this._notify(_('Battery Threshold'), message, 'threshold-error', false);
|
||||
this._notify(message, 'threshold-error', false)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -422,7 +409,7 @@ export const ThresholdIndicator = GObject.registerClass({
|
||||
* @param {string} message Message
|
||||
*/
|
||||
_notifyEnabled(message) {
|
||||
this._notify(_('Battery Threshold'), message, 'threshold-active');
|
||||
this._notify(message, 'threshold-active')
|
||||
}
|
||||
|
||||
/**
|
||||
@ -431,6 +418,54 @@ export const ThresholdIndicator = GObject.registerClass({
|
||||
* @param {string} message Message
|
||||
*/
|
||||
_notifyDisabled(message) {
|
||||
this._notify(_('Battery Threshold'), message, 'threshold-inactive');
|
||||
this._notify(message, 'threshold-inactive')
|
||||
}
|
||||
|
||||
/**
|
||||
* Show alert when are pending values changes
|
||||
*/
|
||||
_pendingChangesAlert() {
|
||||
let notify = false;
|
||||
this._driver.batteries.every(battery => {
|
||||
if (battery.pendingChanges && battery.isActive) {
|
||||
notify = true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (notify) {
|
||||
let message = _(`The currently configured thresholds don't match those set on the system.`);
|
||||
if (SHELL_VERSION >= 48) {
|
||||
// TRANSLATORS: The strings "<b>" and "</b>" are part of the markup language and indicate that the text between the tags will be rendered in "bold"
|
||||
// TRANSLATORS: This chain joins another so it is a good idea to leave a space in front of it.
|
||||
// TRANSLATORS: "Preserve battery health" is an option in Gnome settings.
|
||||
message += _(` Is the <b>Preserve battery health</b> option enabled in Gnome settings? This mode restores its own values.`);
|
||||
}
|
||||
|
||||
const notification = new MessageTray.Notification({
|
||||
source: this._notificationSource,
|
||||
title: _('Battery Threshold'),
|
||||
body: message,
|
||||
gicon: getIcon('threshold-active-warning', true),
|
||||
resident: true,
|
||||
urgency: MessageTray.Urgency.CRITICAL,
|
||||
'use-body-markup': true
|
||||
});
|
||||
notification.addAction(_('Keep detected'), () => {
|
||||
this._driver.batteries.every(battery => {
|
||||
if (battery.pendingChanges && battery.isActive) {
|
||||
this._settings.set_int(`start-${battery.name.toLowerCase()}`, battery.startValue);
|
||||
this._settings.set_int(`end-${battery.name.toLowerCase()}`, battery.endValue);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
notification.destroy();
|
||||
});
|
||||
notification.addAction(_('Set configured'), () => {
|
||||
this._driver.enableAll();
|
||||
notification.destroy();
|
||||
});
|
||||
this._notificationSource.addNotification(notification);
|
||||
}
|
||||
}
|
||||
});
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -5,12 +5,12 @@
|
||||
"name": "Thinkpad Battery Threshold",
|
||||
"settings-schema": "org.gnome.shell.extensions.thinkpad-battery-threshold",
|
||||
"shell-version": [
|
||||
"45",
|
||||
"46",
|
||||
"47",
|
||||
"48"
|
||||
"48",
|
||||
"49"
|
||||
],
|
||||
"url": "https://gitlab.com/marcosdalvarez/thinkpad-battery-threshold-extension",
|
||||
"uuid": "thinkpad-battery-threshold@marcosdalvarez.org",
|
||||
"version": 51
|
||||
"version": 55
|
||||
}
|
||||
Reference in New Issue
Block a user