Skip to content

Instantly share code, notes, and snippets.

@curioswati
Last active March 12, 2024 13:24
Show Gist options
  • Star 59 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save curioswati/668e9e120ddd4b6f8d07dc28b5780d22 to your computer and use it in GitHub Desktop.
Save curioswati/668e9e120ddd4b6f8d07dc28b5780d22 to your computer and use it in GitHub Desktop.
To run flatpak installed apps from dmenu.

To run a flatpak app from dmenu, you can create a symlink for the app in /usr/bin. You can find the flatpak apps binary link in /var/lib/flatpak/exports/bin/ on ubuntu. E.g. to run Rocket Chat (installed from flatpak via software center), you can do something like this:

sudo ln -s /var/lib/flatpak/exports/bin/chat.rocket.RocketChat /usr/bin/rocket-chat

This way you will be able to find it in the dmenu.

Resources:

@fislysandi
Copy link

vmware_Btj2KZUKxX

@fislysandi
Copy link

fislysandi commented Dec 5, 2022

reason why i only need to cut out com. and org. is because sometimes some maintainers like to name their apps org."company"."appname", and org."appname"."company" if spotify and other apps just named like "company"."appname" my modification of the script wouldve been 100 % functional and basically cut out all the pain from flatpaks allowing to launch them without weird naming.

@fislysandi
Copy link

ok ill come back here tomorrow.

@AngelJumbo
Copy link

@fislysandi In general it's not a good idea to have a flatpak named like a regular binary, but if it works for you...... just avoid installing the same app from your regular package manager.

@AngelJumbo
Copy link

reason why i only need to cut out com. and org. is because sometimes some maintainers like to name their apps org."company"."appname", and org."appname"."company" if spotify and other apps just named like "company"."appname" my modification of the script wouldve been 100 % functional and basically cut out all the pain from flatpaks allowing to launch them without weird naming.

btw my script already cuts those parts....

@fislysandi
Copy link

fislysandi commented Dec 7, 2022

hey i did it the other way so the app is named like this FirefoxFlatpak
i just had to change some things and i didnt need cut command

@kliarist
Copy link

Nice one thanks

@fislysandi
Copy link

fislysandi commented Jan 18, 2023

hey does anybody does know how to convert a variable into lowercase? i just need only this and i can post an improved version of flat-bin

the apps will be named like this lowercase(*)flatpak

@alissonzuza
Copy link

alissonzuza commented Feb 13, 2023

In fedora I made this configuration below and when running dmenu it now correctly picks up the bins of the flatpaks
I use i3wm

1.To edit
vi /usr/bin/dmenu_run

  1. Add line export

#!/usr/bin/sh
export PATH=$PATH:/var/lib/flatpak/exports/bin
dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &

Here it worked correctly

When in doubt, do a search where the dmenu_run file is
sudo find / -iname "dmenu_run"

@A350
Copy link

A350 commented Aug 17, 2023

Gracias !!!!

@OnePieceJoker
Copy link

Thanks

@revsuine
Copy link

Lifesaver!

@mlaiseca3
Copy link

I found the path to be as follows:
For system installations, the directory is located at /var/lib/flatpak/exports/bin. For user installations, it’s located at ~/.local/share/flatpak/exports/bin.

thus, my dmenu_run file looked like the following (simlar to alissonzuza's)

#!/usr/bin/sh
export PATH=$PATH:~/.local/share/flatpak/exports/bin
dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &

for context im using dwm and not i3

@alissonzuza
Copy link

Achei o caminho o seguinte: Para instalações do sistema, o diretório está localizado em /var/lib/flatpak/exports/bin. Para instalações do usuário, ele está localizado em ~/.local/share/flatpak/exports/bin.

assim, o meu dmenu_run arquivo ficou com o seguinte (simlar para alissonzuza)

#!/usr/bin/sh
export PATH=$PATH:~/.local/share/flatpak/exports/bin
dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &

para IM de contexto usando DWM e não i3

I believe that to be perfect it could be EXPORT like below
Considering system and user
export PATH=$PATH:/var/lib/flatpak/exports/bin:~/.local/share/flatpak/exports/bin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment