Bug 175369 - www/chromium: Chromimum Desktop Integration doesn't open URLs
Summary: www/chromium: Chromimum Desktop Integration doesn't open URLs
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-chromium mailing list
Depends on:
Reported: 2013-01-17 14:20 UTC by Lawrence Chen
Modified: 2013-11-27 21:42 UTC (History)
0 users

See Also:

file.diff (342 bytes, patch)
2013-01-17 14:20 UTC, Lawrence Chen
no flags Details | Diff
patch.txt (2.00 KB, text/plain; charset=UTF-8)
2013-01-26 19:16 UTC, Lawrence Chen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lawrence Chen 2013-01-17 14:20:01 UTC
	Been an annoyance that everytime Chromium updates, that clicking 
	links on desktop or invoking "Open URL" action only results in 
	starting a new browser instance rather than opening the URL.

	The reason is the chrome.desktop file generated has the wrong
	Exec= parameter.  Hand fixing has resolved the problem each time,
	just have to remember to do this after an upgrade.

Fix: Correct the Exec= line.
How-To-Repeat: 	Repeats with every upgrade
Comment 1 Lawrence Chen 2013-01-19 17:24:40 UTC
Didn't quite fully solve the desktop integration, and reading
http://www.freebsd.org/gnome/docs/porting.html decided the better course
of action would be to provide a 'chromium-browser.desktop'.

This fixes chromium seeing that its the default browser, and should
allow it make itself the default browser.  It also makes the "Create
Application Shortcut" work.

--- Makefile.orig	2013-01-10 19:50:26.000000000 -0600
+++ Makefile	2013-01-19 08:42:45.893220392 -0600
@@ -50,9 +50,6 @@
 MAN1=		chrome.1

-DESKTOP_ENTRIES="Chromium" "${COMMENT}" "${DATADIR}/product_logo_48.png" \
-		"chrome" "Application;Network;WebBrowser;" true
 ALL_TARGET=	chrome

 # See build/common.gypi for all the available variables.
@@ -187,6 +184,9 @@
 	cd ${WRKSRC}/out/${BUILDTYPE} && \
 		${COPYTREE_SHARE} "locales resources" ${DATADIR}
+	${MKDIR} ${PREFIX}/share/applications
+	${INSTALL_DATA} ${FILESDIR}/chromium-browser.desktop \
+		${PREFIX}/share/applications
 	${LN} -sf ${DATADIR}/chrome ${PREFIX}/bin

@@ -194,5 +194,6 @@
 	@${ECHO_MSG} "For best performance please enable shared memory support"
 	@${ECHO_MSG} "in chromium by setting kern.ipc.shm_allow_removed=1"
 	@${ECHO_MSG} "========================================================"
+	-@update-desktop-database

 .include <bsd.port.post.mk>
--- pkg-plist.orig	2013-01-10 19:50:26.000000000 -0600
+++ pkg-plist	2013-01-18 09:58:10.615220943 -0600
@@ -1,4 +1,5 @@
@@ -256,3 +257,5 @@
 @dirrm %%DATADIR%%/resources/extension
 @dirrm %%DATADIR%%/resources
 @dirrm %%DATADIR%%
+@exec %%LOCALBASE%%/bin/update-desktop-database > /dev/null ||
+@unexec %%LOCALBASE%%/bin/update-desktop-database > /dev/null ||
--- files/chromium-browser.desktop.orig	1969-12-31 18:00:00.000000000 -0600
+++ files/chromium-browser.desktop	2013-01-19 08:42:30.244793302 -0600
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Comment=A mostly BSD-licensed web browser based on WebKit and Gtk+
+Exec=chrome %U
Comment 2 Mark Linimon freebsd_committer 2013-01-20 01:38:59 UTC
Responsible Changed
From-To: freebsd-ports-bugs->chromium

Fix synopsis and assign.
Comment 3 Lawrence Chen 2013-01-26 19:16:46 UTC
One of the diffs was wrong, here's the updated diffs against the current
Comment 4 Rene Ladan freebsd_committer 2013-05-22 14:03:49 UTC
State Changed
From-To: open->feedback

Sorry for the late response. 

I applied your patch but on Chromium 27.0.1453.93 the standard browser 
detection does not seem to work. 

The patch is here: 
Comment 5 Rene Ladan 2013-05-22 22:13:15 UTC
The update-desktop-database line is part of ports/Mk/Uses/
desktop-file-utils.mk which is called by the Makefile,
so it must be something else...
Comment 6 Lawrence Chen 2013-05-23 04:54:54 UTC

On 2013-05-22 16:13, René Ladan wrote: 

> The update-desktop-database line is part of ports/Mk/Uses/desktop-file-utils.mk [1]which is called by the Makefile, 
> so it must be something else...

Looks like there's more than one way to do be the default. IE: Firefox
registers a lot more handlers and such, where chromium only does two. Had to
remove all the other firefox ones before chromium would be default again
though perhaps I should leave firefox on ftp? since chromium doesn't claim it
and when it wasn't set, the IE in wine was launching for it. 

For me, it was to try to get chromium to be the default and stay the
default....instead of epiphany (or after I installed calibre -
calibre-ebook-viewer) Which I would fix by having to remember to edit the
mimeinfo.cache file after an update. With this change, it would remain default
after an update (if I forget to reapply this patch, links cause
calibre-ebook-viewer to start...but reapplying the patch and reinstalling the
port was all I needed to do to get chromium back as default. 

Chromium is looking for a file named 'chromium-browser.desktop' to determine
the desktop environment and to be able to create application shortcuts, so
that's still right. Not sure how to have chromium compete with firefox. Not
sure how opera is supposed to work if it wants to be default. (the current
problem of how flash is[n't] working in chromium had me thinking if I should
switch browsers again.... right now its chrome/chromium on all the systems,
except for Solaris. Before chrome it was Firefox....and let's not speak of
what things were like before that.) 

Perhaps what's needed is to figure out a consistent way for all the browsers
to get along on which ever is the desired default. 


[1] http://desktop-file-utils.mk
Comment 7 dfilter service freebsd_committer 2013-05-29 09:42:01 UTC
Author: rene
Date: Wed May 29 08:41:47 2013
New Revision: 319360
URL: http://svnweb.freebsd.org/changeset/ports/319360

  Manually install the desktop file instead of using DESKTOP_ENTRIES, this
  allows to set the MimeTypes.
  PR:		ports/175369 (still open)
  Submitted by:	Lawrence Chen (lchen@zen.lhaven.homeip.net)
  		The BSD Dreamer (beastie@tardisi.com)

  head/www/chromium/files/chromium-browser.desktop.in   (contents, props changed)

Modified: head/www/chromium/Makefile
--- head/www/chromium/Makefile	Wed May 29 08:30:12 2013	(r319359)
+++ head/www/chromium/Makefile	Wed May 29 08:41:47 2013	(r319360)
@@ -42,7 +42,7 @@ RUN_DEPENDS=	${LOCALBASE}/lib/alsa-lib/l
 ONLY_FOR_ARCHS=	i386 amd64
 USE_XZ=		yes
-USES=		bison pkgconfig
+USES=		bison pkgconfig desktop-file-utils
@@ -50,9 +50,6 @@ USE_XORG=	scrnsaverproto x11 xproto xscr
 USE_GNOME=	glib20 gtk20 dconf libxslt
 MAN1=		chrome.1
-DESKTOP_ENTRIES="Chromium" "Web browser" "${DATADIR}/product_logo_48.png" \
-		"chrome %U" "Network;WebBrowser;GTK;" true
 ALL_TARGET=	chrome
 # See build/common.gypi for all the available variables.
@@ -78,6 +75,10 @@ GYP_DEFINES+=	use_cups=1 \
 		prefix_dir=${LOCALBASE} \
+SUB_FILES=	chromium-browser.desktop
 CODECS_DESC=	Compile and enable patented codecs like H.264
@@ -196,6 +197,7 @@ do-install:
 	cd ${WRKSRC}/out/${BUILDTYPE} && \
 		${COPYTREE_SHARE} "locales resources" ${DATADIR}
+	${INSTALL_DATA} ${WRKDIR}/chromium-browser.desktop ${DESKTOPDIR}
 	${LN} -sf ${DATADIR}/chrome ${PREFIX}/bin

Added: head/www/chromium/files/chromium-browser.desktop.in
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/chromium/files/chromium-browser.desktop.in	Wed May 29 08:41:47 2013	(r319360)
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Exec=chrome %U

Modified: head/www/chromium/pkg-plist
--- head/www/chromium/pkg-plist	Wed May 29 08:30:12 2013	(r319359)
+++ head/www/chromium/pkg-plist	Wed May 29 08:41:47 2013	(r319360)
@@ -1,4 +1,5 @@
svn-ports-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 8 Rene Ladan freebsd_committer 2013-11-11 13:51:15 UTC
I wonder if this PR can be closed (i.e., how specific is this to
Chromium on FreeBSD) ?
Comment 9 Lawrence Chen 2013-11-27 19:18:53 UTC
While the patch that went in didn't solve getting along with other
browsers on who wants to be default.

It did address the issues that were probably the specific to Chromium on
FreeBSD.  In not losing that it was default after an update (at least on
my system and a friend's), and making the "Create Application Shortcut"
feature work.

So, this can probably be closed.

On 11/11/2013 07:51, René Ladan wrote:
> I wonder if this PR can be closed (i.e., how specific is this to
> Chromium on FreeBSD) ?

  Name: Lawrence "The Dreamer" Chen      Email: beastie@tardisi.com
 Snail: 1530 College Ave, A5              Blog: http://lawrencechen.net
        Manhattan, KS 66502-2768         Phone: 785-789-4132
Comment 10 Rene Ladan freebsd_committer 2013-11-27 21:42:36 UTC
State Changed
From-To: feedback->closed

Closed at submitters request