Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Brave not recognzied as a browser by Ubuntu #4034

Closed
alexwykoff opened this issue Sep 15, 2016 · 16 comments
Closed

Brave not recognzied as a browser by Ubuntu #4034

alexwykoff opened this issue Sep 15, 2016 · 16 comments
Labels
OS/unix-like/linux shell-integration Integrating brave with OS-level UI features.

Comments

@alexwykoff
Copy link
Contributor

Did you search for similar issues before submitting this one?
Yes

Describe the issue you encountered:
While testing #3776 I found that Brave was not recognized by the system as a browser which could become default.

Expected behavior:
Ubuntu should be able to recognize Brave as a browser and users should be able to set it as a default.

  • Platform (Win7, 8, 10? macOS? Linux distro?):
    Ubuntu
  • Brave Version:
    0.12.1 rc2
  • Steps to reproduce:
    1. Install Brave on Ubuntu
    2. Open System Settings
    3. Open Defaults
    4. Attempt to set Brave as the default browser
  • Screenshot if needed:
    screen shot 2016-09-15 at 2 32 53 pm
  • Any related issues:
@alexwykoff alexwykoff added this to the 0.12.2dev milestone Sep 15, 2016
@nerdy-sam
Copy link

This actually works for me in Ubuntu 15.10 and...
Brave: 0.12.1
Electron: 1.3.15
libchromiumcontent: 52.0.2743.116
V8: 5.2.361.49
Node.js: 6.3.0
Update Channel: dev

@bbondy
Copy link
Member

bbondy commented Sep 17, 2016

@alexwykoff were you for sure using the updated 0.12.1?

@bbondy bbondy modified the milestones: 0.12.3dev, 0.12.2dev Sep 17, 2016
@nerdy-sam
Copy link

Yes, the latest release...

@da2x
Copy link
Contributor

da2x commented Sep 25, 2016

@Mitzip, can you locate the file brave.desktop (not sure about the installation path on Ubuntu) on your system and paste its contents here?

See #3776.

@nerdy-sam
Copy link

nerdy-sam commented Sep 25, 2016

$ dpkg-query -L brave | grep desktop
/usr/share/applications/brave.desktop

$ dpkg-query -L brave | grep desktop | xargs cat
[Desktop Entry]
Name=brave
Comment=Brave laptop and desktop browser
GenericName=brave
Exec=brave %U
Icon=brave
Type=Application
StartupNotify=true
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;

screenshot 2016-09-25 14 03 54

@willy-b
Copy link
Contributor

willy-b commented Sep 25, 2016

This has been working for me on Ubuntu 14.04 since #2839

@willy-b
Copy link
Contributor

willy-b commented Sep 25, 2016

Whoops, I stand corrected. It is not showing as an option for defaults right now on my machine either... now I feel crazy.
The version of Brave I have installed via package is out of date (I run from repo), so I'm running CHANNEL=dev npm run build-installer for 0.12.2 now to see if anything changes.

My brave.desktop file has the MimeType updates, though: (nice shell-fu, @Mitzip!)

$ dpkg-query -L brave | grep desktop | xargs cat
[Desktop Entry]
Name=brave
Comment=Brave laptop and desktop browser
GenericName=brave
Exec=brave %U
Icon=brave
Type=Application
StartupNotify=true
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;

@willy-b
Copy link
Contributor

willy-b commented Sep 25, 2016

OK, I'm only a little crazy. This was fixed with #2839 , and the brave.desktop file is fine:
braveisavailableasdefault

I had manually renamed /usr/bin/brave (to make sure I didn't run a release version instead of DEV by accident) and the Ubuntu Unity Details panel only lists applications it can find the binary for.

When Brave was missing before, unity-control-center info couldn't find brave:

$ strace -f -e trace=file unity-control-center info 2>&1 | grep brave
[pid  2342] openat(AT_FDCWD, "/usr/share/applications/brave.desktop~", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOTDIR (Not a directory)
[pid  2342] open("/usr/share/applications/brave.desktop", O_RDONLY) = 13
[pid  2342] access("/usr/local/sbin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid  2342] access("/usr/local/bin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid  2342] access("/usr/sbin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid  2342] access("/usr/bin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid  2342] access("/sbin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid  2342] access("/bin/brave", X_OK)  = -1 ENOENT (No such file or directory)

Soft linking my dev Brave to /usr/bin/brave made it show up in the list again.

@bbondy bbondy removed this from the 0.12.3dev milestone Sep 26, 2016
@willy-b
Copy link
Contributor

willy-b commented Sep 26, 2016

@alexwykoff , is this still an issue?

If so, can you run the commands from @Mitzip and myself and paste the result here?

  1. dpkg-query -L brave | grep desktop | xargs cat
  2. strace -f -e trace=file unity-control-center info 2>&1 | grep brave

(#2 could have a lot of output, so perhaps just lines around open("/usr/share/applications/brave.desktop", O_RDONLY) to show that unity-control-center is finding brave.desktop and your brave binary)

@alexwykoff
Copy link
Contributor Author

Yep, still an issue on my VM.

test@test:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

test@test:~$ dpkg-query -L brave | grep desktop | xargs cat
[Desktop Entry]
Name=brave
Comment=Brave laptop and desktop browser
GenericName=brave
Exec=brave %U
Icon=brave
Type=Application
StartupNotify=true
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;

test@test:$ strace -f -e trace=file unity-control-center info 2>&1 | grep brave[pid 4545] open("/usr/share/applications/brave.desktop", O_RDONLY) = 13
[pid 4545] access("/home/test/bin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid 4545] access("/home/test/.local/bin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid 4545] access("/usr/local/sbin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid 4545] access("/usr/local/bin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid 4545] access("/usr/sbin/brave", X_OK) = -1 ENOENT (No such file or directory)
[pid 4545] access("/usr/bin/brave", X_OK) = 0
[pid 4545] stat("/usr/bin/brave", {st_mode=S_IFREG|0775, st_size=75054016, ...}) = 0
test@test:
$

@willy-b
Copy link
Contributor

willy-b commented Sep 26, 2016

Thanks @alexwykoff!
Man, I can't reproduce this -- or understand this given your brave.desktop file.

Here's why I am surprised you're not seeing it (maybe it will help).
The apps that show up in "Default application" for a category are determined 100% by GtkAppChooserButton [1] given a content_type to filter by.
For the "Web" category, that is "x-scheme-handler/http" (see preferred_app_infos below).

The content_type for each category is defined in a DefaultAppData struct called preferred_app_infos[] which has one entry for each Application type [2]
That entry maps to 3 properties content_type, label, and extra_type_filter [3].
(N.B. extra_type_filter is NOT used for filtering apps included as default options.)
The dropdown list itself is a standard GtkAppChooserButton given only the content_type property of the DefaultAppData object [4] . (see line of code [5])

Since your brave.desktop entry has x-scheme-handler/http (whole file is identical to mine) I don't get why it isn't showing up.

References:
[1] GtkAppChooserButton: https://people.gnome.org/~ryanl/gtk/html/GtkAppChooserButton.html
[2] preferred_app_infos[]: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/unity-control-center/wily/annotate/head:/panels/info/cc-info-panel.c#L854
[3] DefaultAppData struct defn: http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/unity-control-center/wily/annotate/head:/panels/info/cc-info-panel.c#L86
[4] GtkAppChooserButton#gtk_app_chooser_button_new: https://people.gnome.org/~ryanl/gtk/html/GtkAppChooserButton.html#gtk-app-chooser-button-new
[5] gtk_app_chooser_button_new (data->content_type): http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/wily/unity-control-center/wily/annotate/head:/panels/info/cc-info-panel.c#L840

@cndouglas cndouglas added the shell-integration Integrating brave with OS-level UI features. label Jan 27, 2017
@cndouglas
Copy link

Not reproducible with Brave 0.12.15 on Linux Ubuntu 16.04:
image

@luixxiul
Copy link
Contributor

@liunkae did you install Brave via apt?

@cndouglas
Copy link

@luixxiul I installed via the downloadable .deb file on brave.com.

@luixxiul
Copy link
Contributor

OK then let's close this if you cannot repro the issue @alexwykoff

@cndouglas
Copy link

Closing for now.

@luixxiul luixxiul added this to the Backlog milestone Jan 29, 2017
@bbondy bbondy modified the milestone: Backlog Feb 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
OS/unix-like/linux shell-integration Integrating brave with OS-level UI features.
Projects
None yet
Development

No branches or pull requests

7 participants