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

Some fixes to backlight module #747

Closed
wants to merge 2 commits into from
Closed
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
9 changes: 3 additions & 6 deletions i3pystatus/backlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class Backlight(File):
on_downscroll = "darker"

def init(self):
self.has_xbacklight = shutil.which("xbacklight") is not None

self.base_path = self.base_path.format(backlight=self.backlight)
backlight_entries = sorted(glob.glob(self.base_path))

Expand All @@ -53,7 +55,6 @@ def init(self):
return

self.base_path = backlight_entries[0]
self.has_xbacklight = shutil.which("xbacklight") is not None

# xbacklight expects a percentage as parameter. Calculate the percentage
# for one step (if smaller xbacklight doesn't increases the brightness)
Expand All @@ -75,13 +76,9 @@ def run_no_backlight(self):
"percentage": -1
}

format = self.format_no_backlight
if not format:
format = self.format

self.data = cdict
self.output = {
"full_text": format.format(**cdict),
"full_text": self.format_no_backlight.format(**cdict),
"color": self.color
}

Expand Down