Skip to content

New controller-battery plugin - #25

Merged
0xSolanaceae merged 5 commits into
caelestia-kde:mainfrom
verbrannter-toast:main
Nov 3, 2026
Merged

0xSolanaceae merged 5 commits into
caelestia-kde:mainfrom
verbrannter-toast:main

Conversation

@verbrannter-toast

@verbrannter-toast verbrannter-toast commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This adds a new plugin to show controller battery percentage and charging status as a widget directly on the desktop. The widget is fully movable and saves its position across restarts. Most functionality is explained in the readme.

Demo

(These svg icons are made by myself and licensed under the same MIT license)

Plugin

  • id (folder name): controller-battery
  • name: Controller Battery
  • version: 1.0.0
  • type: quickshell
  • license (SPDX): MIT

Checklist

  • The plugin lives in its own folder under plugins/<id>/ and the folder name equals the id in metadata.json
  • metadata.json is valid JSON and passes python scripts/validate.py
  • A LICENSE file is included in the plugin folder
  • No compiled binaries or archives are included (source-only policy)
  • version follows semver and was bumped for updates
  • For deprecations: `not applicable
  • I have reviewed my plugin's code for safety and malicious behavior

@0xSolanaceae

Copy link
Copy Markdown
Member

@verbrannter-toast sick idea man! Can we set the version to 1.0.0 since it's the first iteration you've submitted? I'll do a code review after that

@verbrannter-toast

Copy link
Copy Markdown
Contributor Author

Ah yeah sure. It was just my internal development versioning. I'll change it now.

@verbrannter-toast

Copy link
Copy Markdown
Contributor Author

@0xSolanaceae I just made the repo I was working in before the fork public so you can test the functionality separately from this repo before merging. Here is the link:

https://github.com/verbrannter-toast/controller-battery

(I did use claude for a few parts of the code which make up like 20-30% of all code written. Everything else is written by me so have some mercy when reviewing since I am not that well versed in QML yet hehe)

@0xSolanaceae 0xSolanaceae left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good, couple of changes to make. You can probably just get rid of main.qml

Comment thread plugins/controller-battery/main.qml Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This appears to be patching a shell bug, not a plugin concern. PluginLoader.setPluginEnabled already finds the right discovered[j], then throws that reference away and passes the lossy ListModel row to syncBackgroundWidgets.

As written it also declares the widget spec twice (here and metadata.json:28-35), skips normalizeBackgroundWidgets's path validation, and depends on isKnown()/register() internals.

Comment thread plugins/controller-battery/main.qml Outdated
}
}

Component.onDestruction: BackgroundWidgetRegistry.unregister(root.pluginId)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This deferred unregister can fire after the new instance's register() and wipe it. The only thing bringing the widget back is the 150 ms timer. Both go away with the fix above.


// The desktop layer only passes input to this region when the Plasma
// wallpaper is shown instead of Caelestia's.
property var inputRegion: Region {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PendingRegion only tracks x/y/width/height of item, not visible, so when line 168 hides the widget this still contributes a card-sized rect to BackgroundWindow.widgetRegions

## Customizing

The panel is movable across the whole desktop and saves its position across reboots. You can reset the position to the default by double clicking it.
[DesktopWidget.qml](DesktopWidget.qml) features a ton of customizing options between line 32 and 56 which should make adjusting to your preference easy. This is also where you can adjust the default position that double clicking resets to. If you want to use different icons to the default ones just replace them with the exact file name in `/icons`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The line numbers appear to be stale

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The line numbers appear to be stale

Not sure what you mean by this. Line 32 - 56 are the correct line numbers for the customization section. I applied all other changes though and will commit in a bit after running the check script again.

@verbrannter-toast

Copy link
Copy Markdown
Contributor Author

Alright, everything you requested should be committed now. I hope the fix in line 29 of DesktopWidget.qml is fine. I wasn't able to reproduce the behavior you described so I couldn't test it

@0xSolanaceae

Copy link
Copy Markdown
Member

good, thanks!

@0xSolanaceae
0xSolanaceae merged commit 52ee191 into caelestia-kde:main Nov 3, 2026
1 check passed
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