feat: add tailscale
This commit is contained in:
parent
f451acb559
commit
89b88b9082
3 changed files with 32 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, nixosConfig, ... }:
|
||||
let
|
||||
check-battery = pkgs.writeShellScript "check-battery" ''
|
||||
bat=/sys/class/power_supply/BAT0
|
||||
|
|
@ -18,6 +18,20 @@ let
|
|||
rm $FILE
|
||||
fi
|
||||
'';
|
||||
tailscale-status = pkgs.writeShellScript "tailscale-status" ''
|
||||
if ${nixosConfig.services.tailscale.package}/bin/tailscale status > /dev/null 2>&1; then
|
||||
echo
|
||||
else
|
||||
echo
|
||||
fi
|
||||
'';
|
||||
tailscale-toggle = pkgs.writeShellScript "tailscale-toggle" ''
|
||||
if ${nixosConfig.services.tailscale.package}/bin/tailscale status > /dev/null 2>&1; then
|
||||
pkexec ${nixosConfig.services.tailscale.package}/bin/tailscale down
|
||||
else
|
||||
pkexec ${nixosConfig.services.tailscale.package}/bin/tailscale up --accept-routes --exit-node=j4m35-bl0nd
|
||||
fi
|
||||
'';
|
||||
in
|
||||
{
|
||||
xdg.configFile = {
|
||||
|
|
@ -115,6 +129,7 @@ in
|
|||
"modules-right": [
|
||||
"tray",
|
||||
"network",
|
||||
"custom/tailscale",
|
||||
"pulseaudio",
|
||||
"disk",
|
||||
"custom/mem",
|
||||
|
|
@ -135,6 +150,11 @@ in
|
|||
"tooltip-format-ethernet": "{ifname} ",
|
||||
"tooltip-format-wifi": "{essid} ({signalStrength}%) "
|
||||
},
|
||||
"custom/tailscale": {
|
||||
"exec": "${tailscale-status}",
|
||||
"interval": 1,
|
||||
"on-click": "${tailscale-toggle}",
|
||||
},
|
||||
"pulseaudio": {
|
||||
"format": "{volume}% {icon} {format_source}",
|
||||
"format-bluetooth": "{volume}% {icon} {format_source}",
|
||||
|
|
@ -268,6 +288,13 @@ in
|
|||
background: transparent;
|
||||
}
|
||||
|
||||
window.swaybar #custom-tailscale {
|
||||
padding-right: 10px;
|
||||
transition: none;
|
||||
color: black;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
window.swaybar #pulseaudio {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue