Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
da367622
Commit
da367622
authored
Nov 24, 2006
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Nov 27, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineshelllink: Use FreeDesktop standard to create Wine menu structure.
parent
ada881ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
110 additions
and
144 deletions
+110
-144
wineshelllink
tools/wineshelllink
+110
-144
No files found.
tools/wineshelllink
View file @
da367622
...
...
@@ -4,6 +4,7 @@
# This is used by the IShellLink interface
#
# Copyright 2000 Alexandre Julliard
# Copyright 2006 Vitaliy Margolen
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
...
...
@@ -22,8 +23,7 @@
# Note that the link is a relative unix-style path name. Since the / character
# is not valid in Windows filenames it is an adequate separator to show the
# menu structure. (This program may need to split the menu structure out for
# implementing xdg-style menus)
# menu structure.
mode
=
""
args
=
""
...
...
@@ -82,176 +82,142 @@ if [ -z "$link" ] ; then
usage
fi
kde
_entry
()
desktop
_entry
()
{
xname
=
`
basename
"
$link
"
`
cat
<<
EOF
# KDE Config File
[KDE Desktop Entry]
Name=
$xname
Exec=wine '
$path
'
$args
Type=Application
Comment=
$descr
EOF
[
-z
"
$workdir
"
]
||
echo
"Path=
\"
$workdir
\"
"
[
-z
"
$xpmicon
"
]
||
echo
"Icon=
$xpmicon
"
}
gnome_entry
()
{
xname
=
`
basename
"
$link
"
`
cat
<<
EOF
[Desktop Entry]
Name=
$
x
name
Name=
$
link
name
Exec=wine "
$path
"
$args
Type=Application
Comment=
$descr
EOF
[
-z
"
$descr
"
]
||
echo
"Comment=
$descr
"
[
-z
"
$workdir
"
]
||
echo
"Path=
$workdir
"
[
-z
"
$xpmicon
"
]
||
echo
"Icon=
$xpmicon
"
}
mdk
_entry
()
directory
_entry
()
{
base
=
`
basename
"
$link
"
`
section
=
`
dirname
"
$link
"
`
[
-z
"
$icon
"
]
||
xicon
=
"icon=
\"
$xpmicon
\"
"
pathmenu
=
`
echo
"
$path
"
|
sed
's+\\\\+\\\\\\\\+g'
`
echo
"?package(local.Wine):needs=x11 section=
\"
/Wine/
$section
\"
title=
\"
$base
\"
longtitle=
\"
$descr
\"
command=
\"
wine '
$pathmenu
'
$args
\"
$xicon
"
cat
<<
EOF
[Desktop Entry]
Type=Directory
EOF
if
[
"
$1
"
==
"wine"
]
;
then
echo
"Name=Wine"
echo
"Icon=wine"
else
echo
"Name=
$1
"
echo
"Icon=folder"
fi
}
# copy the icon file to a specified dir and set xpmicon to the resulting path
copy_icon
()
{
dir
=
"
$1
"
mkdir
-p
"
$dir
"
mkdir
-p
"
$dir
/""
`
dirname
"
$link
"
`
"
||
true
if
[
-f
"
$icon
"
]
then
cp
"
$icon
"
"
$dir
/
$link
.xpm"
xpmicon
=
"
$dir
/
$link
.xpm"
else
xpmicon
=
""
fi
if
[
-f
"
$icon
"
]
then
xpmicon
=
`
basename
"
$icon
"
.xpm
`
mkdir
-p
"
$1
"
cp
"
$icon
"
"
$1
/
$xpmicon
.xpm"
else
xpmicon
=
""
fi
}
# Debian/Mandrake
type
update-menus
>
/dev/null 2>&1
if
[
$?
=
0
-a
$mode
=
"menu"
]
then
iconname
=
"
`
basename
"
$link
"
`
.xpm"
dir
=
"
$HOME
/.menu/icons"
if
[
-f
"
$icon
"
]
then
mkdir
-p
"
$dir
"
cp
"
$icon
"
"
$dir
/
$iconname
"
xpmicon
=
"
$dir
/
$iconname
"
else
xpmicon
=
""
fi
mdk_entry
>>
"
$HOME
/.menu/wine"
if
[
-d
"/usr/lib/menu"
]
&&
[
-w
"/usr/lib/menu"
]
then
mdk_entry
>>
"/usr/lib/menu/wine"
fi
update-menus
>
/dev/null 2>&1
fi
# XDG
# KDE
xdg_config_dir
=
"
${
XDG_CONFIG_HOME
:-
$HOME
/.config
}
/menus/applications-merged"
xdg_data_dir
=
"
${
XDG_DATA_HOME
:-
$HOME
/.local/share
}
"
if
[
-d
"
$HOME
/.kde"
]
then
kdeversion
=
0
if
type
kde-config
>
/dev/null 2>&1
then
kdeversion
=
`
kde-config
-v
|
grep
KDE: |
sed
-n
"s/^KDE:
\(
[^.]*
\)\.
.*
$/
\1
/p"
`
fi
# Create common directories
mkdir
-p
"
$xdg_config_dir
"
mkdir
-p
"
$xdg_data_dir
/desktop-directories"
if
[
$kdeversion
-ge
2
]
then
copy_icon
"
$HOME
/.kde/share/applnk/Wine"
if
[
$mode
=
"menu"
]
then
gnome_entry
>
"
$HOME
/.kde/share/applnk/Wine/
$link
.desktop"
elif
[
-d
"
$HOME
/Desktop"
]
then
gnome_entry
>
"
$HOME
/Desktop/
$link
.desktop"
get_menu_entries
()
{
tmp
=
"
$xdg_config_dir
/
$1
.menu"
if
[
-r
"
$tmp
"
]
;
then
awk
'
BEGIN { RS="<" }
/^Filename/ {
if (match($0,/>/)) {
print substr($0,RSTART+1)
}
}'
$tmp
fi
else
copy_icon
"
$HOME
/.kde/share/applnk/Wine"
if
[
$mode
=
"menu"
]
then
kde_entry
>
"
$HOME
/.kde/share/applnk/Wine/
$link
.kdelnk"
}
# KDE 1.x kludge. Wake up KDE, if we can find kpanel running
type
kwmcom
>
/dev/null 2>/dev/null
&&
\
ps u
-C
kpanel
>
/dev/null 2>/dev/null
&&
\
kwmcom kpanel:restart
# Input
# menu file name
# new item
write_menu_file
()
{
tmpfile
=
`
mktemp
`
(
echo
'<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"'
echo
'"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd">'
echo
'<Menu>'
echo
' <Name>Applications</Name>'
IFS
=
"-"
fullname
=
'wine'
for
i
in
$1
;
do
echo
" <Menu>"
echo
" <Name>
$fullname
-
$i
</Name>"
echo
" <Directory>
$fullname
-
$i
.directory</Directory>"
dir_file_name
=
"
$xdg_data_dir
/desktop-directories/
$fullname
-
$i
.directory"
if
[
!
-f
"
$dir_file_name
"
]
;
then
directory_entry
"
$i
"
>
"
$dir_file_name
"
fi
test
"
$i
"
=
"wine"
||
fullname
=
"
$fullname
-
$i
"
done
echo
" <Include>"
IFS
=
"
"
for
i
in
$(
get_menu_entries
"
$1
"
)
;
do
test
"
$i
"
=
"
$2
"
&&
continue
echo
" <Filename>
$i
</Filename>"
done
# New record
echo
" <Filename>
$2
</Filename>"
echo
" </Include>"
IFS
=
'-'
for
i
in
$1
;
do
echo
" </Menu>"
done
echo
'</Menu>'
)
>
$tmpfile
chmod
0600
$tmpfile
mv
-f
$tmpfile
"
$xdg_config_dir
/
$1
.menu"
}
elif
[
-d
"
$HOME
/Desktop"
]
then
kde_entry
>
"
$HOME
/Desktop/
$link
.kdelnk"
# KDE 1.x kludge: wake up KDE, if we can find kfm running...
type
kfmclient
>
/dev/null 2>/dev/null
&&
\
ps u
-C
kfm
>
/dev/null 2>/dev/null
&&
\
kfmclient refreshDesktop
fi
fi
fi
if
[
-d
"
$HOME
/.kde2"
]
then
copy_icon
"
$HOME
/.kde2/share/applnk/Wine"
if
[
$mode
=
"menu"
]
then
gnome_entry
>
"
$HOME
/.kde2/share/applnk/Wine/
$link
.desktop"
else
if
[
-d
"
$HOME
/Desktop2"
]
then
gnome_entry
>
"
$HOME
/Desktop2/
$link
.desktop"
fi
if
[
-d
"
$HOME
/Desktop"
]
then
gnome_entry
>
"
$HOME
/Desktop/
$link
.desktop"
fi
fi
fi
copy_icon
"
$xdg_data_dir
/icons"
if
[
-d
"
$HOME
/.kde3/share/applnk"
]
then
copy_icon
"
$HOME
/.kde3/share/applnk/Wine"
if
[
$mode
=
"menu"
]
then
gnome_entry
>
"
$HOME
/.kde3/share/applnk/Wine/
$link
.desktop"
else
if
[
-d
"
$HOME
/Desktop3"
]
then
gnome_entry
>
"
$HOME
/Desktop3/
$link
.desktop"
fi
if
[
-d
"
$HOME
/Desktop2"
]
then
gnome_entry
>
"
$HOME
/Desktop2/
$link
.desktop"
fi
if
[
-d
"
$HOME
/Desktop"
]
then
gnome_entry
>
"
$HOME
/Desktop/
$link
.desktop"
linkname
=
`
basename
"
$link
"
`
if
[
$mode
=
"menu"
]
;
then
mkdir
-p
"
$xdg_data_dir
/applications/wine/
`
dirname
"
$link
"
`
"
linkpath
=
`
dirname
"
$link
"
|
sed
's!/!-!g'
`
if
[
"
$linkpath
"
==
"."
]
;
then
linkpath
=
""
else
linkpath
=
"-
$linkpath
"
fi
fi
fi
# Gnome
if
[
-d
"
$HOME
/.gnome"
]
then
copy_icon
"
$HOME
/.gnome/apps/Wine"
if
[
$mode
=
"menu"
]
then
gnome_entry
>
"
$HOME
/.gnome/apps/Wine/
$link
.desktop"
elif
[
-d
"
$HOME
/.gnome-desktop"
]
then
gnome_entry
>
"
$HOME
/.gnome-desktop/
$link
.desktop"
fi
desktop_entry
>
"
$xdg_data_dir
/applications/wine/
$link
.desktop"
write_menu_file
"wine
$linkpath
"
"wine
$linkpath
-
$linkname
.desktop"
else
desktop_entry
>
"
$HOME
/Desktop/
$linkname
.desktop"
fi
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment