Update i3(add i3blocks), bspwm, nvim, tmux, ranger, zsh

This commit is contained in:
Smirnov Olexandr 2021-02-23 10:57:25 +02:00
parent 53d009b671
commit 5374db696a
11 changed files with 137 additions and 33 deletions

6
script/kblayout Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
case "$(xkblayout)" in
Eng) echo "en" ;;
Ukr) echo "ua" ;;
*) echo " " ;;
esac

53
script/volume Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/env bash
if [[ -z "$MIXER" ]] ; then
MIXER="default"
if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
if amixer -D pulse info >/dev/null 2>&1 ; then
MIXER="pulse"
fi
fi
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
MIXER="${2:-$MIXER}"
fi
if [[ -z "$SCONTROL" ]] ; then
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
head -n1
)}"
fi
if [[ -z "$STEP" ]] ; then
STEP="${1:-5%}"
fi
NATURAL_MAPPING=${NATURAL_MAPPING:-0}
if [[ "$NATURAL_MAPPING" != "0" ]] ; then
AMIXER_PARAMS="-M"
fi
capability() {
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL |
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
}
volume() {
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability)
}
format() {
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
perl_filter+='{CORE::say $4 eq "off" ? "M" : "'
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
perl_filter+='"; exit}'
output=$(perl -ne "$perl_filter")
echo "$LABEL$output"
}
case $BLOCK_BUTTON in
3) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;;
4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;;
5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;;
esac
volume | format