this post was submitted on 09 Apr 2024
214 points (95.0% liked)

Linux

47950 readers
1806 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

For example, I'm using Debian, and I think we could learn a thing or two from Mint about how to make it "friendlier" for new users. I often see Mint recommended to new users, but rarely Debian, which has a goal to be "the universal operating system".
I also think we could learn website design from.. looks at notes ..everyone else.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 83 points 6 months ago* (last edited 6 months ago) (9 children)

All distros, or none: flatpak has to improve in regards to launching an app from terminal. Following is a joke:

flatpak run com.github.iwalton3.jellyfin-media-player
[–] [email protected] 24 points 6 months ago (2 children)

Why can’t the installation create aliases like

flatpak run jellyfin-media-player ? And then highlight conflicts during?

[–] [email protected] 9 points 6 months ago

It would also be nice if it could alias to the normal command, for example, LibreOffice with CLI commands like lowriter or localc.

Did you know you can evoke LibreOffice from the terminal to convert one file format to another? It can do what Pandoc does, but also works on old .doc files. Flatpak's weird CLI behavior makes it difficult to use though.

[–] [email protected] 8 points 6 months ago* (last edited 6 months ago)

Ask the devs. I haven't bothered asking so far. There's fp https://github.com/DLopezJr/fp but I don't like workaround if it's easily fixed upstream and it's not like they wouldn't know that it's bullshit. Maybe they can't decide upon a solution. Or are waiting for another important and relevant update.

Edit: https://github.com/flatpak/flatpak/issues/994

[–] [email protected] 11 points 6 months ago* (last edited 6 months ago) (2 children)

This is extremely simple to fix with scripts that can be automatically created on install time. Here is a quick script I just wrote. It will search for first matching app and run it. Just save the script as flatrun, give it executable bit and put it into $PATH. Run it as like this: flatrun freetube

#!/usr/bin/env bash

# flatrun e
# flatrun freetube

if [ "${#}" -eq 0 ]; then
	flatpak list --app --columns=name,application
else
	app="$(
		flatpak list --app --columns=name,application |
			grep -i -F "${@}" |
			awk -F'\t' '{print $2}'
	)"

	if [ -z "${app}" ]; then
		flatpak list --app --columns=name,application
	elif [[ "$(echo "${app}" | wc -l)" -gt 1 ]]; then
		echo "${app}"
	else
		flatpak run "${app}"
	fi
fi

Edit: Just updated the script to output the list of matching apps, if it matches more than one.

[–] [email protected] 7 points 6 months ago (2 children)

Yes and I did a similar script but "just create a script" is a really bad solution.

Apps should need to declare a shortname and flatpak should have a shortcut for those with a separated command like flatrun.

[–] [email protected] 4 points 6 months ago (1 children)

I personally don't think that creating a script is a bad solution. The entire Linux eco system is based around composable components (especially when we talk about terminal commands). Most of the Flatpak applications are available through GUI menus (.desktop files) and that's the focus of Flatpak. And I think it's a design decision not to expose every application as a separate program in the $PATH by default. This way there is less of a chance to collide with anything random on the system, if they have the same name.

Having said this, I still agree it would be beneficial for most users if there was a way to automatically create scripts in a special bin folder, that is available in the $PATH. The problem is, what application name should it have? What about different versions of the same program? The entire Flatpak concept was not designed for this, so creating a script for your personal use is not a bad solution.

[–] [email protected] 2 points 6 months ago (1 children)

Repeating, apps should need to declare a shortname. I think my script currently has no mechanism for detecting duplicates

[–] [email protected] 4 points 6 months ago

Please read my reply before you repeat. How should the different versions of an application be handled? What if the shortname is already taken? There will be collisions, which the longname tries to solve. Flatpak is not a repository where all names can be checked against, this is the job of a repository like Flathub. What about different versions of an application?

This is not a simple case of forcing to specify shortnames.

[–] [email protected] 1 points 6 months ago (1 children)

I think a good solution would to just have that script autogenerated by the flatpak, honestly.

[–] [email protected] 3 points 6 months ago

That would mean the app has access to the path, which was explained as insecure in another place

[–] [email protected] 4 points 6 months ago* (last edited 6 months ago)

That's super. Thanks for sharing.

[–] [email protected] 11 points 6 months ago (1 children)

It’d be dangerous if an installed app claimed to be something like sudo or bash. Even if a mechanism was created for flatpak apps to claim a single shell command, there is no centralized authority on all flatpak apps to vet them. If there was for flathub, and each uploaded package was checked, that still leaves every other non-flathub flatpak repo which must implement the same vetting. Because there’s no way to guarantee to do it safely, and because flatpak devs are unwilling to compromise, this is just what we get.

https://github.com/flatpak/flatpak/issues/1188

[–] [email protected] 3 points 6 months ago* (last edited 6 months ago)

However in the same way, compromised flatpak app can also put a malicious .desktop file in ~/.share/applications, which also allows execution of arbitrary command, even outside of the flatpak sandbox.

User home permission is just incredibly dangerous on linux, I think we need special permission to explicitly allow access to these folders in home. Fortunately more and more app starts to support portal, which makes them much more secure.

Although, I do wish portal would have a access per session vs access forever option. For now if you open a folder through portal, the app was granted r/w permission to that folder forever.

[–] [email protected] 10 points 6 months ago (2 children)

flatpak run com.github.iwalton3.jellyfin-media-player

You can use /var/lib/flatpak/exports/bin/com.github.iwalton3.jellyfin-media-player instead. and then create aliases or symlinks (for example in ~/bin/) for that.

[–] [email protected] 2 points 6 months ago

Wow I was not aware of that folder! Thanks.

[–] [email protected] 2 points 6 months ago

@lemmyreader @barbara it’s a bit annoying but I kinda like that I have to manually link it a bit. So I create sh scripts in the usr/local/bin that just execute the flatpak run command

[–] [email protected] 4 points 6 months ago

https://github.com/boredsquirrel/flatalias

Or my PR for that, that makes aliases on every login. I just have to fix it to work with user flatpaks as well: https://github.com/bjoern-tantau/flatalias/tree/patch-1

[–] [email protected] 3 points 6 months ago

It would be pretty neat if they did like zsh does, where it asks you if you mean a certain command when you only type it partially.

[–] [email protected] 1 points 6 months ago

You can create a alisis

[–] [email protected] 1 points 6 months ago

you're missing a directory from your PATH if you have to do that. flatpak Has friendly names

[–] [email protected] -3 points 6 months ago

There's a reason security people don't use flatpak, but that's not it.