Browse Source

Add brightnesscontrol.sh, switch pulsemixer to pamixer, fix block interrupts

master
Riyyi 5 years ago
parent
commit
61cb157310
  1. 10
      .config/i3/config
  2. 40
      .scripts/brightnesscontrol.sh
  3. 21
      .scripts/mediacontrol.sh
  4. 8
      .scripts/panel/brightness.sh
  5. 14
      .scripts/panel/volume.sh
  6. 2
      packages

10
.config/i3/config

@ -162,8 +162,8 @@ for_window [class="QtBank"] floating enable
#--- Function key bindings ---#
# Screen brightness
bindsym $mod+F3 exec --no-startup-id "brightnessctl -q s +10%; $HOME/.scripts/panel/brightness.sh"
bindsym $mod+F2 exec --no-startup-id "brightnessctl -q s 10%-; $HOME/.scripts/panel/brightness.sh"
bindsym $mod+F3 exec --no-startup-id brightnesscontrol.sh u 10
bindsym $mod+F2 exec --no-startup-id brightnesscontrol.sh d 10
#--- Arrow key bindings ---#
@ -192,9 +192,9 @@ bindsym --release Shift+Print exec scrot -s -e "mv \$f "$capture # Selection
bindsym --release $mod+Print exec scrot -u -e "mv \$f "$capture # Focused window
# Volume
bindsym XF86AudioRaiseVolume exec --no-startup-id "mediacontrol.sh up 5; $HOME/.scripts/panel/volume.sh"
bindsym XF86AudioLowerVolume exec --no-startup-id "mediacontrol.sh down 5; $HOME/.scripts/panel/volume.sh"
bindsym XF86AudioMute exec --no-startup-id "mediacontrol.sh toggle; $HOME/.scripts/panel/volume.sh"
bindsym XF86AudioRaiseVolume exec --no-startup-id mediacontrol.sh up 5
bindsym XF86AudioLowerVolume exec --no-startup-id mediacontrol.sh down 5
bindsym XF86AudioMute exec --no-startup-id mediacontrol.sh toggle
# Touchscreen toggle
bindsym XF86HomePage exec --no-startup-id touchscreen.sh

40
.scripts/brightnesscontrol.sh

@ -0,0 +1,40 @@
#!/bin/sh
# General brightness management
RELOAD="$HOME/.scripts/panel/brightness.sh"
[ -z "$2" ] && NUM="5" || NUM="$2"
help() {
B=$(tput bold)
N=$(tput sgr0)
cat << EOF
${B}NAME${N}
brightnesscontrol - control the volume of the system
${B}SYNOPSIS${N}
./brightnesscontrol.sh <command> [<arg1>]
${B}DESCRIPTION${N}
Commands can be truncated, i.e.
\`${B}brightnesscontrol.sh s${N}\` for \`${B}brightnesscontrol.sh set${N}\`
Arguments need to be of numeric value.
${B}COMMANDS${N}
${B}u*, up <amount>${N}
${B}d*, down <amount>${N}
${B}s*, set <volume>${N}
EOF
}
case "$1" in
u*) brightnessctl -q s +"$NUM"% ; $RELOAD ;;
d*) brightnessctl -q s "$NUM"%- ; $RELOAD ;;
s*) brightnessctl -q s "$NUM"% ; $RELOAD ;;
*) help ;;
esac

21
.scripts/mediacontrol.sh

@ -2,7 +2,7 @@
# General audio management
RELOAD="pkill -RTMIN+1 i3blocks"
RELOAD="$HOME/.scripts/panel/volume.sh"
[ -z "$2" ] && NUM="2" || NUM="$2"
@ -43,13 +43,14 @@ EOF
}
case "$1" in
u*) pulsemixer --change-volume +"$NUM" --max-volume 100 ; $RELOAD ;;
d*) pulsemixer --change-volume -"$NUM" --max-volume 100 ; $RELOAD ;;
s*) pulsemixer --set-volume "$NUM" --max-volume 100 ; $RELOAD ;;
t*) pulsemixer --toggle-mute ; $RELOAD ;;
m*) pulsemixer --mute ; $RELOAD ;;
n*) pulsemixer --unmute ; $RELOAD ;;
getv*) pulsemixer --get-volume | awk '{print $1}' ;;
getm*) pulsemixer --get-mute ;;
*) help ;;
u*) pamixer --increase "$NUM" ; $RELOAD ;;
d*) pamixer --decrease "$NUM" ; $RELOAD ;;
s*) pamixer --set-volume "$NUM" ; $RELOAD ;;
t*) [ "$(pamixer --get-mute)" = "false" ] && \
pamixer --mute || pamixer --unmute ; $RELOAD ;;
m*) pamixer --mute ; $RELOAD ;;
n*) pamixer --unmute ; $RELOAD ;;
getv*) pamixer --get-volume ;;
getm*) pamixer --get-mute ;;
*) help ;;
esac

8
.scripts/panel/brightness.sh

@ -1,9 +1,11 @@
#!/bin/sh
BRIGHTNESS_CONTROL="$HOME/.scripts/brightnesscontrol.sh"
# Right click, scroll up, scroll down
R="A3:brightnessctl -q s 30%; $0:"
U="A4:brightnessctl -q s +10%; $0:"
D="A5:brightnessctl -q s 10%-; $0:"
R="A3:$BRIGHTNESS_CONTROL s 30:"
U="A4:$BRIGHTNESS_CONTROL u 10:"
D="A5:$BRIGHTNESS_CONTROL d 10:"
PERCENTAGE=$(brightnessctl \
| awk '/\([0-9]+%\)/ { print substr($4, 2, length($4) - 3) }')

14
.scripts/panel/volume.sh

@ -1,18 +1,18 @@
#!/bin/sh
MEDIACONTROL="$HOME/.scripts/mediacontrol.sh"
MEDIA_CONTROL="$HOME/.scripts/mediacontrol.sh"
# Left click, scroll click, right click, scroll up and scroll down
L="A1:pavucontrol:"
S="A2:$MEDIACONTROL set 0; $0:"
R="A3:$MEDIACONTROL toggle; $0:"
U="A4:$MEDIACONTROL up 5; $0:"
D="A5:$MEDIACONTROL down 5; $0:"
S="A2:$MEDIA_CONTROL set 0:"
R="A3:$MEDIA_CONTROL toggle:"
U="A4:$MEDIA_CONTROL up 5:"
D="A5:$MEDIA_CONTROL down 5:"
VOLUME="$($MEDIACONTROL getvolume)"
VOLUME="$($MEDIA_CONTROL getvolume)"
COLOR="-"
if [ "$($MEDIACONTROL getmute)" = "1" ]; then
if [ "$($MEDIA_CONTROL getmute)" = "true" ]; then
COLOR="$COLOR7"
SYMBOL=""

2
packages

@ -65,6 +65,7 @@ os-prober
otf-font-awesome
p7zip
pacman-contrib
pamixer
pavucontrol
pdfjs
platformio
@ -72,7 +73,6 @@ playerctl
poppler-glib
pulseaudio
pulseaudio-alsa
pulsemixer-git
pwgen
python2-click-5.1
python2-setuptools

Loading…
Cancel
Save