Compare commits

...

3 Commits

Author SHA1 Message Date
Karma Riuk
09c8a1bde7 Updated README 2021-09-19 19:35:16 +02:00
Karma Riuk
275f0dfc56 Corrected some bugs 2021-09-19 19:31:38 +02:00
Karma Riuk
b4c2559657 Updated the example config to be more explicit 2021-09-19 19:31:04 +02:00
3 changed files with 37 additions and 8 deletions

View File

@ -110,3 +110,9 @@ volumectl -i
|`-h` | `--help` | print the help message and exit | |`-h` | `--help` | print the help message and exit |
## Config
The config file is an optional feature, but it allows you to set a different
volume controller than the default one ([pamixer](https://github.com/cdemoulins/pamixer))

View File

@ -1,10 +1,32 @@
[Controller] [Controller]
# volume_controller: the command to control your volume from the command line (for puslse audio it's `pamixer`)
volume_controller=pamixer
# The follwing are the flags you have to give to the volume controller, the variables are self-explainatory
increase_flag=--increase
decrease_flag=--decrease
set_volume_flag=--set-volume
get_volume_flag=--get-volume
set_mute_flag=--mute
set_unmute_flag=--unmute
toggle_mute_flag=--toggle-mute
get_mute_flag=--get-mute
# Additional flags you always want to be in the command when the volume is changed
# These are placed before the actual instructions, example with the additional
# flag below an end command would look like `pamixer --allow-boost --increase 5`
additional_flags=--allow-boost
[Amounts]
# normal_delta: this is the value used when you use the `-i` flag without arguments
normal_delta=5 normal_delta=5
# big_delta: this is the value used when you use the `-I` flag
big_delta=10 big_delta=10
volume_min=5
volume_max=150
[Notification] [Notification]
# enabled: set wether or not the notifications are active. Possible values: yes, no, true, false, 1, 0
enabled=yes enabled=yes
timeout=3000 # timeout: the notification timeout time, in milliseconds
timeout=1000

View File

@ -15,7 +15,7 @@ DEFAULT_SET_UNMUTE_FLAG="--unmute"
DEFAULT_TOGGLE_MUTE_FLAG="--toggle-mute" DEFAULT_TOGGLE_MUTE_FLAG="--toggle-mute"
DEFAULT_GET_VOLUME_FLAG="--get-volume" DEFAULT_GET_VOLUME_FLAG="--get-volume"
DEFAULT_GET_MUTE_FLAG="--get-mute" DEFAULT_GET_MUTE_FLAG="--get-mute"
DEFAULT_ADDITIONAL_FLAGS=("--allow-boost") DEFAULT_ADDITIONAL_FLAGS=()
## Default values ## Default values
DEFAULT_NOTIFICATION_ENABLED=1 DEFAULT_NOTIFICATION_ENABLED=1
@ -100,8 +100,8 @@ checkout_config () {
GET_MUTE_FLAG=${INI__Controller__get_mute_flag:-$DEFAULT_GET_MUTE_FLAG} GET_MUTE_FLAG=${INI__Controller__get_mute_flag:-$DEFAULT_GET_MUTE_FLAG}
ADDITIONAL_FLAGS=${INI__Controller__additional_flags:-$DEFAULT_ADDITIONAL_FLAGS} ADDITIONAL_FLAGS=${INI__Controller__additional_flags:-$DEFAULT_ADDITIONAL_FLAGS}
NORMAL_DELTA=${INI__Controller__normal_delta:-$DEFAULT_NORMAL_DELTA} NORMAL_DELTA=${INI__Amounts__normal_delta:-$DEFAULT_NORMAL_DELTA}
BIG_DELTA=${INI__Controller__big_delta:-$DEFAULT_BIG_DELTA} BIG_DELTA=${INI__Amounts__big_delta:-$DEFAULT_BIG_DELTA}
NOTIFICATION_ENABLED=${INI__Notification__enabled:-$DEFAULT_NOTIFICATION_ENABLED} NOTIFICATION_ENABLED=${INI__Notification__enabled:-$DEFAULT_NOTIFICATION_ENABLED}
NOTIFICATION_TIMEOUT=${INI__Notification__timeout:-$DEFAULT_NOTIFICATION_TIMEOUT} NOTIFICATION_TIMEOUT=${INI__Notification__timeout:-$DEFAULT_NOTIFICATION_TIMEOUT}
@ -114,6 +114,7 @@ checkout_config () {
echo "SET_VOLUME_FLAG: '$SET_VOLUME_FLAG'" && \ echo "SET_VOLUME_FLAG: '$SET_VOLUME_FLAG'" && \
echo "GET_VOLUME_FLAG: '$GET_VOLUME_FLAG'" && \ echo "GET_VOLUME_FLAG: '$GET_VOLUME_FLAG'" && \
echo "SET_MUTE_FLAG: '$SET_MUTE_FLAG'" && \ echo "SET_MUTE_FLAG: '$SET_MUTE_FLAG'" && \
echo "SET_UNMUTE_FLAG: '$SET_UNMUTE_FLAG'" && \
echo "GET_MUTE_FLAG: '$GET_MUTE_FLAG'" && \ echo "GET_MUTE_FLAG: '$GET_MUTE_FLAG'" && \
echo "ADDITIONAL_FLAGS: '${ADDITIONAL_FLAGS[@]}'" && \ echo "ADDITIONAL_FLAGS: '${ADDITIONAL_FLAGS[@]}'" && \
echo "NORMAL_DELTA: '$NORMAL_DELTA'" && \ echo "NORMAL_DELTA: '$NORMAL_DELTA'" && \
@ -255,7 +256,7 @@ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then #if '__name__' == '__main__'
shift shift
;; ;;
-c|--config) -c|--config)
[[ -f "$2" ]] && CONFIG_PATH="$2" || echo "Error: the config file given '$2' doesn't exists." 1>&2 && exit 1 [[ -f "$2" ]] && CONFIG_PATH="$2" || ( echo "Error: the config file given '$2' doesn't exists." 1>&2 && exit 1 )
verbose && echo "Setting \$CONFIG_PATH to $2 (\$CONFIG_PATH=$CONFIG_PATH)" verbose && echo "Setting \$CONFIG_PATH to $2 (\$CONFIG_PATH=$CONFIG_PATH)"
shift 2 shift 2
;; ;;