Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chromium: fix .desktop file name #23518

Closed
wants to merge 3 commits into from

Conversation

layus
Copy link
Member

@layus layus commented Mar 5, 2017

The desktop file must be name "chromium-browser.desktop" because it is
used as-is when setting chromium as the default browser.

See https://cs.chromium.org/chromium/src/chrome/browser/shell_integration_linux.cc?l=657&rcl=34b92857a547538555be6a38e95f7e95ab9b6842

Fixes #4370 for chromium.

/cc @domenkozar for #4370 (comment)

The desktop file must be name "chromium-browser.desktop" because it is
used as-is when setting chromium as the default browser.

See https://cs.chromium.org/chromium/src/chrome/browser/shell_integration_linux.cc?l=657&rcl=34b92857a547538555be6a38e95f7e95ab9b6842
@mention-bot
Copy link

@layus, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jraygauthier, @aszlig and @obadz to be potential reviewers.

@bjornfor
Copy link
Contributor

bjornfor commented Mar 5, 2017

@layus: Does work for you? After rebuilding my system with this PR, I still get the "Chromium isn't your default browser. [Set as default]" popup. I click "[Set as default]" and the message is still shown the next time I start chromium.

I restarted my machine after doing the first "nixos-rebuild boot" with this PR, and I checked / updated all nix-env packages.

@layus
Copy link
Member Author

layus commented Mar 6, 2017

There seems to be an issue indeed. It only partially works. Investigating. (handlers are set properly, but not the default browser)

@layus
Copy link
Member Author

layus commented Mar 6, 2017

It seems that xdg-mime is somehow broken. Reading and writing does not use the same file !

$ XDG_UTILS_DEBUG_LEVEL=3 xdg-mime query default text/html
Checking /home/gmaudoux/.config/mimeapps.list
firefox.desktop

$ XDG_UTILS_DEBUG_LEVEL=3 xdg-mime default chromium-browser.desktop text/html
make_default_kde: No kde runtime detected
make_default_generic chromium-browser.desktop text/html
Updating /home/gmaudoux/.local/share/applications/mimeapps.list

$ XDG_UTILS_DEBUG_LEVEL=3 xdg-mime query default text/html
Checking /home/gmaudoux/.config/mimeapps.list
firefox.desktop

@layus
Copy link
Member Author

layus commented Mar 6, 2017

And indeed the fix we need is at https://cgit.freedesktop.org/xdg/xdg-utils/commit/scripts/xdg-mime.in?id=9dac27a442b0e44b3f235798b77715e26169500f.
By the way, chromium has xdg_utils as build input, but it is not a runtime dependency. Either we need to patch chromium to use the provided xdg_utils, or we can just remove xdg_utils from the imput list. With the current build, chromium looks for xdg-settings in the environment.

@Mic92 Mic92 changed the title chromium: fix .destop file name chromium: fix .desktop file name Mar 6, 2017
@fpletz fpletz added this to the 17.03 milestone Mar 7, 2017
@bjornfor
Copy link
Contributor

bjornfor commented Mar 7, 2017

And indeed the fix we need is at [GIT]

It's amazing how fixes like that can sit in a development branch and not get released for so long.

I've asked upstream to make a release: https://lists.freedesktop.org/archives/portland/2017-March/001193.html

@layus layus force-pushed the fix-chromium-desktop-file-name branch 2 times, most recently from fc1eed0 to fbdbe93 Compare March 7, 2017 10:44
Building from git because we need a patch for chromium.
@layus layus force-pushed the fix-chromium-desktop-file-name branch from fbdbe93 to 179d201 Compare March 7, 2017 10:45
@layus
Copy link
Member Author

layus commented Mar 7, 2017

@fpletz xdg_utils has some history of building from git. These three commits fix chromium default-browser feature and make xdg-utils a proper runtime dependency of chromium.

/edit I meant @bjornfor

@layus
Copy link
Member Author

layus commented Mar 23, 2017

@globin This is ready for 17.03, but better merge this soon, because it updates xdg-utils. This is a small mass-rebuild ;-).

@domenkozar
Copy link
Member

Testing.

@layus
Copy link
Member Author

layus commented Mar 24, 2017

@domenkozar Testing this together with the fix for firefox is interesting. You can alternate between both as default ;-).

@domenkozar
Copy link
Member

I couldn't reproduce the problem anymore even before testing this. I can share chromium closure if someone wants :)

@layus
Copy link
Member Author

layus commented Mar 25, 2017

@domenkozar Yes, please share it :-).

Have you tried xdg-settings get default-web-browser and xdg-mime query default x-scheme-handler/https ? Strace also helps to track what files are really edited.

Also, note that chromium does not always ask to be the default browser. You neet to go into the options and check there the default status.

@domenkozar
Copy link
Member

Chromium in this PR is out of date with master, so it reports it can not load the profile.

It still reports in settings that it's not the default browser.

@domenkozar
Copy link
Member

domenkozar commented Mar 25, 2017

$ xdg-settings get default-web-browser
chromium.desktop

$ xdg-mime query default x-scheme-handler/https
chromium.desktop

@layus
Copy link
Member Author

layus commented Mar 25, 2017

@domenkozar Something went wrong then, because setting chromium as default browser should make chromium-browser.desktop the default app reported by xdg-*.

You need to set this chromium as the default browser before it can report being the default one. Chromium has never recognised chromium.desktop as itself.

@srhb
Copy link
Contributor

srhb commented Apr 3, 2017

What's holding up this merge? Is any further testing required?

@domenkozar
Copy link
Member

@layus I might have tested this wrong, as it seems I need to install chromium into my profile so the desktop file gets propagated correctly. Did someone test this and confirm it works?

@layus
Copy link
Member Author

layus commented Apr 3, 2017

@layus [...] it seems I need to install chromium into my profile so the desktop file gets propagated correctly.

Yes, it only works if chromium is installed in the profile. Otherwise it cannot find chromium-browser.desktop and fails to set it as the default.

@fpletz fpletz modified the milestones: 17.09, 17.03 Jul 25, 2017
@joachifm joachifm requested a review from bendlas October 28, 2017 11:19
@bendlas
Copy link
Contributor

bendlas commented Oct 28, 2017

Seems like an obvious fix. Our xdg-utils version is 1.1.2 by now. Does that have our required patch?
EDIT it does https://github.com/freedesktop/xdg-utils/commit/9dac27a442b0e44b3f235798b77715e26169500f

@bendlas bendlas closed this in c7f00e3 Nov 10, 2017
bendlas pushed a commit that referenced this pull request Nov 10, 2017
bendlas pushed a commit that referenced this pull request Nov 10, 2017
The desktop file must be name "chromium-browser.desktop" because it is
used as-is when setting chromium as the default browser.

See https://cs.chromium.org/chromium/src/chrome/browser/shell_integration_linux.cc?l=657&rcl=34b92857a547538555be6a38e95f7e95ab9b6842

fixes #23518

(cherry picked from commit c7f00e3)
bendlas pushed a commit that referenced this pull request Nov 10, 2017
@jerith666
Copy link
Contributor

I just updated from nixos-unstable @ cfafd6f to nixos-unstable @ 7ebacd1, which includes commits c7f00e3 and 84fb41d from this issue. The Chromium menu item in the KDE application launcher (and in a quicklauch area I have on the desktop) now don't work, they still seem to expect a file /run/current-system/sw/share/applications/chromium.desktop (even after recreating the quicklaunch on the desktop). Maybe the old path is cached somewhere, but I don't know where that might be ... ?

@orivej
Copy link
Contributor

orivej commented Nov 13, 2017

AFAIK so far the menu updates require a logout to take effect.

@jerith666
Copy link
Contributor

I rebooted already, as part of applying the update.

@bendlas
Copy link
Contributor

bendlas commented Nov 13, 2017

I hope, I did not break chromium's icon on stable. I'll test our hydra's build in the evening ...

@layus
Copy link
Member Author

layus commented Nov 13, 2017

@jerith666 I would be glad to get more insights from your side. I am not too familiar with KDE, but there should be an actual file describing the content of the launcher. Could you dig into the issue and find why it looks for /run/current-system/sw/share/applications/chromium.desktop ? Could you in particular look into ~/.config/mimeapps.list ?

@jerith666
Copy link
Contributor

~/.config/mimeapps.list doesn't seem to be it (my default browser is set to Firefox (aka "nightly"):

$ egrep -i 'chrom|brows|web|http' mimeapps.list
x-scheme-handler/chrome=userapp-Nightly-UQEXHY.desktop;userapp-Nightly-ZSP1IY.desktop;userapp-Nightly-711TIY.desktop;userapp-Nightly-EQHGJY.desktop;userapp-Nightly-O1LXJY.desktop;userapp-Nightly-QH05JY.desktop;userapp-Nightly-CI86KY.desktop;userapp-Nightly-ODI0KY.desktop;userapp-Nightly-MD8MMY.desktop;userapp-Nightly-R0YTMY.desktop;userapp-Nightly-YGYMNY.desktop;userapp-Nightly-237PNY.desktop;userapp-Nightly-I0YGOY.desktop;userapp-Nightly-YMHPPY.desktop;userapp-Nightly-1FCVQY.desktop;userapp-Nightly-5YU9QY.desktop;userapp-Nightly-AGHWRY.desktop;userapp-Nightly-1W7LTY.desktop;userapp-Nightly-BDFOTY.desktop;userapp-Nightly-VGVZVY.desktop;userapp-Nightly-CHPMWY.desktop;userapp-Nightly-PORBWY.desktop;userapp-Nightly-TAMYWY.desktop;firefox.desktop;
x-scheme-handler/http=userapp-Nightly-UQEXHY.desktop;userapp-Nightly-ZSP1IY.desktop;userapp-Nightly-711TIY.desktop;userapp-Nightly-EQHGJY.desktop;userapp-Nightly-O1LXJY.desktop;userapp-Nightly-QH05JY.desktop;userapp-Nightly-CI86KY.desktop;userapp-Nightly-ODI0KY.desktop;userapp-Nightly-MD8MMY.desktop;userapp-Nightly-R0YTMY.desktop;userapp-Nightly-YGYMNY.desktop;userapp-Nightly-237PNY.desktop;userapp-Nightly-I0YGOY.desktop;userapp-Nightly-YMHPPY.desktop;userapp-Nightly-1FCVQY.desktop;userapp-Nightly-5YU9QY.desktop;userapp-Nightly-AGHWRY.desktop;userapp-Nightly-1W7LTY.desktop;userapp-Nightly-BDFOTY.desktop;userapp-Nightly-VGVZVY.desktop;userapp-Nightly-CHPMWY.desktop;userapp-Nightly-PORBWY.desktop;userapp-Nightly-TAMYWY.desktop;firefox.desktop;
x-scheme-handler/https=userapp-Nightly-UQEXHY.desktop;userapp-Nightly-ZSP1IY.desktop;userapp-Nightly-711TIY.desktop;userapp-Nightly-EQHGJY.desktop;userapp-Nightly-O1LXJY.desktop;userapp-Nightly-QH05JY.desktop;userapp-Nightly-CI86KY.desktop;userapp-Nightly-ODI0KY.desktop;userapp-Nightly-MD8MMY.desktop;userapp-Nightly-R0YTMY.desktop;userapp-Nightly-YGYMNY.desktop;userapp-Nightly-237PNY.desktop;userapp-Nightly-I0YGOY.desktop;userapp-Nightly-YMHPPY.desktop;userapp-Nightly-1FCVQY.desktop;userapp-Nightly-5YU9QY.desktop;userapp-Nightly-AGHWRY.desktop;userapp-Nightly-1W7LTY.desktop;userapp-Nightly-BDFOTY.desktop;userapp-Nightly-VGVZVY.desktop;userapp-Nightly-CHPMWY.desktop;userapp-Nightly-PORBWY.desktop;userapp-Nightly-TAMYWY.desktop;firefox.desktop;
x-scheme-handler/chrome=firefox.desktop
x-scheme-handler/http=firefox.desktop
x-scheme-handler/https=firefox.desktop

@jerith666
Copy link
Contributor

here are two other hits, may be more relevant. I don't have GUI access to the machine in question right now though, just SSH, so can't test extensively:

<r:0 j:0 ~/.config >
$ grep -i chromium plasma*
plasma-org.kde.plasma.desktop-appletsrc:launcherUrls=file:///run/current-system/sw/share/applications/firefox.desktop,file:///run/current-system/sw/share/applications/org.kde.konsole.desktop,file:///run/current-system/sw/share/applications/chromium.desktop,file:///run/current-system/sw/share/applications/gqview.desktop,file:///run/current-system/sw/share/applications/kde4/amarok.desktop,file:///run/current-system/sw/share/applications/gnucash.desktop,file:///run/current-system/sw/share/applications/calc.desktop,file:///run/current-system/sw/share/applications/writer.desktop,file:///run/current-system/sw/share/applications/org.kde.dolphin.desktop
plasmashellrc:History=chromium %U,dolphin %u,firefox %U,konsole,libreoffice --writer %U,libreoffice --calc %U,gnucash %f,amarok %U,gqview -r %F,gqview
grep: plasma-workspace: Is a directory

@jerith666
Copy link
Contributor

I did a recursive grep of all my dot directories and files (find . -maxdepth 1 -name '\.*' -type d -not -name '.' -not -name .bitcoin\* -exec grep -lr chromium {} \;), and didn't find anything informative. I also did an strace of the plasmashell executable while launching Chromium, and didn't see anything informative there either (though it was really noisy, so I could have missed something). :-/

@layus
Copy link
Member Author

layus commented Nov 14, 2017

@jerith666 You can safely remove all the references to userapp-Nightly... in ~/.config/mimeapps.list. These are old entries inserted by firefox.

The file:///run/current-system/sw/share/applications/chromium.desktop in ~/.config/plasma-org.kde.plasma.desktop-appletsrc should be changed to .../chromium-browser.desktop. Even better, you could just remove it, logout (or restart) and add the shortcut again to your desktop.

If deleting the line does not remove the shortcut, we will have to look elsewhere for its definition.

@jerith666
Copy link
Contributor

I removed the shortcut, confirmed no hits for grep chrom ~/.config/plasma-org.kde.plasma.desktop-appletsrc, rebooted, re-added the shortcut, and I still find:

$ grep -i chrom plasma-org.kde.plasma.desktop-appletsrc 
launcherUrls=file:///run/current-system/sw/share/applications/firefox.desktop,file:///run/current-system/sw/share/applications/org.kde.konsole.desktop,file:///run/current-system/sw/share/applications/gqview.desktop,file:///run/current-system/sw/share/applications/kde4/amarok.desktop,file:///run/current-system/sw/share/applications/gnucash.desktop,file:///run/current-system/sw/share/applications/calc.desktop,file:///run/current-system/sw/share/applications/writer.desktop,file:///run/current-system/sw/share/applications/org.kde.dolphin.desktop,file:///run/current-system/sw/share/applications/chromium.desktop

$ ls -l /run/current-system/sw/share/applications/chr*
lrwxrwxrwx 1 root root 109 Dec 31  1969 /run/current-system/sw/share/applications/chromium-browser.desktop -> /nix/store/6i0g7zhkxsq26g7bizs7mhycyqqwwjm6-chromium-62.0.3202.89/share/applications/chromium-browser.desktop

I also confirmed that the Chromium menu item on the KDE "start" menu is still failing. Specifically, clicking it produces these dialogs:

chrome-dialog
chrome-dialog-2

Still can't find anyplace that's storing this old shortcut name. :(

(In the meantime, I've just locally reverted c7f00e3.)

@layus
Copy link
Member Author

layus commented Nov 20, 2017

@jerith666 I have tried a fresh vm with https://gist.github.com/layus/f5ad459f5a4e13be93fe8d86b51d46b7. I am unable to reproduce your bug, and everything works well.
The vm may however provide a reference for comparison with your system.

In particular, when I made a shortcut to chromium, it was a shortcut to /run/current-system/.../chromium-browser.desktop and it launched chromium correctly. You could check that you do have the fix in your channel, and that you are using the right chromium (it may be installed only for your user, or only for the system). I last resort, you may find some kde/plasma gurus on irc.

I wish I could be more useful, but this is as far as I can go concerning plasma :-/.

@bendlas
Copy link
Contributor

bendlas commented Nov 20, 2017

I couldn't reproduce it either. I admit, that this change should have gone in before stable release, due to the potential breakage. I does fix a long-standing annoyance of NixOS, though, and since there aren't more reports on this, I'm leaving it in.

@jerith666
Copy link
Contributor

Thanks for checking into it, both of you -- it's about as far as my understanding goes WRT plasma too. :) I agree it doesn't need to be reverted in nixpkgs. I think I'm just going to keep my revert locally, and leave this thread here for any others who might run into this issue.

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.

None yet

9 participants