Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
5.91k stars 667 forks source link

We need a module for ModemManager 4G connection #1453

Open gnull opened 2 years ago

gnull commented 2 years ago

I would be really awesome to have a module in waybar to display the status of 4G connection (for machines that have one). Some laptops come with LTE module included (Thinkpads), some may have a USB LTE card.

I just wanted to create an issue to see if there's any support for the feature and to hear people's opinions. I'm using a Thinkpad with a sim card in it all the time so I might write a module for it myself.

I'm using ModemManager which supports connecting to internet through a sim-card, checking signal strength as well as reading SMS messages. So one could want to have all this data shown on his waybar in realtime.

Ivan

gnull commented 1 year ago

A short update. I implemented the needed functionality using the custom module for now.

In my Waybar config I did:

    "custom/modemmanager": {
        "format": "☎ {}",
        "interval": 5,
        "exec": "/home/io/.local/bin/waybar-mm-status",
    },

And my waybar-mm-status is:

#!/bin/sh -efu

modemId=$(mmcli --list-modems | grep -oP 'Modem/\d+' | sed 's:Modem/::')

if [ -z "$modemId" ]; then
  echo -e '\n\nabsent'
fi

s=$(mmcli -m "$modemId")

tech=$(echo "$s" | grep 'access tech:' | sed -e 's/.*: //')
sign=$(echo "$s" | grep 'signal quality:' | sed -e 's/.*: //' | sed -e 's/%.*/%/')
state=$(echo "$s" | grep '  state:' | sed -e 's/.*: //' | grep -oP 'connected|disconnected')

echo -e "$sign $tech\n\n$state"

It just reads off the information from mmcli. I think a good module implementation should get the same data directly from D-Bus interface provided by ModemManager which mmcli itself uses.

Ivan

chayleaf commented 9 months ago

I might work on this later for use in mobile Linux

guax commented 1 week ago

This feature would be great for my uConsole.