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

added a nice battery that is similar to the one in ios 16 #84

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added a configurable option to resize the battery icon.
  • Loading branch information
1fadi committed Apr 17, 2023
commit 7c4f94fd097f5685bd2670ca3d73202bc131bfac
10 changes: 7 additions & 3 deletions ibattery.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,20 @@ class Battery(base._Widget):
10,
"time in seconds to display notification."
),
(
"size",
(16, 30),
"Size of the widget. takes a tuple: (height, width). "
),
]

def __init__(self, **config):
self.widget_width = 36
base._Widget.__init__(self, bar.CALCULATED, **config)
self.add_defaults(Battery.defaults)

self.HEIGHT, self.BAR_WIDTH = self.size # battery bar
self.widget_width = self.BAR_WIDTH + 6
self.length = self.padding * 2 + self.widget_width
self.HEIGHT = 16 # widgets height
self.BAR_WIDTH = 30 # battery bar

self._has_notified = False
self.timeout = int(self.notification_timeout * 1000)
Expand Down