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

Adding battery monitoring support #52

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ let GTop = null;
let Cpu = null;
let Mem = null;
let Net = null;
let Bat = null;
try {
// eslint-disable-next-line no-unused-vars
GTop = imports.gi.GTop;
Cpu = Me.imports.lib.cpu;
Mem = Me.imports.lib.mem;
Net = Me.imports.lib.net;
Bat = Me.imports.lib.battery;
} catch (err) {
log(`[${Me.metadata.name}] Error loading dependencies: ${err}`);
depFailures.push(err);
Expand Down Expand Up @@ -64,9 +66,11 @@ class TopHat {
this.cpu = new Cpu.CpuMonitor(this.configHandler);
this.mem = new Mem.MemMonitor(this.configHandler);
this.net = new Net.NetMonitor(this.configHandler);
this.bat = new Bat.PowerMonitor(this.configHandler);
this.container.addMonitor(this.cpu);
this.container.addMonitor(this.mem);
this.container.addMonitor(this.net);
this.container.addMonitor(this.bat);
this.configHandler.settings.connect('changed::position-in-panel', () => {
this.moveWithinPanel();
});
Expand Down
125 changes: 125 additions & 0 deletions icons/bat-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading