big update

This commit is contained in:
Adrian Amaglio 2023-01-24 23:56:39 +01:00
parent c9a826082a
commit 679a0ff8ce
5 changed files with 32 additions and 19 deletions

2
emails
View File

@ -2,4 +2,4 @@
# We setup xauthority file to display stuff # We setup xauthority file to display stuff
auth="$(xauth extract - "$DISPLAY" | base64)" auth="$(xauth extract - "$DISPLAY" | base64)"
exec sudo -u emails sh -c "echo -n '$auth' | base64 -d > ~/.Xauthority && . ~/.bashrc && cd ~/attachements && exec aerc" exec sudo -u emails sh -c "echo -n '$auth' | base64 -d > ~/.Xauthority && . ~/.bashrc && cd ~/attachements && exec neomutt"

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
i3lock -e -c 000000 -u && [ -z "$(grep off "/run/user/1000/enable_suspend")" ] && systemctl suspend i3lock -e -c 000000 -u && [ "$(cat "$XDG_RUNTIME_DIR/enable_suspend")" != off ] && systemctl suspend

View File

@ -1,12 +1,8 @@
nextcloud & #!/bin/bash
feedreader &
#jami-gnome & #feedreader &>/dev/null &
offlineimap #jami-gnome &>/dev/null &
vdirsyncer sync nicotine &>/dev/null &
birthday_reminder qbittorrent &>/dev/null &
while true ; do #vdirsyncer sync
offlineimap -q sudo -u emails syncmails
#mpop -a
#notmuch new
sleep 30
done

5
term
View File

@ -1,3 +1,4 @@
#!/bin/sh #!/bin/bash
cd "$(readlink -f "/proc/$(pgrep -P $(xdotool getwindowpid "$(xdotool getactivewindow)"))/cwd")" &>/dev/null || cd "$HOME" pid="$(xdotool getactivewindow getwindowpid)"
[ -n "$pid" ] && cd "$(readlink -f "/proc/$(pgrep -P "$pid")/cwd")" &>/dev/null || cd "$HOME"
exec st "${SHELL:-bash}" exec st "${SHELL:-bash}"

View File

@ -60,13 +60,29 @@ ssid="$(nmcli -f IN-USE,SSID,BARS d wifi list | dmenu -l 8)"
ssid="$(echo "${ssid:2:-5}" | sed 's/^ *//g' | sed 's/ *$//g')" ssid="$(echo "${ssid:2:-5}" | sed 's/^ *//g' | sed 's/ *$//g')"
# We get a clean version of SSIDs. It is a fix to connect to wifis that begin or end with spaces # We get a clean version of SSIDs. It is a fix to connect to wifis that begin or end with spaces
ssid="$(nmcli -f SSID -m multiline -t -c no d wifi list | grep -F "$ssid")" ssid="$(nmcli -f SSID -m multiline -t -c no d wifi list | grep -F -- "$ssid")"
ssid="${ssid:5}" ssid="${ssid:5}"
[ $verb -gt 0 ] && echo "ssid: $ssid" [ $verb -gt 0 ] && echo "ssid: $ssid"
[ -z "$ssid" ] && notify "No SSID selected" && exit 1 [ -z "$ssid" ] && notify "No SSID selected" && exit 1
notify "Connecting to $ssid" notify "Connecting to $ssid"
out="$(nmcli d wifi connect "$ssid" 2>&1 | grep -i error)" #out="$(nmcli d wifi connect "$ssid" 2>&1 | grep -i error)"
out="$(nmcli con up "$ssid" 2>&1 | grep -i error)"
res="$?" res="$?"
[ -z "$out" ] && notify "Connected :)" || notify "Error connecting :(\n$out" # 10 If the connexion does not exist already #
# 4 If the SSID got multiple bad connexion names #
if [ "$res" -ne 0 ] ; then
out2="$out"
out="$(nmcli device wifi connect "$ssid" 2>&1 | grep -i error)"
res="$?"
fi
if [ -n "$(echo $out | grep -i 'secrets were required')" ] ; then
out2="$out2$out"
notify "Need password"
pass="$(zenity --password)"
out="$(nmcli device wifi connect "$ssid" --password "$pass" 2>&1 | grep -i error)"
res="$?"
fi
[ -z "$out" ] && notify "Connected :)" || notify "Error connecting :(\n$out\n$out2"