From 2c797f8bab380044a43e4dee23043bd15f1fbe4c Mon Sep 17 00:00:00 2001 From: joestandring Date: Sat, 29 Jun 2019 16:02:31 +0100 Subject: [PATCH] Add dwm_backlight Add dwm_backlight that displays the value of xbacklight rounded to the nearest int. --- README.md | 7 +++++++ bar-functions/dwm_backlight.sh | 13 +++++++++++++ dwm_bar.sh | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 bar-functions/dwm_backlight.sh diff --git a/README.md b/README.md index ed638ac..24a8b4c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ A modular statusbar for DWM - [dwm_vpn](#dwm_vpn) - [dwm_ccurse](#dwm_ccurse) - [dwm_transmission](#dwm_transmission) + - [dwm_backlight](#dwm_backlight) - [Installation](#installation) - [Usage](#usage) - [Customizing](#customizing) @@ -107,6 +108,12 @@ Displays the current status of a torrent with transmission-remote [⏬ archlinux-2019.06.01... | 92% 1min ⬆3.4 ⬇1.5] ``` Dependencies: ```transmission-remote``` +### dwm_backlight +Displays the current backlight level with xbacklight +``` +[☀ 80] +``` +Dependencies: ```xbacklight``` ## Installation 1. Clone and enter the repository: ``` diff --git a/bar-functions/dwm_backlight.sh b/bar-functions/dwm_backlight.sh new file mode 100755 index 0000000..eb88792 --- /dev/null +++ b/bar-functions/dwm_backlight.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# A dwm_bar module to display the current backlight brighness with xbacklight +# Joe Standring +# GNU GPLv3 + +# Dependencies: xbacklight + +dwm_backlight () { + printf "☀ %.0f\n" "$(xbacklight)" +} + +dwm_backlight diff --git a/dwm_bar.sh b/dwm_bar.sh index f635da3..ebd0747 100755 --- a/dwm_bar.sh +++ b/dwm_bar.sh @@ -24,6 +24,7 @@ export IDENTIFIER="unicode" . "$DIR/bar-functions/dwm_resources.sh" . "$DIR/bar-functions/dwm_battery.sh" . "$DIR/bar-functions/dwm_mail.sh" +. "$DIR/bar-functions/dwm_backlight.sh" . "$DIR/bar-functions/dwm_alsa.sh" . "$DIR/bar-functions/dwm_pulse.sh" . "$DIR/bar-functions/dwm_weather.sh" @@ -36,6 +37,6 @@ export IDENTIFIER="unicode" # Update dwm status bar every second while true do - xsetroot -name "[$(dwm_countdown)][$(dwm_transmission)][$(dwm_cmus)][$(dwm_resources)][$(dwm_battery)][$(dwm_mail)][$(dwm_alsa)][$(dwm_weather)][$(dwm_vpn)][$(dwm_network)][$(dwm_keyboard)][$(dwm_date)]" + xsetroot -name "[$(dwm_countdown)][$(dwm_transmission)][$(dwm_cmus)][$(dwm_resources)][$(dwm_battery)][$(dwm_mail)][$(dwm_backlight)][$(dwm_alsa)][$(dwm_weather)][$(dwm_vpn)][$(dwm_network)][$(dwm_keyboard)][$(dwm_date)]" sleep 1 done