-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathjumpappify-desktop-entry
More file actions
executable file
·29 lines (21 loc) · 969 Bytes
/
jumpappify-desktop-entry
File metadata and controls
executable file
·29 lines (21 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
if [ "$#" -eq 0 ] || [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
echo "Usage: $(basename "$0") SOMEFILE.desktop
Given a desktop entry file (*.desktop), output a new desktop entry file that
wraps the application's \`Exec\` in a call to jumpapp(1).
EXAMPLES
jumpappify-desktop-entry /usr/share/applications/chromium-browser.desktop \\
> ~/.local/share/applications/chromium-browser.desktop
Or convert multiple in one go:
for entry in /usr/share/applications/{firefox,gnome-terminal}.desktop; do
target=~/\".local/share/applications/\$(basename \"\$entry\")\"
jumpappify-desktop-entry \"\$entry\" >\"\$target\"
done"
exit 0
fi
# Desktop Entry reference: http://standards.freedesktop.org/desktop-entry-spec/latest/index.html
exec perl -pe 'do {
s/^(Name=.*)/\1 (Jump)/;
s/^Exec=(.*)/Exec=jumpapp \1/;
s/^Exec=jumpapp (?=.*%\w)(.*)/Exec=jumpapp -p \1/;
} if /^\[Desktop Entry\]/ ... /^\[.*\]/' "$@"