xdg-utils/0019-xdg-settings-convert-multi-group-desktop-file-to-XFC.patch

42 lines
1.9 KiB
Diff
Raw Normal View History

2014-09-20 14:12:26 +00:00
From 190448845baaccf68154e7d03392c74cbe163505 Mon Sep 17 00:00:00 2001
From: Ken Neighbors <ken@nsds.com>
Date: Fri, 19 Sep 2014 09:29:49 -0700
Subject: [PATCH 19/22] xdg-settings: convert multi-group desktop file to XFCE
WebBrowser helper file
When generating an XFCE helper file for the default WebBrowser, the
XFCE keys cannot always simply be appended to the end of the file, but
must be placed in the first group under "[Desktop Entry]". (A desktop
file can contain additional group headers, such as
"X-Ayatana-Desktop-Shortcuts" groups.)
---
scripts/xdg-settings.in | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/scripts/xdg-settings.in b/scripts/xdg-settings.in
index eaed991..460ffc9 100644
--- a/scripts/xdg-settings.in
+++ b/scripts/xdg-settings.in
@@ -407,13 +407,15 @@ check_xfce_desktop_file()
# Found a file to convert.
target="${XDG_DATA_HOME:-$HOME/.local/share}/xfce4/helpers"
mkdir -p "$target"
- grep -v "^Type=" "$file" > "$target/$1"
- echo "Type=X-XFCE-Helper" >> "$target/$1"
+ # Copy file up to first "Exec=" line.
+ sed -e 's/^Type=.*/Type=X-XFCE-Helper/' -e '/^Exec[=[]/,$d' "$file" > "$target/$1"
echo "X-XFCE-Category=WebBrowser" >> "$target/$1"
# Change %F, %f, %U, and %u to "%s".
- command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/%[FfUu]/"%s"/g'`"
+ command="`grep -E "^Exec(\[[^]=]*])?=" "$file" | cut -d= -f 2- | sed -e 's/%[FfUu]/"%s"/g' | head -1`"
echo "X-XFCE-Commands=`echo "$command" | first_word`" >> "$target/$1"
echo "X-XFCE-CommandsWithParameter=$command" >> "$target/$1"
+ # Copy rest of file (from first "Exec=" line to end-of-file).
+ sed -n -e 's/^Type=.*/Type=X-XFCE-Helper/' -e '/^Exec[=[]/,$p' "$file" >> "$target/$1"
return
fi
done
--
2.1.0