diff --git a/Panel.qml b/Panel.qml index 7306b77..efe71fc 100644 --- a/Panel.qml +++ b/Panel.qml @@ -113,7 +113,15 @@ Panel { function openUrl(url) { var value = String(url || "") if (value === "") return - Quickshell.execDetached(["omarchy-launch-browser", value]) + var behavior = setting("linkBehavior", "Browser tab") + if (behavior === "Web app window") { + Quickshell.execDetached(["omarchy-launch-webapp", value]) + } else if (behavior === "Web app window (reuse)") { + var opener = decodeURIComponent(Qt.resolvedUrl("omarchy-github-open").toString().replace(/^file:\/\//, "")) + Quickshell.execDetached([opener, value]) + } else { + Quickshell.execDetached(["omarchy-launch-browser", value]) + } close() } diff --git a/README.md b/README.md index 0123fdb..5e1ac31 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ Configure the widget through Omarchy's bar widget settings. Existing installatio | Setting | Default | | --- | --- | | Refresh interval | 900 seconds (15 minutes) | +| Open links | **Browser tab** | | Include archived repositories | Off | | Include forks | Off | | Repository scope | **Owned** | @@ -151,6 +152,8 @@ Configure the widget through Omarchy's bar widget settings. Existing installatio **All repositories** is also opt-in and starts six paginated Actions request streams per repository on every refresh. Combining it with **Owned and organizations** can consume substantial GitHub API capacity in large organizations. Use **Recent repositories** or **Off** for a bounded scan, and increase the refresh interval when broader monitoring is required. +**Open links** controls where notifications, pull requests, issues, workflow runs, and repositories open. The default **Browser tab** keeps the historical behavior in any browser. **Web app window** opens each link in a dedicated Chromium app window via `omarchy-launch-webapp`, and **Web app window (reuse)** keeps a single web app window: any open GitHub web app window is closed and the clicked link opens in a fresh one. Both web app modes require a Chromium-based default browser; with any other default browser they fall back to launching Chromium directly. + Set these options from the command line after installing the plugin: ```bash diff --git a/Service.qml b/Service.qml index 35d945d..95ae579 100644 --- a/Service.qml +++ b/Service.qml @@ -103,7 +103,7 @@ Item { } function helperPath() { - return Qt.resolvedUrl("omarchy-github-fetch").toString().replace(/^file:\/\//, ""); + return decodeURIComponent(Qt.resolvedUrl("omarchy-github-fetch").toString().replace(/^file:\/\//, "")); } function command() { diff --git a/manifest.json b/manifest.json index d5a45ef..0bc9952 100644 --- a/manifest.json +++ b/manifest.json @@ -20,6 +20,7 @@ "defaultSection": "right", "defaults": { "refreshIntervalSec": 900, + "linkBehavior": "Browser tab", "includeArchived": false, "includeForks": false, "repositoryScope": "Owned", @@ -34,6 +35,7 @@ }, "schema": [ { "key": "refreshIntervalSec", "type": "integer", "label": "Refresh interval (seconds)", "min": 60, "max": 3600, "step": 60, "defaultValue": 900 }, + { "key": "linkBehavior", "type": "enum", "label": "Open links", "options": ["Browser tab", "Web app window", "Web app window (reuse)"], "defaultValue": "Browser tab", "description": "Open links in a browser tab, in a dedicated web app window, or reusing a single web app window that always shows the clicked link. The web app modes require Hyprland and a Chromium-based default browser." }, { "key": "includeArchived", "type": "boolean", "label": "Include archived repositories", "defaultValue": false }, { "key": "includeForks", "type": "boolean", "label": "Include forked repositories", "defaultValue": false }, { "key": "repositoryScope", "type": "enum", "label": "Repository scope", "options": ["Owned", "Owned and organizations"], "defaultValue": "Owned", "description": "List only repositories you own, or include organization repositories. This scope also supplies candidates for Actions scanning." }, diff --git a/omarchy-github-open b/omarchy-github-open new file mode 100755 index 0000000..c387b40 --- /dev/null +++ b/omarchy-github-open @@ -0,0 +1,25 @@ +#!/bin/bash +# Reuse a single GitHub web app window: close any open GitHub web app +# windows, then open url in a fresh one so the window always shows the +# link that was clicked. +# omarchy:args= + +url="$1" + +if [[ -z $url ]]; then + exit 0 +fi + +pattern='github\.com__' + +addresses=$(hyprctl clients -j | jq -r --arg p "$pattern" '.[] | select(.class | test($p)) | .address') + +while IFS= read -r addr; do + [[ -n $addr ]] || continue + hyprctl dispatch "hl.dsp.window.close({ window = \"address:$addr\" })" >/dev/null 2>&1 || + hyprctl dispatch "closewindow address:$addr" >/dev/null 2>&1 +done <<<"$addresses" + +sleep 0.25 + +exec omarchy-launch-webapp "$url"