Feat: Commands
Add commands that can be the target of keybindings to perform an action and update the status bar.
This commit is contained in:
parent
3c56b60400
commit
59b3d77547
24
README.md
24
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.
|
||||
|
||||
|
13
cmd/lowerbl
Executable file
13
cmd/lowerbl
Executable file
@ -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
|
||||
|
5
cmd/lowervol-amixer
Executable file
5
cmd/lowervol-amixer
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
amixer set Master 3%- &> /dev/null
|
||||
"${0%/*}"/../avds vol-amixer
|
||||
|
5
cmd/mutevol-amixer
Executable file
5
cmd/mutevol-amixer
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
amixer set Master toggle &> /dev/null
|
||||
"${0%/*}"/../avds vol-amixer
|
||||
|
13
cmd/raisebl
Executable file
13
cmd/raisebl
Executable file
@ -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
|
||||
|
5
cmd/raisevol-amixer
Executable file
5
cmd/raisevol-amixer
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
amixer set Master 3%+ &> /dev/null
|
||||
"${0%/*}"/../avds vol-amixer
|
||||
|
Loading…
Reference in New Issue
Block a user