mirror of
https://github.com/bvanroll/_dotfiles.git
synced 2025-08-29 20:12:42 +00:00
init
This commit is contained in:
14
.config/i3blocks/openvpn-systemd/README.md
Normal file
14
.config/i3blocks/openvpn-systemd/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# openvpn-systemd
|
||||
|
||||
Show connection status of VPNs managed by systemd.
|
||||
|
||||

|
||||
|
||||
# Config
|
||||
|
||||
```ini
|
||||
[openvpn-systemd]
|
||||
command=$SCRIPT_DIR/openvpn-systemd
|
||||
interval=20
|
||||
label=VPN
|
||||
```
|
23
.config/i3blocks/openvpn-systemd/openvpn-systemd
Executable file
23
.config/i3blocks/openvpn-systemd/openvpn-systemd
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
use JSON::Parse 'parse_json';
|
||||
|
||||
my $units = parse_json(`systemctl list-units --output=json --state=active 'openvpn-client@*'`);
|
||||
|
||||
if (@$units) {
|
||||
my @names = sort map {
|
||||
$_->{unit} =~ /^openvpn-client@(.*)\.service$/;
|
||||
$1;
|
||||
} @$units;
|
||||
print join(' ', @names) . "\n";
|
||||
print "up\n";
|
||||
print "#00FF00\n";
|
||||
} else {
|
||||
print "down\n";
|
||||
print "down\n";
|
||||
print "#FF0000\n";
|
||||
}
|
BIN
.config/i3blocks/openvpn-systemd/openvpn-systemd.png
Normal file
BIN
.config/i3blocks/openvpn-systemd/openvpn-systemd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Reference in New Issue
Block a user