fix: wlp not working properly

This commit is contained in:
AngeD 2023-06-26 18:05:56 +02:00
parent 305ecfa9b8
commit c367348bf2
3 changed files with 22 additions and 14 deletions

View File

@ -2,6 +2,7 @@ vim.cmd("packadd lspconfig")
lspconfig = require"lspconfig"
local servers = {
"pyright",
}
local on_attach = function(client, bufnr)

View File

@ -84,7 +84,7 @@ trap 'update_crypto;display' 'RTMIN+2'
sec=0
while true; do
[ "$((sec % 3600))" = 0 ] && update_crypto
[ "$((sec % 300))" = 0 ] && update_crypto
[ "$((sec % 5 ))" = 0 ] && {
update_time
update_cpu

27
bin/wlp
View File

@ -5,21 +5,27 @@ CON=("${NMCLI[@]}" connect)
RESCAN=0
function rescan() {
if [ "$RESCAN" = 0 ]; then
if [ "$RESCAN" = 1 ]; then
return 1
fi
RESCAN=1
"${NMCLI[@]}" list --rescan yes > /dev/null
fi
readarray -t NET <<< "$("${NMCLI[@]}" list | awk '!w[$1]++' | tail -n+2)"
}
function connect() {
if ! (
"${CON[@]}" "$1" || ([ "$?" = 4 ] && "${CON[@]}" "$1" password "$(zenity --entry --text "Enter password for $1")")
) 2> /dev/null; then
rescan || return 1
local pass
if ! "${CON[@]}" "$1"; then
return 1
fi
case "$?" in
4)
pass="$(zenity --entry --text "Enter password for $1")"
"${CON[@]}" "$1" password "$pass"
;;
10)
rescan && connect "$@"
;;
esac
fi
kill -36 "$(cat "$HOME/.cache/pidofbar")"
exit
@ -31,11 +37,12 @@ fi
readarray -t NET <<< "$("${NMCLI[@]}" list | awk '!w[$1]++' | tail -n+2)"
while true; do
n="$(printf '%s\n' "${NET[@]}" reload | dmenu -i -l 10)"
n="$(printf '%s\n' "${NET[@]}" rescan | dmenu -i -l 10)"
if [ -z "$n" ]; then
exit
fi
if [ "$n" = reload ]; then
if [ "$n" = rescan ]; then
RESCAN=0
rescan
else
connect "$(awk '{print $1}' <<< "$n")"