First commit. Add .i3 directory

This commit is contained in:
kuben
2019-07-02 21:47:58 +02:00
commit 554573c69b
23 changed files with 1604 additions and 0 deletions

32
.i3/scripts/adjbr.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Launches a yad window to change the brightness (or volume, not in use)
panel_fifo="/tmp/i3_lemonbar1_${USER}"
panel_commands="/tmp/i3_lemonbar2_${USER}"
if [ "$1" == "-b" ]; then
CLASS="YADWINBR"
ICON='☼'
COLOR='yellow'
elif [ "$1" == "-v" ]; then
CLASS="YADWINV"
ICON='🔈'
COLOR='white'
else
exit 1
fi
LEVEL=$(bc <<< "scale=0; $(brillo -G)/1")
[[ "$3" == "-t" ]] && TIMER="--timeout=1"
declare -a YADARGS=("--sticky" "--undecorated" "--on-top" "--class=$CLASS"
"--scale" "--text='<span color=\"$COLOR\" font=\"20\">$ICON</span>'"
"--value" "$LEVEL" "--no-buttons"
"--geometry=15x150" "--vertical" "--text-align" "center" "$TIMER" "--print-partial")
YARGS=${YADARGS[@]}
FIFO="$2"
(echo "kill_unfocus $BASHPID" > $FIFO; exec sh -c "yad $YARGS") | \
while read out; do
~/.i3/scripts/level.sh -b set $out
done

9
.i3/scripts/dpmsctl.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
STATUS=`xset q | awk '{for (I=1;I<=NF;I++) if ($I == "DPMS" && $(I+1) == "is") {print $(I+2)};}'`
if [ "$STATUS" == "Enabled" ]; then
xset -dpms
yad --timeout 1 --text "<span font=\"20\">DPMS Disabled</span>" --no-buttons --sticky --on-top
else
xset dpms
yad --timeout 1 --text "<span font=\"20\">DPMS Enabled</span>" --no-buttons --sticky --on-top
fi

34
.i3/scripts/lang.sh Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
panel_fifo="/tmp/i3_lemonbar1_${USER}"
panel_commands="/tmp/i3_lemonbar2_${USER}"
function show(){
setxkbmap -print -display :0 | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'
}
if [ $# -lt 1 ]; then
echo LANG$(show)
fi
if [ "$1" == "next" ]; then
cur=$(show)
next='se'
if [ "$cur" == "se" ]; then
next='pl'
fi
setxkbmap -display :0 $next
if [ -e $panel_fifo ]; then
echo -e "LANG$next\n" > "${panel_fifo}"
fi
if [ -e $panel_commands ]; then
echo -e "setlang $next\n" > "${panel_commands}"
fi
elif [ "$1" == "qset" ]; then
next=$2
setxkbmap -display :0 $next
if [ -e $panel_fifo ]; then
echo -e "LANG$next\n" > "${panel_fifo}"
fi
elif [ "$1" == "show" ]; then
show
else
exit 1
fi

33
.i3/scripts/level.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
panel_fifo="/tmp/i3_lemonbar1_${USER}"
panel_commands="/tmp/i3_lemonbar2_${USER}"
if [[ "$1" == "-b" ]]; then
icon="-s /usr/share/pixmaps/volnoti/display-brightness-symbolic.svg"
if [[ "$2" == "up" ]]; then
level=$(brillo -A 5 -u 100000; brillo)
elif [[ "$2" == "down" ]]; then
level=$(brillo -U 5 -u 100000; brillo)
elif [[ "$2" == "set" ]]; then
level=$(brillo -S $3; brillo)
fi
echo "BRIGHT$level" > $panel_fifo
elif [[ "$1" == "-v" ]]; then
if [[ "$2" == "up" ]]; then
amixer -q set Master 5%+
elif [[ "$2" == "down" ]]; then
amixer -q set Master 5%-
elif [[ "$2" == "toggle" ]]; then
amixer -q set Master toggle
fi
level=$(~/.i3/lemonbar/get_vol.sh)
if [[ "$level" == "MUTE" ]]; then
level="-m"
elif [[ "$level" == "NONE" ]]; then
echo "Missing"
fi
fi
if [[ "$2" != "set" ]]; then
volnoti-show $icon $level
fi

9
.i3/scripts/vol.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/bin/bash
[[ "$1" == "up" ]] && amixer set Master 5%+
[[ "$1" == "down" ]] && amixer set Master 5%-
[[ "$1" == "mute" ]] && amixer sset Master toggle
VOL=$(amixer get Master | grep 'Front Left:' | cut -c 31-33)
[[ $(amixer get Master | grep "\[off\]") ]] && sudo -u kuba volnoti-show -m $VOL && exit
sudo -u kuba volnoti-show $VOL