diff --git a/plugins/sourceos/src/sourceos.cpp b/plugins/sourceos/src/sourceos.cpp index 46007286..8a0f4e34 100644 --- a/plugins/sourceos/src/sourceos.cpp +++ b/plugins/sourceos/src/sourceos.cpp @@ -32,6 +32,11 @@ static inline double matchScore(const QString &query, const QString &candidate) return clamp01(mm.score()); } +static inline void run(const QStringList &cmd) +{ + (void)albert::runDetachedProcess(cmd); +} + } // namespace class SourceOSPlugin final : public albert::ExtensionPlugin, @@ -42,14 +47,10 @@ class SourceOSPlugin final : public albert::ExtensionPlugin, public: SourceOSPlugin() = default; - QString id() const override { return "sourceos"; } - QString name() const override { return "SourceOS"; } - QString description() const override { return "SourceOS workstation actions (doctor, profiles, tools)"; } - QString synopsis(const QString &query) const override { (void)query; - return "doctor | profile apply | k9s | lazygit"; + return "status | doctor | profile apply | sesh | tmux | k9s | lazygit | lazydocker | yazi"; } QString defaultTrigger() const override @@ -76,21 +77,43 @@ class SourceOSPlugin final : public albert::ExtensionPlugin, std::vector terms; }; + // Launcher-friendly commands: use --open variants to open reports. const std::vector actions = { + {"status", + "SourceOS: status", + "Open JSON workstation health report", + "โœ…", + {"sourceos", "status", "--open"}, + {"status", "health", "json"}}, + {"doctor", "SourceOS: doctor", - "Run workstation checks (workstation-v0)", + "Open full doctor output", "๐Ÿฉบ", - {"sourceos", "doctor", "workstation-v0"}, - {"doctor", "check", "diagnose", "health"}}, + {"sourceos", "doctor", "--open"}, + {"doctor", "check", "diagnose"}}, {"apply", "SourceOS: profile apply", - "Apply workstation profile (workstation-v0)", + "Apply workstation profile (may prompt for sudo)", "๐Ÿงฐ", - {"sourceos", "profile", "apply", "workstation-v0"}, + {"sourceos", "profile", "apply"}, {"apply", "profile", "install", "bootstrap"}}, + {"sesh", + "Open sesh", + "tmux session manager", + "๐Ÿงต", + {"sesh"}, + {"sesh", "session", "tmux"}}, + + {"tmux", + "Open tmux", + "terminal multiplexer", + "๐Ÿงฉ", + {"tmux"}, + {"tmux", "mux"}}, + {"k9s", "Open k9s", "Kubernetes TUI", @@ -104,6 +127,20 @@ class SourceOSPlugin final : public albert::ExtensionPlugin, "๐ŸŒฟ", {"lazygit"}, {"lazygit", "git"}}, + + {"lazydocker", + "Open lazydocker", + "Docker/Podman TUI", + "๐Ÿณ", + {"lazydocker"}, + {"lazydocker", "docker", "podman"}}, + + {"yazi", + "Open yazi", + "Terminal file manager", + "๐Ÿ“", + {"yazi"}, + {"yazi", "files", "file"}}, }; std::vector out; @@ -113,7 +150,6 @@ class SourceOSPlugin final : public albert::ExtensionPlugin, double score = 0.0; if (empty) { - // Be conservative: RankItem doc says (0,1] even though empty queries are a special case. score = 0.01; } else { for (const auto &term : a.terms) @@ -131,7 +167,7 @@ class SourceOSPlugin final : public albert::ExtensionPlugin, acts.push_back(albert::Action{ "run", "Run", - [cmd=a.cmd]() { albert::runDetachedProcess(cmd); }, + [cmd=a.cmd]() { run(cmd); }, true });