scripts moved to new repo and added
This commit is contained in:
parent
093aaca150
commit
4fffdcaae4
16 changed files with 387 additions and 0 deletions
86
scripts/bar.sh
Executable file
86
scripts/bar.sh
Executable file
|
@ -0,0 +1,86 @@
|
|||
#!/bin/bash
|
||||
|
||||
icon_color="#A0A57E"
|
||||
icon() { echo -n "%{F$icon_color}"; printf '%b' "\ue$1"; echo -n "%{F-}"; }
|
||||
|
||||
icon_music=$(icon 05c)
|
||||
icon_music_paused=$(icon 059)
|
||||
icon_services=$(icon 040)
|
||||
icon_diskspace=$(icon 0ab)
|
||||
icon_wifi=$(icon 048)
|
||||
icon_battery=$(icon 033)
|
||||
icon_battery_charging=$(icon 042)
|
||||
icon_clock=$(icon 018)
|
||||
|
||||
color_service_running="#A0A57E"
|
||||
color_service_stopped="#C37561"
|
||||
color_battery_good="white"
|
||||
color_battery_low="#C37561"
|
||||
|
||||
music() {
|
||||
info=$(mpc current -f '[%artist%] - [%title%]')
|
||||
icon=$icon_music
|
||||
if [ -z "$info" ]; then
|
||||
info="(-)"
|
||||
elif [ -n "$(mpc status | grep paused)" ]; then
|
||||
icon=$icon_music_paused
|
||||
fi
|
||||
echo -n "$icon $info"
|
||||
}
|
||||
|
||||
serviceinfo() {
|
||||
service=$1
|
||||
text=$2
|
||||
systemctl is-active -q $service
|
||||
if [ "$?" -eq 0 ]; then
|
||||
echo -n "%{F$color_service_running}$text%{F-}"
|
||||
else
|
||||
echo -n "%{F$color_service_stopped}$text%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
services() {
|
||||
echo -n "$icon_services $(serviceinfo zomnet z) $(serviceinfo docker d)"
|
||||
}
|
||||
|
||||
diskspace() {
|
||||
echo -n "$icon_diskspace "
|
||||
df -h | awk '{if($6 == "/") { print $3 " / " $2 }}'
|
||||
}
|
||||
|
||||
wifi() {
|
||||
echo -n "$icon_wifi "
|
||||
info=$(wicd-cli --wireless --status | perl -e 'foreach $line (<>) { if($line =~ /Connected to (.+) at .+IP: ([0-9.]+)/ ) { print $1 . " - " . $2; break; } elsif($line =~ /Connecting to wireless network \"(.+)\"/) { print $1 . " - connecting"; break; } }')
|
||||
if [ -z "$info" ]; then
|
||||
info="(-)"
|
||||
fi
|
||||
echo -n $info
|
||||
}
|
||||
|
||||
battery() {
|
||||
level=$(acpi -b | awk -F, 'BEGIN { s=0 } { s+=$2 } END { print int(s/NR) }')
|
||||
charging=$(acpi -b | grep Charging)
|
||||
if [ -n "$charging" ]; then
|
||||
echo -n "$icon_battery_charging "
|
||||
else
|
||||
echo -n "$icon_battery "
|
||||
fi
|
||||
|
||||
if [ "$level" -lt 20 ]; then
|
||||
echo -n "%{F$color_battery_low}$level%%{F-}"
|
||||
else
|
||||
echo -n "%{F$color_battery_good}$level%%{F-}"
|
||||
fi
|
||||
}
|
||||
|
||||
clock() {
|
||||
echo -n "$icon_clock "
|
||||
date +"%a %d.%m (%V) %H:%M"
|
||||
}
|
||||
|
||||
while true; do
|
||||
echo "%{l} $(music) $(services) $(diskspace)%{r}$(wifi) $(battery) $(clock) "
|
||||
sleep 1
|
||||
done | lemonbar -g 1366x15 -f "Terminus:size=8","Stlarch:size=6:style=regular" -B "#88000000"
|
||||
|
||||
|
33
scripts/batteryobserver.sh
Executable file
33
scripts/batteryobserver.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
#Config
|
||||
WARNING_LEVEL=10
|
||||
SHUTDOWN_LEVEL=2
|
||||
#End config
|
||||
|
||||
|
||||
STATE=0
|
||||
|
||||
while true; do
|
||||
level=$(acpi -b | awk -F, 'BEGIN{s=0}{s+=$2}END{print int(s/NR)}')
|
||||
charger_connected=$(acpi -b | grep Charging)
|
||||
case "$STATE" in
|
||||
0) # battery ok
|
||||
if [ "$level" -le "$WARNING_LEVEL" -a -z "$charger_connected" ]; then
|
||||
zenity --warning --text="Your battery is getting low\!" --no-wrap &
|
||||
STATE=1
|
||||
fi
|
||||
;;
|
||||
1) # battery low
|
||||
if [ -n "$charger_connected" ]; then
|
||||
STATE=0
|
||||
elif [ "$level" -le "$SHUTDOWN_LEVEL" ]; then
|
||||
systemctl hibernate;
|
||||
else
|
||||
notify-send -u critical -a "BatterySystem" "Battery is low!" "Please connect a charger"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
sleep 20
|
||||
done
|
||||
|
9
scripts/blurlock.sh
Executable file
9
scripts/blurlock.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
TMP=/tmp/lockscreen.png
|
||||
|
||||
#scrot -q 30 -z $TMP
|
||||
#convert $TMP -scale 10% -scale 1000% $TMP
|
||||
|
||||
blurscreen $TMP
|
||||
exec i3lock -u -i $TMP
|
87
scripts/cmenu.sh
Executable file
87
scripts/cmenu.sh
Executable file
|
@ -0,0 +1,87 @@
|
|||
#!/bin/bash
|
||||
|
||||
DMENU="$(dirname $0)/dmenu.sh"
|
||||
menu() {
|
||||
echo $@ | tr ' ' '\n' | $DMENU
|
||||
}
|
||||
|
||||
screenshot() {
|
||||
cd ~/Screenshots
|
||||
exec scrot $@ -e 'firefox $f'
|
||||
}
|
||||
|
||||
sysctl() {
|
||||
action=$1
|
||||
service=$2
|
||||
gksu -S -m "$action $service" systemctl $action $service
|
||||
}
|
||||
|
||||
require-service() {
|
||||
service=$1
|
||||
systemctl is-active --quiet $service || sysctl start $service
|
||||
}
|
||||
|
||||
case "$(menu timer screenshot wallpaper wicd ncmpcpp zomnet power)" in
|
||||
timer)
|
||||
exec urxvt -geometry 50x3 -e ~/.config/scripts/teatimer.sh
|
||||
;;
|
||||
screenshot)
|
||||
case "$(menu all selective)" in
|
||||
all)
|
||||
screenshot
|
||||
;;
|
||||
selective)
|
||||
screenshot -s
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
wallpaper)
|
||||
exec nitrogen ~/wallpapers
|
||||
;;
|
||||
wicd)
|
||||
exec wicd-gtk
|
||||
;;
|
||||
ncmpcpp)
|
||||
exec urxvt -e ncmpcpp
|
||||
;;
|
||||
zomnet)
|
||||
case "$(menu start-stop uservm ncmpcpp deluge)" in
|
||||
start-stop)
|
||||
systemctl is-active zomnet > /dev/null
|
||||
if [ "$?" -eq 0 ]; then
|
||||
sysctl stop zomnet
|
||||
else
|
||||
sysctl start zomnet
|
||||
fi
|
||||
;;
|
||||
uservm)
|
||||
require-service zomnet
|
||||
exec urxvt -e ssh user.vm.zom.bi
|
||||
;;
|
||||
ncmpcpp)
|
||||
require-service zomnet
|
||||
exec urxvt -e ncmpcpp -h user.vm.zom.bi
|
||||
;;
|
||||
deluge)
|
||||
require-service zomnet
|
||||
exec deluge-gtk
|
||||
esac
|
||||
;;
|
||||
power)
|
||||
case "$(menu hibernate suspend reboot poweroff)" in
|
||||
hibernate)
|
||||
systemctl hibernate
|
||||
;;
|
||||
suspend)
|
||||
systemctl suspend
|
||||
;;
|
||||
reboot)
|
||||
systemctl reboot
|
||||
;;
|
||||
poweroff)
|
||||
systemctl poweroff
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
3
scripts/dmenu.sh
Executable file
3
scripts/dmenu.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
exec dmenu -ch -y 100 -w 600 -h 30 -l 10 -sb "#444444" $@
|
15
scripts/dmenu_run.sh
Executable file
15
scripts/dmenu_run.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
|
||||
if [ -d "$cachedir" ]; then
|
||||
cache=$cachedir/dmenu_run
|
||||
else
|
||||
cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
|
||||
fi
|
||||
(
|
||||
IFS=:
|
||||
if stest -dqr -n "$cache" $PATH; then
|
||||
stest -flx $PATH | sort -u | tee "$cache" | $(dirname $0)/dmenu.sh
|
||||
else
|
||||
$(dirname $0)/dmenu.sh < "$cache"
|
||||
fi
|
||||
) | ${SHELL:-"/bin/sh"} &
|
46
scripts/explorer_run.sh
Executable file
46
scripts/explorer_run.sh
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
DMENU=$(dirname $0)/dmenu.sh
|
||||
|
||||
UP="[..]"
|
||||
OPEN_EXPLORER="[Open Thunar here]"
|
||||
OPEN_TERMINAL="[Open Terminal here]"
|
||||
WIDTH=300
|
||||
LINES=30
|
||||
|
||||
OPEN_CMD="xdg-open"
|
||||
TERM_CMD="urxvt"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
DIR=$1
|
||||
else
|
||||
DIR=$HOME
|
||||
fi
|
||||
|
||||
while true; do
|
||||
bname=$(basename "$DIR")
|
||||
choice=$(
|
||||
(
|
||||
echo "$UP";
|
||||
echo "$OPEN_EXPLORER";
|
||||
echo "$OPEN_TERMINAL";
|
||||
ls $DIR;
|
||||
) | $DMENU -i
|
||||
)
|
||||
if [ -z "$choice" ]; then
|
||||
exit 1
|
||||
elif [ "$choice" == "$UP" ]; then
|
||||
DIR=$(dirname $DIR)
|
||||
elif [ "$choice" == "$OPEN_EXPLORER" ]; then
|
||||
($OPEN_CMD "$DIR" &) &
|
||||
exit 0
|
||||
elif [ "$choice" == "$OPEN_TERMINAL" ]; then
|
||||
( cd $DIR; $TERM_CMD &) &
|
||||
exit 0
|
||||
elif [ -f "$DIR/$choice" ]; then
|
||||
($OPEN_CMD "$DIR/$choice" &) &
|
||||
exit 0
|
||||
elif [ -d "$DIR/$choice" ]; then
|
||||
DIR=$DIR/$choice
|
||||
fi
|
||||
done
|
5
scripts/lock.sh
Executable file
5
scripts/lock.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
mpc pause > /dev/null
|
||||
|
||||
exec $(dirname $0)/blurlock.sh
|
15
scripts/mirrorlist
Executable file
15
scripts/mirrorlist
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/awk -f
|
||||
|
||||
BEGIN {
|
||||
c = ""
|
||||
}
|
||||
|
||||
/^##/ {
|
||||
c = substr($0,4);
|
||||
}
|
||||
|
||||
/^#Server/ {
|
||||
if( c==COUNTRY ) {
|
||||
print substr($0,2);
|
||||
}
|
||||
}
|
7
scripts/monitor_switch.sh
Executable file
7
scripts/monitor_switch.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
./prepare_monitors.sh
|
||||
nitrogen --restore &
|
||||
~/.config/bspwm/bspwmrc
|
14
scripts/pacrank
Executable file
14
scripts/pacrank
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0 <Country>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
country=$1
|
||||
|
||||
INPUT=/etc/pacman.d/mirrorlist.pacnew
|
||||
OUTPUT=/etc/pacman.d/mirrorlist
|
||||
|
||||
cat $INPUT | awk -v "COUNTRY=$country" 'BEGIN { c="" } /^##/ { c=substr($0,4); } /^#Server/ { if(c==COUNTRY) { print substr($0,2); } }' | rankmirrors - | sudo tee $OUTPUT
|
||||
|
12
scripts/prepare_monitors.sh
Executable file
12
scripts/prepare_monitors.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
INTERN="LVDS1"
|
||||
EXTERN="VGA1"
|
||||
|
||||
xrandr --output $INTERN --auto
|
||||
|
||||
if [ -n "$(xrandr -q | grep $EXTERN' connected')" ]; then
|
||||
xrandr --output $EXTERN --auto --right-of $INTERN
|
||||
else
|
||||
xrandr --output $EXTERN --off
|
||||
fi
|
18
scripts/tabletmode.sh
Executable file
18
scripts/tabletmode.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
INTERN="LVDS1"
|
||||
IDS=$(./wacomdevices.sh)
|
||||
|
||||
if [ "$1" == "on" ]; then
|
||||
#xrandr --output $INTERN --rotate left
|
||||
xrandr --output $INTERN --rotate inverted
|
||||
|
||||
for i in $IDS; do xsetwacom set $i Rotate half; done
|
||||
else
|
||||
#xrandr --output $INTERN --rotate left
|
||||
xrandr --output $INTERN --rotate normal
|
||||
|
||||
for i in $IDS; do xsetwacom set $i Rotate none; done
|
||||
fi
|
9
scripts/teatimer.sh
Executable file
9
scripts/teatimer.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo
|
||||
echo -n " Time: "
|
||||
read ttime
|
||||
|
||||
python ~/Projects/teatimer-curses/main.py $ttime
|
||||
|
||||
aplay ~/.config/assets/atone.wav > /dev/null
|
25
scripts/volume.sh
Executable file
25
scripts/volume.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
case $1 in
|
||||
+)
|
||||
pamixer --unmute --increase 2
|
||||
;;
|
||||
-)
|
||||
pamixer --unmute --decrease 2
|
||||
;;
|
||||
mute)
|
||||
pamixer --toggle-mute
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
MUTE=$(pamixer --get-mute)
|
||||
if [ "$MUTE" == "true" ]; then
|
||||
VOLUME=0
|
||||
else
|
||||
VOLUME=$(pamixer --get-volume)
|
||||
fi
|
||||
|
||||
osd_cat --colour=White --shadow 1 --pos bottom --align center --offset 80 --delay=1 -b percentage -P $VOLUME -T "Lautstärke"
|
3
scripts/wacomdevices.sh
Executable file
3
scripts/wacomdevices.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
xsetwacom list dev | awk -F'\t' '{print $2}' | cut -c 5-
|
Loading…
Reference in a new issue