Skip to content

Commit b64f284

Browse files
committed
Copy current URL to clipboard with browser extension
In Omarchy web apps it's impossible to get the curent URL to share it in another applications. This commit adds a browser extension which is included by default via the chromium-flags.conf config. With this extension you can get the current URL via a keyboard shortcut. The default shortcut for getting the current URL is `Ctrl+Shift+L`, this shortcut can be changed via this page: chrome://extensions/shortcuts.
1 parent 8fd668f commit b64f284

File tree

6 files changed

+45
-0
lines changed

6 files changed

+45
-0
lines changed

config/chromium-flags.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
--ozone-platform=wayland
22
--ozone-platform-hint=wayland
33
--enable-features=TouchpadOverscrollHistoryNavigation
4+
--load-extension=~/.local/share/omarchy/extensions/copy-url

extensions/copy-url/background.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
chrome.commands.onCommand.addListener((command) => {
2+
if (command === 'copy-url') {
3+
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
4+
const currentTab = tabs[0];
5+
6+
chrome.scripting.executeScript({
7+
target: { tabId: currentTab.id },
8+
func: () => {
9+
navigator.clipboard.writeText(window.location.href);
10+
}
11+
}).then(() => {
12+
chrome.notifications.create({
13+
type: 'basic',
14+
iconUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==',
15+
title: 'URL Copied',
16+
message: ''
17+
});
18+
});
19+
});
20+
}
21+
});

extensions/copy-url/icon.png

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../icon.png

extensions/copy-url/manifest.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"manifest_version": 3,
3+
"name": "Copy URL",
4+
"version": "1.0",
5+
"description": "Copy current URL to clipboard, this extension is installed by Omarchy",
6+
"permissions": ["activeTab", "scripting", "notifications"],
7+
"icons": {
8+
"16": "icon.png",
9+
"48": "icon.png",
10+
"128": "icon.png"
11+
},
12+
"commands": {
13+
"copy-url": {
14+
"suggested_key": {"default": "Ctrl+Shift+L"},
15+
"description": "Copy URL"
16+
}
17+
},
18+
"background": {"service_worker": "background.js"}
19+
}

icon.png

1.52 KB
Loading

migrations/1757021485.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
echo "Install Copy URL extension for Chromium"
2+
3+
omarchy-refresh-config chromium-flags.conf

0 commit comments

Comments
 (0)