Compare commits

..

4 Commits

Author SHA1 Message Date
90d2373ee2 mail and address scripts 2022-03-11 13:43:53 +01:00
d49f19e48b suspend update 2022-03-11 13:43:31 +01:00
35f8cdfba0 wifi update 2022-03-11 13:43:21 +01:00
4735d58b77 choose wifi on start 2022-03-01 02:28:05 +01:00
6 changed files with 43 additions and 12 deletions

View File

@ -2,4 +2,4 @@
khard email "$@" | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" khard email "$@" | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"
s="$@" s="$@"
[ "$#" -gt 0 ] && notmuch address "$@" | grep -i "$s" [ "$#" -gt 0 ] && notmuch address "$s" | grep -i "$s"

5
emails Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
# We setup xauthority file to display stuff
xauthority="$(cat ~/.Xauthority)"
exec sudo -u emails sh -c "echo \"$xauthority\" > ~/.Xauthority && . ~/.bashrc && exec aerc"

View File

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
# Lock screen and suspend if enabled in config file # Lock screen and suspend if enabled in config file
DISPLAY=:0 i3lock -e -c 000000 -u && [ -z "$(grep off "/run/user/1000/enable_suspend")" ] && systemctl suspend i3lock -e -c 000000 -u && [ -z "$(grep off "/run/user/1000/enable_suspend")" ] && systemctl suspend

View File

@ -1,8 +0,0 @@
#!/bin/sh
if [[ "$(nmcli radio wifi)" = "enabled" ]] ; then
nmcli radio wifi off
notify-send "Wifi is now" off
else
nmcli radio wifi on
notify-send "Wifi is now" on
fi

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
if [ -z "$(grep off "/run/user/1000/enable_suspend")" ] ; then if [ -z "$(grep off "$XDG_RUNTIME_DIR/enable_suspend")" ] ; then
echo off > "$XDG_RUNTIME_DIR/enable_suspend" echo off > "$XDG_RUNTIME_DIR/enable_suspend"
notify-send "Sleep mode is now" "off" notify-send "Sleep mode is now" "off"
else else

View File

@ -2,6 +2,32 @@
# choose a wifi signal in range and try to connect to it # choose a wifi signal in range and try to connect to it
verb=0 verb=0
action=start
while true ; do
case "$1" in
"-v")
verb=1
;;
"stop")
action=stop
;;
"start") ;;
"") break ;;
*)
echo "Invalid parameter '$1'"
break;;
esac
shift
done
# Remaining args are garbage
if [ "$#" -ne 0 ] ; then
echo "Usage: $0 [-v] [start|stop]"
echo "-v verbose output"
echo "start or stop the wifi"
exit -1
fi
title="Wifi Selector" title="Wifi Selector"
id="" id=""
@ -13,10 +39,18 @@ notify () {
fi fi
} }
# Stop the wifi if asked
if [ "$action" == "stop" ] ; then
nmcli radio wifi off
notify "Wifi stopped"
exit "$?"
fi
# Else, start it if needed
if ( nmcli radio wifi | grep disabled > /dev/null ) ; then if ( nmcli radio wifi | grep disabled > /dev/null ) ; then
notify "Turning on" notify "Turning on"
nmcli radio wifi on nmcli radio wifi on
sleep 1 sleep 2
fi fi
notify "Scanning networks in range..." notify "Scanning networks in range..."