Add old dotfiles
This commit is contained in:
commit
1cace80e48
192 files changed
+13538
No files matched your search
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# script name: dm-wifi
|
||||
# Description: Connect to wifi using dmenu
|
||||
# Dependencies: dmenu, fzf, rofi, nmcli, Any Nerd Font
|
||||
# GitLab: https://www.gitlab.com/dwt1/dmscripts
|
||||
# License: https://www.gitlab.com/dwt1/dmscripts/LICENSE
|
||||
# Contributor: WitherCubes
|
||||
# Derek Taylor
|
||||
|
||||
# Set with the flags "-e", "-u","-o pipefail" cause the script to fail
|
||||
# if certain things happen, which is a good thing. Otherwise, we can
|
||||
# get hidden bugs that are hard to discover.
|
||||
set -euo pipefail
|
||||
|
||||
# shellcheck disable=SC1091
|
||||
source ./_dm-helper.sh 2>/dev/null || source _dm-helper.sh 2>/dev/null
|
||||
|
||||
source_dmscripts_configs
|
||||
|
||||
if configs_are_different; then
|
||||
echo "$(date): configs are different" >>"$DM_CONFIG_DIFF_LOGFILE"
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
main() {
|
||||
# TODO: Fix cut line at some point
|
||||
bssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | ${MENU} "Select Wifi :" | cut -d' ' -f1)
|
||||
pass=$(echo "" | ${MENU} "Enter Password :")
|
||||
# We are disabling a shellcheck warning about using && and || as it doesn't apply here.
|
||||
# shellcheck disable=SC2015
|
||||
[ -n "$pass" ] && nmcli device wifi connect "$bssid" password "$pass" || nmcli device wifi connect "$bssid"
|
||||
sleep 10
|
||||
if ping -q -c 2 -W 2 google.com >/dev/null; then
|
||||
notify-send "Your internet is working :)"
|
||||
else
|
||||
notify-send "Your internet is not working :("
|
||||
fi
|
||||
}
|
||||
|
||||
MENU="$(get_menu_program "$@")"
|
||||
[[ "${BASH_SOURCE[0]}" == "${0}" ]] && main
|
||||
Reference in new issue
Block a user