feat(waybar): add a record module to track screen recording

This commit is contained in:
Yorick Barbanneau 2025-09-01 01:20:43 +02:00
parent ed79106342
commit 79d55b304c
Signed by: ephase
GPG key ID: 246042E52B41FFCF
2 changed files with 50 additions and 2 deletions

View file

@ -117,3 +117,17 @@ button:hover{
font-family: "DejaVu sans"; font-family: "DejaVu sans";
font-size: 12px; font-size: 12px;
} }
#custom-screenrecord {
color: @color-critical;
border-bottom: 1px solid @color-critical;
animation-name: critical-animation;
animation-duration: 2s;
animation-timing-function: ease-in-out;
animation-direction: alternate;
animation-iteration-count: infinite;
}
@keyframes critical-animation {
from {color: @color-critical;}
to {color: white;}
}

View file

@ -1,4 +1,4 @@
{lib, config, ...}: {lib, config, pkgs, ...}:
with lib; with lib;
let let
cfg = config.modules.desktop.sway; cfg = config.modules.desktop.sway;
@ -16,7 +16,9 @@ in
layer = "top"; layer = "top";
spacing = 6; spacing = 6;
disable-toolptips = true; disable-toolptips = true;
modules-center = []; modules-center = [
"custom/screenrecord"
];
modules-left = [ modules-left = [
"sway/workspaces" "sway/workspaces"
"sway/mode" "sway/mode"
@ -53,6 +55,7 @@ in
"custom/sep" "custom/sep"
"clock" "clock"
"custom/sep" "custom/sep"
"privacy"
"tray" "tray"
]; ];
"clock" = { "clock" = {
@ -73,6 +76,14 @@ in
"format" = "|"; "format" = "|";
"tooltip" = false; "tooltip" = false;
}; };
"custom/screenrecord" = {
"format" = " [rec.] ";
"interval" = 1;
"exec" = "echo '{\"class\": \"recording\"}'";
"exec-if" = "${pkgs.procps}/bin/pgrep wl-screenrec";
"on-click" = "exec ${pkgs.coreutils}/bin/kill -s SIGINT $(${pkgs.procps}/bin/pgrep wl-screenrec)";
"tooltype" = false;
};
"idle_inhibitor" = { "idle_inhibitor" = {
"format" = "{icon}"; "format" = "{icon}";
"format-icons" = { "format-icons" = {
@ -96,6 +107,29 @@ in
"format-wifi" = "{essid} ({signalStrength}%) "; "format-wifi" = "{essid} ({signalStrength}%) ";
"tooltip" = false; "tooltip" = false;
}; };
"privacy"= {
"icon-spacing" = 4;
"icon-size" = 10;
"transition-duration" = 250;
"modules"= [
{
"type" = "screenshare";
"tooltip" = true;
"tooltip-icon-size" = 16;
}
{
"type" = "audio-out";
"tooltip" = true;
"tooltip-icon-size" = 24;
}
{
"type" = "audio-in";
"tooltip" = true;
"tooltip-icon-size" = 24;
}
];
"ignore-monitor" = true;
};
"pulseaudio#output" = { "pulseaudio#output" = {
"format" = "{volume}% {icon} "; "format" = "{volume}% {icon} ";
"format-bluetooth" = "{volume}% {icon}"; "format-bluetooth" = "{volume}% {icon}";