aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.scripts/airplay8
-rwxr-xr-x.scripts/autolock26
-rwxr-xr-x.scripts/clip3
-rwxr-xr-x.scripts/emoji2
-rwxr-xr-x.scripts/islocked5
-rwxr-xr-x.scripts/panic7
-rwxr-xr-x.scripts/softpanic5
-rwxr-xr-x.scripts/stats2
-rwxr-xr-x.scripts/tscrot2
-rwxr-xr-x.scripts/wallset6
-rwxr-xr-x.scripts/warn9
11 files changed, 66 insertions, 9 deletions
diff --git a/.scripts/airplay b/.scripts/airplay
index c01099d..1bf2c26 100755
--- a/.scripts/airplay
+++ b/.scripts/airplay
@@ -1,6 +1,10 @@
#!/bin/env sh
-sudo systemctl start avahi-daemon
-sleep 1
+#sudo ufw disable
+sudo systemctl restart avahi-daemon
+echo "started avahi, waiting..."
+sleep 5
uxplay -n melvin -nh -p
sudo systemctl stop avahi-daemon
+#sudo ufw enable
+echo "stopped avahi"
diff --git a/.scripts/autolock b/.scripts/autolock
new file mode 100755
index 0000000..cd14371
--- /dev/null
+++ b/.scripts/autolock
@@ -0,0 +1,26 @@
+#!/bin/env sh
+
+islocked || exit 0 # already locked
+
+export XAUTHORITY=/home/melvin/.Xauthority
+export DISPLAY=:0
+export XDG_RUNTIME_DIR=/run/user/1000
+export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
+
+ishome && (
+ hasyubi || (
+ notify-send "intrusion detected" &
+ (
+ sleep 1
+ softpanic
+ )
+ )
+) || (
+ hasyubi || (
+ notify-send -u critical "connect key now or poweroff!" &
+ (
+ sleep 30
+ hasyubi || panic
+ )
+ )
+)
diff --git a/.scripts/clip b/.scripts/clip
index 8331cb6..a9d8f0c 100755
--- a/.scripts/clip
+++ b/.scripts/clip
@@ -1,3 +1,4 @@
#!/bin/sh
-copyq copy $1 -
+# copyq copy $1 -
+xclip -in -selection primary -f | xclip -in -selection secondary -f | xclip -in -selection clipboard
diff --git a/.scripts/emoji b/.scripts/emoji
index 2d22796..8a69ddf 100755
--- a/.scripts/emoji
+++ b/.scripts/emoji
@@ -12,7 +12,7 @@ fi
emoji=$(grep "^$(echo $@)|" ~/.config/emoji | cut -d '|' -f 2 | tr -s '\r')
-#echo "$emoji" | xclip -selection clipboard
+echo "$emoji" | clip
xdotool type --window "$window" "$emoji"
xdotool windowactivate "$window"
diff --git a/.scripts/islocked b/.scripts/islocked
new file mode 100755
index 0000000..9f2c7ef
--- /dev/null
+++ b/.scripts/islocked
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# fails if locked
+
+(pgrep -x "slock" 2>/dev/null) && exit 1 || exit 0
diff --git a/.scripts/panic b/.scripts/panic
index 2368d8a..1c3de63 100755
--- a/.scripts/panic
+++ b/.scripts/panic
@@ -1,3 +1,10 @@
#!/bin/sh
+# xdotool search "" windowkill %@
+
+for i in $(seq 5); do
+ printf "panic\npanic\npanic" | osd_cat -d 1 -A center -l 3 -p middle -c red -f '-*-*-*-*-*-*-*-240-*-*-*-*-*-*'
+ sleep 0.1
+done
+
systemctl poweroff
diff --git a/.scripts/softpanic b/.scripts/softpanic
new file mode 100755
index 0000000..7268d7c
--- /dev/null
+++ b/.scripts/softpanic
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+wifi off
+slock
+wifi on
diff --git a/.scripts/stats b/.scripts/stats
index a71b40f..8e4012a 100755
--- a/.scripts/stats
+++ b/.scripts/stats
@@ -10,7 +10,7 @@ mem=$(free -m | awk '/^Mem:/{printf("%.1fGb\n",$3/1000)}')
swap=$(free -m | awk '/^Swap:/{printf("%.1fGb\n",$3/1000)}')
cpu=$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else printf "%.1f%", (($2+$4-u1) * 100 / (t-t1)); }' <(grep 'cpu ' /proc/stat) <(sleep .5; grep 'cpu ' /proc/stat))
-mouse=$(upower -d | grep -A 10 mouse | awk '/percentage/{printf("| M%s ",$2)}')
+mouse=$(upower -d | grep -m 1 -A 10 mouse | awk '/percentage/{printf("| M%s ",$2)}')
if bluetooth | grep -q on; then
btdev=$(bluetoothctl info)
diff --git a/.scripts/tscrot b/.scripts/tscrot
index f9ff595..fe89c9a 100755
--- a/.scripts/tscrot
+++ b/.scripts/tscrot
@@ -3,4 +3,4 @@
lang=$(echo -e "eng\ndeu" | dmenu)
killall -9 flameshot
-flameshot gui --raw | tesseract -l "$lang" stdin stdout | xclip -in -selection clipboard
+flameshot gui --raw | tesseract -l "$lang" stdin stdout | clip
diff --git a/.scripts/wallset b/.scripts/wallset
index 420f5a0..be87da7 100755
--- a/.scripts/wallset
+++ b/.scripts/wallset
@@ -2,6 +2,6 @@
xsetroot -solid black
-#random=$(find $HOME/.walls -maxdepth 1 -name "k*" -type f | shuf -n 1)
-#echo $random
-#hsetroot -cover "$random"
+# random=$(find $HOME/.walls -maxdepth 1 -name "l*" -type f | shuf -n 1)
+# echo $random
+# hsetroot -cover "$random"
diff --git a/.scripts/warn b/.scripts/warn
new file mode 100755
index 0000000..0ea43f9
--- /dev/null
+++ b/.scripts/warn
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# codes from there (first 6 letters, rest 0)
+# https://www.xrepository.de/api/xrepository/urn:de:bund:destatis:bevoelkerungsstatistik:schluessel:rs_2021-07-31/download/Regionalschl_ssel_2021-07-31.json
+
+code="084160000000"
+warnings="https://warnung.bund.de/api31/dashboard/$code.json"
+
+curl "$warnings" | jq