add vpn-status

This commit is contained in:
Dmitriy Holkin 2020-01-15 05:52:08 +04:00
parent edc6346d0d
commit 090f4c1cc1
3 changed files with 17 additions and 3 deletions

View File

@ -53,9 +53,9 @@ in {
command = scripts.brightness; command = scripts.brightness;
interval = 1; interval = 1;
}; };
h_wireless = pkgs.stdenv.lib.optionalAttrs config.deviceSpecific.isLaptop { # h_wireless = pkgs.stdenv.lib.optionalAttrs config.deviceSpecific.isLaptop {
command = scripts.wireless; # command = scripts.wireless;
}; # };
# i_network = { # i_network = {
# command = scripts.network; # command = scripts.network;
# }; # };
@ -85,6 +85,10 @@ in {
echo '<span font="Material Icons 11"></span>' $(sudo btrfs fi usage / | grep "Free" | awk '{print $3}') echo '<span font="Material Icons 11"></span>' $(sudo btrfs fi usage / | grep "Free" | awk '{print $3}')
''; '';
}; };
n_vpn = {
command = scripts.vpn-status;
interval = 600;
};
o_date = { o_date = {
command = "${pkgs.coreutils}/bin/date +'<span font=\"Material Icons 11\"></span> %a %y-%m-%d'"; command = "${pkgs.coreutils}/bin/date +'<span font=\"Material Icons 11\"></span> %a %y-%m-%d'";
interval = 10; interval = 10;

View File

@ -30,6 +30,7 @@ writeTextFile {
weather = ./weather.nix; weather = ./weather.nix;
sound = ./sound.nix; sound = ./sound.nix;
music = ./music.nix; music = ./music.nix;
vpn-status = ./vpn-status.nix;
#temperature = ./temperature.nix; #temperature = ./temperature.nix;
#free = ./free.nix; #free = ./free.nix;
} }

View File

@ -0,0 +1,9 @@
{ curl, ... }: ''
#!/usr/bin/env bash
API="$(${curl} https://am.i.mullvad.net/connected)"
if [[ $(echo "$API" | awk -F'[ ()]+' '{print $6}') = 'server' ]]; then
echo $(echo "$API" | awk -F'[ ()]+' '{print $7}')
else
echo 'Not connected'
fi
''