Skip to content

Copy URL to clipboard from Chromium apps#1458

Merged
dhh merged 10 commits intobasecamp:devfrom
jankeesvw:copy-to-clipboard-from-chromium
Sep 15, 2025
Merged

Copy URL to clipboard from Chromium apps#1458
dhh merged 10 commits intobasecamp:devfrom
jankeesvw:copy-to-clipboard-from-chromium

Conversation

@jankeesvw
Copy link
Copy Markdown
Contributor

@jankeesvw jankeesvw commented Sep 4, 2025

This afternoon I was at Rails World, talking to @dhh, I was asking if there is a way to copy the current URL to the clipboard with a Omarchy web application. We came up with an idea to use a Chrome extension that would be bundled with Omarchy. In this PR there is a bundled Chrome extension that is loaded via the /config/chromium-flags.conf.

Below in the screenshot you'll see an example of how it works. I'm browsing with the preinstalled HEY application, when I press ALT+SHIFT+U the current URL is on my clipboard and I see a small notification.

image

How to test:

cd ~/.local/share/omarchy
gh pr checkout 1458
omarchy-update

pkill chromium # not required

You should see this:

# Running migration (1757021485)
# Install Copy URL extension for Chromium

Then start a chromium browser, et voila.

Comment thread migrations/1757021485.sh Outdated
@jankeesvw jankeesvw force-pushed the copy-to-clipboard-from-chromium branch 2 times, most recently from 0955a84 to debfe8c Compare September 5, 2025 05:35
@jankeesvw

This comment was marked as outdated.

@hjanuschka
Copy link
Copy Markdown
Contributor

guess chromium needs atleast one full restart?!

@jankeesvw
Copy link
Copy Markdown
Contributor Author

guess chromium needs atleast one full restart?!

My solution works when you don't have any other Chromium open, so it has to be the first.

Right now I'm working on making a .crx, which should work.

@hjanuschka
Copy link
Copy Markdown
Contributor

i wonder if we should just patch chromium to have a global hotkey 🤨

@jankeesvw
Copy link
Copy Markdown
Contributor Author

i wonder if we should just patch chromium to have a global hotkey 🤨

Is that easier to do? I think this extension could work.

@hjanuschka
Copy link
Copy Markdown
Contributor

shouldn't be that hard, extension for me feels a bit heavy, but well on the otherside if we can ship it so that it works reliable

so your PR works if the first chromium that launches has the config to load the extension?
if you'd publish the extension to the store, we could just enable it by default via policy (i think this is what is planned for 1-password; or done already)

@jankeesvw
Copy link
Copy Markdown
Contributor Author

jankeesvw commented Sep 5, 2025

shouldn't be that hard, extension for me feels a bit heavy, but well on the otherside if we can ship it so that it works reliable

so your PR works if the first chromium that launches has the config to load the extension? if you'd publish the extension to the store, we could just enable it by default via policy (i think this is what is planned for 1-password; or done already)

Shipping it to the store is the easiest, but the disadvantage is that this is also an attack vector that could be exploited, if someone overwrites the extension (through my account) they could compromise the browser. That's why I started with making the extension locally.

The flag --load-extension works great, but only if you aren't running Chromium, otherwise it reuses the existing Chromium.

I'll try to make some time this weekend. Just got back from the conference.

@hjanuschka
Copy link
Copy Markdown
Contributor

hjanuschka commented Sep 5, 2025

cant we somehow download it and verify the hash? to protect against tempered extension?

The flag --load-extension works great, but only if you aren't running Chromium, otherwise it reuses the existing Chromium.

yes this is because there can only be one i nstance running, we could add --load-extension= to https://github.com/basecamp/omarchy/blob/master/config/chromium-flags.conf

so no matter how chromium is started it gets the flags

@jankeesvw
Copy link
Copy Markdown
Contributor Author

Thanks for the pointer! I'll take a look at it tomorrow.

@jankeesvw jankeesvw force-pushed the copy-to-clipboard-from-chromium branch 4 times, most recently from 16919f8 to d009947 Compare September 6, 2025 15:26
@jankeesvw jankeesvw marked this pull request as ready for review September 6, 2025 15:28
@jankeesvw jankeesvw changed the title Copy URL to clipboard (with Chrome extension) from Chromium apps Copy URL to clipboard from Chromium apps Sep 6, 2025
@jankeesvw

This comment was marked as outdated.

@hjanuschka
Copy link
Copy Markdown
Contributor

so - i am not the one deciding to merge (cc @dhh ) - but overall this looks good to me.

i would like to rename the extension to "omarchy" - and keep it as a place for further stuff - and not making it explicitly only for copy of url.

Comment thread config/chromium-flags.conf Outdated
@jankeesvw jankeesvw force-pushed the copy-to-clipboard-from-chromium branch from 9604f43 to 7561714 Compare September 7, 2025 09:21
@dhh
Copy link
Copy Markdown
Member

dhh commented Sep 7, 2025

I'm digging this! But let's use ctrl + alt + L as the hotkey to mirror that ctrl + L is how you access the location bar. Let's refer to icon.png in the root of Omarchy folder too. And let's put this under extensions/copy-url at the top level instead of applications.

@jankeesvw
Copy link
Copy Markdown
Contributor Author

jankeesvw commented Sep 7, 2025

I'm digging this! But let's use ctrl + alt + L as the hotkey to mirror that ctrl + L is how you access the location bar. Let's refer to icon.png in the root of Omarchy folder too. And let's put this under extensions/copy-url at the top level instead of applications.

Nice to hear that you like it, I agree with your suggestions. However there are two minor "issues";

  1. ctrl + alt + L is not available, but ctrl + shift + L is
  2. The icon in the root is an ascii file, can I include a PNG version of the logo in the root?

What do you think?

@jankeesvw jankeesvw force-pushed the copy-to-clipboard-from-chromium branch from 7561714 to cdad7a9 Compare September 7, 2025 20:45
@jankeesvw
Copy link
Copy Markdown
Contributor Author

@dhh I just pushed an update to this branch. I went with ctrl + shift + L, since it's close to ctrl + L like you mentioned. I also added a PNG version of the logo in the root and created a symlink from the extension folder to that file. Plus, I moved everything to the suggested folder. 👌

@jankeesvw jankeesvw force-pushed the copy-to-clipboard-from-chromium branch 3 times, most recently from 06e2205 to b64f284 Compare September 7, 2025 21:03
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.
@jankeesvw jankeesvw force-pushed the copy-to-clipboard-from-chromium branch from b64f284 to d972704 Compare September 10, 2025 08:48
@jankeesvw

This comment was marked as outdated.

@dhh dhh changed the base branch from master to dev September 14, 2025 14:41
@dhh
Copy link
Copy Markdown
Member

dhh commented Sep 14, 2025

Hmm, I can get this to load, but the hotkey is not getting picked up. Ctrl + Shift + L doesn't do anything. I checked that the extension is loaded, and it is. But yeah, no hotkey is exposed. Not in chromium itself, not in the webapps.

@dhh dhh added this to the 3.0 milestone Sep 14, 2025
jankeesvw and others added 4 commits September 15, 2025 10:57
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.
@dhh
Copy link
Copy Markdown
Member

dhh commented Sep 15, 2025

Moving it to Alt + Shift + L worked 👌

Better mirrors Ctrl + L as well
@jankeesvw
Copy link
Copy Markdown
Contributor Author

@dhh ah, you noticed my changed. :-)

I just asked some friends to test it. I'm glad it now works on your machine too.

@jankeesvw

This comment was marked as outdated.

@dhh
Copy link
Copy Markdown
Member

dhh commented Sep 15, 2025

I had Alt + L working, but then I couldn't get it working again?? It refused to allow anything but Alt + Shift + L.

@dhh dhh merged commit 1e6ddf5 into basecamp:dev Sep 15, 2025
@jankeesvw
Copy link
Copy Markdown
Contributor Author

I had Alt + L working, but then I couldn't get it working again?? It refused to allow anything but Alt + Shift + L.

I had the same issue, strange. There is something funky with these shortcuts. It's not well documented, what should, and what shouldn't work.

But Ctrl-Alt+L works, notification with the world icon:

image

@jankeesvw jankeesvw deleted the copy-to-clipboard-from-chromium branch September 15, 2025 10:23
manuel1618 pushed a commit to manuel1618/omarchy that referenced this pull request Sep 15, 2025
* 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>
hamidriaz1998 pushed a commit to hamidriaz1998/omarchy that referenced this pull request Sep 18, 2025
* 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>
dhcrzf pushed a commit to dhcrzf/omarchy that referenced this pull request Sep 18, 2025
* 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>
MarianoMiguel pushed a commit to MarianoMiguel/omarchy that referenced this pull request Sep 18, 2025
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants