Skip to content

Commit

Permalink
custom change_command for backlight widget (qtile#1284)
Browse files Browse the repository at this point in the history
custom change_command for backlight widget
  • Loading branch information
zordsdavini authored and tych0 committed Feb 18, 2019
1 parent ab8d48c commit 1a8c399
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libqtile/widget/backlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
# SOFTWARE.

import os
import shlex
from . import base

from typing import Dict
Expand Down Expand Up @@ -52,7 +53,8 @@ class Backlight(base.InLoopPollText):
),
('update_interval', .2, 'The delay in seconds between updates'),
('step', 10, 'Percent of backlight every scroll changed'),
('format', '{percent: 2.0%}', 'Display format')
('format', '{percent: 2.0%}', 'Display format'),
('change_command', 'xbacklight -set {0}', 'Execute command to change value')
]

def __init__(self, **config):
Expand Down Expand Up @@ -81,7 +83,7 @@ def poll(self):
return self.format.format(percent=percent)

def change_backlight(self, value):
self.call_process(["xbacklight", "-set", str(value)])
self.call_process(shlex.split(self.change_command.format(value)))

def button_press(self, x, y, button):
if self.future and not self.future.done():
Expand Down

0 comments on commit 1a8c399

Please sign in to comment.