Added rofi wifi menu
This commit is contained in:
@@ -28,7 +28,9 @@ orange- = #FEB548
|
|||||||
orange = #F18F01
|
orange = #F18F01
|
||||||
orange+ = #A26201
|
orange+ = #A26201
|
||||||
|
|
||||||
|
apricot- = #FFAB85
|
||||||
apricot = #FFCAB1
|
apricot = #FFCAB1
|
||||||
|
apricot+ = #FFF1EB
|
||||||
|
|
||||||
rose- = #CC8FA0
|
rose- = #CC8FA0
|
||||||
rose = #AB4E68
|
rose = #AB4E68
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
type = custom/script
|
type = custom/script
|
||||||
exec = ~/.config/polybar/scripts/bluetooth.sh
|
exec = ~/.config/polybar/scripts/bluetooth.sh
|
||||||
interval = 5
|
interval = 5
|
||||||
click-left = ~/.config/polybar/scripts/bluetooth.sh --toggle &
|
click-left = ~/.config/rofi/bluetooth/bluetooth.sh
|
||||||
|
|
||||||
format-background = ${colours/bluetooth.bg}
|
format-background = ${colours/bluetooth.bg}
|
||||||
format-foreground = ${colours/bluetooth.fg}
|
format-foreground = ${colours/bluetooth.fg}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
type = internal/network
|
type = internal/network
|
||||||
interface-type = wireless
|
interface-type = wireless
|
||||||
interval = 3.0
|
interval = 3.0
|
||||||
|
click-left = ~/.config/rofi/wifi/wifi.sh
|
||||||
|
|
||||||
accumulate-stats = true
|
accumulate-stats = true
|
||||||
;unknown-as-up = true
|
;unknown-as-up = true
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ window {
|
|||||||
location: center;
|
location: center;
|
||||||
anchor: center;
|
anchor: center;
|
||||||
fullscreen: false;
|
fullscreen: false;
|
||||||
width: 500px;
|
width: 800px;
|
||||||
x-offset: 0px;
|
x-offset: 0px;
|
||||||
y-offset: 0px;
|
y-offset: 0px;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# __ _ _ _ _ _ _
|
# __ _ _ _ _ _ _
|
||||||
# _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__
|
# _ __ ___ / _(_) | |__ | |_ _ ___| |_ ___ ___ | |_| |__
|
||||||
# | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \
|
# | '__/ _ \| |_| |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __| '_ \
|
||||||
@@ -17,14 +17,17 @@
|
|||||||
# Arch repositories: rofi, bluez-utils (contains bluetoothctl)
|
# Arch repositories: rofi, bluez-utils (contains bluetoothctl)
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
divider="---------"
|
divider=""
|
||||||
goback="Back"
|
goback="Back"
|
||||||
|
|
||||||
|
# For debugging/development purposes
|
||||||
|
# PREFIX=projects/samfelag/config/
|
||||||
|
|
||||||
# Rofi command to pipe into, can add any options here
|
# Rofi command to pipe into, can add any options here
|
||||||
dir="$HOME/.config/rofi/bluetooth/"
|
dir="$HOME/$PREFIX.config/rofi/bluetooth/"
|
||||||
theme='bluetooth'
|
theme='bluetooth'
|
||||||
|
|
||||||
rofi_command="rofi -dmenu -no-fixed-num-lines -theme ${dir}/${theme}.rasi -i -p"
|
rofi_command="rofi -dmenu -theme ${dir}/${theme}.rasi -i -p"
|
||||||
|
|
||||||
# rofi -dmenu \
|
# rofi -dmenu \
|
||||||
# -theme ${dir}/${theme}.rasi
|
# -theme ${dir}/${theme}.rasi
|
||||||
|
|||||||
156
config/.config/rofi/wifi/wifi.rasi
Executable file
156
config/.config/rofi/wifi/wifi.rasi
Executable file
@@ -0,0 +1,156 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* Author : Marc Sastre, based on Aditya Shakya (adi1090x, Github : @adi1090x)
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
/*****----- Configuration -----*****/
|
||||||
|
configuration {
|
||||||
|
show-icons: false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****----- Global Properties -----*****/
|
||||||
|
* {
|
||||||
|
font: "Iosevka Nerd Font 10";
|
||||||
|
background: #FFAB85;
|
||||||
|
background-alt: #FFCAB1;
|
||||||
|
foreground: #444444;
|
||||||
|
selected: #CC8FA0;
|
||||||
|
active: #7E3A4D;
|
||||||
|
urgent: #7E3A4D;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****----- Main Window -----*****/
|
||||||
|
window {
|
||||||
|
/* properties for window widget */
|
||||||
|
transparency: "real";
|
||||||
|
location: center;
|
||||||
|
anchor: center;
|
||||||
|
fullscreen: false;
|
||||||
|
width: 800px;
|
||||||
|
x-offset: 0px;
|
||||||
|
y-offset: 0px;
|
||||||
|
|
||||||
|
/* properties for all widgets */
|
||||||
|
enabled: true;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
border: 0px solid;
|
||||||
|
border-radius: 20px;
|
||||||
|
border-color: @selected;
|
||||||
|
cursor: "default";
|
||||||
|
background-color: @background;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****----- Main Box -----*****/
|
||||||
|
mainbox {
|
||||||
|
enabled: true;
|
||||||
|
spacing: 15px;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 30px;
|
||||||
|
border: 0px solid;
|
||||||
|
border-radius: 0px;
|
||||||
|
border-color: @selected;
|
||||||
|
background-color: transparent;
|
||||||
|
children: [ "inputbar", "listview" ];
|
||||||
|
}
|
||||||
|
message {
|
||||||
|
enabled: true;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 10px;
|
||||||
|
border: 0px solid;
|
||||||
|
border-radius: 10px;
|
||||||
|
border-color: @selected;
|
||||||
|
background-color: @background-alt;
|
||||||
|
text-color: @foreground;
|
||||||
|
}
|
||||||
|
textbox {
|
||||||
|
background-color: inherit;
|
||||||
|
text-color: inherit;
|
||||||
|
vertical-align: 0.5;
|
||||||
|
horizontal-align: 0.0;
|
||||||
|
placeholder-color: @foreground;
|
||||||
|
blink: true;
|
||||||
|
markup: true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****----- Inputbar -----*****/
|
||||||
|
inputbar {
|
||||||
|
enabled: true;
|
||||||
|
spacing: 10px;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: @background-alt;
|
||||||
|
text-color: @foreground;
|
||||||
|
children: [ "textbox-prompt-colon", "entry" ];
|
||||||
|
}
|
||||||
|
textbox-prompt-colon {
|
||||||
|
enabled: true;
|
||||||
|
expand: false;
|
||||||
|
str: "直";
|
||||||
|
background-color: inherit;
|
||||||
|
text-color: inherit;
|
||||||
|
}
|
||||||
|
entry {
|
||||||
|
enabled: true;
|
||||||
|
background-color: inherit;
|
||||||
|
text-color: inherit;
|
||||||
|
cursor: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****----- Listview -----*****/
|
||||||
|
listview {
|
||||||
|
enabled: true;
|
||||||
|
columns: 1;
|
||||||
|
lines: 5;
|
||||||
|
cycle: true;
|
||||||
|
dynamic: true;
|
||||||
|
scrollbar: false;
|
||||||
|
layout: vertical;
|
||||||
|
reverse: false;
|
||||||
|
fixed-height: true;
|
||||||
|
fixed-columns: true;
|
||||||
|
|
||||||
|
spacing: 5px;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
border: 0px solid;
|
||||||
|
border-radius: 0px;
|
||||||
|
border-color: @selected;
|
||||||
|
background-color: transparent;
|
||||||
|
text-color: @foreground;
|
||||||
|
cursor: "default";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****----- Elements -----*****/
|
||||||
|
element {
|
||||||
|
enabled: true;
|
||||||
|
spacing: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 0px solid;
|
||||||
|
border-radius: 100%;
|
||||||
|
border-color: @selected;
|
||||||
|
background-color: transparent;
|
||||||
|
text-color: @foreground;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
element-text {
|
||||||
|
background-color: transparent;
|
||||||
|
text-color: inherit;
|
||||||
|
cursor: inherit;
|
||||||
|
vertical-align: 0.5;
|
||||||
|
horizontal-align: 0.0;
|
||||||
|
}
|
||||||
|
element selected.normal {
|
||||||
|
background-color: var(selected);
|
||||||
|
text-color: var(background);
|
||||||
|
}
|
||||||
|
element active {
|
||||||
|
background-color: var(active);
|
||||||
|
text-color: var(background);
|
||||||
|
}
|
||||||
|
element selected.active {
|
||||||
|
background-color: var(selected);
|
||||||
|
text-color: var(background);
|
||||||
|
}
|
||||||
83
config/.config/rofi/wifi/wifi.sh
Executable file
83
config/.config/rofi/wifi/wifi.sh
Executable file
@@ -0,0 +1,83 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Shamelessly stolen from https://github.com/zbaylin/rofi-wifi-menu
|
||||||
|
|
||||||
|
# Starts a scan of available broadcasting SSIDs
|
||||||
|
# nmcli dev wifi rescan
|
||||||
|
|
||||||
|
|
||||||
|
# For debugging/development purposes
|
||||||
|
# PREFIX=projects/samfelag/config/
|
||||||
|
|
||||||
|
# Rofi command to pipe into, can add any options here
|
||||||
|
dir="$HOME/$PREFIX.config/rofi/wifi/"
|
||||||
|
theme='wifi'
|
||||||
|
|
||||||
|
rofi_command="rofi -dmenu -i -theme ${dir}/${theme}.rasi"
|
||||||
|
|
||||||
|
FIELDS=SSID,SECURITY,BARS
|
||||||
|
|
||||||
|
LIST=$(nmcli --fields "$FIELDS" device wifi list | sed '/^--/d')
|
||||||
|
# Gives a list of known connections so we can parse it later
|
||||||
|
KNOWNCON=$(nmcli connection show)
|
||||||
|
# Really janky way of telling if there is currently a connection
|
||||||
|
CONSTATE=$(nmcli -fields WIFI g)
|
||||||
|
CURRSSID=$(LANGUAGE=C nmcli -t -f active,ssid dev wifi | awk -F: '$1 ~ /^yes/ {print $2}')
|
||||||
|
|
||||||
|
if [[ ! -z $CURRSSID ]]; then
|
||||||
|
HIGHLINE=$(echo "$(echo "$LIST" | awk -F "[ ]{2,}" '{print $1}' | grep -Fxn -m 1 "$CURRSSID" | awk -F ":" '{print $1}') + 1" | bc )
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$CONSTATE" =~ "habilitat" ]]; then
|
||||||
|
TOGGLE="toggle off"
|
||||||
|
elif [[ "$CONSTATE" =~ "deshabilitat" ]]; then
|
||||||
|
TOGGLE="toggle on"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
CHENTRY=$(echo -e "$TOGGLE\nmanual\n$LIST" | uniq -u | $rofi_command -p "Wi-Fi SSID: " -a "$HIGHLINE")
|
||||||
|
#echo "$CHENTRY"
|
||||||
|
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $1}')
|
||||||
|
#echo "$CHSSID"
|
||||||
|
|
||||||
|
# If the user inputs "manual" as their SSID in the start window, it will bring them to this screen
|
||||||
|
if [ "$CHENTRY" = "manual" ] ; then
|
||||||
|
# Manual entry of the SSID and password (if appplicable)
|
||||||
|
MSSID=$(echo "enter the SSID of the network (SSID,password)" | $rofi_command -p "Manual Entry: " -lines 1)
|
||||||
|
# Separating the password from the entered string
|
||||||
|
MPASS=$(echo "$MSSID" | awk -F "," '{print $2}')
|
||||||
|
|
||||||
|
#echo "$MSSID"
|
||||||
|
#echo "$MPASS"
|
||||||
|
|
||||||
|
# If the user entered a manual password, then use the password nmcli command
|
||||||
|
if [ "$MPASS" = "" ]; then
|
||||||
|
nmcli dev wifi con "$MSSID"
|
||||||
|
else
|
||||||
|
nmcli dev wifi con "$MSSID" password "$MPASS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "$CHENTRY" = "toggle on" ]; then
|
||||||
|
nmcli radio wifi on
|
||||||
|
|
||||||
|
elif [ "$CHENTRY" = "toggle off" ]; then
|
||||||
|
nmcli radio wifi off
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# If the connection is already in use, then this will still be able to get the SSID
|
||||||
|
if [ "$CHSSID" = "*" ]; then
|
||||||
|
CHSSID=$(echo "$CHENTRY" | sed 's/\s\{2,\}/\|/g' | awk -F "|" '{print $3}')
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Parses the list of preconfigured connections to see if it already contains the chosen SSID. This speeds up the connection process
|
||||||
|
if [[ $(echo "$KNOWNCON" | grep "$CHSSID") = "$CHSSID" ]]; then
|
||||||
|
nmcli con up "$CHSSID"
|
||||||
|
else
|
||||||
|
if [[ "$CHENTRY" =~ "WPA2" ]] || [[ "$CHENTRY" =~ "WEP" ]]; then
|
||||||
|
WIFIPASS=$(echo "Enter password, if connection is stored, hit enter" | $rofi_command -p "Password: " -lines 1 )
|
||||||
|
fi
|
||||||
|
nmcli dev wifi con "$CHSSID" password "$WIFIPASS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.samfelag.modules.desktop.polybar;
|
cfg = config.samfelag.modules.desktop.polybar;
|
||||||
|
i3Cfg = config.samfelag.modules.desktop.i3;
|
||||||
polybar_pkg = pkgs.polybar.override {
|
polybar_pkg = pkgs.polybar.override {
|
||||||
i3Support = true;
|
i3Support = true;
|
||||||
pulseSupport = true;
|
pulseSupport = true;
|
||||||
@@ -34,6 +35,12 @@ in {
|
|||||||
hm.xdg.configFile."polybar/bars".source = paths.bars;
|
hm.xdg.configFile."polybar/bars".source = paths.bars;
|
||||||
hm.xdg.configFile."polybar/scripts".source = paths.scripts;
|
hm.xdg.configFile."polybar/scripts".source = paths.scripts;
|
||||||
|
|
||||||
|
# The polybar modules use rofi
|
||||||
|
samfelag.modules.desktop.rofi.enable = true;
|
||||||
|
samfelag.modules.desktop.i3.extraKeybindings = lib.mkIf i3Cfg.enable {
|
||||||
|
"${i3Cfg.mod}+Shift+w" = "exec $HOME/.config/rofi/wifi/wifi.sh";
|
||||||
|
};
|
||||||
|
|
||||||
hm.systemd.user.services.polybar = {
|
hm.systemd.user.services.polybar = {
|
||||||
Unit = {
|
Unit = {
|
||||||
Description = "Polybar status bar";
|
Description = "Polybar status bar";
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ in
|
|||||||
};
|
};
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
bc
|
||||||
zip
|
zip
|
||||||
unzip
|
unzip
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user