Indicate and jump to tmux panes waiting for attention
Show a bar indicator whenever tmux has flagged a window, the same state that highlights the tab, and jump to it on click or with Super + Ctrl + J. Tmux hooks push the state to the shell, so nothing polls while no pane is waiting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
98e88723ae
commit
a382be2645
@@ -0,0 +1,63 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Ui
|
||||
|
||||
BarIndicator {
|
||||
id: root
|
||||
|
||||
property int waitingCount: 0
|
||||
property string tooltip: ""
|
||||
|
||||
active: waitingCount > 0
|
||||
activeText: ""
|
||||
inactiveText: ""
|
||||
activeTooltipText: tooltip
|
||||
inactiveTooltipText: "No terminal is waiting"
|
||||
|
||||
function refresh() {
|
||||
if (!statusProc.running) statusProc.running = true
|
||||
}
|
||||
|
||||
function update(raw) {
|
||||
var data = extractData(raw)
|
||||
waitingCount = Number(data.count || 0)
|
||||
tooltip = String(data.tooltip || "")
|
||||
}
|
||||
|
||||
Component.onCompleted: refresh()
|
||||
|
||||
// Alerts can also disappear without a hook, such as when the window or its
|
||||
// session is killed while still flagged.
|
||||
Timer {
|
||||
interval: 5000
|
||||
running: root.active
|
||||
repeat: true
|
||||
onTriggered: root.refresh()
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root.indicatorHost
|
||||
ignoreUnknownSignals: true
|
||||
function onRefreshRequested() { root.refresh() }
|
||||
}
|
||||
|
||||
Process {
|
||||
id: statusProc
|
||||
command: ["omarchy-tmux-alert", "show", "--json"]
|
||||
stdout: StdioCollector {
|
||||
waitForEnd: true
|
||||
onStreamFinished: root.update(text)
|
||||
}
|
||||
onExited: function(exitCode) {
|
||||
if (exitCode !== 0) {
|
||||
root.waitingCount = 0
|
||||
root.tooltip = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onPressed: function() {
|
||||
Quickshell.execDetached(["omarchy-tmux-alert", "focus"])
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,11 @@
|
||||
"label": "Reminder",
|
||||
"description": "Queued reminder status"
|
||||
},
|
||||
{
|
||||
"value": "TmuxAlert",
|
||||
"label": "Tmux alert",
|
||||
"description": "Tmux windows waiting for attention"
|
||||
},
|
||||
{
|
||||
"value": "NightLight",
|
||||
"label": "Night light",
|
||||
|
||||
@@ -8,7 +8,7 @@ BarWidget {
|
||||
id: root
|
||||
moduleName: "omarchy.indicators"
|
||||
|
||||
readonly property var defaultIndicatorEntries: [ "Dnd", "Reminder", "NightLight", "StayAwake", "ScreenRecording", "Dictation" ]
|
||||
readonly property var defaultIndicatorEntries: [ "Dnd", "Reminder", "TmuxAlert", "NightLight", "StayAwake", "ScreenRecording", "Dictation" ]
|
||||
readonly property var indicatorEntries: indicatorEntriesFromSettings(settings)
|
||||
property var activeIndicatorIds: []
|
||||
property var indicatorActiveStates: ({})
|
||||
|
||||
Reference in New Issue
Block a user