├── LICENSE ├── README.md ├── docs └── images │ ├── main.png │ └── options.png ├── setup.sh └── src ├── icons ├── alert.svg ├── change.svg ├── restart.svg ├── scanning.svg ├── vpn.svg ├── wait.svg ├── wifi-off.svg ├── wifi-on.svg ├── wired-off.svg └── wired-on.svg ├── languages ├── english.lang ├── greek.lang └── lang_file.example ├── ronema ├── ronema.conf └── themes ├── nord.rasi ├── ronema.rasi └── ronema_grey.rasi /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 George Demesiotis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ronema - Rofi-Network-manager 2 | A Network manager for Tiling Window Managers [i3/bspwm/awesome/etc] or not. 3 | 4 | Inspired from [rofi-wifi-menu](https://github.com/zbaylin/rofi-wifi-menu). 5 | ## Table of Contents 6 | 7 | - [Requirements](#requirements) 8 | - [Features](#features) 9 | - [Screenshots](#screenshots) 10 | - [Config](#config) 11 | - [Languages](#language-localization) 12 | - [Download-Usage](#download-usage) 13 | - [Instalationn](#installing-uninstalling-and-updating-ronema) 14 | - [Themes](#themes) 15 | - [Examples-Usage](#examples-usage) 16 | - [ToDo](#todo) 17 | 18 | ### Requirements 19 | 20 | - **NetworkManager** (_nmcli_) 21 | - [**rofi**](https://github.com/davatorium/rofi) 22 | - **Notification Daemon** (_Optional_) (_For notifications_) 23 | - [notify-osd](https://launchpad.net/notify-osd) 24 | - [dunst](https://github.com/dunst-project/dunst) 25 | - [fnott](https://codeberg.org/dnkl/fnott) 26 | - **nm-connection-editor** (_Optional_) (_For editing connections_) 27 | - [**qrencode**](https://fukuchi.org/works/qrencode) (_Optional_) (_For sharing wifi with qrcode_) 28 | 29 | ### Features 30 | 31 | - Connect to an existing network. 32 | - Disconnect from the network. 33 | - Turn on/off wifi. 34 | - Support for Multiple wifi devices. 35 | - Option to change between wifi devices when available. 36 | - Manual Connection to a Access Point or a hidden one. 37 | - Turn on/off ethernet. 38 | - See when ethernet is unavailable. 39 | - Restart the network. 40 | - Status 41 | - See devices Connection name and local IP. 42 | - See Current wifi password and share it with a qrcode. 43 | - Connect to pre-configured VPNs. 44 | - Change the defualt signal strength bars with anything you want. 45 | - Support for language localization based on configuration file. 46 | 47 | ### Screenshots 48 | 49 | ![Desktop](docs/images/main.png) 50 | ![Options](docs/images/options.png) 51 | 52 | ### Config 53 | 54 |
55 | ronema.conf 56 | 57 | 58 | ``` 59 | # Location 60 | # +---------- + 61 | # | 1 | 2 | 3 | 62 | # | 8 | 0 | 4 | 63 | # | 7 | 6 | 5 | 64 | # +-----------+ 65 | #The grid represents the screen with the numbers indicating the location of the window. 66 | #If you want the window to be in the upper right corner, set location to 3. 67 | LOCATION=0 68 | #This sets the anchor point for the window displaying the QR code. 69 | QRCODE_LOCATION=$LOCATION 70 | #X, Y Offset 71 | #This sets the distance of the window from the edge of the screen on the X and Y axis. 72 | Y_AXIS=0 73 | X_AXIS=0 74 | #Use notifications or not 75 | #Values can be "true" or "false" 76 | NOTIFICATIONS="false" 77 | NOTIFICATIONS_ICONS="false" 78 | #Location of qrcode wifi image 79 | QRCODE_DIR="/tmp/" 80 | #WIDTH_FIX_MAIN/WIDTH_FIX_STATUS 81 | #These values can be adjusted if the text doesn't fit or 82 | #if there is too much space at the end when you launch the script. 83 | #It will depend on the font type and size. 84 | WIDTH_FIX_MAIN=1 85 | WIDTH_FIX_STATUS=10 86 | #Values can be "true" or "false" 87 | #Set it to true, if the script outputs the signal strength with asterisks 88 | #and you want bars. 89 | ASCII_OUT="false" 90 | #Values can be "true" or "false" 91 | #Set it to true if you want to use custom icons 92 | #for the signal strength instead of the default ones. 93 | CHANGE_BARS="false" 94 | #Custom signal strength indicators 95 | SIGNAL_STRENGTH_0="0" 96 | SIGNAL_STRENGTH_1="1" 97 | SIGNAL_STRENGTH_2="12" 98 | SIGNAL_STRENGTH_3="123" 99 | SIGNAL_STRENGTH_4="1234" 100 | #Selection prefix 101 | SELECTION_PREFIX="~" 102 | #Language 103 | LANGUAGE="english" 104 | #Default theme 105 | THEME="ronema.rasi" 106 | ``` 107 |
108 | 109 | ### Language Localization 110 | 111 | To localize Rofi-NetWork-manager to your preferred language: 112 | 113 | 1. **Create a New Language File**: Duplicate `lang_file.example` and rename it to match your language (e.g., `french.lang`). 114 | 115 | 2. **Translate Strings**: Open the new language file (`french.lang`) and translate all strings to your language. 116 | 117 | 3. **Save the File**: Save your translated language file in `/languages`. 118 | 119 | 4. **Select the Language**: In `ronema.conf`, set `LANGUAGE` to your language file's name (without extension). 120 | 121 | ### Download-Usage 122 | 123 | ```bash 124 | git clone --depth 1 --branch master https://github.com/P3rf/rofi-network-manager.git 125 | cd rofi-network-manager 126 | ./src/ronema 127 | ``` 128 | 129 | ### Installing, Uninstalling, and Updating ronema 130 | 131 | To install ronema, run the following command: 132 | 133 | ```bash 134 | ./setup.sh install 135 | ``` 136 | > **Note:** This will only install ronema, not its dependencies. Please refer to the [Requirements](#requirements) section and ensure all dependencies are installed. 137 | 138 | To uninstall ronema, you can use the following command: 139 | 140 | ```bash 141 | ./setup.sh uninstall [--remove_config] 142 | ``` 143 | 144 | The `--remove_config` flag is optional. If provided, it will remove the configuration files along with the program. 145 | 146 | To update ronema, run: 147 | 148 | ```bash 149 | ./setup.sh update [--override_conf] 150 | ``` 151 | 152 | The `--override_conf` flag is optional. If provided, it will override the existing configuration file during the update process. 153 | 154 | Configuration files will be located at `~/.config/ronema`. 155 | 156 | ### Themes 157 | 158 | Rofi themes for ronema are located in the `src/themes` directory, or if installed, in `~/.config/ronema/themes`. Available themes at the moment are: 159 | 160 | - `nord.rasi` 161 | - `ronema_grey.rasi` 162 | - `ronema.rasi` 163 | 164 | You can create your own Rofi theme for ronema and set it in the configuration file (`ronema.conf`) by changing the `THEME` option. 165 | 166 | 167 | ### Examples-Usage 168 | 169 |
170 | Polybar modules 171 | 172 | ``` 173 | [module/wireless-network] 174 | type = internal/network 175 | interface = wlan0 176 | interval = 3.0 177 | unknown-as-up = true 178 | format-connected-background = ${colors.background} 179 | format-connected-foreground = ${colors.foreground} 180 | format-connected-padding = 1 181 | format-connected = %{A1:ronema:} %{A} 182 | label-connected = %essid%/%local_ip% 183 | format-disconnected-background = ${colors.background} 184 | format-disconnected-foreground = ${colors.foreground} 185 | format-disconnected-padding = 1 186 | format-disconnected = %{A1:ronema:}%{A} 187 | label-disconnected ="" 188 | ramp-signal-0 = "󰤯" 189 | ramp-signal-1 = "󰤟" 190 | ramp-signal-2 = "󰤢" 191 | ramp-signal-3 = "󰤥" 192 | ramp-signal-4 = "󰤨" 193 | ramp-signal-foreground = ${colors.white} 194 | ``` 195 | 196 | ``` 197 | [module/wired-network] 198 | type = internal/network 199 | interface = eth0 200 | interval = 3.0 201 | format-connected-background = ${colors.background} 202 | format-connected-foreground = ${colors.foreground} 203 | format-connected-padding = 1 204 | format-connected = %{A1:ronema:}%{A} 205 | label-connected =  %local_ip% 206 | format-disconnected-background = ${colors.background} 207 | format-disconnected-foreground = ${colors.foreground-alt} 208 | format-disconnected-padding = 1 209 | format-disconnected = %{A1:ronema:}%{A} 210 | label-disconnected ="󰌺" 211 | ``` 212 |
213 | 214 | ### ToDo 215 | 216 | - [x] Fix notifications 217 | - [x] Add notifications icons 218 | - [x] Support for multiple wifi devices 219 | - [ ] Add Hotspot support 220 | - [x] Share wifi password with qrcode inside rofi 221 | - [x] Find a way to manage duplicate Access Points 222 | -------------------------------------------------------------------------------- /docs/images/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/P3rf/rofi-network-manager/e7d7027d1bac3a2b6204ac86773a254f4f5c61ba/docs/images/main.png -------------------------------------------------------------------------------- /docs/images/options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/P3rf/rofi-network-manager/e7d7027d1bac3a2b6204ac86773a254f4f5c61ba/docs/images/options.png -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | INSTALL_DIR="/usr/local/bin" 4 | CONFIG_DIR="$HOME/.config/ronema" 5 | SRC_DIR="src" 6 | 7 | function copy_files() { 8 | local source_path=$1 9 | local destination_path=$2 10 | local item=$3 11 | 12 | if cp -r "$source_path/$item" "$destination_path"; then 13 | echo "Copied $item to $destination_path." 14 | else 15 | echo "Error: Failed to copy $item to $destination_path." 16 | exit 1 17 | fi 18 | } 19 | 20 | function copy_main_script() { 21 | local source_path=$1 22 | local destination_path=$2 23 | 24 | if [ ! -w "$destination_path" ]; then 25 | echo "Info: You do not have write permissions for $destination_path." 26 | echo "Attempting to use sudo to copy and change permissions." 27 | sudo cp "$source_path/ronema" "$destination_path" 28 | sudo chmod +x "$destination_path/ronema" 29 | echo "Changed permissions of ronema to executable using sudo." 30 | else 31 | cp "$source_path/ronema" "$destination_path" 32 | chmod +x "$destination_path/ronema" 33 | echo "Copied ronema to $destination_path." 34 | echo "Changed permissions of ronema to executable." 35 | fi 36 | } 37 | 38 | function install() { 39 | mkdir -p "$CONFIG_DIR" 40 | 41 | copy_main_script "$SRC_DIR" "$INSTALL_DIR" 42 | 43 | for item in languages themes icons ronema.conf; do 44 | copy_files "$SRC_DIR" "$CONFIG_DIR" "$item" 45 | done 46 | 47 | echo "Ronema has been successfully installed" 48 | echo "Configuration files are stored in $CONFIG_DIR." 49 | echo "You can execute 'ronema' to run the program." 50 | } 51 | 52 | function uninstall() { 53 | local remove_conf=false 54 | 55 | while getopts ":h-:" opt; do 56 | case $opt in 57 | -) 58 | case $OPTARG in 59 | remove_config) 60 | remove_conf=true 61 | ;; 62 | *) 63 | echo "Invalid option: --$OPTARG" >&2 64 | exit 1 65 | ;; 66 | esac 67 | ;; 68 | h) 69 | echo "Usage: $0 uninstall [--remove_config]" >&2 70 | exit 71 | ;; 72 | \?) 73 | echo "Invalid option: -$OPTARG" >&2 74 | exit 1 75 | ;; 76 | esac 77 | done 78 | 79 | sudo rm -f "$INSTALL_DIR/ronema" 80 | 81 | if [ "$remove_conf" = true ]; then 82 | sudo rm -rf "$CONFIG_DIR" 83 | fi 84 | 85 | echo "Ronema has been successfully uninstalled." 86 | if [ "$remove_conf" = true ]; then 87 | echo "Configuration files have been removed." 88 | else 89 | echo "Configuration files remain in $CONFIG_DIR." 90 | fi 91 | } 92 | 93 | function update() { 94 | local override_conf=false 95 | while getopts ":h-:" opt; do 96 | case $opt in 97 | -) 98 | case $OPTARG in 99 | override_conf) 100 | override_conf=true 101 | ;; 102 | *) 103 | echo "Invalid option: --$OPTARG" >&2 104 | exit 1 105 | ;; 106 | esac 107 | ;; 108 | h) 109 | echo "Usage: $0 update [--override_conf]" >&2 110 | exit 111 | ;; 112 | \?) 113 | echo "Invalid option: -$OPTARG" >&2 114 | exit 1 115 | ;; 116 | esac 117 | done 118 | 119 | copy_main_script "$SRC_DIR" "$INSTALL_DIR" 120 | for item in languages themes icons; do 121 | copy_files "$SRC_DIR" "$CONFIG_DIR" "$item" 122 | done 123 | if [ "$override_conf" = true ]; then 124 | copy_files "$SRC_DIR" "$CONFIG_DIR" "ronema.conf" 125 | else 126 | echo "Skipping copying ronema.conf as --override_conf option is not provided." 127 | fi 128 | echo "Ronema has been successfully updated." 129 | echo "Configuration files are stored in $CONFIG_DIR." 130 | echo "You can execute 'ronema' to run the program." 131 | } 132 | 133 | case "$1" in 134 | install) 135 | install 136 | ;; 137 | uninstall) 138 | shift 139 | uninstall "$@" 140 | ;; 141 | update) 142 | shift 143 | update "$@" 144 | ;; 145 | *) 146 | echo "Usage: $0 {install|uninstall [--remove_config]|update [--override_conf]}" >&2 147 | exit 1 148 | ;; 149 | esac 150 | -------------------------------------------------------------------------------- /src/icons/alert.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/change.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/restart.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/scanning.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/vpn.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/wait.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/wifi-off.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/wifi-on.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/icons/wired-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 15 | 17 | 18 | 27 | 31 | 38 | 45 | 52 | 61 | 62 | -------------------------------------------------------------------------------- /src/icons/wired-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 15 | 17 | 18 | 27 | 31 | 38 | 45 | 52 | 53 | -------------------------------------------------------------------------------- /src/languages/english.lang: -------------------------------------------------------------------------------- 1 | PASSWORD_ENTER="if connection is stored,hit enter/esc." 2 | PROMPT_PASSWORD="Enter_Password" 3 | PROMPT_SSID="Enter_SSID" 4 | 5 | SELECTION_DISCONECT="Disconnect" 6 | SELECTION_SCAN="Scan" 7 | SELECTION_STATUS="Status" 8 | SELECTION_SHARE="Share Wifi Password" 9 | SELECTION_MANUAL_HIDDEN="Manual/Hidden" 10 | SELECTION_MANUAL="Manual" 11 | SELECTION_HIDDEN="Hidden" 12 | SELECTION_WIFI_ON="Wi-Fi On" 13 | SELECTION_WIFI_OFF="Wi-Fi Off" 14 | SELECTION_WIFI_DISABLED="***Wi-Fi Disabled***" 15 | SELECTION_ETH_ON="Wired On" 16 | SELECTION_ETH_OFF="Wired Off" 17 | SELECTION_ETH_UNAVAILBLE="***Wired Unavailable***" 18 | SELECTION_ETH_INITIALIZING="***Wired Initializing***" 19 | SELECTION_CHANGE_WIFI_INTERFACE="Change Wifi Interface" 20 | SELECTION_RESTAT_NETWORK="Restart Network" 21 | SELECTION_QRCODE="QrCode" 22 | SELECTION_MORE_OPTIONS="More Options" 23 | SELECTION_OPEN_EDITOR="Open Connection Editor" 24 | SELECTION_VPN="VPN" 25 | 26 | NOTIFICATION_WIFI_TILE="Wi-Fi" 27 | NOTIFICATION_WIFI_TILE_CONNECTION_OK="Connection_Established" 28 | NOTIFICATION_WIFI_TILE_CONNECTION_ERROR="Connection_Error" 29 | NOTIFICATION_WIFI_TILE_TERMINATED="Connection_Terminated" 30 | NOTIFICATION_WIFI_ENABLE="Enabling Wi-Fi connection" 31 | NOTIFICATION_WIFI_DISABLE="Disabling Wi-Fi connection" 32 | NOTIFICATION_WIFI_SCANNING="Please Wait Scanning" 33 | NOTIFICATION_WIFI_CONNECTING="Connecting to" 34 | NOTIFICATION_WIFI_CONNECTED="You're now connected to Wi-Fi network" 35 | NOTIFICATION_WIFI_DISCONNECTED="You're now disconnected from Wi-Fi network" 36 | NOTIFICATION_WIFI_ERROR="Connection can not be established" 37 | 38 | NOTIFICATION_WIRED_TITLE="Ethernet" 39 | NOTIFICATION_WIRED_ENABLE="Enabling Wired connection" 40 | NOTIFICATION_WIRED_DISBALE="Disabling Wired connection" 41 | 42 | NOTIFICATION_VPN_TITLE_OK="VPN_Successfully_Activated" 43 | NOTIFICATION_VPN_TITLE_ERROR="Error_Activating_VPN" 44 | NOTIFICATION_VPN_TITLE_ACTIVATING="Activating_VPN" 45 | NOTIFICATION_VPN_TITLE_DEACTIVE="VPN_Deactivated" 46 | NOTIFICATION_VPN_CHECK="Check your configuration for" 47 | 48 | NOTIFICATION_NETWORK_TITLE="Network" 49 | NOTIFICATION_NETWORK_RESTART="Restarting Network" -------------------------------------------------------------------------------- /src/languages/greek.lang: -------------------------------------------------------------------------------- 1 | PASSWORD_ENTER="αν η σύνδεση είναι αποθηκευμένη, πατήστε enter/esc." 2 | PROMPT_PASSWORD="Εισάγετε κωδικό πρόσβασης" 3 | PROMPT_SSID="Εισάγετε SSID" 4 | 5 | SELECTION_DISCONECT="Αποσύνδεση" 6 | SELECTION_SCAN="Σάρωση" 7 | SELECTION_STATUS="Κατάσταση" 8 | SELECTION_SHARE="Κοινή χρήση κωδικού πρόσβασης Wifi" 9 | SELECTION_MANUAL_HIDDEN="Χειροκίνητη/Κρυφό" 10 | SELECTION_MANUAL="Χειροκίνητη" 11 | SELECTION_HIDDEN="Κρυφό" 12 | SELECTION_WIFI_ON="Wi-Fi On" 13 | SELECTION_WIFI_OFF="Wi-Fi Off" 14 | SELECTION_WIFI_DISABLED="***Wi-Fi Απενεργοποιημένο***" 15 | SELECTION_ETH_ON="Ενσύρματη σύνδεση" 16 | SELECTION_ETH_OFF="Wired Off" 17 | SELECTION_ETH_UNAVAILBLE="***Ενσύρματη Σύνδεση Μη Διαθέσιμη***" 18 | SELECTION_ETH_INITIALIZING="***Ενσύρματη Σύνδεση Αρχικοποίηση***" 19 | SELECTION_CHANGE_WIFI_INTERFACE="Αλλαγή Διεπαφής Wi-Fi" 20 | SELECTION_RESTAT_NETWORK="Επανεκκίνηση δικτύου" 21 | SELECTION_QRCODE="QrCode" 22 | SELECTION_MORE_OPTIONS="Περισσότερες επιλογές" 23 | SELECTION_OPEN_EDITOR="Άνοιγμα επεξεργαστή σύνδεσης" 24 | SELECTION_VPN="VPN" 25 | 26 | NOTIFICATION_WIFI_TILE="Wi-Fi" 27 | NOTIFICATION_WIFI_TILE_CONNECTION_OK="Επιτυχής_σύνδεση" 28 | NOTIFICATION_WIFI_TILE_CONNECTION_ERROR="Σφάλμα_σύνδεσης" 29 | NOTIFICATION_WIFI_TILE_TERMINATED="Διακοπή_σύνδεσης" 30 | NOTIFICATION_WIFI_ENABLE="Ενεργοποίηση σύνδεσης Wi-Fi" 31 | NOTIFICATION_WIFI_DISABLE="Απενεργοποίηση της σύνδεσης Wi-Fi" 32 | NOTIFICATION_WIFI_SCANNING="Παρακαλώ περιμένετε σάρωση" 33 | NOTIFICATION_WIFI_CONNECTING="Σύνδεση σε" 34 | NOTIFICATION_WIFI_CONNECTED="Είστε τώρα συνδεδεμένοι σε δίκτυο Wi-Fi" 35 | NOTIFICATION_WIFI_DISCONNECTED="Έχετε αποσυνδεθεί από το δίκτυο Wi-Fi" 36 | NOTIFICATION_WIFI_ERROR="Η σύνδεση δεν μπορεί να επιτευχθεί" 37 | 38 | NOTIFICATION_WIRED_TITLE="Ethernet" 39 | NOTIFICATION_WIRED_ENABLE="Ενεργοποίηση ενσύρματης σύνδεσης" 40 | NOTIFICATION_WIRED_DISBALE="Απενεργοποίηση ενσύρματης σύνδεσης" 41 | 42 | NOTIFICATION_VPN_TITLE_OK="VPN_ενεργοποιήθηκε_επιτυχώς" 43 | NOTIFICATION_VPN_TITLE_ERROR="Σφάλμα_στην_ενεργοποίηση_VPN" 44 | NOTIFICATION_VPN_TITLE_ACTIVATING="Ενεργοποίηση_VPN" 45 | NOTIFICATION_VPN_TITLE_DEACTIVE="VPN_απενεργοποιήθηκε" 46 | NOTIFICATION_VPN_CHECK="Ελέγξτε τη διαμόρφωση για" 47 | 48 | NOTIFICATION_NETWORK_TITLE="Δίκτυο" 49 | NOTIFICATION_NETWORK_RESTART="Επανεκκίνηση δικτύου" -------------------------------------------------------------------------------- /src/languages/lang_file.example: -------------------------------------------------------------------------------- 1 | PASSWORD_ENTER="" 2 | PROMPT_PASSWORD="" 3 | PROMPT_SSID="" 4 | 5 | SELECTION_DISCONECT="" 6 | SELECTION_SCAN="" 7 | SELECTION_STATUS="" 8 | SELECTION_SHARE="" 9 | SELECTION_MANUAL_HIDDEN="" 10 | SELECTION_MANUAL="" 11 | SELECTION_HIDDEN="" 12 | SELECTION_WIFI_ON="" 13 | SELECTION_WIFI_OFF="" 14 | SELECTION_WIFI_DISABLED="" 15 | SELECTION_ETH_ON="" 16 | SELECTION_ETH_OFF="" 17 | SELECTION_ETH_UNAVAILBLE="" 18 | SELECTION_ETH_INITIALIZING="" 19 | SELECTION_CHANGE_WIFI_INTERFACE="" 20 | SELECTION_RESTAT_NETWORK="" 21 | SELECTION_QRCODE="" 22 | SELECTION_MORE_OPTIONS="" 23 | SELECTION_OPEN_EDITOR="" 24 | SELECTION_VPN="" 25 | 26 | NOTIFICATION_WIFI_TILE="" 27 | NOTIFICATION_WIFI_TILE_CONNECTION_OK="" 28 | NOTIFICATION_WIFI_TILE_CONNECTION_ERROR="" 29 | NOTIFICATION_WIFI_TILE_TERMINATED="" 30 | NOTIFICATION_WIFI_ENABLE="" 31 | NOTIFICATION_WIFI_DISABLE="" 32 | NOTIFICATION_WIFI_SCANNING="" 33 | NOTIFICATION_WIFI_CONNECTING="" 34 | NOTIFICATION_WIFI_CONNECTED="" 35 | NOTIFICATION_WIFI_DISCONNECTED="" 36 | NOTIFICATION_WIFI_ERROR="" 37 | 38 | NOTIFICATION_WIRED_TITLE="" 39 | NOTIFICATION_WIRED_ENABLE="" 40 | NOTIFICATION_WIRED_DISBALE="" 41 | 42 | NOTIFICATION_VPN_TITLE_OK="" 43 | NOTIFICATION_VPN_TITLE_ERROR="" 44 | NOTIFICATION_VPN_TITLE_ACTIVATING="" 45 | NOTIFICATION_VPN_TITLE_DEACTIVE="" 46 | NOTIFICATION_VPN_CHECK="" 47 | 48 | NOTIFICATION_NETWORK_TITLE="" 49 | NOTIFICATION_NETWORK_RESTART="" -------------------------------------------------------------------------------- /src/ronema: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 3 | WIRELESS_INTERFACES=($(nmcli device | awk '$2=="wifi" {print $1}')) 4 | WIRELESS_INTERFACES_PRODUCT=() 5 | WLAN_INT=0 6 | WIRED_INTERFACES=($(nmcli device | awk '$2=="ethernet" {print $1}')) 7 | WIRED_INTERFACES_PRODUCT=() 8 | VPN_PATTERN='(wireguard|vpn)' 9 | function initialization() { 10 | source "$DIR/ronema.conf" || source "${XDG_CONFIG_HOME:-$HOME/.config}/ronema/ronema.conf" || exit 11 | source "$DIR/languages/${LANGUAGE}.lang" || source "${XDG_CONFIG_HOME:-$HOME/.config}/ronema/languages/${LANGUAGE}.lang" || exit 12 | { [[ -f "$DIR/themes/${THEME}" ]] && RASI_DIR="$DIR/themes/${THEME}"; } || { [[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/ronema/themes/${THEME}" ]] && RASI_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/ronema/themes/${THEME}"; } || exit 13 | { [[ -d "$DIR/icons" ]] && ICON_DIR="$DIR/icons" ; } || { [[ -d "${XDG_CONFIG_HOME:-$HOME/.config}/ronema/icons" ]] && ICON_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/ronema/icons" ; } || exit 14 | for i in "${WIRELESS_INTERFACES[@]}"; do WIRELESS_INTERFACES_PRODUCT+=("$(nmcli -f general.product device show "$i" | awk '{print $2}')"); done 15 | for i in "${WIRED_INTERFACES[@]}"; do WIRED_INTERFACES_PRODUCT+=("$(nmcli -f general.product device show "$i" | awk '{print $2}')"); done 16 | wireless_interface_state && ethernet_interface_state 17 | } 18 | function notification() { 19 | [[ "$NOTIFICATIONS" == "true" && -x "$(command -v notify-send)" ]] && { 20 | [[ $NOTIFICATIONS_ICONS == true ]] && ICON="-i $ICON_DIR/$3" || ICON="" 21 | notify-send -r "5" -u "normal" $1 "$2" $ICON 22 | } 23 | } 24 | function wireless_interface_state() { 25 | 26 | [[ ${#WIRELESS_INTERFACES[@]} -eq "0" ]] || { 27 | ACTIVE_SSID=$(nmcli device status | grep "^${WIRELESS_INTERFACES[WLAN_INT]}." | awk '{print $4}') 28 | WIFI_CON_STATE=$(nmcli device status | grep "^${WIRELESS_INTERFACES[WLAN_INT]}." | awk '{print $3}') 29 | { [[ "$WIFI_CON_STATE" == "unavailable" ]] && WIFI_LIST="${SELECTION_WIFI_DISABLED}" && WIFI_SWITCH="${SELECTION_PREFIX}${SELECTION_WIFI_ON}" && OPTIONS="${WIFI_LIST}\n${WIFI_SWITCH}\n${SELECTION_PREFIX}${SELECTION_SCAN}\n"; } || { [[ "$WIFI_CON_STATE" =~ "connected" ]] && { 30 | PROMPT=${WIRELESS_INTERFACES_PRODUCT[WLAN_INT]}[${WIRELESS_INTERFACES[WLAN_INT]}] 31 | WIFI_LIST=$(nmcli --fields SSID,SECURITY,BARS device wifi list ifname "${WIRELESS_INTERFACES[WLAN_INT]}") 32 | wifi_list 33 | [[ "$ACTIVE_SSID" == "--" ]] && WIFI_SWITCH="${SELECTION_PREFIX}${SELECTION_SCAN}\n${SELECTION_PREFIX}${SELECTION_MANUAL_HIDDEN}\n${SELECTION_PREFIX}${SELECTION_WIFI_OFF}" || WIFI_SWITCH="${SELECTION_PREFIX}${SELECTION_SCAN}\n${SELECTION_PREFIX}${SELECTION_DISCONECT}\n${SELECTION_PREFIX}${SELECTION_MANUAL_HIDDEN}\n${SELECTION_PREFIX}${SELECTION_WIFI_OFF}" 34 | OPTIONS="${WIFI_LIST}\n${WIFI_SWITCH}\n" 35 | }; } 36 | } 37 | } 38 | function ethernet_interface_state() { 39 | [[ ${#WIRED_INTERFACES[@]} -eq "0" ]] || { 40 | WIRED_CON_STATE=$(nmcli device status | grep "ethernet" | head -1 | awk '{print $3}') 41 | { [[ "$WIRED_CON_STATE" == "disconnected" ]] && WIRED_SWITCH="${SELECTION_PREFIX}${SELECTION_ETH_ON}"; } || { [[ "$WIRED_CON_STATE" == "connected" ]] && WIRED_SWITCH="${SELECTION_PREFIX}${SELECTION_ETH_OFF}"; } || { [[ "$WIRED_CON_STATE" == "unavailable" ]] && WIRED_SWITCH="${SELECTION_ETH_UNAVAILBLE}"; } || { [[ "$WIRED_CON_STATE" == "connecting" ]] && WIRED_SWITCH="${SELECTION_ETH_INITIALIZING}"; } 42 | OPTIONS="${OPTIONS}${WIRED_SWITCH}\n" 43 | } 44 | } 45 | function rofi_menu() { 46 | { [[ ${#WIRELESS_INTERFACES[@]} -gt "1" ]] && OPTIONS="${OPTIONS}${SELECTION_PREFIX}${SELECTION_CHANGE_WIFI_INTERFACE}\n${SELECTION_PREFIX}${SELECTION_MORE_OPTIONS}"; } || { OPTIONS="${OPTIONS}${SELECTION_PREFIX}${SELECTION_MORE_OPTIONS}"; } 47 | { [[ "$WIRED_CON_STATE" == "connected" ]] && PROMPT="${WIRED_INTERFACES_PRODUCT}[$WIRED_INTERFACES]"; } || PROMPT="${WIRELESS_INTERFACES_PRODUCT[WLAN_INT]}[${WIRELESS_INTERFACES[WLAN_INT]}]" 48 | SELECTION=$(echo -e "$OPTIONS" | rofi_cmd "$OPTIONS" $WIDTH_FIX_MAIN "-a 0") 49 | SSID=$(echo "$SELECTION" | sed "s/\s\{2,\}/\|/g" | awk -F "|" '{print $1}') 50 | selection_action 51 | } 52 | function rofi_cmd() { 53 | { [[ -n "${1}" ]] && WIDTH=$(echo -e "$1" | awk '{print length}' | sort -n | tail -1) && ((WIDTH += $2)) && ((WIDTH = WIDTH / 2)); } || { ((WIDTH = $2 / 2)); } 54 | rofi -dmenu -i -location "$LOCATION" -yoffset "$Y_AXIS" -xoffset "$X_AXIS" $3 -theme "$RASI_DIR" -theme-str 'window{width: '"$WIDTH"'em;}textbox-prompt-colon{str:"'"$PROMPT"':";}'"$4"'' 55 | } 56 | function change_wireless_interface() { 57 | { [[ ${#WIRELESS_INTERFACES[@]} -eq "2" ]] && { [[ $WLAN_INT -eq "0" ]] && WLAN_INT=1 || WLAN_INT=0; }; } || { 58 | LIST_WLAN_INT="" 59 | for i in "${!WIRELESS_INTERFACES[@]}"; do LIST_WLAN_INT=("${LIST_WLAN_INT[@]}${WIRELESS_INTERFACES_PRODUCT[$i]}[${WIRELESS_INTERFACES[$i]}]\n"); done 60 | LIST_WLAN_INT[-1]=${LIST_WLAN_INT[-1]::-2} 61 | CHANGE_WLAN_INT=$(echo -e "${LIST_WLAN_INT[@]}" | rofi_cmd "${LIST_WLAN_INT[@]}" $WIDTH_FIX_STATUS) 62 | for i in "${!WIRELESS_INTERFACES[@]}"; do [[ $CHANGE_WLAN_INT == "${WIRELESS_INTERFACES_PRODUCT[$i]}[${WIRELESS_INTERFACES[$i]}]" ]] && WLAN_INT=$i && break; done 63 | } 64 | wireless_interface_state && ethernet_interface_state 65 | rofi_menu 66 | } 67 | function scan() { 68 | [[ "$WIFI_CON_STATE" =~ "unavailable" ]] && change_wifi_state "${NOTIFICATION_WIFI_TILE}" "${NOTIFICATION_WIFI_ENABLE}" "on" "wifi-on.svg" && sleep 2 69 | notification "-t 0 ${NOTIFICATION_WIFI_TILE}" "${NOTIFICATION_WIFI_SCANNING}" "scanning.svg" 70 | WIFI_LIST=$(nmcli --fields SSID,SECURITY,BARS device wifi list ifname "${WIRELESS_INTERFACES[WLAN_INT]}" --rescan yes) 71 | wifi_list 72 | wireless_interface_state && ethernet_interface_state 73 | notification "-t 1 ${NOTIFICATION_WIFI_TILE}" "${NOTIFICATION_WIFI_SCANNING}" "scanning.svg" 74 | rofi_menu 75 | } 76 | function wifi_list() { 77 | WIFI_LIST=$(echo -e "$WIFI_LIST" | awk -F' +' '{ if (!seen[$1]++) print}' | awk '$1!="--" {print}' | awk '$1 !~ "^'"${ACTIVE_SSID}"'"') 78 | [[ $ASCII_OUT == "true" ]] && WIFI_LIST=$(echo -e "$WIFI_LIST" | sed 's/\(..*\)\*\{4,4\}/\1▂▄▆█/g' | sed 's/\(..*\)\*\{3,3\}/\1▂▄▆_/g' | sed 's/\(..*\)\*\{2,2\}/\1▂▄__/g' | sed 's/\(..*\)\*\{1,1\}/\1▂___/g') 79 | [[ $CHANGE_BARS == "true" ]] && WIFI_LIST=$(echo -e "$WIFI_LIST" | sed 's/\(.*\)▂▄▆█/\1'$SIGNAL_STRENGTH_4'/' | sed 's/\(.*\)▂▄▆_/\1'$SIGNAL_STRENGTH_3'/' | sed 's/\(.*\)▂▄__/\1'$SIGNAL_STRENGTH_2'/' | sed 's/\(.*\)▂___/\1'$SIGNAL_STRENGTH_1'/' | sed 's/\(.*\)____/\1'$SIGNAL_STRENGTH_0'/') 80 | } 81 | function change_wifi_state() { 82 | notification "$1" "$2" "$4" 83 | nmcli radio wifi "$3" 84 | } 85 | function change_wired_state() { 86 | notification "$1" "$2" "$5" 87 | nmcli device "$3" "$4" 88 | } 89 | function net_restart() { 90 | notification "$1" "$2" "restart.svg" 91 | nmcli networking off && sleep 3 && nmcli networking on 92 | } 93 | function disconnect() { 94 | ACTIVE_SSID=$(nmcli -t -f GENERAL.CONNECTION dev show "${WIRELESS_INTERFACES[WLAN_INT]}" | cut -d ':' -f2) 95 | notification "$1" "${NOTIFICATION_WIFI_DISCONNECTED} '$ACTIVE_SSID'" "wifi-off.svg" 96 | nmcli con down id "$ACTIVE_SSID" 97 | } 98 | function check_wifi_connected() { 99 | [[ "$(nmcli device status | grep "^${WIRELESS_INTERFACES[WLAN_INT]}." | awk '{print $3}')" == "connected" ]] && disconnect "${NOTIFICATION_WIFI_TILE_TERMINATED}" 100 | } 101 | function connect() { 102 | check_wifi_connected 103 | notification "-t 0 Wi-Fi" "${NOTIFICATION_WIFI_CONNECTING} $1" "wait.svg" 104 | { [[ $(nmcli dev wifi con "$1" password "$2" ifname "${WIRELESS_INTERFACES[WLAN_INT]}" | grep -c "successfully activated") -eq "1" ]] && notification "${NOTIFICATION_WIFI_TILE_CONNECTION_OK}" "${NOTIFICATION_WIFI_CONNECTED} '$1'" "wifi-on.svg"; } || notification "${NOTIFICATION_WIFI_TILE_CONNECTION_ERROR}" "${NOTIFICATION_WIFI_ERROR}" "alert.svg" 105 | } 106 | function enter_passwword() { 107 | PROMPT="${PROMPT_PASSWORD}" && PASS=$(echo "$PASSWORD_ENTER" | rofi_cmd "$PASSWORD_ENTER" 4 "-password") 108 | } 109 | function enter_ssid() { 110 | PROMPT="${PROMPT_SSID}" && SSID=$(rofi_cmd "" 40) 111 | } 112 | function stored_connection() { 113 | check_wifi_connected 114 | notification "-t 0 Wi-Fi" "${NOTIFICATION_WIFI_CONNECTING} $1" "wait.svg" 115 | { [[ $(nmcli dev wifi con "$1" ifname "${WIRELESS_INTERFACES[WLAN_INT]}" | grep -c "successfully activated") -eq "1" ]] && notification "${NOTIFICATION_WIFI_TILE_CONNECTION_OK}" "${NOTIFICATION_WIFI_CONNECTED} '$1'" "wifi-on.svg"; } || notification "${NOTIFICATION_WIFI_TILE_CONNECTION_ERROR}" "${NOTIFICATION_WIFI_ERROR}" "alert.svg" 116 | } 117 | function ssid_manual() { 118 | enter_ssid 119 | [[ -n $SSID ]] && { 120 | enter_passwword 121 | { [[ -n "$PASS" ]] && [[ "$PASS" != "$PASSWORD_ENTER" ]] && connect "$SSID" "$PASS"; } || stored_connection "$SSID" 122 | } 123 | } 124 | function ssid_hidden() { 125 | enter_ssid 126 | [[ -n $SSID ]] && { 127 | enter_passwword && check_wifi_connected 128 | [[ -n "$PASS" ]] && [[ "$PASS" != "$PASSWORD_ENTER" ]] && { 129 | nmcli con add type wifi con-name "$SSID" ssid "$SSID" ifname "${WIRELESS_INTERFACES[WLAN_INT]}" 130 | nmcli con modify "$SSID" wifi-sec.key-mgmt wpa-psk 131 | nmcli con modify "$SSID" wifi-sec.psk "$PASS" 132 | } || [[ $(nmcli -g NAME con show | grep -c "$SSID") -eq "0" ]] && nmcli con add type wifi con-name "$SSID" ssid "$SSID" ifname "${WIRELESS_INTERFACES[WLAN_INT]}" 133 | notification "-t 0 ${NOTIFICATION_WIFI_TILE}" "${NOTIFICATION_WIFI_CONNECTING} $SSID" "wait.svg" 134 | { [[ $(nmcli con up id "$SSID" | grep -c "successfully activated") -eq "1" ]] && notification "${NOTIFICATION_WIFI_TILE_CONNECTION_OK}" "${NOTIFICATION_WIFI_CONNECTED} '$SSID'"; } || notification "${NOTIFICATION_WIFI_TILE_CONNECTION_ERROR}" "${NOTIFICATION_WIFI_ERROR}" "alert.svg" 135 | } 136 | } 137 | function interface_status() { 138 | local -n INTERFACES=$1 && local -n INTERFACES_PRODUCT=$2 139 | for i in "${!INTERFACES[@]}"; do 140 | CON_STATE=$(nmcli device status | grep "^${INTERFACES[$i]}." | awk '{print $3}') 141 | INT_NAME=${INTERFACES_PRODUCT[$i]}[${INTERFACES[$i]}] 142 | [[ "$CON_STATE" == "connected" ]] && STATUS="$INT_NAME:\n\t$(nmcli -t -f GENERAL.CONNECTION dev show "${INTERFACES[$i]}" | awk -F '[:]' '{print $2}') ~ $(nmcli -t -f IP4.ADDRESS dev show "${INTERFACES[$i]}" | awk -F '[:/]' '{print $2}')" || STATUS="$INT_NAME: ${CON_STATE^}" 143 | echo -e "${STATUS}" 144 | done 145 | } 146 | function status() { 147 | OPTIONS="" 148 | [[ ${#WIRED_INTERFACES[@]} -ne "0" ]] && ETH_STATUS="$(interface_status WIRED_INTERFACES WIRED_INTERFACES_PRODUCT)" && OPTIONS="${OPTIONS}${ETH_STATUS}" 149 | [[ ${#WIRELESS_INTERFACES[@]} -ne "0" ]] && WLAN_STATUS="$(interface_status WIRELESS_INTERFACES WIRELESS_INTERFACES_PRODUCT)" && { [[ -n ${OPTIONS} ]] && OPTIONS="${OPTIONS}\n${WLAN_STATUS}" || OPTIONS="${OPTIONS}${WLAN_STATUS}"; } 150 | ACTIVE_VPN=$(nmcli -g NAME,TYPE con show --active | awk '/:'$VPN_PATTERN'/ {sub(/:'$VPN_PATTERN'.*/, ""); print}') 151 | [[ -n $ACTIVE_VPN ]] && OPTIONS="${OPTIONS}\n${ACTIVE_VPN}[VPN]: $(nmcli -g ip4.address con show "${ACTIVE_VPN}" | awk -F '[:/]' '{print $1}')" 152 | echo -e "$OPTIONS" | rofi_cmd "$OPTIONS" $WIDTH_FIX_STATUS "" "mainbox{children:[listview];}" 153 | } 154 | function share_pass() { 155 | SSID=$(nmcli dev wifi show-password | grep -oP '(?<=SSID: ).*' | head -1) 156 | PASSWORD=$(nmcli dev wifi show-password | grep -oP '(?<=Password: ).*' | head -1) 157 | OPTIONS="SSID: ${SSID}\nPassword: ${PASSWORD}" 158 | [[ -x "$(command -v qrencode)" ]] && OPTIONS="${OPTIONS}\n${SELECTION_PREFIX}${SELECTION_QRCODE}" 159 | SELECTION=$(echo -e "$OPTIONS" | rofi_cmd "$OPTIONS" $WIDTH_FIX_STATUS "-a -1" "mainbox{children:[listview];}") 160 | selection_action 161 | } 162 | function gen_qrcode() { 163 | DIRECTIONS=("Center" "Northwest" "North" "Northeast" "East" "Southeast" "South" "Southwest" "West") 164 | TMP_SSID="${SSID// /_}" 165 | [[ -e $QRCODE_DIR$TMP_SSID.png ]] || qrencode -t png -o $QRCODE_DIR$TMP_SSID.png -l H -s 25 -m 2 --dpi=192 "WIFI:S:""$SSID"";T:""$(nmcli dev wifi show-password | grep -oP '(?<=Security: ).*' | head -1)"";P:""$PASSWORD"";;" 166 | rofi_cmd "" "0" "" "entry{enabled:false;}window{location:""${DIRECTIONS[QRCODE_LOCATION]}"";border-radius:6mm;padding:1mm;width:100mm;height:100mm; 167 | background-image:url(\"$QRCODE_DIR$TMP_SSID.png\",both);}" 168 | } 169 | function manual_hidden() { 170 | OPTIONS="${SELECTION_PREFIX}${SELECTION_MANUAL}\n${SELECTION_PREFIX}${SELECTION_HIDDEN}" && SELECTION=$(echo -e "$OPTIONS" | rofi_cmd "$OPTIONS" $WIDTH_FIX_STATUS "" "mainbox{children:[listview];}") 171 | selection_action 172 | } 173 | function vpn() { 174 | ACTIVE_VPN=$(nmcli -g NAME,TYPE con show --active | awk '/:'$VPN_PATTERN'/ {sub(/:'$VPN_PATTERN'.*/, ""); print}') 175 | [[ $ACTIVE_VPN ]] && OPTIONS="${SELECTION_PREFIX}${SELECTION_DISCONECT} $ACTIVE_VPN" || OPTIONS="$(nmcli -g NAME,TYPE connection | awk '/:'$VPN_PATTERN'/ {sub(/:'$VPN_PATTERN'.*/, ""); print}')" 176 | VPN_ACTION=$(echo -e "$OPTIONS" | rofi_cmd "$OPTIONS" "$WIDTH_FIX_STATUS" "" "mainbox {children:[listview];}") 177 | [[ -n "$VPN_ACTION" ]] && { { [[ "$VPN_ACTION" =~ "${SELECTION_PREFIX}${SELECTION_DISCONECT}" ]] && nmcli connection down "$ACTIVE_VPN" && notification "${NOTIFICATION_VPN_TITLE_DEACTIVE}" "$ACTIVE_VPN" "vpn.svg"; } || { 178 | notification "-t 0 ${NOTIFICATION_VPN_TITLE_ACTIVATING}" "$VPN_ACTION" "vpn.svg" 179 | VPN_OUTPUT=$(nmcli connection up "$VPN_ACTION" 2>/dev/null) 180 | { [[ $(echo "$VPN_OUTPUT" | grep -c "Connection successfully activated") -eq "1" ]] && notification "${NOTIFICATION_VPN_TITLE_OK}" "$VPN_ACTION" "vpn.svg"; } || notification "${NOTIFICATION_VPN_TITLE_ERROR}" "${NOTIFICATION_VPN_CHECK} $VPN_ACTION" "alert.svg" 181 | }; } 182 | } 183 | function more_options() { 184 | OPTIONS="" 185 | [[ "$WIFI_CON_STATE" == "connected" ]] && OPTIONS="${SELECTION_PREFIX}${SELECTION_SHARE}\n" 186 | OPTIONS="${OPTIONS}${SELECTION_PREFIX}${SELECTION_STATUS}\n${SELECTION_PREFIX}${SELECTION_RESTAT_NETWORK}" 187 | [[ $(nmcli -g NAME,TYPE connection | awk '/:'$VPN_PATTERN'/ {sub(/:'$VPN_PATTERN'.*/, ""); print}') ]] && OPTIONS="${OPTIONS}\n${SELECTION_PREFIX}${SELECTION_VPN}" 188 | [[ -x "$(command -v nm-connection-editor)" ]] && OPTIONS="${OPTIONS}\n${SELECTION_PREFIX}${SELECTION_OPEN_EDITOR}" 189 | SELECTION=$(echo -e "$OPTIONS" | rofi_cmd "$OPTIONS" "$WIDTH_FIX_STATUS" "" "mainbox {children:[listview];}") 190 | selection_action 191 | } 192 | function selection_action() { 193 | case "$SELECTION" in 194 | "${SELECTION_PREFIX}${SELECTION_DISCONECT}") disconnect "${NOTIFICATION_WIFI_TILE_TERMINATED}" ;; 195 | "${SELECTION_PREFIX}${SELECTION_SCAN}") scan ;; 196 | "${SELECTION_PREFIX}${SELECTION_STATUS}") status ;; 197 | "${SELECTION_PREFIX}${SELECTION_SHARE}") share_pass ;; 198 | "${SELECTION_PREFIX}${SELECTION_MANUAL_HIDDEN}") manual_hidden ;; 199 | "${SELECTION_PREFIX}${SELECTION_MANUAL}") ssid_manual ;; 200 | "${SELECTION_PREFIX}${SELECTION_HIDDEN}") ssid_hidden ;; 201 | "${SELECTION_PREFIX}${SELECTION_WIFI_ON}") change_wifi_state "${NOTIFICATION_WIFI_TILE}" "${NOTIFICATION_WIFI_ENABLE}" "on" "wifi-on.svg";; 202 | "${SELECTION_PREFIX}${SELECTION_WIFI_OFF}") change_wifi_state "${NOTIFICATION_WIFI_TILE}" "${NOTIFICATION_WIFI_DISABLE}" "off" "wifi-off.svg";; 203 | "${SELECTION_PREFIX}${SELECTION_ETH_OFF}") change_wired_state "${NOTIFICATION_WIRED_TITLE}" "${NOTIFICATION_WIRED_DISBALE}" "disconnect" "${WIRED_INTERFACES}" "wired-off.svg";; 204 | "${SELECTION_PREFIX}${SELECTION_ETH_ON}") change_wired_state "${NOTIFICATION_WIRED_TITLE}" "${NOTIFICATION_WIRED_ENABLE}" "connect" "${WIRED_INTERFACES}" "wired-on.svg";; 205 | "${SELECTION_WIFI_DISABLED}") main;; 206 | "${SELECTION_ETH_UNAVAILBLE}") main;; 207 | "${SELECTION_ETH_INITIALIZING}") main;; 208 | "${SELECTION_PREFIX}${SELECTION_CHANGE_WIFI_INTERFACE}") change_wireless_interface ;; 209 | "${SELECTION_PREFIX}${SELECTION_RESTAT_NETWORK}") net_restart "${NOTIFICATION_NETWORK_TITLE}" "${NOTIFICATION_NETWORK_RESTART}" ;; 210 | "${SELECTION_PREFIX}${SELECTION_QRCODE}") gen_qrcode ;; 211 | "${SELECTION_PREFIX}${SELECTION_MORE_OPTIONS}") more_options ;; 212 | "${SELECTION_PREFIX}${SELECTION_OPEN_EDITOR}") nm-connection-editor ;; 213 | "${SELECTION_PREFIX}${SELECTION_VPN}") vpn ;; 214 | *) 215 | [[ -n "$SELECTION" ]] && [[ "$WIFI_LIST" =~ .*"$SELECTION".* ]] && { 216 | [[ "$SSID" == "*" ]] && SSID=$(echo "$SELECTION" | sed "s/\s\{2,\}/\|/g " | awk -F "|" '{print $3}') 217 | { [[ "$ACTIVE_SSID" == "$SSID" ]] && nmcli con up "$SSID" ifname "${WIRELESS_INTERFACES[WLAN_INT]}"; } || { 218 | [[ "$SELECTION" =~ "WPA2" ]] || [[ "$SELECTION" =~ "WEP" ]] && enter_passwword 219 | { [[ -n "$PASS" ]] && [[ "$PASS" != "$PASSWORD_ENTER" ]] && connect "$SSID" "$PASS"; } || stored_connection "$SSID" 220 | } 221 | } 222 | ;; 223 | esac 224 | } 225 | function main() { 226 | initialization && rofi_menu 227 | } 228 | main 229 | -------------------------------------------------------------------------------- /src/ronema.conf: -------------------------------------------------------------------------------- 1 | # Location 2 | # +---------- + 3 | # | 1 | 2 | 3 | 4 | # | 8 | 0 | 4 | 5 | # | 7 | 6 | 5 | 6 | # +-----------+ 7 | #The grid represents the screen with the numbers indicating the location of the window. 8 | #If you want the window to be in the upper right corner, set location to 3. 9 | LOCATION=0 10 | #This sets the anchor point for the window displaying the QR code. 11 | QRCODE_LOCATION=$LOCATION 12 | #X, Y Offset 13 | #This sets the distance of the window from the edge of the screen on the X and Y axis. 14 | Y_AXIS=0 15 | X_AXIS=0 16 | #Use notifications or not 17 | #Values can be "true" or "false" 18 | NOTIFICATIONS="false" 19 | NOTIFICATIONS_ICONS="false" 20 | #Location of qrcode wifi image 21 | QRCODE_DIR="/tmp/" 22 | #WIDTH_FIX_MAIN/WIDTH_FIX_STATUS 23 | #These values can be adjusted if the text doesn't fit or 24 | #if there is too much space at the end when you launch the script. 25 | #It will depend on the font type and size. 26 | WIDTH_FIX_MAIN=1 27 | WIDTH_FIX_STATUS=10 28 | #Values can be "true" or "false" 29 | #Set it to true, if the script outputs the signal strength with asterisks 30 | #and you want bars. 31 | ASCII_OUT="false" 32 | #Values can be "true" or "false" 33 | #Set it to true if you want to use custom icons 34 | #for the signal strength instead of the default ones. 35 | CHANGE_BARS="false" 36 | #Custom signal strength indicators 37 | SIGNAL_STRENGTH_0="0" 38 | SIGNAL_STRENGTH_1="1" 39 | SIGNAL_STRENGTH_2="12" 40 | SIGNAL_STRENGTH_3="123" 41 | SIGNAL_STRENGTH_4="1234" 42 | #Selection prefix 43 | SELECTION_PREFIX="~" 44 | #Language 45 | LANGUAGE="english" 46 | #Default theme 47 | THEME="ronema.rasi" -------------------------------------------------------------------------------- /src/themes/nord.rasi: -------------------------------------------------------------------------------- 1 | /* 2 | * Nord color theme 3 | * 4 | * Based on https://github.com/Murzchnvok/rofi-collection/blob/master/murz/murz.rasi 5 | * 6 | */ 7 | 8 | * { 9 | font: "JetBrainsMono Nerd Font Medium 10"; 10 | border: 0; 11 | margin: 0; 12 | padding: 0; 13 | spacing: 0; 14 | 15 | bg: #2E3440; 16 | bg-alt: #3B4252; 17 | fg: #81A1C1; 18 | fg-alt: #EBCB8B; 19 | 20 | background-color: @bg; 21 | text-color: @fg; 22 | } 23 | 24 | window { 25 | text-color: inherit; 26 | background-color: inherit; 27 | border-radius: 6px; 28 | 29 | } 30 | mainbox { 31 | border: 0; 32 | padding: 0; 33 | children: [inputbar, listview]; 34 | } 35 | 36 | listview { 37 | spacing: 4px; 38 | dynamic: true; 39 | fixed-height: false; 40 | border: 0; 41 | scrollbar: false; 42 | } 43 | 44 | inputbar { 45 | background-color: @bg-alt; 46 | children: [textbox-prompt-colon,entry]; 47 | padding: 4px; 48 | } 49 | 50 | entry { 51 | placeholder: ""; 52 | background-color: inherit; 53 | } 54 | 55 | prompt { 56 | background-color: inherit; 57 | 58 | } 59 | 60 | element { 61 | children: [element-icon, element-text]; 62 | } 63 | 64 | 65 | element-text { 66 | padding: 2px 0; 67 | } 68 | 69 | element-text selected { 70 | text-color: @fg-alt; 71 | } 72 | textbox-prompt-colon{ 73 | expand: false; 74 | margin: 0; 75 | str: ":"; 76 | } -------------------------------------------------------------------------------- /src/themes/ronema.rasi: -------------------------------------------------------------------------------- 1 | 2 | *{ 3 | font: "DejaVu Sans Mono 9"; //Font 4 | //Colors 5 | foreground:#f8f8f2; //Text 6 | background:#0A1229; //Background 7 | accent:#00BCD4; //Highlight 8 | foreground-selection:@foreground; //Selection_fg 9 | background-selection:#e34039; //Selection_bg 10 | 11 | transparent: #ffffff00; 12 | background-color: @transparent; 13 | text-color: @foreground; 14 | selected-normal-foreground: @foreground-selection; 15 | normal-foreground: @foreground; 16 | alternate-normal-background: @transparent; 17 | selected-urgent-foreground: @foreground; 18 | urgent-foreground: @foreground; 19 | alternate-urgent-background: @background; 20 | active-foreground: @accent; 21 | selected-active-foreground: @background-selection; 22 | alternate-normal-foreground: @foreground; 23 | alternate-active-background: @background; 24 | bordercolor: @background; 25 | normal-background: @transparent; 26 | selected-normal-background: @background-selection; 27 | separatorcolor: @accent; 28 | urgent-background: @accent; 29 | alternate-urgent-foreground: @foreground; 30 | selected-urgent-background: @accent; 31 | alternate-active-foreground: @foreground; 32 | selected-active-background: @transparent; 33 | active-background: @transparent; 34 | } 35 | window { 36 | text-color: @foreground; 37 | background-color: @background; 38 | border-radius: 6px; 39 | padding: 10; 40 | } 41 | mainbox { 42 | border: 0; 43 | padding: 0; 44 | } 45 | textbox { 46 | text-color: @foreground; 47 | } 48 | listview { 49 | spacing: 4px; 50 | dynamic: true; 51 | fixed-height: false; 52 | border: 0; 53 | scrollbar: false; 54 | text-color: @separatorcolor; 55 | } 56 | element { 57 | border: 0; 58 | padding: 0; 59 | border-radius: 4px; 60 | } 61 | element-text { 62 | background-color: inherit; 63 | text-color: inherit; 64 | } 65 | element.normal.normal { 66 | text-color: @normal-foreground; 67 | background-color: @normal-background; 68 | } 69 | element.normal.urgent { 70 | text-color: @urgent-foreground; 71 | background-color: @urgent-background; 72 | } 73 | element.normal.active { 74 | text-color: @active-foreground; 75 | background-color: @active-background; 76 | } 77 | element.selected.normal { 78 | text-color: @selected-normal-foreground; 79 | background-color: @selected-normal-background; 80 | } 81 | element.selected.urgent { 82 | text-color: @selected-urgent-foreground; 83 | background-color: @selected-urgent-background; 84 | } 85 | element.selected.active { 86 | text-color: @selected-active-foreground; 87 | background-color: @selected-active-background; 88 | } 89 | element.alternate.normal { 90 | text-color: @alternate-normal-foreground; 91 | background-color: @alternate-normal-background; 92 | } 93 | element.alternate.urgent { 94 | text-color: @alternate-urgent-foreground; 95 | background-color: @alternate-urgent-background; 96 | } 97 | element.alternate.active { 98 | text-color: @alternate-active-foreground; 99 | background-color: @alternate-active-background; 100 | } 101 | mode-switcher { 102 | border: 0; 103 | } 104 | button selected { 105 | text-color: @selected-normal-foreground; 106 | background-color: @selected-normal-background; 107 | } 108 | button normal { 109 | text-color: @foreground; 110 | } 111 | inputbar { 112 | children: [textbox-prompt-colon,entry]; 113 | } 114 | textbox-prompt-colon{ 115 | expand: false; 116 | margin: 0; 117 | str: ":"; 118 | } 119 | entry { 120 | placeholder: ""; 121 | } 122 | -------------------------------------------------------------------------------- /src/themes/ronema_grey.rasi: -------------------------------------------------------------------------------- 1 | configuration { 2 | show-icons: false; 3 | sidebar-mode: false; 4 | hover-select: true; 5 | me-select-entry: ""; 6 | me-accept-entry: [ MousePrimary ]; 7 | } 8 | *{ 9 | font: "Mononoki Nerd Font Mono Bold 10"; // Font 10 | /* 11 | foreground:#f8f8f2; //Text 12 | background:#0A1229; //Background 13 | accent:#00BCD4; //Hightlight 14 | foreground-selection:@foreground; //Selection_fg 15 | background-selection:#e34039; //Selection_bg 16 | */ 17 | 18 | foreground:#fdf6e3; //Text 19 | background:#1d1f21cc; //Background 20 | accent:#8f8f8f; //Hightlight 21 | foreground-selection:@foreground; //Selection_fg 22 | background-selection:#dc322fb3; //Selection_bg 23 | 24 | transparent: #ffffff00; 25 | background-color: @transparent; 26 | text-color: @foreground; 27 | selected-normal-foreground: @foreground-selection; 28 | normal-foreground: @foreground; 29 | alternate-normal-background: @transparent; 30 | selected-urgent-foreground: @foreground; 31 | urgent-foreground: @foreground; 32 | alternate-urgent-background: @background; 33 | active-foreground: @accent; 34 | selected-active-foreground: @background-selection; 35 | alternate-normal-foreground: @foreground; 36 | alternate-active-background: @background; 37 | bordercolor: @background; 38 | normal-background: @transparent; 39 | selected-normal-background: @background-selection; 40 | separatorcolor: @accent; 41 | urgent-background: @accent; 42 | alternate-urgent-foreground: @foreground; 43 | selected-urgent-background: @accent; 44 | alternate-active-foreground: @foreground; 45 | selected-active-background: @transparent; 46 | active-background: @transparent; 47 | } 48 | window { 49 | text-color: @foreground; 50 | background-color: @background; 51 | border-radius: 6px; 52 | padding: 10; 53 | } 54 | mainbox { 55 | border: 0; 56 | padding: 0; 57 | } 58 | textbox { 59 | text-color: @foreground; 60 | } 61 | listview { 62 | spacing: 4px; 63 | dynamic: true; 64 | fixed-height: false; 65 | border: 0; 66 | scrollbar: false; 67 | text-color: @separatorcolor; 68 | } 69 | element { 70 | border: 0; 71 | padding: 0; 72 | border-radius: 4px; 73 | } 74 | element-text { 75 | background-color: inherit; 76 | text-color: inherit; 77 | } 78 | element.normal.normal { 79 | text-color: @normal-foreground; 80 | background-color: @normal-background; 81 | } 82 | element.normal.urgent { 83 | text-color: @urgent-foreground; 84 | background-color: @urgent-background; 85 | } 86 | element.normal.active { 87 | text-color: @active-foreground; 88 | background-color: @active-background; 89 | } 90 | element.selected.normal { 91 | text-color: @selected-normal-foreground; 92 | background-color: @selected-normal-background; 93 | } 94 | element.selected.urgent { 95 | text-color: @selected-urgent-foreground; 96 | background-color: @selected-urgent-background; 97 | } 98 | element.selected.active { 99 | text-color: @selected-active-foreground; 100 | background-color: @selected-active-background; 101 | } 102 | element.alternate.normal { 103 | text-color: @alternate-normal-foreground; 104 | background-color: @alternate-normal-background; 105 | } 106 | element.alternate.urgent { 107 | text-color: @alternate-urgent-foreground; 108 | background-color: @alternate-urgent-background; 109 | } 110 | element.alternate.active { 111 | text-color: @alternate-active-foreground; 112 | background-color: @alternate-active-background; 113 | } 114 | mode-switcher { 115 | border: 0; 116 | } 117 | button selected { 118 | text-color: @selected-normal-foreground; 119 | background-color: @selected-normal-background; 120 | } 121 | button normal { 122 | text-color: @foreground; 123 | } 124 | inputbar { 125 | children: [textbox-prompt-colon,entry]; 126 | } 127 | textbox-prompt-colon{ 128 | expand: false; 129 | margin: 0; 130 | str: ":"; 131 | } 132 | entry { 133 | placeholder: ""; 134 | } 135 | --------------------------------------------------------------------------------