From 16a7fb7e8cfb9a682e411891c0cb81e0aa0a1b15 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 6 Mar 2026 19:30:48 +0100 Subject: niri: screenshare indicators --- accounts/gkleen@sif/niri.nix | 18 ++++++++++++++++++ accounts/gkleen@sif/shell/quickshell/Bar.qml | 8 +++++++- .../shell/quickshell/Services/NiriService.qml | 10 ++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/accounts/gkleen@sif/niri.nix b/accounts/gkleen@sif/niri.nix index b701b4c2..80abfc1a 100644 --- a/accounts/gkleen@sif/niri.nix +++ b/accounts/gkleen@sif/niri.nix @@ -711,6 +711,24 @@ in { (sleaf "match" { app-id = "^org\\.gnome\\.Papers$"; }) (sleaf "default-column-display" "tabbed") ]) + (plain "window-rule" [ + (sleaf "match" { is-window-cast-target = true; }) + (plain "border" [ + (sleaf "width" 2) + (sleaf "active-gradient" { + from = "hsla(20 100% 45% 1)"; + to = "hsla(340 100% 37.5% 1)"; + angle = 29; + relative-to = "workspace-view"; + }) + (sleaf "inactive-gradient" { + from = "hsla(20 50% 27.7% 1)"; + to = "hsla(340 50% 23% 1)"; + angle = 29; + relative-to = "workspace-view"; + }) + ]) + ]) (plain "layer-rule" [ (sleaf "match" { namespace = "^notifications$"; }) diff --git a/accounts/gkleen@sif/shell/quickshell/Bar.qml b/accounts/gkleen@sif/shell/quickshell/Bar.qml index 54ac2d3c..e8bd6245 100644 --- a/accounts/gkleen@sif/shell/quickshell/Bar.qml +++ b/accounts/gkleen@sif/shell/quickshell/Bar.qml @@ -32,8 +32,14 @@ PanelWindow { implicitHeight: 21 color: "transparent" + property bool haveScreenshare: Array.from(NiriService.casts).some(cast => cast.target.Output?.name == bar.screen.name) + Rectangle { - color: bar.haveMaximizedWindow ? "black" : Qt.rgba(0, 0, 0, 0.75) + color: { + if (bar.haveScreenshare) + return bar.haveMaximizedWindow ? Qt.rgba(0.2, 0, 0, 1) : Qt.rgba(0.2, 0, 0, 0.75); + return bar.haveMaximizedWindow ? "black" : Qt.rgba(0, 0, 0, 0.75); + } anchors.fill: parent // bottomLeftRadius: 8 // bottomRightRadius: 8 diff --git a/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml b/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml index 6dbff134..cd4ed125 100644 --- a/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml +++ b/accounts/gkleen@sif/shell/quickshell/Services/NiriService.qml @@ -74,6 +74,10 @@ Singleton { eventWindowFocusTimestampChanged(event.WindowFocusTimestampChanged); else if (event.CastsChanged) root.casts = event.CastsChanged.casts + else if (event.CastStartedOrChanged) + eventCastStartedOrChanged(event.CastStartedOrChanged); + else if (event.CastStopped) + eventCastStopped(event.CastStopped); else if (event.Ok && !eventStreamSocket.acked) { eventStreamSocket.acked = true; } else if (event.OverviewOpenedOrClosed) {} else if (event.ConfigLoaded) {} @@ -203,4 +207,10 @@ Singleton { return win; }); } + function eventCastStartedOrChanged(data) { + root.casts = [...Array.from(root.casts).filter(cast => cast.stream_id !== data.cast.stream_id), data.cast]; + } + function eventCastStopped(data) { + root.casts = Array.from(root.casts).filter(cast => cast.stream_id !== data.stream_id); + } } -- cgit v1.2.3