diff --git a/README.MD b/README.MD index d1d2100..965339b 100644 --- a/README.MD +++ b/README.MD @@ -28,6 +28,9 @@ or it can also be run without any arguments to receive a i3bar compatible json string Personally, I have these bound to key combinations in i3. In fact, I have a seperate `bindsym` mode in which all these tools are accessible i.e. `$mod+i` to get to "info" mode then `p` to show pingclock. + +You can also set the volume and brightness levels by typing a numeric figure into the dmenu/rofi input box + There's also an i3bar_tools_threaded folder with tools for use with i3bar/i3blocks which continously update. Currently these are not working as I recently switched from this as primary, to a secondary choice. These have some configuration variables explicit to me, you'll need to change them for you for them to be useful I imagine. diff --git a/brightness.nim b/brightness.nim index 1691f63..860c3c5 100644 --- a/brightness.nim +++ b/brightness.nim @@ -44,13 +44,21 @@ proc get_brightness*(run_once: bool = false) = data.selected_color = black let args = @["up", "down"] let option = outputJSON(data,args) - case option: - of "up": - discard execCmd("xbacklight -inc 5") - get_brightness(true) - of "down": - discard execCmd("xbacklight -dec 5") + if option in args: + case option: + of "up": + discard execCmd("xbacklight -inc 5") + get_brightness(true) + of "down": + discard execCmd("xbacklight -dec 5") + get_brightness(true) + else: + try: + let i = parseInt(option) + discard execCmd("xbacklight -set " & $i) get_brightness(true) + except: + echo getCurrentExceptionMsg() if run_once: break