most amazing wifi script for rofi/wofi/dmenu is now complete
This commit is contained in:
parent
4d9b8a55f8
commit
4da0fd9bbe
9 changed files with 44 additions and 80 deletions
|
@ -6,7 +6,7 @@
|
|||
## /_____/_/ \__,_/_/|_|\___/ My custom bash_profile config
|
||||
##
|
||||
|
||||
### STARTING XSESSION
|
||||
# starting hyprland
|
||||
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]
|
||||
then
|
||||
sh "$HOME/.winitrc"
|
||||
|
@ -27,10 +27,11 @@ export WGETRC="$HOME/.config/wget/wgetrc"
|
|||
export INPUTRC="$HOME/.config/inputrc"
|
||||
export LESSHISTFILE=-
|
||||
|
||||
# user defined global variables
|
||||
export MEDIA_DIR="$HOME/Media"
|
||||
export TEMP_DIR="$HOME/Temporal"
|
||||
export RUNNER="wofi --dmenu"
|
||||
export RUNNER_EX="wofi -p ' Run'"
|
||||
|
||||
### BASHRC
|
||||
source "$HOME"/.bashrc # Load the bashrc
|
||||
# bashrc
|
||||
source "$HOME"/.bashrc
|
||||
|
|
|
@ -179,7 +179,7 @@
|
|||
# corners.
|
||||
# The radius will be automatically lowered if it exceeds half of the
|
||||
# notification height to avoid clipping text and/or icons.
|
||||
corner_radius = 7
|
||||
corner_radius = 0
|
||||
|
||||
### Legacy
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ https://planet.kde.org/global/atom.xml "~Planet KDE"
|
|||
https://pointieststick.com/feed/ "~This Week on KDE"
|
||||
https://www.kdeblog.com/rss "~KDE Blog"
|
||||
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://blog.thunderbird.net/feed/ "~The Thunderbird Blog"
|
||||
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"
|
||||
https://theevilskeleton.gitlab.io/feed.xml "~TheEvilSkeleton"
|
||||
https://tutanota.com/blog/feed.xml "~Tutanota Blogs"
|
||||
https://vanillaos.org/feed.xml "~Vanilla OS"
|
||||
https://techcrunch.com/feed/ "~TechCrunch"
|
||||
http://www.techradar.com/rss "~TechRadar"
|
||||
https://www.zdnet.com/news/rss.xml "~ZDNET - News"
|
||||
https://c3po.website/rss/ "~Blog de C3PO"
|
||||
https://thecheis.com/feed/ "~THE_CHEI$"
|
||||
http://yro.slashdot.org/yro.rss "~Slashdot: Your Rights Online"
|
||||
https://freedom-to-tinker.com/feed/rss/ "~Freedom to Tinker"
|
||||
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/UC9-y-6csu5WGm29I7JiwpnA "~YT - Computerphile"
|
||||
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/UCBq5p-xOla8xhnrbhu8AIAg "~YT - Tech Over Tea"
|
||||
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/UCGE-JpLbibXJg3W_N2hbo8g "~YT - Sethorven"
|
||||
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/UCd4XwUn2Lure2NHHjukoCwA "~YT - Linux For Everyone"
|
||||
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/UCgkyQiY_Q5AlrygIXGWO2Zw "~YT - Tux Traveler"
|
||||
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/UCmyGZ0689ODyReHw3rsKLtQ "~YT - Michael Tunnell"
|
||||
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/UCoryWpk4QVYKFCJul9KBdyw "~YT - Switched to Linux"
|
||||
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/UCybBViio_TH_uiFFDJuz5tg "~YT - Einzelgänger"
|
||||
https://inv.vern.cc/feed/channel/UCylGUf9BvQooEFjgdNudoQg "~YT - The Linux Cast"
|
||||
https://inv.vern.cc/feed/channel/UC5KDiSAFxrDWhmysBcNqtMA "~YT - Eric Murphy"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// Choose the order of the modules
|
||||
"modules-left": ["hyprland/workspaces"],
|
||||
// "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": {
|
||||
"on-click": "activate",
|
||||
|
@ -48,14 +48,6 @@
|
|||
"format-es": "ES",
|
||||
},
|
||||
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"activated": "\udb83\udf62",
|
||||
"deactivated": "\udb83\udf64"
|
||||
}
|
||||
},
|
||||
|
||||
"clock": {
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
|
||||
"format": "\udb82\udd54 {:%H:%M}",
|
||||
|
|
|
@ -77,8 +77,7 @@ button:hover {
|
|||
#network,
|
||||
#pulseaudio,
|
||||
#language,
|
||||
#mode,
|
||||
#idle_inhibitor {
|
||||
#mode {
|
||||
font-family: Symbols Nerd Font Mono, mononoki Nerd Font;
|
||||
font-size: 16px;
|
||||
padding: 0 8px;
|
||||
|
@ -152,14 +151,6 @@ label:focus {
|
|||
background-color: #076678;
|
||||
}
|
||||
|
||||
#idle_inhibitor {
|
||||
background-color: #af3a03;
|
||||
}
|
||||
|
||||
#idle_inhibitor.activated {
|
||||
background-color: #d55d09;
|
||||
}
|
||||
|
||||
#language {
|
||||
background-color: #8f3f71;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
style=/home/drk/.config/wofi/style.css
|
||||
show=drun
|
||||
width=960
|
||||
width=750
|
||||
height=320
|
||||
always_parse_args=true
|
||||
show_all=true
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
###########################
|
||||
## Screenshots Directory ##
|
||||
###########################
|
||||
SHOTDIR="$MEDIA_DIR/Pictures/Screenshots" # $MEDIA_DIR reffers to a global variable in .xinitrc/.bash_profile
|
||||
VCAPDIR="$MEDIA_DIR/Videos/Screencasts" # $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 .winitrc/.bash_profile
|
||||
[ ! -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")
|
||||
}
|
||||
|
||||
# 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
|
||||
## screenshot without delay, depending on
|
||||
|
|
|
@ -20,9 +20,8 @@ options="$option1\n$option2\n$option3\n$option4\n$option5\n$option6"
|
|||
## information about the wireless
|
||||
## interface
|
||||
#####
|
||||
wlan=$(nmcli dev | grep wifi | sed 's/ \{2,\}/|/g' | cut -d '|' -f1 | head -1)
|
||||
constate=$(nmcli dev | grep wifi | sed 's/ \{2,\}/|/g' | cut -d '|' -f3 | head -1)
|
||||
currentwfi=$(nmcli dev | grep wifi | sed 's/ \{2,\}/|/g' | cut -d '|' -f4 | head -1)
|
||||
wifi_info=$(nmcli dev | awk '/wifi/ {print $1,$3; exit}')
|
||||
read -r wlan constate <<< "$wifi_info"
|
||||
|
||||
#####
|
||||
## This function uses nmcli to turn
|
||||
|
@ -78,7 +77,9 @@ disconnect() {
|
|||
#####
|
||||
connect() {
|
||||
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
|
||||
#####
|
||||
password() {
|
||||
# TODO Create a condition to check if the chosen network is open or not, that
|
||||
# way this will be skipped of it's open
|
||||
# TODO What if the network is already saved? The user doesn't need to type the
|
||||
# password again
|
||||
pass=$($RUNNER -i -W 250 -L 1 -p "Enter Password " --password);
|
||||
if nmcli connection show | grep -q "$ssid"; then # check if the network is already saved
|
||||
return 0; # no password is required
|
||||
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
|
||||
return 0; # no password is required
|
||||
else
|
||||
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
|
||||
#####
|
||||
action() {
|
||||
nmcli device wifi connect "$bssid" password "$pass" || nmcli device 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 :(";
|
||||
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";
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -140,20 +135,9 @@ case "$cases" in
|
|||
disconnect;
|
||||
;;
|
||||
"$option4")
|
||||
connect;
|
||||
if [ -n "$bssid" ]; then # if the user chooses a network
|
||||
password;
|
||||
if [ -n "$pass" ]; then # if the user typed a password
|
||||
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
|
||||
if connect; then # if the user chooses a network
|
||||
password; # this function will exit the script if the user didn't put a password
|
||||
action;
|
||||
else
|
||||
exit 1; # if not, exit the script
|
||||
fi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd ~
|
||||
cd "$HOME" || exit 1
|
||||
|
||||
# Log WLR errors and logs to the hyprland log. Recommended
|
||||
export HYPRLAND_LOG_WLR=1
|
||||
|
@ -46,6 +46,7 @@ export VISUAL="neovide --neovim-bim $HOME/.local/bin/lvim"
|
|||
export BROWSER="qutebrowser"
|
||||
export VIEWER="zathura"
|
||||
|
||||
# user defined global variables
|
||||
export MEDIA_DIR="$HOME/Media"
|
||||
export TEMP_DIR="$HOME/Temporal"
|
||||
export RUNNER="wofi --dmenu"
|
||||
|
|
Loading…
Reference in a new issue