Skip to content

Commit e9ae5ee

Browse files
feat/add gsm support
1 parent 89d16fd commit e9ae5ee

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

docs/CONFIG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,8 @@ set -g @dracula-mpc-format "%title% - %artist%"
470470

471471
`set -g @dracula-refresh-rate 5` affects this widget
472472
### network - [up](#table-of-contents)
473-
This widget displays one of three states: offline, ethernet connected, or wifi connected.
474-
however, per default **this will only display the wifi you're connected to, if it provides internet access!**
473+
This widget displays one of four states: offline, ethernet connected, wifi connected, or gsm connected.
474+
however, per default **this will only display the ethernet/wifi/gsm you're connected to, if it provides internet access!**
475475

476476
You can use different hosts to ping in order to check for a wifi or wired connection.
477477
If you frequently use networks without internet access, you can use local ip-addresses here to still display the connection.
@@ -483,14 +483,15 @@ Possible nerdfont settings for network info:
483483
```bash
484484
set -g @dracula-network-ethernet-label "󰈀 Eth"
485485
set -g @dracula-network-offline-label "󱍢 "
486-
set -g @dracula-network-wifi-label ""
486+
set -g @dracula-network-wifi-label ""
487+
set -g @dracula-network-gsm-label ""
487488
```
488489

489490
Nerdfont icons to consider:
490491
```
491492
ethernet: 󰈀 󰒪 󰒍 󰌗 󰌘
492493
offline: 󰖪 󱍢
493-
wifi:    󰖩 󰘊 󰒢
494+
wifi/gsm:    󰖩 󰘊 󰒢
494495
```
495496

496497
Known issues:

scripts/network.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source $current_dir/utils.sh
88
# set your own hosts so that a wifi is recognised even without internet access
99
HOSTS=$(get_tmux_option "@dracula-network-hosts" "google.com github.com example.com")
1010
wifi_label=$(get_tmux_option "@dracula-network-wifi-label" "")
11+
gsm_label=$(get_tmux_option "@dracula-network-gsm-label" "GSM")
1112
ethernet_label=$(get_tmux_option "@dracula-network-ethernet-label" "Ethernet")
1213

1314
get_ssid()
@@ -16,8 +17,17 @@ get_ssid()
1617
case $(uname -s) in
1718
Linux)
1819
SSID=$(iw dev | sed -nr 's/^\t\tssid (.*)/\1/p')
20+
if [ ! -x "$(which nmcli 2> /dev/null)" ];then
21+
nmcli connection show --active | grep gsm
22+
gsm_connected=$?
23+
else
24+
gsm_connected=false
25+
fi
1926
if [ -n "$SSID" ]; then
2027
echo "$wifi_label$SSID"
28+
elif [ $gsm_connected ]; then
29+
gsm_carrier=$(nmcli connection show --active | grep gsm | cut -d ' ' -f 1)
30+
echo "$gsm_label$gsm_carrier"
2131
else
2232
echo "$ethernet_label"
2333
fi

0 commit comments

Comments
 (0)