Skip to content

AlwaysOn@Krivetochka v1.2.0: Deactivating the applet before turning off the PC#8379

Open
Krivetochka wants to merge 3 commits intolinuxmint:masterfrom
Krivetochka:master
Open

AlwaysOn@Krivetochka v1.2.0: Deactivating the applet before turning off the PC#8379
Krivetochka wants to merge 3 commits intolinuxmint:masterfrom
Krivetochka:master

Conversation

@Krivetochka
Copy link
Contributor

  • Code refactoring.
  • Now, when the PC is turned off, the settings that were affected by the applet are restored.
  • Added the ability to control settings when closing the laptop lid.
  • Simplified applet settings.

* Code refactoring.
* Now, when the PC is turned off, the settings that were affected by the applet are restored.
* Added the ability to control settings when closing the laptop lid.
* Simplified applet settings.
Copilot AI review requested due to automatic review settings February 26, 2026 12:15
@github-actions
Copy link
Contributor

Best-practices scanner

This is a regex-based check for API usage that can pose security, performance or
maintainability issues, or that may already be provided by Cinnamon. Having code flagged
by it doesn't automatically disqualify a pull request.

This check is not perfect will not replace a normal review.


Found 3 potential issue(s):

⚠️ lang_bind

AlwaysOn@krivetochka/files/AlwaysOn@krivetochka/applet.js:50

this._panelEditSignalId = global.settings.connect('changed::' + PANEL_EDIT_MODE_KEY, Lang.bind(this, this.on_settings_changed));

Lang.bind() is deprecated. Use arrow functions (() => {}) or Function.prototype.bind() instead.

AlwaysOn@krivetochka/files/AlwaysOn@krivetochka/applet.js:58

Lang.bind(this, this._onPrepareForShutdown)

Lang.bind() is deprecated. Use arrow functions (() => {}) or Function.prototype.bind() instead.

AlwaysOn@krivetochka/files/AlwaysOn@krivetochka/applet.js:200

Main.keybindingManager.addHotKey(this._uuid, this.keybind, Lang.bind(this, this.on_applet_clicked));

Lang.bind() is deprecated. Use arrow functions (() => {}) or Function.prototype.bind() instead.


Automated pattern check.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request upgrades the AlwaysOn applet to version 1.2.0 with significant code refactoring and new functionality. The applet prevents computers from going to sleep when activated. The changes improve code maintainability by replacing a global state variable with proper instance state management, add automatic settings restoration on PC shutdown, introduce laptop lid-close action control, and simplify the settings interface.

Changes:

  • Refactored state management from global switcher variable to instance-based _isActive property with dedicated activation/deactivation methods
  • Added DBus signal subscription to detect system shutdown and automatically restore original power settings before shutdown completes
  • Added new lid-close action setting that prevents laptop from sleeping when lid is closed (when applet is active)
  • Implemented proper lifecycle cleanup in on_applet_removed_from_panel() including signal disconnection, keybinding removal, and settings finalization

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
applet.js Major refactoring: replaced global state with instance properties, extracted activation/deactivation logic into separate methods, added shutdown detection via PrepareForShutdown DBus signal, implemented proper cleanup in on_applet_removed_from_panel(), added lid-close action support
settings-schema.json Removed change-affected-settings toggle and its dependencies, added lid-close-action setting, reorganized settings order (moved keybinding to later section)
metadata.json Version bumped from 1.1.0 to 1.2.0
po/*.po Updated POT-Creation-Date timestamps, added two new untranslated strings for new/changed settings descriptions, adjusted line number references to match refactored code
po/AlwaysOn@krivetochka.pot Updated version to 1.2.0, updated POT-Creation-Date, added entries for new settings strings

@Krivetochka Krivetochka changed the title AlwaysOn v1.2.0: Deactivating the applet before turning off the PC AlwaysOn@Krivetochka v1.2.0: Deactivating the applet before turning off the PC Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants