2

On my system, Firefox needs to be started with the option

MOZ_USE_XINPUT2=1 /usr/bin/firefox

in order to get my touchscreen to work with Firefox, while

MOZ_USE_XINPUT2=1 firefox

seems to work fine too.

Now, I would like to add this starting option to the launcher. Ideally,

  • MOZ_USE_XINPUT2=1 /usr/bin/firefox should become the default option;
  • firefox %u should become an additional quicklist-entry;
  • The option (quicklist entry) to launch a new window should remain.
  • The option (quicklist entry) to launch a private window should remain.
  • The custom launcher should persist through Firefox updates.
  • The quicklist toolstips should be multilanguage (english and german)

On my way trying to achieve these things, I fiddled with Alacarte and Menulibre; I modified usr/share/applications/firefox.desktop I copied the modified firefox.desktop to ./local/share/applications/ in order to start Firefox from there. None of that worked, so I did a clean reinstall of Firefox and write this post. The system is Ubuntu 17.04 with GNOME Shell 3.24.2

P.S. I am not sure if those tiny dark-grey boxes are called quicklist in gnome-shell. If not, what I mean is the equivalent of unity-quicklists in gnome-shell, where you can select to launch a new private window, for example.

  • Thsose grey boxes, well you could better call them tooltips or quick-menus. – Videonauth Nov 29 '17 at 1:33
2

First of all copying a .desktop file from /usr/share/applications to ~/.local/share/applications will make the copy overwrite the system wide icon only for you. Means you should in most cases not edit files put into /usr/share/applications copy it first and edit it then in ~/.local/share/applications.

As for how to create such a desktop file for your needs, the contents should look like this:

[Desktop Entry]
Version=1.0
Name=Firefox Web Browser
Comment=Browse the World Wide Web
Comment[de]=Im Internet surfen
GenericName=Web Browser
Keywords=Internet;WWW;Browser;Web;Explorer
Keywords[de]=Internet;WWW;Browser;Web;Explorer;Webseite;Site;surfen;online;browsen
Exec=/bin/bash -c 'export MOZ_USE_XINPUT2=1; firefox %u' 
Terminal=false
Type=Application
Icon=firefox
Categories=GNOME;GTK;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/chrome;video/webm;application/x-xpinstall;
StartupNotify=true
Actions=new-window;new-window-wi;new-private-window;new-private-window-wi;

[Desktop Action new-window]
Name=Open a new Window
Name[de]=Ein neues Fenster öffnen
Exec=/bin/bash -c 'export MOZ_USE_XINPUT2=0; firefox -new-window'

[Desktop Action new-window-wi]
Name=Open a new Touch-Window
Name[de]=Ein neues Touch-Fenster öffnen
Exec=/bin/bash -c 'export MOZ_USE_XINPUT2=1; firefox -new-window'

[Desktop Action new-private-window]
Name=Open a New Private Window
Name[de]=Ein neues privates Fenster öffnen
Exec=/bin/bash -c 'export MOZ_USE_XINPUT2=0; firefox -private-window'

[Desktop Action new-private-window-wi]
Name=Open a New Private Touch-Window
Name[de]=Ein neues privates Touch-Fenster öffnen
Exec=/bin/bash -c 'export MOZ_USE_XINPUT2=1; firefox -private-window'

I left out the language specific strings, except the German ones, so it becomes more clear what needs to be changed.

You can simply make a new file in ~/.local/share/applications by copying the above code field with Ctrl+C then

nano ~/.local/share/applications/firefox.desktop

and pasting in your previous copied code field with Ctrl+Shift+V. To exit editing then simply press Ctrl+X, confirm your write by pressing Y and hit Return to write to the filename given.

Since an update will only overwrite the .desktop file in /usr/share/applications this edit should last through updates. but you need to confirm on major changes that the file is still correct according to the system wide file.

  • check MOZ_USE_XINPUT2=1 /usr/bin/firefox should become the default option;
  • check The option (quicklist entry) to launch a new window should remain.
  • check The option (quicklist entry) to launch a private window should remain.
  • check The custom launcher should persist through Firefox updates.
  • check The quicklist toolstips should be multilanguage (english and german)
  • Sorry to say, but somehow your solution did not work. I created ~/.local/share/applications/firefox.desktop with touch and pasted your code in pluma. Firefox behaved like a fresh install, even after a reboot and replacing the starter in the gnome-shell. When copying the .desktop file with your code to /usr/share/applications and double klicking on it, an error message says "an error occured". Gnome-Shell does not find the browser anymore. (No worries I made a backup of the original file ;) ) – johnnybegood Nov 29 '17 at 2:47
  • Can you provide a pastebin of the actual original file then so i can revise my answer according to it. I tested my solution in Ubuntu 17.10 and it did work. – Videonauth Nov 29 '17 at 2:50
  • Also you could try to put the Exec value lines in ". Example: Exec="MOZ_USE_XINPUT2=1 /usr/bin/firefox" – Videonauth Nov 29 '17 at 2:52
  • pastebin.com/bGfK1iz0 There is the paste, I will try value lines. – johnnybegood Nov 29 '17 at 2:59
  • That is exact an identical file where I started from and based my answer upon. I think leaving out the %u at the default is a bad move tho – Videonauth Nov 29 '17 at 3:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.