Repository navigation
Install gliff by default and show when a remote session is active #14712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b567a93
Install gliff by default
dhh f01ba14
Show a bar indicator while a gliff remote session is active
dhh 6b5efac
Address review of the remote session indicator
dhh 5df3b8a
Drop the remote session notifications
dhh 42cda51
Tighten remote session detection after review
dhh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,7 @@ fontconfig | |
| foot | ||
| fzf | ||
| git | ||
| gliff | ||
| gnome-keyring | ||
| gnome-themes-extra | ||
| grim | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| echo "Install Gliff, the Hyprland remote desktop over SSH" | ||
|
|
||
| omarchy-pkg-add gliff |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import QtQuick | ||
| import qs.Commons as Commons | ||
| import qs.Ui | ||
|
|
||
| BarIndicator { | ||
| id: root | ||
|
|
||
| readonly property var remoteSessionService: bar?.shell?.firstPartyServiceFor("omarchy.remote-session") | ||
| readonly property var peers: remoteSessionService && Array.isArray(remoteSessionService.peers) ? remoteSessionService.peers : [] | ||
|
|
||
| active: remoteSessionService ? remoteSessionService.active : false | ||
| activeText: "" | ||
| inactiveText: "" | ||
| activeTooltipText: peers.length > 0 ? "Remote session from " + peers.join(", ") : "Remote session" | ||
| inactiveTooltipText: "Remote Session" | ||
| useActiveColor: true | ||
| activeColor: Commons.Color.urgent | ||
|
|
||
| Connections { | ||
| target: root.indicatorHost | ||
| ignoreUnknownSignals: true | ||
| function onRefreshRequested() { | ||
| if (root.remoteSessionService) root.remoteSessionService.refresh() | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
shell/plugins/services/remote-session/RemoteSessionModel.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Hyprland emits this whenever a screencopy session starts or stops, which | ||
| // covers gliff-server (ext-image-copy-capture) as well as screen recorders | ||
| // and browser screen shares, so the event is only a cue to re-probe. The | ||
| // matching screencastv2 event always accompanies it and is left alone so one | ||
| // transition costs one probe. | ||
| function isCaptureEvent(name) { | ||
| return String(name || "") === "screencast" | ||
| } | ||
|
|
||
| // Parses the probe output: one "<pid> [peer]" line per running gliff-server, | ||
| // where peer is the ssh client address when the server was spawned over ssh. | ||
| function stateFromOutput(text) { | ||
| var lines = String(text || "").split("\n") | ||
| var active = false | ||
| var peers = [] | ||
| for (var i = 0; i < lines.length; i++) { | ||
| var parts = lines[i].trim().split(/\s+/) | ||
| if (parts[0] === "") continue | ||
| active = true | ||
| var peer = parts[1] || "" | ||
| if (peer !== "" && peers.indexOf(peer) === -1) peers.push(peer) | ||
| } | ||
| return { active: active, peers: peers } | ||
| } | ||
|
|
||
| if (typeof module !== "undefined") { | ||
| module.exports = { | ||
| isCaptureEvent: isCaptureEvent, | ||
| stateFromOutput: stateFromOutput | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import QtQuick | ||
| import Quickshell | ||
| import Quickshell.Hyprland | ||
| import Quickshell.Io | ||
| import "RemoteSessionModel.js" as RemoteSessionModel | ||
|
|
||
| // Watches for gliff-server, the Hyprland remote desktop, so the machine being | ||
| // controlled can see that someone is on it: the RemoteSession bar indicator | ||
| // reads `active` and `peers`. | ||
| Item { | ||
| id: root | ||
|
|
||
| // Injected by omarchy-shell (the first-party service loader). | ||
| property var shell: null | ||
|
|
||
| property bool stateLoaded: false | ||
| property bool active: false | ||
| property var peers: [] | ||
|
|
||
| property bool refreshPending: false | ||
|
|
||
| function refresh() { | ||
| if (statusProbe.running) { | ||
| root.refreshPending = true | ||
| return | ||
| } | ||
| root.refreshPending = false | ||
| statusProbe.running = true | ||
| } | ||
|
|
||
| function applyProbe(text) { | ||
| var state = RemoteSessionModel.stateFromOutput(text) | ||
| root.peers = state.peers | ||
| root.active = state.active | ||
| root.stateLoaded = true | ||
| } | ||
|
|
||
| Component.onCompleted: refresh() | ||
|
|
||
| // gliff-server captures the screen through ext-image-copy-capture, so a | ||
| // session start surfaces as a Hyprland screencast event. The probe decides | ||
| // whether it was gliff or another screencopy client, and a short debounce | ||
| // folds the event bursts Hyprland sends around one transition into one probe. | ||
| Connections { | ||
| target: Hyprland | ||
| function onRawEvent(event) { | ||
| if (RemoteSessionModel.isCaptureEvent(event ? event.name : "")) eventDebounce.restart() | ||
| } | ||
| } | ||
|
|
||
| Timer { | ||
| id: eventDebounce | ||
| interval: 150 | ||
| repeat: false | ||
| onTriggered: root.refresh() | ||
| } | ||
|
|
||
| // The end of a session often has no event: Hyprland reports the screencast | ||
| // stopped as soon as frames pause for half a second, and says nothing more | ||
| // when the server later exits. So poll while a session is active. | ||
| Timer { | ||
| interval: 2000 | ||
| repeat: true | ||
| running: root.active | ||
| onTriggered: root.refresh() | ||
| } | ||
|
|
||
| Process { | ||
| id: statusProbe | ||
| command: ["bash", Quickshell.env("OMARCHY_PATH") + "/shell/plugins/services/remote-session/probe.sh"] | ||
| stdout: StdioCollector { | ||
| waitForEnd: true | ||
| onStreamFinished: root.applyProbe(text) | ||
| } | ||
| onExited: function() { | ||
| if (root.refreshPending) Qt.callLater(root.refresh) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "schemaVersion": 1, | ||
| "id": "omarchy.remote-session", | ||
| "name": "Remote Session", | ||
| "version": "1.0.0", | ||
| "author": "Omarchy", | ||
| "description": "Detects a gliff remote-desktop session on this machine for the bar indicator.", | ||
| "kinds": [ | ||
| "service" | ||
| ], | ||
| "entryPoints": { | ||
| "service": "Service.qml" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Lists this user's running gliff-server processes, one "<pid> [peer]" line | ||
| # each. The peer is the ssh client address when the server was spawned over | ||
| # ssh (the real path); a local --listen server has none. Another account's | ||
| # server captures its own desktop, not this one, so other users are skipped. | ||
|
|
||
| for pid in $(pgrep -x -u "$(id -u)" gliff-server); do | ||
| peer=$(tr '\0' '\n' <"/proc/$pid/environ" 2>/dev/null | sed -n 's/^SSH_CONNECTION=\([^ ]*\).*/\1/p') | ||
| printf '%s %s\n' "$pid" "$peer" | ||
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.