Skip to content

Conversation

jankeesvw
Copy link

@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.

@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
Copy link
Author

I just pushed an update to this PR, it is now wrapped in the launcher for web apps. Unfortunately it isn't consistently working yet. If you kill all Chromium sessions it works, but if there is still a session active it won't.

@hjanuschka
Copy link

guess chromium needs atleast one full restart?!

@jankeesvw
Copy link
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

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

@jankeesvw
Copy link
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

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
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

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
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
Copy link
Author

Added the Omarchy icon to the extension so people recognize the origin of this extension:

screenshot-2025-09-06_19-23-24

@hjanuschka
Copy link

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.

@@ -1,3 +1,4 @@
--ozone-platform=wayland
--ozone-platform-hint=wayland
--enable-features=TouchpadOverscrollHistoryNavigation
--load-extension=$HOME/.local/share/omarchy/applications/chromium/copy-url

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder if we could use "~/.local/share/omarchy/applications/chromium/copy-url" and then could totally avoid the $HOME changes in this PR

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjanuschka nice! This works.

I had tried $HOME which doesn't work. But ~ works fine, great suggestion. I dropped the change to the update script.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hjanuschka can you give it a try?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works for me! :) but i had to change the shortcut, as my customized conf + german macbook keyboard

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for testing. I added a little explanation to the commit to make it clear you can change it.

@jankeesvw jankeesvw force-pushed the copy-to-clipboard-from-chromium branch from 9604f43 to 7561714 Compare September 7, 2025 09:21
@dhh
Copy link
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
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
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
Copy link
Author

I just rebased this pull request with master after the release of #1540

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