most amazing wifi script for rofi/wofi/dmenu is now complete

This commit is contained in:
Clay Gomera 2023-09-10 02:29:11 -04:00
parent 4d9b8a55f8
commit 4da0fd9bbe
9 changed files with 44 additions and 80 deletions

View file

@ -6,7 +6,7 @@
## /_____/_/ \__,_/_/|_|\___/ My custom bash_profile config ## /_____/_/ \__,_/_/|_|\___/ My custom bash_profile config
## ##
### STARTING XSESSION # starting hyprland
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ] if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]
then then
sh "$HOME/.winitrc" sh "$HOME/.winitrc"
@ -27,10 +27,11 @@ export WGETRC="$HOME/.config/wget/wgetrc"
export INPUTRC="$HOME/.config/inputrc" export INPUTRC="$HOME/.config/inputrc"
export LESSHISTFILE=- export LESSHISTFILE=-
# user defined global variables
export MEDIA_DIR="$HOME/Media" export MEDIA_DIR="$HOME/Media"
export TEMP_DIR="$HOME/Temporal" export TEMP_DIR="$HOME/Temporal"
export RUNNER="wofi --dmenu" export RUNNER="wofi --dmenu"
export RUNNER_EX="wofi -p ' Run'" export RUNNER_EX="wofi -p ' Run'"
### BASHRC # bashrc
source "$HOME"/.bashrc # Load the bashrc source "$HOME"/.bashrc

View file

@ -179,7 +179,7 @@
# corners. # corners.
# The radius will be automatically lowered if it exceeds half of the # The radius will be automatically lowered if it exceeds half of the
# notification height to avoid clipping text and/or icons. # notification height to avoid clipping text and/or icons.
corner_radius = 7 corner_radius = 0
### Legacy ### Legacy

View file

@ -6,7 +6,7 @@ https://planet.kde.org/global/atom.xml "~Planet KDE"
https://pointieststick.com/feed/ "~This Week on KDE" https://pointieststick.com/feed/ "~This Week on KDE"
https://www.kdeblog.com/rss "~KDE Blog" https://www.kdeblog.com/rss "~KDE Blog"
https://thisweek.gnome.org/index.xml "~This Week on GNOME" https://thisweek.gnome.org/index.xml "~This Week on GNOME"
https://www.omgubuntu.co.uk/feed "~OMG Ubuntu!" https://www.omgubuntu.co.uk/feed "~OMG!Ubuntu"
https://www.omglinux.com/feed "~OMG!Linux" https://www.omglinux.com/feed "~OMG!Linux"
https://blog.thunderbird.net/feed/ "~The Thunderbird Blog" https://blog.thunderbird.net/feed/ "~The Thunderbird Blog"
https://thelinuxexp.com/feed.xml "~The Linux Experiment" https://thelinuxexp.com/feed.xml "~The Linux Experiment"
@ -28,11 +28,11 @@ https://betanews.com/feed "~Betanews Linux"
http://lxer.com/module/newswire/headlines.rss "~Lxer" http://lxer.com/module/newswire/headlines.rss "~Lxer"
https://theevilskeleton.gitlab.io/feed.xml "~TheEvilSkeleton" https://theevilskeleton.gitlab.io/feed.xml "~TheEvilSkeleton"
https://tutanota.com/blog/feed.xml "~Tutanota Blogs" https://tutanota.com/blog/feed.xml "~Tutanota Blogs"
https://vanillaos.org/feed.xml "~Vanilla OS"
https://techcrunch.com/feed/ "~TechCrunch" https://techcrunch.com/feed/ "~TechCrunch"
http://www.techradar.com/rss "~TechRadar" http://www.techradar.com/rss "~TechRadar"
https://www.zdnet.com/news/rss.xml "~ZDNET - News" https://www.zdnet.com/news/rss.xml "~ZDNET - News"
https://c3po.website/rss/ "~Blog de C3PO" https://c3po.website/rss/ "~Blog de C3PO"
https://thecheis.com/feed/ "~THE_CHEI$"
http://yro.slashdot.org/yro.rss "~Slashdot: Your Rights Online" http://yro.slashdot.org/yro.rss "~Slashdot: Your Rights Online"
https://freedom-to-tinker.com/feed/rss/ "~Freedom to Tinker" https://freedom-to-tinker.com/feed/rss/ "~Freedom to Tinker"
https://act.eff.org/action.atom "~EFF - Action Center" https://act.eff.org/action.atom "~EFF - Action Center"
@ -55,10 +55,12 @@ https://inv.vern.cc/feed/channel/UC8ENHE5xdFSwx71u3fDH5Xw "~YT - ThePrimeagen"
https://inv.vern.cc/feed/channel/UC8uT9cgJorJPWu7ITLGo9Ww "~YT - The 8-Bit Guy" https://inv.vern.cc/feed/channel/UC8uT9cgJorJPWu7ITLGo9Ww "~YT - The 8-Bit Guy"
https://inv.vern.cc/feed/channel/UC9-y-6csu5WGm29I7JiwpnA "~YT - Computerphile" https://inv.vern.cc/feed/channel/UC9-y-6csu5WGm29I7JiwpnA "~YT - Computerphile"
https://inv.vern.cc/feed/channel/UC9bORzxOWiewqMXxkmhAwAg "~YT - Gingy" https://inv.vern.cc/feed/channel/UC9bORzxOWiewqMXxkmhAwAg "~YT - Gingy"
https://inv.vern.cc/feed/channel/UCAYKj_peyESIMDp5LtHlH2A "~YT - unfa" https://inv.vern.cc/feed/channel/UCAYKj_peyESIMDp5LtHlH2A "~YT - unfa🇺🇦"
https://inv.vern.cc/feed/channel/UCAiiOTio8Yu69c3XnR7nQBQ "~YT - System Crafters" https://inv.vern.cc/feed/channel/UCAiiOTio8Yu69c3XnR7nQBQ "~YT - System Crafters"
https://inv.vern.cc/feed/channel/UCBq5p-xOla8xhnrbhu8AIAg "~YT - Tech Over Tea" https://inv.vern.cc/feed/channel/UCBq5p-xOla8xhnrbhu8AIAg "~YT - Tech Over Tea"
https://inv.vern.cc/feed/channel/UCCIHOP7e271SIumQgyl6XBQ "~YT - OldTechBloke" https://inv.vern.cc/feed/channel/UCCIHOP7e271SIumQgyl6XBQ "~YT - OldTechBloke"
https://inv.vern.cc/feed/channel/UCE0H52NoucHL2JkhPdZ1ykA "~YT - Jwlar"
https://inv.vern.cc/feed/channel/UCEp20NgOZHmgWdbQdHSxgjw "~YT - This Does Not Compute"
https://inv.vern.cc/feed/channel/UCFhXFikryT4aFcLkLw2LBLA "~YT - NileRed" https://inv.vern.cc/feed/channel/UCFhXFikryT4aFcLkLw2LBLA "~YT - NileRed"
https://inv.vern.cc/feed/channel/UCGE-JpLbibXJg3W_N2hbo8g "~YT - Sethorven" https://inv.vern.cc/feed/channel/UCGE-JpLbibXJg3W_N2hbo8g "~YT - Sethorven"
https://inv.vern.cc/feed/channel/UCH5DsMZAgdx5Fkk9wwMNwCA "~YT - The New Oil" https://inv.vern.cc/feed/channel/UCH5DsMZAgdx5Fkk9wwMNwCA "~YT - The New Oil"
@ -85,6 +87,7 @@ https://inv.vern.cc/feed/channel/UCbiGcwDWZjz05njNPrJU7jA "~YT - ExplainingCompu
https://inv.vern.cc/feed/channel/UCcf2Mr1qNoX51XXDUd3Rquw "~YT - ByteSeb" https://inv.vern.cc/feed/channel/UCcf2Mr1qNoX51XXDUd3Rquw "~YT - ByteSeb"
https://inv.vern.cc/feed/channel/UCd4XwUn2Lure2NHHjukoCwA "~YT - Linux For Everyone" https://inv.vern.cc/feed/channel/UCd4XwUn2Lure2NHHjukoCwA "~YT - Linux For Everyone"
https://inv.vern.cc/feed/channel/UCeHOkFGW-7uAZFvq3BXb8YA "~YT - :3ildcat" https://inv.vern.cc/feed/channel/UCeHOkFGW-7uAZFvq3BXb8YA "~YT - :3ildcat"
https://inv.vern.cc/feed/channel/UCerEIdrEW-IqwvlH8lTQUJQ "~YT - Tech Tangents"
https://inv.vern.cc/feed/channel/UCg6gPGh8HU2U01vaFCAsvmQ "~YT - Chris Titus Tech" https://inv.vern.cc/feed/channel/UCg6gPGh8HU2U01vaFCAsvmQ "~YT - Chris Titus Tech"
https://inv.vern.cc/feed/channel/UCgkyQiY_Q5AlrygIXGWO2Zw "~YT - Tux Traveler" https://inv.vern.cc/feed/channel/UCgkyQiY_Q5AlrygIXGWO2Zw "~YT - Tux Traveler"
https://inv.vern.cc/feed/channel/UChI0q9a-ZcbZh7dAu_-J-hg "~YT - Upper Echelon" https://inv.vern.cc/feed/channel/UChI0q9a-ZcbZh7dAu_-J-hg "~YT - Upper Echelon"
@ -98,6 +101,7 @@ https://inv.vern.cc/feed/channel/UCld68syR8Wi-GY_n4CaoJGA "~YT - Brodie Robertso
https://inv.vern.cc/feed/channel/UCmw-QGOHbHA5cDAvwwqUTKQ "~YT - Zaney" https://inv.vern.cc/feed/channel/UCmw-QGOHbHA5cDAvwwqUTKQ "~YT - Zaney"
https://inv.vern.cc/feed/channel/UCmyGZ0689ODyReHw3rsKLtQ "~YT - Michael Tunnell" https://inv.vern.cc/feed/channel/UCmyGZ0689ODyReHw3rsKLtQ "~YT - Michael Tunnell"
https://inv.vern.cc/feed/channel/UCnIfca4LPFVn8-FjpPVc1ow "~YT - Fedora Project" https://inv.vern.cc/feed/channel/UCnIfca4LPFVn8-FjpPVc1ow "~YT - Fedora Project"
https://inv.vern.cc/feed/channel/UCnw3aIEiz60S6O3XcztCVkQ "~YT - PatricianTV"
https://inv.vern.cc/feed/channel/UCoL8olX-259lS1N6QPyP4IQ "~YT - Action Retro" https://inv.vern.cc/feed/channel/UCoL8olX-259lS1N6QPyP4IQ "~YT - Action Retro"
https://inv.vern.cc/feed/channel/UCoryWpk4QVYKFCJul9KBdyw "~YT - Switched to Linux" https://inv.vern.cc/feed/channel/UCoryWpk4QVYKFCJul9KBdyw "~YT - Switched to Linux"
https://inv.vern.cc/feed/channel/UCoxcjq-8xIDTYp3uz647V5A "~YT - Numberphile" https://inv.vern.cc/feed/channel/UCoxcjq-8xIDTYp3uz647V5A "~YT - Numberphile"
@ -114,3 +118,4 @@ https://inv.vern.cc/feed/channel/UCxkw-TfCK1t1VKxfHwPzD6w "~YT - Our Walk in Chr
https://inv.vern.cc/feed/channel/UCy0tKL1T7wFoYcxCe0xjN6Q "~YT - Technology Connections" https://inv.vern.cc/feed/channel/UCy0tKL1T7wFoYcxCe0xjN6Q "~YT - Technology Connections"
https://inv.vern.cc/feed/channel/UCybBViio_TH_uiFFDJuz5tg "~YT - Einzelgänger" https://inv.vern.cc/feed/channel/UCybBViio_TH_uiFFDJuz5tg "~YT - Einzelgänger"
https://inv.vern.cc/feed/channel/UCylGUf9BvQooEFjgdNudoQg "~YT - The Linux Cast" https://inv.vern.cc/feed/channel/UCylGUf9BvQooEFjgdNudoQg "~YT - The Linux Cast"
https://inv.vern.cc/feed/channel/UC5KDiSAFxrDWhmysBcNqtMA "~YT - Eric Murphy"

View file

@ -7,7 +7,7 @@
// Choose the order of the modules // Choose the order of the modules
"modules-left": ["hyprland/workspaces"], "modules-left": ["hyprland/workspaces"],
// "modules-center": ["clock"], // "modules-center": ["clock"],
"modules-right": ["idle_inhibitor", "hyprland/language", "pulseaudio", "backlight", "battery", "custom/powerprofiles", "network", "clock"], "modules-right": ["hyprland/language", "pulseaudio", "backlight", "battery", "custom/powerprofiles", "network", "clock"],
"hyprland/workspaces": { "hyprland/workspaces": {
"on-click": "activate", "on-click": "activate",
@ -48,14 +48,6 @@
"format-es": "ES", "format-es": "ES",
}, },
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "\udb83\udf62",
"deactivated": "\udb83\udf64"
}
},
"clock": { "clock": {
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>", "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format": "\udb82\udd54 {:%H:%M}", "format": "\udb82\udd54 {:%H:%M}",

View file

@ -77,8 +77,7 @@ button:hover {
#network, #network,
#pulseaudio, #pulseaudio,
#language, #language,
#mode, #mode {
#idle_inhibitor {
font-family: Symbols Nerd Font Mono, mononoki Nerd Font; font-family: Symbols Nerd Font Mono, mononoki Nerd Font;
font-size: 16px; font-size: 16px;
padding: 0 8px; padding: 0 8px;
@ -152,14 +151,6 @@ label:focus {
background-color: #076678; background-color: #076678;
} }
#idle_inhibitor {
background-color: #af3a03;
}
#idle_inhibitor.activated {
background-color: #d55d09;
}
#language { #language {
background-color: #8f3f71; background-color: #8f3f71;
} }

View file

@ -1,6 +1,6 @@
style=/home/drk/.config/wofi/style.css style=/home/drk/.config/wofi/style.css
show=drun show=drun
width=960 width=750
height=320 height=320
always_parse_args=true always_parse_args=true
show_all=true show_all=true

View file

@ -7,8 +7,8 @@
########################### ###########################
## Screenshots Directory ## ## Screenshots Directory ##
########################### ###########################
SHOTDIR="$MEDIA_DIR/Pictures/Screenshots" # $MEDIA_DIR reffers to a global variable in .xinitrc/.bash_profile SHOTDIR="$MEDIA_DIR/Pictures/Screenshots" # $MEDIA_DIR reffers to a global variable in .winitrc/.bash_profile
VCAPDIR="$MEDIA_DIR/Videos/Screencasts" # $MEDIA_DIR reffers to a global variable in .xinitrc/.bash_profile VCAPDIR="$MEDIA_DIR/Videos/Screencasts" # $MEDIA_DIR reffers to a global variable in .winitrc/.bash_profile
[ ! -d "$SHOTDIR" ] && [ ! -d "$VCAPDIR" ] && mkdir -p "$SHOTDIR" "$VCAPDIR" || echo [ ! -d "$SHOTDIR" ] && [ ! -d "$VCAPDIR" ] && mkdir -p "$SHOTDIR" "$VCAPDIR" || echo
##### #####
@ -85,16 +85,6 @@ fdel() {
del=$(echo -e "$dels" | $RUNNER -L 5 -i -p " Select Delay") del=$(echo -e "$dels" | $RUNNER -L 5 -i -p " Select Delay")
} }
# countdown function
countdown() {
notify-send "Screenshot" "Executing in 3 seconds" -t 1000
sleep 1
notify-send "Screenshot" "Executing in 2 seconds" -t 1000
sleep 1
notify-send "Screenshot" "Executing in 1 seconds" -t 1000
sleep 2
}
##### #####
## This function does a full screen ## This function does a full screen
## screenshot without delay, depending on ## screenshot without delay, depending on

View file

@ -20,9 +20,8 @@ options="$option1\n$option2\n$option3\n$option4\n$option5\n$option6"
## information about the wireless ## information about the wireless
## interface ## interface
##### #####
wlan=$(nmcli dev | grep wifi | sed 's/ \{2,\}/|/g' | cut -d '|' -f1 | head -1) wifi_info=$(nmcli dev | awk '/wifi/ {print $1,$3; exit}')
constate=$(nmcli dev | grep wifi | sed 's/ \{2,\}/|/g' | cut -d '|' -f3 | head -1) read -r wlan constate <<< "$wifi_info"
currentwfi=$(nmcli dev | grep wifi | sed 's/ \{2,\}/|/g' | cut -d '|' -f4 | head -1)
##### #####
## This function uses nmcli to turn ## This function uses nmcli to turn
@ -78,7 +77,9 @@ disconnect() {
##### #####
connect() { connect() {
notify-send "Scannig networks..." && nmcli dev wifi rescan; notify-send "Scannig networks..." && nmcli dev wifi rescan;
bssid=$(nmcli device wifi list | sed -n '1!p' | cut -b 9- | $RUNNER -i -p " Select a Wifi Network" | cut -d' ' -f1); wifinet=$(nmcli -f BSSID,SSID,BARS,SECURITY dev wifi list | sed -n '1!p' | $RUNNER -i -p " Select a Wifi Network");
bssid=$(echo "$wifinet" | cut -d' ' -f1)
ssid=$(echo "$wifinet" | cut -d' ' -f3)
} }
##### #####
@ -89,11 +90,18 @@ connect() {
## return: string ## return: string
##### #####
password() { password() {
# TODO Create a condition to check if the chosen network is open or not, that if nmcli connection show | grep -q "$ssid"; then # check if the network is already saved
# way this will be skipped of it's open return 0; # no password is required
# TODO What if the network is already saved? The user doesn't need to type the elif nmcli -f BSSID,SECURITY dev wifi list | sed -n '1!p' | grep "$bssid" | awk '{print $2}' | grep -q -- "--"; then # check if the network is open
# password again return 0; # no password is required
else
pass=$($RUNNER -i -W 250 -L 1 -p "Enter Password " --password); pass=$($RUNNER -i -W 250 -L 1 -p "Enter Password " --password);
if [ -n "$pass" ]; then # if the user gave a password
return 0;
else
exit 1; # if not, exit the script
fi
fi
} }
##### #####
@ -105,23 +113,10 @@ password() {
## return: void ## return: void
##### #####
action() { action() {
nmcli device wifi connect "$bssid" password "$pass" || nmcli device wifi connect "$bssid"; if [ -n "$pass" ]; then # we need to check again if the $pass variable exists
} nmcli dev wifi connect "$bssid" password "$pass"
else # if not, that means that the password() function ended in one of the first two conditions, the network is saved or open
##### nmcli dev wifi connect "$bssid";
## This function will check if the
## connection works
#####
## param: none
## return: void
#####
check() {
notify-send "Checking if connection was successful";
sleep 1;
if ping -q -c 2 -W 2 google.com >/dev/null; then
notify-send "You are now connected to $currentwfi and internet is working properly";
else
notify-send "Your internet is not working :(";
fi fi
} }
@ -140,20 +135,9 @@ case "$cases" in
disconnect; disconnect;
;; ;;
"$option4") "$option4")
connect; if connect; then # if the user chooses a network
if [ -n "$bssid" ]; then # if the user chooses a network password; # this function will exit the script if the user didn't put a password
password;
if [ -n "$pass" ]; then # if the user typed a password
action; action;
if [ "$constate" = "connected" ]; then # if the connection was successful
check;
else
notify-send "Connection error"; # if not, connection error
exit 1;
fi
else
exit 1; # if not, exit the script
fi
else else
exit 1; # if not, exit the script exit 1; # if not, exit the script
fi fi

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
cd ~ cd "$HOME" || exit 1
# Log WLR errors and logs to the hyprland log. Recommended # Log WLR errors and logs to the hyprland log. Recommended
export HYPRLAND_LOG_WLR=1 export HYPRLAND_LOG_WLR=1
@ -46,6 +46,7 @@ export VISUAL="neovide --neovim-bim $HOME/.local/bin/lvim"
export BROWSER="qutebrowser" export BROWSER="qutebrowser"
export VIEWER="zathura" export VIEWER="zathura"
# user defined global variables
export MEDIA_DIR="$HOME/Media" export MEDIA_DIR="$HOME/Media"
export TEMP_DIR="$HOME/Temporal" export TEMP_DIR="$HOME/Temporal"
export RUNNER="wofi --dmenu" export RUNNER="wofi --dmenu"