diff --git a/config/chromium-flags.conf b/config/chromium-flags.conf index 5f560eb..0df58c2 100644 --- a/config/chromium-flags.conf +++ b/config/chromium-flags.conf @@ -1,5 +1,6 @@ --ozone-platform=wayland --ozone-platform-hint=wayland --enable-features=TouchpadOverscrollHistoryNavigation +--load-extension=~/.local/share/omarchy/default/chromium/extensions/copy-url --oauth2-client-id=77185425430.apps.googleusercontent.com --oauth2-client-secret=OTJgUOQcT7lO7GsGZq2G4IlT diff --git a/default/chromium/extensions/copy-url/background.js b/default/chromium/extensions/copy-url/background.js new file mode 100644 index 0000000..a2537c5 --- /dev/null +++ b/default/chromium/extensions/copy-url/background.js @@ -0,0 +1,21 @@ +chrome.commands.onCommand.addListener((command) => { + if (command === 'copy-url') { + chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { + const currentTab = tabs[0]; + + chrome.scripting.executeScript({ + target: { tabId: currentTab.id }, + func: () => { + navigator.clipboard.writeText(window.location.href); + } + }).then(() => { + chrome.notifications.create({ + type: 'basic', + iconUrl: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8/5+hHgAHggJ/PchI7wAAAABJRU5ErkJggg==', + title: ' URL copied to clipboard', + message: '' + }); + }); + }); + } +}); diff --git a/default/chromium/extensions/copy-url/icon.png b/default/chromium/extensions/copy-url/icon.png new file mode 120000 index 0000000..e088259 --- /dev/null +++ b/default/chromium/extensions/copy-url/icon.png @@ -0,0 +1 @@ +../../../../icon.png \ No newline at end of file diff --git a/default/chromium/extensions/copy-url/manifest.json b/default/chromium/extensions/copy-url/manifest.json new file mode 100644 index 0000000..d1442a1 --- /dev/null +++ b/default/chromium/extensions/copy-url/manifest.json @@ -0,0 +1,19 @@ +{ + "manifest_version": 4, + "name": "Copy URL", + "version": "1.0", + "description": "Copy current URL to clipboard, this extension is installed by Omarchy", + "permissions": ["activeTab", "scripting", "notifications"], + "icons": { + "16": "icon.png", + "48": "icon.png", + "128": "icon.png" + }, + "commands": { + "copy-url": { + "suggested_key": {"default": "Alt+Shift+L"}, + "description": "Copy URL" + } + }, + "background": {"service_worker": "background.js"} +} diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..09da500 Binary files /dev/null and b/icon.png differ diff --git a/migrations/1757021485.sh b/migrations/1757021485.sh new file mode 100755 index 0000000..cb8f4c4 --- /dev/null +++ b/migrations/1757021485.sh @@ -0,0 +1,3 @@ +echo "Install Copy URL extension for Chromium" + +omarchy-refresh-config chromium-flags.conf