Glowup - glow Librem 5 photos up

I am not sure why I did not think about the ModemInfo script. I tried to save the .py file to my Home directory. I may or may not have allowed an execution privilege. However, I could not get it to work with the below entry in ~/.local/share/Applications:

[Desktop Entry]
Name=Glowup
Exec=gnome-terminal -x bash -c “flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --cwd=“pwd” --talk-name=org.freedesktop.Flatpak --command=“/usr/bin/python” org.gnome.Characters glowup.py; exec bash”
StartupNotify=true
Terminal=false
Type=Application
Categories=Utilities;
Icon=/home/purism/.local/share/icons/glow.png

Any thoughts on where I might be going wrong? Perhaps in the “Exec” information above?

1 Like

I haven’t done many of these. How about just:

Exec=flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --cwd="pwd" --talk-name=org.freedesktop.Flatpak --command="/usr/bin/python" org.gnome.Characters glowup.py

?

1 Like

No, neither of the those work. Thank you, though, for the effort.

1 Like

It’s probably something annoyingly simple. For this you could do an AI inquiry to maybe get some pointers, as this is likely syntax related, which AI should handle well.

1 Like

Yep, I agree. I can play with it and report back with any success. I am not sure it matters but, as long as I am in the “glowup” folder on my home directory, I can execute the script I built - but only if I am in the “glowup” folder.

1 Like

If you put the command in an .sh file it might work better. (I don’t know why🤷‍♂️)

2 Likes

Replace glowup.py with the absolute path to glowup.py.

2 Likes

This is probably just a forum thing but note that the double quotes are all butchered in what you posted i.e. straight quotes (") have become curly quotes ( “ ” ) - inconsistently varying between posts.

And it is always sketchy whether something like `pwd` will work in some random config file. I would settle for hard-coding an actual pathname. It doesn’t really make sense anyway to use the current working directory in the context of something that you are intending to launch from the desktop GUI.

2 Likes

BTW. There’s no need to pass --cwd when using absolute path to the script.

1 Like

So something like the above where I added /home/pursim/glowup/.glowup.py ?

1 Like

Seems right (no harm trying). Also, based on the previous comments, you should be able leave out --cwd=“pwd”

1 Like

Nope. I tried leaving out --cwd=“pwd” but that did not help either.

1 Like

As an aside, I wanted to let you know how much I enjoy Glowup. My pictures have greatly improved with this time-saving tool. Thank you very much.

1 Like

I think you somehow put a “.” before “glowup.py” which changes the file name to one that is not there.

2 Likes

Ok, let’s back up and take that command apart. Here’s what the AIs had to suggest:

Assistant A

Excellent catch—this one is a little gnarly, but we can straighten it out. The desktop entry Exec line you posted is tripping over several common pitfalls:


The original:

Exec=gnome-terminal -x bash -c “flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --cwd=“pwd” --talk-name=org.freedesktop.Flatpak --command=“/usr/bin/python” org.gnome.Characters /home/pursim/glowup/.glowup.py; exec bash”

Problems inside it:

  1. Wrong quotation marks
    Those are curly “smart quotes” (“ ”) instead of straight ASCII quotes ("). Desktop files and shells are very picky—they need plain quotes.

  2. -x with gnome-terminal is deprecated
    Modern gnome-terminal no longer supports -x. The correct way is:

    gnome-terminal -- bash -c ...
    
  3. Substitution "pwd"
    You wrote --cwd=“pwd”. That’s a literal string, not a shell substitution. The shell won’t expand it if quoted with "pwd". You need command substitution: --cwd="$(pwd)".

  4. Layered quoting around bash -c
    Since you are already in bash -c "...", you need to carefully manage quotes inside. Each inner --command="/usr/bin/python" must use straight quotes.

  5. Unnecessary exec bash at the end
    If you append ; exec bash, you’re launching a new bash shell after your Flatpak program finishes. This is only useful if you want the terminal to stay open interactively after execution. If that was intentional, that’s fine—just be aware.


A corrected version:

Exec=gnome-terminal -- bash -c "flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --cwd=\"$(pwd)\" --talk-name=org.freedesktop.Flatpak --command='/usr/bin/python' org.gnome.Characters /home/pursim/glowup/.glowup.py; exec bash"

Key fixes:

  • Straight quotes only. Copy-paste smart quotes are the bane of shell commands.
  • Use -- instead of -x with gnome-terminal.
  • Use $(pwd) instead of "pwd".
  • Consistent quoting around paths. Notice how --cwd=\"$(pwd)\" protects spaces properly.

Optional simplification

If you don’t actually need to keep the terminal open afterward, you can drop the trailing ; exec bash:

Exec=gnome-terminal -- bash -c "flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --cwd=\"$(pwd)\" --talk-name=org.freedesktop.Flatpak --command='/usr/bin/python' org.gnome.Characters /home/pursim/glowup/.glowup.py"

So the primary culprit was curly quotes, with a side dish of (-x being obsolete) and incorrect pwd usage. After fixing those, your launcher should behave properly.

Assistant B

Looking at this command, there are several issues that need to be fixed:

Problems Identified:

  1. Incorrect quoting around pwd: The pwd command is inside double quotes, which means it won’t be executed as a command but treated as the literal string “pwd”.

  2. Mismatched application: You’re using org.gnome.Characters (a character map application) but trying to run a Python script, which doesn’t make sense.

  3. Path mismatch: You’re specifying --command="/usr/bin/python" but then trying to run a script at /home/pursim/glowup/.glowup.py which would be outside the flatpak container.

Fixed Version:

Here’s the corrected command:

Exec=gnome-terminal -x bash -c "flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --cwd=$(pwd) --talk-name=org.freedesktop.Flatpak --command=/usr/bin/python org.freedesktop.Sdk//23.08 /home/pursim/glowup/.glowup.py; exec bash"

Or, if you have a specific Python flatpak application:

Exec=gnome-terminal -x bash -c "flatpak run --filesystem=home --socket=session-bus --socket=wayland --device=dri org.freedesktop.Sdk//23.08 python3 /home/pursim/glowup/.glowup.py; exec bash"

Key Changes:

  1. Fixed pwd: Changed from "pwd" to $(pwd) to actually execute the command
  2. Changed application: Replaced org.gnome.Characters with a proper Python runtime like org.freedesktop.Sdk
  3. Simplified permissions: --filesystem=host might be overkill; --filesystem=home is probably sufficient

Alternative Approach:

If you don’t actually need flatpak for this Python script, a simpler approach would be:

Exec=gnome-terminal -x bash -c "cd /home/pursim/glowup && python3 .glowup.py; exec bash"

This would run the Python script directly without the flatpak overhead.

Shared insight seems to be use $(pwd) instead of "pwd" among others. The latter alternatively also suggests skipping the flatpak.

And for testing at least I agree that leaving the hiding (.) from filename for now might be a good idea.

2 Likes

Ok. Thank you. SOLVED. It even shows me icon snippets of my pictures now. Here is what I ended up using:

[Desktop Entry]
Name=Glowup
Exec=gnome-terminal -- bash -c "flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --talk-name=org.freedesktop.Flatpak --command='/usr/bin/python' org.gnome.Characters ~/glowup/glowup.py; exec bash"
StartupNotify=true
Terminal=false
Type=Application
Categories=Utilities;
Icon=/home/purism/.local/share/icons/glow.png
2 Likes
Exec=flatpak run --filesystem=host --socket=session-bus --socket=wayland --device=dri --talk-name=org.freedesktop.Flatpak --command=/usr/bin/python org.gnome.Characters /home/purism/glowup/glowup.py

would be enough (assuming that homedir is /home/purism).

4 Likes

Shows the limitations of AI though.

Doesn’t “understand” that the problem with the double quotes is probably just a forum thing.

Didn’t pick up the likely typo in the name of the Python script (and I think that it’s reasonable to expect that it would pick that up because even nautilus gives you a warning if you try to rename a file so that it now begins with a dot or rename a file whose name already begins with a dot).

The Natural Intelligences are telling the poster not to specify --cwd at all and that, if you do specify it, then, depending on the exact environment and implementation, none of $(pwd) `pwd` ~ will even work.

Note that the poster was not specifying --cwd="pwd" - that was just a forum thing (Discourse butchering the command) and, again, the AI didn’t “understand” that this is just a forum thing.

4 Likes

I just setup glowup on my L5. However, it only grabs 16 of my most recent pictures, out of hundreds. Is there any way to change how it finds them?

3 Likes