|
|
|
|
@@ -11,7 +11,6 @@ let
|
|
|
|
|
# A Nerd Font Private-Use-Area codepoint as a literal character, decoded
|
|
|
|
|
# through JSON so the glyph survives as bytes rather than an editor paste.
|
|
|
|
|
g = code: builtins.fromJSON ''"\u${code}"'';
|
|
|
|
|
user = config.user.name;
|
|
|
|
|
|
|
|
|
|
sleepOffIcon = builtins.fromJSON ''"\udb81\udcb3"'';
|
|
|
|
|
|
|
|
|
|
@@ -19,7 +18,7 @@ let
|
|
|
|
|
# With no mako daemon answering, the status reads "notifications on", keeping
|
|
|
|
|
# the widget inert rather than broken.
|
|
|
|
|
dndStatus = pkgs.writeShellScript "waybar-dnd-status" ''
|
|
|
|
|
if ${pkgs.mako}/bin/makoctl mode 2>/dev/null | ${pkgs.gnugrep}/bin/grep -qx dnd; then
|
|
|
|
|
if ${lib.getExe' pkgs.mako "makoctl"} mode 2>/dev/null | ${lib.getExe pkgs.gnugrep} -qx dnd; then
|
|
|
|
|
printf '{"text":"${g "f1f6"}","tooltip":"Do not disturb: on","class":"dnd"}\n'
|
|
|
|
|
else
|
|
|
|
|
printf '{"text":"${g "f0f3"}","tooltip":"Notifications on","class":"active"}\n'
|
|
|
|
|
@@ -27,14 +26,14 @@ let
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
dndToggle = pkgs.writeShellScript "waybar-dnd-toggle" ''
|
|
|
|
|
${pkgs.mako}/bin/makoctl mode -t dnd >/dev/null 2>&1
|
|
|
|
|
${pkgs.procps}/bin/pkill -RTMIN+8 waybar
|
|
|
|
|
${lib.getExe' pkgs.mako "makoctl"} mode -t dnd >/dev/null 2>&1
|
|
|
|
|
${lib.getExe' pkgs.procps "pkill"} -RTMIN+8 waybar
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
# Lit while a wf-recorder capture is running.
|
|
|
|
|
# Empty text collapses the widget when idle, so it shows nothing until then.
|
|
|
|
|
recStatus = pkgs.writeShellScript "waybar-recording-status" ''
|
|
|
|
|
if ${pkgs.procps}/bin/pgrep -x wf-recorder >/dev/null; then
|
|
|
|
|
if ${lib.getExe' pkgs.procps "pgrep"} -x wf-recorder >/dev/null; then
|
|
|
|
|
printf '{"text":"${g "f03d"}","tooltip":"Recording","class":"recording"}\n'
|
|
|
|
|
else
|
|
|
|
|
printf '{"text":"","class":"idle"}\n'
|
|
|
|
|
@@ -42,7 +41,7 @@ let
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
idleLockStatus = pkgs.writeShellScript "waybar-idle-lock-status" ''
|
|
|
|
|
if ${pkgs.systemd}/bin/systemctl --user is-active --quiet lockscreen-idle-inhibit.service; then
|
|
|
|
|
if ${lib.getExe' pkgs.systemd "systemctl"} --user is-active --quiet lockscreen-idle-inhibit.service; then
|
|
|
|
|
printf '{"text":"${sleepOffIcon}","tooltip":"Idle locking inhibited","class":"inhibited"}\n'
|
|
|
|
|
else
|
|
|
|
|
printf '{"text":"","class":"idle"}\n'
|
|
|
|
|
@@ -52,14 +51,14 @@ let
|
|
|
|
|
vpnStatus = pkgs.writeShellScript "waybar-vpn-status" ''
|
|
|
|
|
interface=${lib.escapeShellArg vpnClient.interface}
|
|
|
|
|
|
|
|
|
|
if ! ${pkgs.iproute2}/bin/ip link show dev "$interface" >/dev/null 2>&1; then
|
|
|
|
|
if ! ${lib.getExe' pkgs.iproute2 "ip"} link show dev "$interface" >/dev/null 2>&1; then
|
|
|
|
|
printf '{"text":"","class":"idle"}\n'
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
ipaddr=$(${pkgs.iproute2}/bin/ip -4 -o addr show dev "$interface" | ${pkgs.gawk}/bin/awk '{ print $4; exit }')
|
|
|
|
|
ipaddr=$(${lib.getExe' pkgs.iproute2 "ip"} -4 -o addr show dev "$interface" | ${lib.getExe' pkgs.gawk "awk"} '{ print $4; exit }')
|
|
|
|
|
|
|
|
|
|
${pkgs.jq}/bin/jq -cn \
|
|
|
|
|
${lib.getExe pkgs.jq} -cn \
|
|
|
|
|
--arg text "" \
|
|
|
|
|
--arg tooltip "VPN $interface: ''${ipaddr:-no IPv4}" \
|
|
|
|
|
--arg class "active" \
|
|
|
|
|
@@ -68,12 +67,12 @@ let
|
|
|
|
|
|
|
|
|
|
networkStatus = pkgs.writeShellScript "waybar-network-status" ''
|
|
|
|
|
active=$(
|
|
|
|
|
${pkgs.networkmanager}/bin/nmcli -t -f DEVICE,TYPE,STATE,CONNECTION device status \
|
|
|
|
|
| ${pkgs.gawk}/bin/awk -F: '$3 == "connected" && $2 != "loopback" { print; exit }'
|
|
|
|
|
${lib.getExe' pkgs.networkmanager "nmcli"} -t -f DEVICE,TYPE,STATE,CONNECTION device status \
|
|
|
|
|
| ${lib.getExe' pkgs.gawk "awk"} -F: '$3 == "connected" && $2 != "loopback" { print; exit }'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if [ -z "$active" ]; then
|
|
|
|
|
${pkgs.jq}/bin/jq -cn \
|
|
|
|
|
${lib.getExe pkgs.jq} -cn \
|
|
|
|
|
--arg text "${g "f127"} off" \
|
|
|
|
|
--arg tooltip "Network disconnected" \
|
|
|
|
|
--arg class "disconnected" \
|
|
|
|
|
@@ -89,9 +88,9 @@ let
|
|
|
|
|
*) icon="NET" ;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
ipaddr=$(${pkgs.iproute2}/bin/ip -4 -o addr show dev "$device" | ${pkgs.gawk}/bin/awk '{ print $4; exit }')
|
|
|
|
|
ipaddr=$(${lib.getExe' pkgs.iproute2 "ip"} -4 -o addr show dev "$device" | ${lib.getExe' pkgs.gawk "awk"} '{ print $4; exit }')
|
|
|
|
|
|
|
|
|
|
${pkgs.jq}/bin/jq -cn \
|
|
|
|
|
${lib.getExe pkgs.jq} -cn \
|
|
|
|
|
--arg text "$icon $connection" \
|
|
|
|
|
--arg tooltip "$device: ''${ipaddr:-no IPv4}" \
|
|
|
|
|
--arg class "$type" \
|
|
|
|
|
@@ -106,7 +105,7 @@ in
|
|
|
|
|
# codepoints Stylix's monospace font does not carry.
|
|
|
|
|
fonts.packages = [ pkgs.nerd-fonts.symbols-only ];
|
|
|
|
|
|
|
|
|
|
home-manager.users.${user}.programs.waybar = {
|
|
|
|
|
home-manager.users.${config.user.name}.programs.waybar = {
|
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
|
|
# A user service bound to graphical-session.target, which uwsm activates,
|
|
|
|
|
@@ -151,16 +150,9 @@ in
|
|
|
|
|
format = "{id} {windows}";
|
|
|
|
|
format-window-separator = " ";
|
|
|
|
|
window-rewrite-default = g "f2d0";
|
|
|
|
|
window-rewrite = {
|
|
|
|
|
"class<com.mitchellh.ghostty>" = g "f120";
|
|
|
|
|
"class<.*[Ff]irefox.*>" = g "f269";
|
|
|
|
|
"class<chromium.*>" = g "f268";
|
|
|
|
|
"class<[Cc]ode>" = g "f121";
|
|
|
|
|
"class<obsidian>" = g "f02d";
|
|
|
|
|
"class<[Ss]ignal>" = g "f4ad";
|
|
|
|
|
"class<[Ss]team>" = g "f1b6";
|
|
|
|
|
"class<[Vv]esktop>" = g "f1ff";
|
|
|
|
|
};
|
|
|
|
|
window-rewrite = lib.mapAttrs' (
|
|
|
|
|
_name: windowIcon: lib.nameValuePair "class<${windowIcon.class}>" (g windowIcon.icon)
|
|
|
|
|
) (lib.attrByPath [ config.networking.hostName ] { } config.registry.window-icon);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
clock = {
|
|
|
|
|
@@ -190,7 +182,7 @@ in
|
|
|
|
|
(g "f027")
|
|
|
|
|
(g "f028")
|
|
|
|
|
];
|
|
|
|
|
on-click = "${pkgs.wireplumber}/bin/wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
|
|
|
|
on-click = "${lib.getExe' pkgs.wireplumber "wpctl"} set-mute @DEFAULT_AUDIO_SINK@ toggle";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
"custom/vpn" = {
|
|
|
|
|
|