From 491f5ff2aec5602b4d469535bd90416a8e8ef4fb Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Thu, 8 Oct 2026 13:38:29 +0200 Subject: [PATCH] gui: add 'Open Workdir' context menu for sessions and agents - Add openDirectory() method using QDesktopServices::openUrl - Session context menu: opens session cwd - Agent context menu: opens agent's effective cwd --- kde/gui/SessionTree.qml | 18 ++++++++++++++++++ kde/gui/ollie9pclient.cpp | 7 +++++++ kde/gui/ollie9pclient.h | 1 + 3 files changed, 26 insertions(+) diff --git a/kde/gui/SessionTree.qml b/kde/gui/SessionTree.qml index a4021e5..e93e503 100644 --- a/kde/gui/SessionTree.qml +++ b/kde/gui/SessionTree.qml @@ -160,6 +160,15 @@ Item { tree.sessionSettingsRequested(tree.killTargetSessionName) } } + MenuItem { + text: "Open Workdir" + onClicked: { + if (tree.killTargetSessionName) { + var cfg = ollie.readSessionConfig(tree.killTargetSessionName) + if (cfg.cwd) ollie.openDirectory(cfg.cwd) + } + } + } MenuItem { text: "New Agent..." onClicked: { @@ -196,6 +205,15 @@ Item { tree.agentSettingsRequested(tree.killTargetAgentSessionId, tree.killTargetAgentId) } } + MenuItem { + text: "Open Workdir" + onClicked: { + if (tree.killTargetAgentSessionId && tree.killTargetAgentId) { + var cfg = ollie.readAgentConfig(tree.killTargetAgentSessionId, tree.killTargetAgentId) + if (cfg.cwd) ollie.openDirectory(cfg.cwd) + } + } + } MenuItem { text: "Kill" onClicked: { diff --git a/kde/gui/ollie9pclient.cpp b/kde/gui/ollie9pclient.cpp index a72cb65..ac2e622 100644 --- a/kde/gui/ollie9pclient.cpp +++ b/kde/gui/ollie9pclient.cpp @@ -1,6 +1,7 @@ #include "ollie9pclient.h" #include "lib9pstreamer.h" +#include #include #include #include @@ -964,6 +965,12 @@ QString Ollie9pClient::procOutput(const QString &sessionId, const QString &agent return QString::fromUtf8(out); } +void Ollie9pClient::openDirectory(const QString &path) +{ + if (path.isEmpty()) return; + QDesktopServices::openUrl(QUrl::fromLocalFile(path)); +} + // --- Root data loading (lazy) --- void Ollie9pClient::ensureRootDataLoaded() diff --git a/kde/gui/ollie9pclient.h b/kde/gui/ollie9pclient.h index 89780e5..2ad1590 100644 --- a/kde/gui/ollie9pclient.h +++ b/kde/gui/ollie9pclient.h @@ -100,6 +100,7 @@ public: Q_INVOKABLE bool procTerm(const QString &sessionId, const QString &agentId, int pid); Q_INVOKABLE bool procKill(const QString &sessionId, const QString &agentId, int pid); Q_INVOKABLE QString procOutput(const QString &sessionId, const QString &agentId, int pid); + Q_INVOKABLE void openDirectory(const QString &path); Q_INVOKABLE QString lastError() const { return m_9p ? m_9p->lastError() : QString(); } signals: