Last active
August 21, 2018 18:37
-
-
Save benad/f864e339c9b1c148f0f8 to your computer and use it in GitHub Desktop.
Run opendesktop.org-style *.desktop files (usually located under ~/.local/share/applications) from the command-line. This is only a bare-bones omplementation. Useful on a Mac. See http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html .
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
my $cmd; | |
my $path; | |
while (<>) { | |
if (/^Exec=(.*)/) { | |
$cmd = $1; | |
$cmd =~ s{\\\\}{\\}g; | |
$cmd =~ s{\\`}{`}g; | |
$cmd =~ s{\\\$}{\$}g; | |
} | |
if (/^Path=(.*)/) { | |
$path = $1; | |
} | |
} | |
if ($cmd) { | |
if ($path) { | |
chdir($path); | |
} | |
system($cmd); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment