Simplify volume block, add media script
This commit is contained in:
+9
-7
@@ -1,14 +1,16 @@
|
|||||||
##--- General ---##
|
##--- General ---##
|
||||||
|
|
||||||
# Basic definitions
|
# Basic definitions
|
||||||
set $mod Mod4
|
for_window [class="^.*"] border pixel 2
|
||||||
set $mod2 Mod1
|
|
||||||
smart_gaps on
|
smart_gaps on
|
||||||
gaps inner 10
|
gaps inner 10
|
||||||
gaps outer 0
|
gaps outer 0
|
||||||
hide_edge_borders both
|
hide_edge_borders both
|
||||||
for_window [class="^.*"] border pixel 2
|
set $mod Mod4
|
||||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
set $mod2 Mod1
|
||||||
|
set $mc $HOME/.scripts/mediacontrol.sh
|
||||||
|
|
||||||
|
# Use Mouse+$mod to drag floating windows
|
||||||
floating_modifier $mod
|
floating_modifier $mod
|
||||||
|
|
||||||
# Application startup
|
# Application startup
|
||||||
@@ -198,6 +200,6 @@ bindsym --release Shift+Print exec scrot -s -e "mv \$f $HOME/Pictures/screen_c
|
|||||||
bindsym --release $mod+Print exec scrot -u -e "mv \$f $HOME/Pictures/screen_captures/" # Focused window
|
bindsym --release $mod+Print exec scrot -u -e "mv \$f $HOME/Pictures/screen_captures/" # Focused window
|
||||||
|
|
||||||
# Volume
|
# Volume
|
||||||
bindsym XF86AudioRaiseVolume exec --no-startup-id amixer -q -D pulse sset Master 5%+ unmute && pkill -RTMIN+1 i3blocks
|
bindsym XF86AudioRaiseVolume exec --no-startup-id $mc up 5
|
||||||
bindsym XF86AudioLowerVolume exec --no-startup-id amixer -q -D pulse sset Master 5%- unmute && pkill -RTMIN+1 i3blocks
|
bindsym XF86AudioLowerVolume exec --no-startup-id $mc down 5
|
||||||
bindsym XF86AudioMute exec --no-startup-id amixer -q -D pulse sset Master toggle && pkill -RTMIN+1 i3blocks
|
bindsym XF86AudioMute exec --no-startup-id $mc toggle
|
||||||
|
|||||||
+5
-4
@@ -126,13 +126,14 @@ alias gd="git diff"
|
|||||||
alias gdc="git diff --cached"
|
alias gdc="git diff --cached"
|
||||||
alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d %C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
|
alias gl="git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d %C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"
|
||||||
|
|
||||||
|
# Scripts
|
||||||
|
alias mc="$HOME/.scripts/mediacontrol.sh"
|
||||||
|
alias nw="$HOME/.scripts/network.sh"
|
||||||
|
alias vp="$HOME/.scripts/vimplugin.sh"
|
||||||
|
|
||||||
# Laptop
|
# Laptop
|
||||||
alias offtouchpad='sudo rmmod i2c_hid'
|
alias offtouchpad='sudo rmmod i2c_hid'
|
||||||
alias ontouchpad="sudo modprobe i2c_hid && $HOME/.scripts/touchscreen.sh 0"
|
alias ontouchpad="sudo modprobe i2c_hid && $HOME/.scripts/touchscreen.sh 0"
|
||||||
alias nw="$HOME/.scripts/network.sh"
|
|
||||||
|
|
||||||
# Scripts
|
|
||||||
alias vimplugin="$HOME/.scripts/vimplugin.sh"
|
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
alias mysql-workbench="GDK_SCALE=1 GDK_DPI_SCALE=1 mysql-workbench 1>/dev/null 2>&1 &; disown"
|
alias mysql-workbench="GDK_SCALE=1 GDK_DPI_SCALE=1 mysql-workbench 1>/dev/null 2>&1 &; disown"
|
||||||
|
|||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# General audio management
|
||||||
|
|
||||||
|
RELOAD="pkill -RTMIN+1 i3blocks"
|
||||||
|
|
||||||
|
[ -z "$2" ] && NUM="2" || NUM="$2"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
u*) pulsemixer --change-volume +"$NUM" ; $RELOAD ;;
|
||||||
|
d*) pulsemixer --change-volume -"$NUM" ; $RELOAD ;;
|
||||||
|
s*) pulsemixer --set-volume "$NUM" ; $RELOAD ;;
|
||||||
|
t*) pulsemixer --toggle-mute ; $RELOAD ;;
|
||||||
|
m*) pulsemixer --mute ; $RELOAD ;;
|
||||||
|
u*) pulsemixer --unmute ; $RELOAD ;;
|
||||||
|
getv*) pulsemixer --get-volume | awk '{print $1}' ;;
|
||||||
|
getm*) pulsemixer --get-mute ;;
|
||||||
|
esac
|
||||||
+13
-34
@@ -1,26 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# default (ALSA), pulse, jack
|
MEDIACONTROL="$HOME/.scripts/mediacontrol.sh"
|
||||||
MIXER="pulse"
|
|
||||||
INSTANCE=${BLOCK_INSTANCE:-"Master"}
|
|
||||||
STEP="5%"
|
|
||||||
|
|
||||||
case $BLOCK_BUTTON in
|
case $BLOCK_BUTTON in
|
||||||
1) pavucontrol ;; # left click, start sound settings
|
1) pavucontrol ;; # Left click
|
||||||
2) amixer -q -D $MIXER sset $INSTANCE 0 unmute ;; # scroll click, set 0
|
2) $MEDIACONTROL set 0 ;; # Scroll click
|
||||||
3) amixer -q -D $MIXER sset $INSTANCE toggle ;; # right click, mute/unmute
|
3) $MEDIACONTROL toggle ;; # Right click
|
||||||
4) amixer -q -D $MIXER sset $INSTANCE ${STEP}+ unmute ;; # scroll up, increase
|
4) $MEDIACONTROL up 5 ;; # Scroll up
|
||||||
5) amixer -q -D $MIXER sset $INSTANCE ${STEP}- unmute ;; # scroll down, decrease
|
5) $MEDIACONTROL down 5 ;; # Scroll down
|
||||||
esac
|
esac
|
||||||
|
|
||||||
INFO="amixer -D $MIXER get $INSTANCE"
|
if [ "$($MEDIACONTROL getmute)" == "0" ]; then
|
||||||
|
COLOR="#676E7D"
|
||||||
volume() {
|
VOLUME="MUTE"
|
||||||
VOLUME="$(${INFO} | \
|
SYMBOL=""
|
||||||
awk '/\[[0-9]+%\]/ { print substr($5, 2, length($5) - 3); exit }')"
|
else
|
||||||
}
|
COLOR="#FFF"
|
||||||
|
VOLUME="$($MEDIACONTROL getvolume)%"
|
||||||
symbol() {
|
|
||||||
|
|
||||||
if [ "$VOLUME" -ge "50" ]; then
|
if [ "$VOLUME" -ge "50" ]; then
|
||||||
SYMBOL=""
|
SYMBOL=""
|
||||||
@@ -29,23 +25,6 @@ symbol() {
|
|||||||
else
|
else
|
||||||
SYMBOL=""
|
SYMBOL=""
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
setOutput() {
|
|
||||||
# If sound is not muted
|
|
||||||
if [ -n "$(${INFO} | sed -nr 's/(\[on\])/\1/p')" ]; then
|
|
||||||
COLOR="#FFF"
|
|
||||||
volume
|
|
||||||
symbol
|
|
||||||
VOLUME="$VOLUME%"
|
|
||||||
else
|
|
||||||
COLOR="#676E7D"
|
|
||||||
VOLUME="MUTE"
|
|
||||||
SYMBOL=""
|
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
setOutput
|
|
||||||
|
|
||||||
echo "<span color='$COLOR'>$SYMBOL</span> $VOLUME"
|
echo "<span color='$COLOR'>$SYMBOL</span> $VOLUME"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user