mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-06 04:20:23 +00:00
Copy URL to clipboard from Chromium apps (#1458)
* 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. * Change the shortcut to Alt+Shift+L In my testing and research I found out that not all shortcuts are available as suggested_key. We still want to use L because that's easy to remember because we associate it with the location bar. * Improve notification language * Move it to just Alt + L since that's not used Better mirrors Ctrl + L as well * Move this under default/chromium * Fix symlink * It didn't like Alt+L alone after all --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
committed by
GitHub
parent
5582c51676
commit
1e6ddf55ce
@@ -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
|
||||
|
||||
21
default/chromium/extensions/copy-url/background.js
Normal file
21
default/chromium/extensions/copy-url/background.js
Normal file
@@ -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: ''
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
1
default/chromium/extensions/copy-url/icon.png
Symbolic link
1
default/chromium/extensions/copy-url/icon.png
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../icon.png
|
||||
19
default/chromium/extensions/copy-url/manifest.json
Normal file
19
default/chromium/extensions/copy-url/manifest.json
Normal file
@@ -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"}
|
||||
}
|
||||
3
migrations/1757021485.sh
Executable file
3
migrations/1757021485.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
echo "Install Copy URL extension for Chromium"
|
||||
|
||||
omarchy-refresh-config chromium-flags.conf
|
||||
Reference in New Issue
Block a user