Home > Software engineering >  How do you get a launcher for firefox?
How do you get a launcher for firefox?

Time:09-29

I hope that I'm tagging/asking on the correct page. I'm Using Linux Mint 6.0, but it could be OS independent.

So the used command for installing Firefox was

nix-env -iA nixpkgs.firefox-esr

When I type which firefox, I get:

/home/foo/.nix-profile/bin/firefox

So Linux Mint comes with Chrome preinstalled, which has a launcher, e.g. also in the start menu. How do I get that for firefox as well? I didn't find a tool to create such a launcher in Mint and I actually think, that nix should do that for me.

Edit Chrome Launcher

EDIT: I also found this page which seemed helpful and advertised e.g. the KDE Kickoff, but I wasn't able to get that one to run.

CodePudding user response:

Imho, the most direct way is to just create a simple bash script:

#!/bin/bash
./home/foo/.nix-profile/bin/firefox & #Run Firefox
echo Firefox was started with PID $!

In order to make it runnable, enter chmod x your_skript_name.sh then. ./firefox 2> /dev/null & can be used instead to run it silently.

You can also consider the developer/command line options for firefox (Archive) or this blog article here.


Maybe /usr/bin/menulibre is also the right application, it allows you to create .desktop files. This app can also be found by right-clicking on the start "menu".

CodePudding user response:

I can only speak for Ubuntu launchers, but other distros will have launcher files that will have a similar setup

TLDR, add ~/.nix-profile/share to XDG_DATA_DIRS env variable on login. Add the following to ~/.profile after nix loading commands

export XDG_DATA_DIRS=$HOME/.nix-profile/share:$XDG_DATA_DIRS

Explanation:

Installed packages via nix will have an immutable path in nix/store. ~/.nix-profile/bin/firefox is the derivation your current nix environment is linked to (if you update the firefox package, it'll point to the new one)

This means you can create a launcher file for that executable. Lets see if the firefox-esr derivation comes with a desktop launcher or not:

$ nix-build '<nixpkgs>' -A firefox-esr

This will build the package and give you a derivation path. For my current channel it is /nix/store/3iipcmiykgr4p34fg3rkicdz1bw584gm-firefox-102.2.0esr

If I check inside it, there is a .desktop file which defines Ubuntu launchers:

$ ls /nix/store/3iipcmiykgr4p34fg3rkicdz1bw584gm-firefox-102.2.0esr/share/applications
firefox.desktop

These files will also be available under ~/.nix-profile/share/applications so you can simply add that to XDG_DATA_DIRS env variable before boot

If an application did not have one, you can manually make one and add it under ~/.local/share/applications, then set the executable path to the nix one

  • Related