diff --git a/README.md b/README.md index f586822..09f9a11 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,19 @@ avds vol-amixer avds bl ``` +You can also bind keys to commands like those in the `cmd` directory to +perform actions and also update the status bar. For instance, you can bind +keys to these commands to control the backlight and volume while also updating +the status bar: + +```Shell +./cmd/lowerbl +./cmd/raisebl +./cmd/lowervol-amixer +./cmd/raisevol-amixer +./cmd/mutevol-amixer +``` + Modules ------- @@ -104,3 +117,14 @@ heavily upon. Please note that those bar-functions are not compatible with the akuma-v-dwm daemon, but they could very easily be modified to work with this daemon. +Commands +-------- + +In the `cmd` directory are shell scripts that perform actions that effect +the status bar and update the status bar, such as changing the backlight or +volume levels. These commands can be bound to keys, so the action will be +carried out and the status bar will be updated when the key is pressed. + +Please feel free to submit a pull request to have your command included as +part of this repo. + diff --git a/cmd/lowerbl b/cmd/lowerbl new file mode 100755 index 0000000..93d87c9 --- /dev/null +++ b/cmd/lowerbl @@ -0,0 +1,13 @@ +#!/bin/bash + +read -r -d '' bl_dir < \ + <(find /sys/class/backlight -mindepth 1 -maxdepth 1 -print0 | head -z -n 1) +read -r max_bl < "${bl_dir}"/max_brightness +delta=$((max_bl / 10)) +bl_file="${bl_dir}"/brightness +read -r bl < "${bl_file}" +bl2=$((bl - delta)) +if [[ "${bl2}" -lt 0 ]]; then bl2=0; fi +printf '%s' "${bl2}" | sudo tee "${bl_file}" &> /dev/null +"${0%/*}"/../avds bl + diff --git a/cmd/lowervol-amixer b/cmd/lowervol-amixer new file mode 100755 index 0000000..6e2a5aa --- /dev/null +++ b/cmd/lowervol-amixer @@ -0,0 +1,5 @@ +#!/bin/bash + +amixer set Master 3%- &> /dev/null +"${0%/*}"/../avds vol-amixer + diff --git a/cmd/mutevol-amixer b/cmd/mutevol-amixer new file mode 100755 index 0000000..8e493ef --- /dev/null +++ b/cmd/mutevol-amixer @@ -0,0 +1,5 @@ +#!/bin/bash + +amixer set Master toggle &> /dev/null +"${0%/*}"/../avds vol-amixer + diff --git a/cmd/raisebl b/cmd/raisebl new file mode 100755 index 0000000..9e9f004 --- /dev/null +++ b/cmd/raisebl @@ -0,0 +1,13 @@ +#!/bin/bash + +read -r -d '' bl_dir < \ + <(find /sys/class/backlight -mindepth 1 -maxdepth 1 -print0 | head -z -n 1) +read -r max_bl < "${bl_dir}"/max_brightness +delta=$((max_bl / 10)) +bl_file="${bl_dir}"/brightness +read -r bl < "${bl_file}" +bl2=$((bl + delta)) +if [[ "${bl2}" -gt "${max_bl}" ]]; then bl2="${max_bl}"; fi +printf '%s' "${bl2}" | sudo tee "${bl_file}" &> /dev/null +"${0%/*}"/../avds bl + diff --git a/cmd/raisevol-amixer b/cmd/raisevol-amixer new file mode 100755 index 0000000..8e29588 --- /dev/null +++ b/cmd/raisevol-amixer @@ -0,0 +1,5 @@ +#!/bin/bash + +amixer set Master 3%+ &> /dev/null +"${0%/*}"/../avds vol-amixer +