forked from Ravenports/Ravenports
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xdg-utils
408 lines (352 loc) · 13.2 KB
/
xdg-utils
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# Buildsheet autogenerated by ravenadm tool -- Do not edit.
NAMEBASE= xdg-utils
VERSION= 1.1.3
KEYWORDS= devel
VARIANTS= standard
SDESC[standard]= Basic desktop integration functions
HOMEPAGE= https://www.freedesktop.org/wiki/Software/xdg-utils/
CONTACT= nobody
DOWNLOAD_GROUPS= main
SITES[main]= http://portland.freedesktop.org/download/
DISTFILE[1]= xdg-utils-1.1.3.tar.gz:main
DF_INDEX= 1
SPKGS[standard]= single
OPTIONS_AVAILABLE= none
OPTIONS_STANDARD= none
BUILD_DEPENDS= minixmlto:single:standard
BUILDRUN_DEPENDS= hicolor-icon-theme:single:standard
USES= gmake
XORG_COMPONENTS= xprop xset
LICENSE= MIT:single
LICENSE_FILE= MIT:{{WRKSRC}}/LICENSE
LICENSE_SCHEME= solo
FPC_EQUIVALENT= devel/xdg-utils
MUST_CONFIGURE= gnu
CONFIGURE_ENV= XMLTO={{LOCALBASE}}/bin/minixmlto
post-patch:
${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \
${WRKSRC}/scripts/xdg-*
[FILE:394:descriptions/desc.single]
xdg-utils is a set of tools that allows applications to easily integrate
with the desktop environment of the user, regardless of the specific
desktop environment that the user runs.
About half of the tools focus on tasks commonly required during the
installation of a desktop application and the other half focuses on
integration with the desktop environment while the application is running.
[FILE:101:distinfo]
d798b08af8a8e2063ddde6c9fa3398ca81484f27dec642c5627ffcaa0d4051d9 297170 xdg-utils-1.1.3.tar.gz
[FILE:295:manifests/plist.single]
bin/
xdg-desktop-icon
xdg-desktop-menu
xdg-email
xdg-icon-resource
xdg-mime
xdg-open
xdg-screensaver
xdg-settings
share/man/man1/
xdg-desktop-icon.1.gz
xdg-desktop-menu.1.gz
xdg-email.1.gz
xdg-icon-resource.1.gz
xdg-mime.1.gz
xdg-open.1.gz
xdg-screensaver.1.gz
xdg-settings.1.gz
[FILE:1959:patches/patch-scripts_xdg-desktop-menu.in]
--- scripts/xdg-desktop-menu.in.orig 2016-01-27 22:06:06.661844000 +0100
+++ scripts/xdg-desktop-menu.in 2016-01-27 22:08:30.057702000 +0100
@@ -67,7 +67,7 @@
for MIME in $mimetypes ; do
xdg_default_dirs="$XDG_DATA_DIRS"
- [ -n "$xdg_default_dirs" ] || xdg_default_dirs=/usr/local/share/:/usr/share/
+ [ -n "$xdg_default_dirs" ] || xdg_default_dirs=%%LOCALBASE%%/share/:/usr/share/
if [ x"$mode" = x"user" ] ; then
xdg_user_dir="$XDG_DATA_HOME"
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
@@ -110,7 +110,7 @@
xdg_user_dir="$xdg_user_dir/$xdg_dir_name"
xdg_system_dirs="$XDG_CONFIG_DIRS"
- [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/etc/xdg
+ [ -n "$xdg_system_dirs" ] || xdg_system_dirs=%%LOCALBASE%%/etc/xdg
xdg_global_dir=
for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
if [ -w $x/$xdg_dir_name ] ; then
@@ -475,7 +475,7 @@
xdg_user_dir="$xdg_user_dir/$xdg_dir_name"
xdg_system_dirs="$XDG_DATA_DIRS"
-[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+[ -n "$xdg_system_dirs" ] || xdg_system_dirs=%%LOCALBASE%%/share/:/usr/share/
xdg_global_dir=
for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
if [ -w $x/$xdg_dir_name ] ; then
@@ -542,7 +542,7 @@
xdg_user_dir="$xdg_user_dir/$xdg_dir_name"
xdg_system_dirs="$XDG_DATA_DIRS"
-[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+[ -n "$xdg_system_dirs" ] || xdg_system_dirs=%%LOCALBASE%%/share/:/usr/share/
xdg_global_dir=
for x in `echo $xdg_system_dirs | sed 's/:/ /g'` ; do
if [ -w $x/$xdg_dir_name ] ; then
@@ -556,7 +556,7 @@
[ -w $kde_global_dir ] || kde_global_dir=
gnome_user_dir="$HOME/.gnome/apps"
-gnome_global_dir="/usr/share/gnome/apps"
+gnome_global_dir="%%LOCALBASE%%/share/gnome/apps"
[ -w $gnome_global_dir ] || gnome_global_dir=
DEBUG 3 "Install locations for *.desktop files:"
[FILE:1593:patches/patch-scripts_xdg-email.in]
--- scripts/xdg-email.in.orig 2017-05-08 12:12:18 UTC
+++ scripts/xdg-email.in
@@ -34,7 +34,7 @@ run_thunderbird()
{
local THUNDERBIRD MAILTO NEWMAILTO TO CC BCC SUBJECT BODY ATTACH
THUNDERBIRD="$1"
- MAILTO=$(echo "$2" | sed 's/^mailto://')
+ MAILTO=$(echo "$2" | tr '&' '\n')
echo "$MAILTO" | grep -qs "^?"
if [ "$?" = "0" ] ; then
MAILTO=$(echo "$MAILTO" | sed 's/^?//')
@@ -48,7 +48,7 @@ run_thunderbird()
BCC=$(/bin/echo -e $(echo "$MAILTO" | grep '^bcc=' | sed 's/^bcc=//;s/%\(..\)/\\x\1/g' | awk '{ printf "%s,",$0 }'))
SUBJECT=$(echo "$MAILTO" | grep '^subject=' | tail -n 1)
BODY=$(echo "$MAILTO" | grep '^body=' | tail -n 1)
- ATTACH=$(/bin/echo -e $(echo "$MAILTO" | grep '^attach=' | sed 's/^attach=//;s/%\(..\)/\\x\1/g' | awk '{ printf "%s,",$0 }' | sed 's/,$//'))
+ ATTACH=$(for attachment in $(echo "$MAILTO" | sed -ne 's,^attach=,file://,gp') ; do printf "%s," "$attachment" ; done); ATTACH=${ATTACH%,}
if [ -z "$TO" ] ; then
NEWMAILTO=
@@ -314,7 +314,7 @@ LC_ALL="$ORIG_LC_ALL"
options=
mailto=
-utf8="iconv -t utf8"
+utf8="iconv -t UTF-8"
while [ $# -gt 0 ] ; do
parm="$1"
shift
@@ -455,7 +455,7 @@ fi
if [ x"$BROWSER" = x"" ]; then
BROWSER=www-browser:links2:elinks:links:lynx:w3m
if has_display; then
- BROWSER=x-www-browser:firefox:iceweasel:seamonkey:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
+ BROWSER=x-www-browser:firefox:iceweasel:seamonkey:mozilla:epiphany:konqueror:chrome:chromium-browser:google-chrome:$BROWSER
fi
fi
[FILE:525:patches/patch-scripts_xdg-icon-resource.in]
--- scripts/xdg-icon-resource.in.orig 2016-01-27 22:13:25.171381000 +0100
+++ scripts/xdg-icon-resource.in 2016-01-27 22:13:51.264266000 +0100
@@ -222,7 +222,7 @@
xdg_global_dir=
xdg_global_prefix=
xdg_system_dirs="$XDG_DATA_DIRS"
-[ -n "$xdg_system_dirs" ] || xdg_system_dirs="/usr/local/share/:/usr/share/"
+[ -n "$xdg_system_dirs" ] || xdg_system_dirs="%%LOCALBASE%%/share/:/usr/share/"
for x in `echo "$xdg_system_dirs" | sed 's/:/ /g'`; do
if [ -w "$x/$xdg_dir_name" ] ; then
xdg_global_prefix="$x/icons"
[FILE:1863:patches/patch-scripts_xdg-mime.in]
--- scripts/xdg-mime.in.orig 2017-05-08 12:12:18 UTC
+++ scripts/xdg-mime.in
@@ -318,7 +318,7 @@ defapp_fallback()
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
xdg_system_dirs="$XDG_DATA_DIRS"
- [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+ [ -n "$xdg_system_dirs" ] || xdg_system_dirs=%%LOCALBASE%%/share/:/usr/share/
preference=-1
desktop_file=""
@@ -401,7 +401,7 @@ defapp_generic()
xdg_user_dir="$XDG_DATA_HOME"
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
xdg_system_dirs="$XDG_DATA_DIRS"
- [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+ [ -n "$xdg_system_dirs" ] || xdg_system_dirs=%%LOCALBASE%%/share/:/usr/share/
local oldifs="$IFS" dir
@@ -500,7 +500,7 @@ case $1 in
;;
esac
check_input_file "$filename"
- filename=`readlink -f -- "$filename"`
+ filename=`stat -f "$filename"`
;;
default)
@@ -702,7 +702,7 @@ xdg_user_dir="$XDG_DATA_HOME"
xdg_user_dir="$xdg_user_dir/$xdg_dir_name"
xdg_system_dirs="$XDG_DATA_DIRS"
-[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+[ -n "$xdg_system_dirs" ] || xdg_system_dirs=%%LOCALBASE%%/share/:/usr/share/
for x in `echo $xdg_system_dirs | sed 's/:/ /g'`; do
if [ -w $x/$xdg_dir_name ] ; then
[ x"$mode" = x"system" ] && xdg_base_dir="$x/mime"
@@ -734,7 +734,7 @@ DEBUG 3 "kde_global_dir: $kde_global_dir
# TODO: Gnome legacy support
# See http://forums.fedoraforum.org/showthread.php?t=26875
gnome_user_dir="$HOME/.gnome/apps"
-gnome_global_dir=/usr/share/gnome/apps
+gnome_global_dir=%%LOCALBASE%%/share/gnome/apps
[ -w $gnome_global_dir ] || gnome_global_dir=
DEBUG 3 "gnome_user_dir: $gnome_user_dir"
DEBUG 3 "gnome_global_dir: $gnome_global_dir"
[FILE:2001:patches/patch-scripts_xdg-open.in]
--- scripts/xdg-open.in.orig 2017-05-08 12:12:18 UTC
+++ scripts/xdg-open.in
@@ -15,6 +15,12 @@
#
#---------------------------------------------
+# If we are started from a Linux app with LD_PRELOAD set unset that
+# so native apps (like browers) won't fail to start.
+if [ "x$(uname)" = "xLinux" ]; then
+ unset LD_PRELOAD
+fi
+
manualpage()
{
cat << _MANUALPAGE
@@ -92,7 +98,7 @@ file_url_to_path()
if [ -x /usr/bin/printf ]; then
printf=/usr/bin/printf
fi
- file=$($printf "$(echo "$file" | sed -e 's@%\([a-f0-9A-F]\{2\}\)@\\x\1@g')")
+ file=$(echo "$file" | unvis -h)
fi
echo "$file"
}
@@ -246,6 +252,17 @@ open_flatpak()
fi
}
+open_lumina()
+{
+ lumina-open "$1"
+
+ if [ $? -eq 0 ]; then
+ exit_success
+ else
+ exit_failure_operation_failed
+ fi
+}
+
#-----------------------------------------
# Recursively search .desktop file
@@ -327,7 +344,7 @@ open_generic_xdg_mime()
[ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
xdg_system_dirs="$XDG_DATA_DIRS"
- [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+ [ -n "$xdg_system_dirs" ] || xdg_system_dirs=%%LOCALBASE%%/share/:/usr/share/
DEBUG 3 "$xdg_user_dir:$xdg_system_dirs"
for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do
@@ -415,7 +432,7 @@ open_generic()
if [ x"$BROWSER" = x"" ]; then
BROWSER=www-browser:links2:elinks:links:lynx:w3m
if has_display; then
- BROWSER=x-www-browser:firefox:iceweasel:seamonkey:mozilla:epiphany:konqueror:chromium:chromium-browser:google-chrome:$BROWSER
+ BROWSER=x-www-browser:firefox:iceweasel:seamonkey:mozilla:epiphany:konqueror:chrome:chromium:chromium-browser:google-chrome:$BROWSER
fi
fi
@@ -507,6 +524,10 @@ case "$DE" in
open_mate "$url"
;;
+ lumina)
+ open_lumina "$url"
+ ;;
+
xfce)
open_xfce "$url"
;;
[FILE:519:patches/patch-scripts_xdg-screensaver.in]
--- scripts/xdg-screensaver.in.orig 2016-01-27 22:18:04.068869000 +0100
+++ scripts/xdg-screensaver.in 2016-01-27 22:18:32.024901000 +0100
@@ -27,7 +27,9 @@
#@xdg-utils-common@
# Check if we can use "mv -T"
-if mv -T ... ... 2>&1 | grep '\.\.\.' > /dev/null ; then
+# FreeBSD mv doesn't support this, so supress scary messages in the terminal
+#if mv -T ... ... 2>&1 | grep '\.\.\.' > /dev/null ; then
+if false; then
# We can securely move files in /tmp with mv -T
DEBUG 1 "mv -T available"
MV="mv -T"
[FILE:569:patches/patch-scripts_xdg-settings.in]
--- scripts/xdg-settings.in.orig 2017-05-08 12:12:18 UTC
+++ scripts/xdg-settings.in
@@ -399,7 +399,7 @@ check_xfce_desktop_file()
# "Type" must be "X-XFCE-Helper"
# "X-XFCE-Category" must be "WebBrowser" (for web browsers, anyway)
# "X-XFCE-Commands" and "X-XFCE-CommandsWithParameter" must be set
- search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
+ search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-%%LOCALBASE%%/share:/usr/share}"
IFS=:
for dir in $search; do
unset IFS
[FILE:2305:patches/patch-scripts_xdg-utils-common.in]
--- scripts/xdg-utils-common.in.orig 2017-05-08 12:12:18 UTC
+++ scripts/xdg-utils-common.in
@@ -22,7 +22,7 @@ first_word()
# map a binary to a .desktop file
binary_to_desktop_file()
{
- search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
+ search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-%%LOCALBASE%%/share:/usr/share}"
binary="`which "$1"`"
binary="`readlink -f "$binary"`"
base="`basename "$binary"`"
@@ -52,7 +52,7 @@ binary_to_desktop_file()
# map a .desktop file to a binary
desktop_file_to_binary()
{
- search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
+ search="${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-%%LOCALBASE%%/share:/usr/share}"
desktop="`basename "$1"`"
IFS=:
for dir in $search; do
@@ -300,6 +300,44 @@ detectDE()
XFCE)
DE=xfce
;;
+ Lumina)
+ DE=lumina
+ ;;
+ X-Generic)
+ DE=generic
+ ;;
+ esac
+ fi
+
+# xxx PCDM_SESSION check here?
+ if [ -n "${PCDM_SESSION}" ]; then
+ case "${PCDM_SESSION}" in
+ # only recently added to menu-spec, pre-spec X- still in use
+ CINNAMON)
+ DE=cinnamon;
+ ;;
+ ENLIGHTENMENT)
+ DE=enlightenment;
+ ;;
+ # GNOME, GNOME-Classic:GNOME, or GNOME-Flashback:GNOME
+ GNOME*)
+ DE=gnome;
+ ;;
+ KDE)
+ DE=kde;
+ ;;
+ LXDE)
+ DE=lxde;
+ ;;
+ MATE)
+ DE=mate;
+ ;;
+ XFCE)
+ DE=xfce
+ ;;
+ LUMINA)
+ DE=lumina
+ ;;
X-Generic)
DE=generic
;;
@@ -316,6 +354,8 @@ detectDE()
elif xprop -root 2> /dev/null | grep -i '^xfce_desktop_window' >/dev/null 2>&1; then DE=xfce
elif echo $DESKTOP | grep -q '^Enlightenment'; then DE=enlightenment;
elif [ x"$LXQT_SESSION_CONFIG" != x"" ]; then DE=lxqt;
+ #Simple fallback for non-XDG window managers if Lumina is installed in the normal place (no heavy runtime dependencies)
+ elif [ -x "%%LOCALBASE%%/bin/lumina-open" ]; then DE=lumina;
fi
fi