This commit is contained in:
parent
5e1ef25879
commit
2d488eaa7a
2 changed files with 26 additions and 0 deletions
|
@ -8,6 +8,8 @@
|
|||
static const Block blocks[] = {
|
||||
{"", "status-audio", 10, 0},
|
||||
|
||||
{"", "status-network", 10, 0},
|
||||
|
||||
{"", "status-battery", 60, 0},
|
||||
|
||||
{"", "free -h | awk '/^Mem/ { printf \"%s/%s RAM\\n\", $3, $2 }' | sed 's/i//g'", 30, 0},
|
||||
|
|
24
modules/hosts/t480/dwm/dwmblocks/network.nix
Normal file
24
modules/hosts/t480/dwm/dwmblocks/network.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
flake.modules.homeManager.gui =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "status-network";
|
||||
|
||||
runtimeInputs = with pkgs; [ networkmanager ];
|
||||
|
||||
text = ''
|
||||
connected_to="$(nmcli | grep "connected to")"
|
||||
|
||||
network_name="$(echo "$connected_to" | awk '{print $NF}')"
|
||||
connected_device="$(echo "$connected_to" | cut -d ':' -f 1)"
|
||||
|
||||
ip_address="$(ip a | grep "$connected_device" | grep inet | awk '{print $2}'| cut -d '/' -f 1)"
|
||||
|
||||
echo "$network_name $ip_address"
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue