He’s not your buddy, friend!
ooo that looks nice! I’ll try it once I need to unrust my script skills again, thanks for the help!
It’s fixed now! At first I researched a little more and found about the desktop-file-validate
cli utility from the desktop-file-utils
package, and it did tell me a lot about the syntax errors I was making with the exec command.
But as you wisely suggested, dealing with those escaping rules was a bit too bothersome for my use case, so I ended going the bash script route which worked flawlessly at last! So thank you for pointing that out!
Here’s the final .desktop file for anyone interested:
[Desktop Entry]
Type=Service
MimeType=image/png;image/jpg;image/jpeg;image/ico;image/heic;image/svg+xml;image/webp;
Actions=topng;tojpg;toico;towebp
X-KDE-Submenu=Convert Image Format
Icon=viewimage
[Desktop Action topng]
Name=To Png
Exec=/home/myuser/.local/share/kio/servicemenus/scripts/convert-image.sh %f png
Icon=viewimage
[Desktop Action tojpg]
Name=To Jpg
Exec=/home/myuser/.local/share/kio/servicemenus/scripts/convert-image.sh %f jpg
Icon=viewimage
[Desktop Action toico]
Name=To Ico
Exec=/home/myuser/.local/share/kio/servicemenus/scripts/convert-image.sh %f ico
Icon=viewimage
[Desktop Action towebp]
Name=To Webp
Exec=/home/myuser/.local/share/kio/servicemenus/scripts/convert-image.sh %f webp
Icon=viewimage
and the bash script coupled with it:
#!/bin/bash
FILE="${1}"
FORMAT="${2}"
# Check if magick is installed
if ! command -v magick &> /dev/null; then
echo "Error: magick command not found. Please install ImageMagick."
exit 1
fi
# Check if FILE exists
if [[ ! -f "$FILE" ]]; then
echo "File not found: $FILE"
exit 1
fi
DIRECTORY=$(dirname "$FILE")
# Get the file name by looking for the longest match starting from the beginning of the string up to the last dot.
FILENAME=$(basename "$FILE" .${FILE##*.})
# Convert the file format using magick
magick "$FILE" -format "$FORMAT" "$DIRECTORY/$FILENAME.$FORMAT"
If I understood correctly, I made the changes as you said like this:
Exec=sh -c "FILE=\"%f\"; DIRECTORY=\"$(dirname \"$FILE\")\"; FILENAME=\"${FILE%.*}\"; magick \"$FILE\" -format png \"$DIRECTORY/$FILENAME.png\""
Now when I click on the service menu option this error popup appears:
Syntax error in command sh -c "FILE=%f; DIRECTORY=$(dirname $FILE); FILENAME=${FILE%.*}; magick $FILE\ -format png $DIRECTORY/$FILENAME.png" coming from
It seems escaping the double quotes doesn’t actually escape the backlash with it?
I then tried escaping those new backlashes like this
Exec=sh -c "FILE=\\"%f\\"; DIRECTORY=\\"$(dirname \\"$FILE\\")\\"; FILENAME=\\"${FILE%.*}\\"; magick \\"$FILE\\" -format png \\"$DIRECTORY/$FILENAME.png\\""
and now Dolphin doesnt complain about syntax, but the new converted image doesn’t get made :(
For anyone wanting to relive the minecraft 7th gen console experience on PC, I suggest you give the Legacy4J mod a try, specially with the Re-Console Modpack. I had lots of fun revisiting the old tutorial worlds
Haha, I’m in a better position now thankfully. It just caught me by surprise how I could relate to that page from time to time.
That vimeo link of the spanish tv crew coverage doesn’t seem to work for me. Do you happen to have any mirror of it?
Tux is in need of a glass of wine to handle all those pesky windows households
Checking your battery percentage by using neofetch is wildd
I’ll add that to the list of ice cream flavors i wouldn’t like trying along with this one
Fallout New Vegas! I’m really enjoying all the characters that I have met so far, but I’m starting to realize that villifying factions right from the start isn’t the best idea when trying to get to new places
Haha yeah everyone starts somewhere. I think if it wasn’t for the pandemic and the free time it gave my I would still be really bad at the game. But apart from getting better and better, I also find it fun to discover new music through random multiplayer lobbies, going into lazer and putting all the quirky mods I can or even trying to map new levels of some songs that I personally like. I truly think past the otaku stuff osu! has a lot of great stuff to check out, specially for a ftp game.
Bingo bango bongo, bish bash bosh
Wouldn’t it put Firefox on a pickle? Say Chrome gets bought out of Google’s hands, would they still bother to pay half a billion to Firefox to stay as the default search engine? Could Firefox survive being financially independent?
I know this question is a year old, but I’m just discovering that this community is on lemmy so I guess it’s better late than never!
So it is not just a cosmetic mode. With the classic mod, your slider head click timing is a lot more forgiving than on normal lazer. You can try it yourself: if you click on a slider somewhat early or late it still registers as a great or 300. This is how it’s done on the classic version of osu!
I don’t know why it started this way, but maybe it was because Osu! Tatakae! Ouendan (the ds game osu! is based on) also registered acc like that too.
IIRC, the pp (performance points) system now awards you for playing without classic mode as it is, well, more challenging this way. So take that in mind if you want to climb the osu! leaderboard.
Has it fixed the markdown inconsistencies yet? Last time I tried the app for lemmy all the spoiler boxes I saw just didnt work
I’ve got to try #1