Add scripts

This commit is contained in:
LordMathis 2018-05-25 23:47:28 +02:00
parent 54e3151d0c
commit c36f047564
4 changed files with 156 additions and 0 deletions

20
bin/lock.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
letterEnteredColor=00af46ff
letterRemovedColor=d23c3dff
passwordCorrect=00000000
passwordIncorrect=d23c3dff
background=00000000
foreground=ffffffff
i3lock \
-t -i "$1" \
--timepos="110:h-70" \
--datepos="135:h-45" \
--clock --datestr "Type password to unlock..." \
--insidecolor=$background --ringcolor=$foreground --line-uses-inside \
--keyhlcolor=$letterEnteredColor --bshlcolor=$letterRemovedColor --separatorcolor=$background \
--insidevercolor=$passwordCorrect --insidewrongcolor=$passwordIncorrect \
--ringvercolor=$foreground --ringwrongcolor=$foreground --indpos="x+280:h-70" \
--radius=20 --ring-width=4 --veriftext="" --wrongtext="" \
--verifcolor="$foreground" --timecolor="$foreground" --datecolor="$foreground" \
--noinputtext="" --force-clock $lockargs

52
bin/openweathermap-simple.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
get_icon() {
case $1 in
01d) icon="";;
01n) icon="";;
02d) icon="";;
02n) icon="";;
03*) icon="";;
04*) icon="";;
09d) icon="";;
09n) icon="";;
10d) icon="";;
10n) icon="";;
11d) icon="";;
11n) icon="";;
13d) icon="";;
13n) icon="";;
50d) icon="";;
50n) icon="";;
*) icon="";
esac
echo $icon
}
KEY="55d35ce697a99136aab82ea73edcb538"
CITY=""
UNITS="metric"
SYMBOL="°"
if [ ! -z $CITY ]; then
weather=$(curl -sf "http://api.openweathermap.org/data/2.5/weather?APPID=$KEY&id=$CITY&units=$UNITS")
# weather=$(curl -sf "http://api.openweathermap.org/data/2.5/forecast?APPID=$KEY&id=$CITY&units=$UNITS&cnt=1")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ ! -z "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
weather=$(curl -sf "http://api.openweathermap.org/data/2.5/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
fi
fi
if [ ! -z "$weather" ]; then
weather_temp=$(echo "$weather" | jq ".main.temp" | cut -d "." -f 1)
weather_icon=$(echo "$weather" | jq -r ".weather[].icon")
echo "$(get_icon "$weather_icon")" "$weather_temp$SYMBOL"
fi

72
bin/pulseaudio-tail.sh Executable file
View File

@ -0,0 +1,72 @@
#!/bin/sh
sink=0
show_active() {
if pacmd list-sinks | grep active | head -n 1 | grep -q speaker; then
echo "speaker"
elif pacmd list-sinks | grep active | head -n 1 | grep headphones; then
echo "headphones"
else
echo "hdmi"
fi
}
volume_up() {
pactl set-sink-volume $sink +1%
}
volume_down() {
pactl set-sink-volume $sink -1%
}
volume_mute() {
pactl set-sink-mute $sink toggle
}
volume_print() {
if pacmd list-sinks | grep active | head -n 1 | grep -q speaker; then
icon=""
elif pacmd list-sinks | grep active | head -n 1 | grep headphones; then
icon=""
else
icon=""
fi
muted=$(pamixer --sink $sink --get-mute)
if [ "$muted" = true ]; then
echo "$icon --"
else
echo "$icon $(pamixer --sink $sink --get-volume)"
fi
}
listen() {
volume_print
pactl subscribe | while read -r event; do
if echo "$event" | grep -q "#$sink"; then
volume_print
fi
done
}
case "$1" in
--up)
volume_up
;;
--down)
volume_down
;;
--mute)
volume_mute
;;
--show)
show_active
;;
*)
listen
;;
esac

12
bin/updates.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
updates_arch=$(checkupdates | wc -l)
updates_aur=$(pacaur -k | wc -l)
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo " $updates"
else
echo ""
fi