Browse Source

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

master
Riyyi 6 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 ---# #--- Function key bindings ---#
# Screen brightness # Screen brightness
bindsym $mod+F3 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 "brightnessctl -q s 10%-; $HOME/.scripts/panel/brightness.sh" bindsym $mod+F2 exec --no-startup-id brightnesscontrol.sh d 10
#--- Arrow key bindings ---# #--- 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 bindsym --release $mod+Print exec scrot -u -e "mv \$f "$capture # Focused window
# Volume # Volume
bindsym XF86AudioRaiseVolume exec --no-startup-id "mediacontrol.sh up 5; $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; $HOME/.scripts/panel/volume.sh" bindsym XF86AudioLowerVolume exec --no-startup-id mediacontrol.sh down 5
bindsym XF86AudioMute exec --no-startup-id "mediacontrol.sh toggle; $HOME/.scripts/panel/volume.sh" bindsym XF86AudioMute exec --no-startup-id mediacontrol.sh toggle
# Touchscreen toggle # Touchscreen toggle
bindsym XF86HomePage exec --no-startup-id touchscreen.sh 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 # General audio management
RELOAD="pkill -RTMIN+1 i3blocks" RELOAD="$HOME/.scripts/panel/volume.sh"
[ -z "$2" ] && NUM="2" || NUM="$2" [ -z "$2" ] && NUM="2" || NUM="$2"
@ -43,13 +43,14 @@ EOF
} }
case "$1" in case "$1" in
u*) pulsemixer --change-volume +"$NUM" --max-volume 100 ; $RELOAD ;; u*) pamixer --increase "$NUM" ; $RELOAD ;;
d*) pulsemixer --change-volume -"$NUM" --max-volume 100 ; $RELOAD ;; d*) pamixer --decrease "$NUM" ; $RELOAD ;;
s*) pulsemixer --set-volume "$NUM" --max-volume 100 ; $RELOAD ;; s*) pamixer --set-volume "$NUM" ; $RELOAD ;;
t*) pulsemixer --toggle-mute ; $RELOAD ;; t*) [ "$(pamixer --get-mute)" = "false" ] && \
m*) pulsemixer --mute ; $RELOAD ;; pamixer --mute || pamixer --unmute ; $RELOAD ;;
n*) pulsemixer --unmute ; $RELOAD ;; m*) pamixer --mute ; $RELOAD ;;
getv*) pulsemixer --get-volume | awk '{print $1}' ;; n*) pamixer --unmute ; $RELOAD ;;
getm*) pulsemixer --get-mute ;; getv*) pamixer --get-volume ;;
*) help ;; getm*) pamixer --get-mute ;;
*) help ;;
esac esac

8
.scripts/panel/brightness.sh

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

14
.scripts/panel/volume.sh

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

2
packages

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

Loading…
Cancel
Save