Merge remote-tracking branch 'origin/pr/28'
* origin/pr/28: qubes-rpc: fix icon selection using pyxdg and support SVG icons qubes-rpc: fix broken temporary file deletion in qubes.GetImageRGBA Conflicts: qubes-rpc/qubes.GetImageRGBA rpm_spec/core-vm.spec
This commit is contained in:
commit
c615afb88f
1
Makefile
1
Makefile
@ -180,6 +180,7 @@ install-common:
|
|||||||
install qubes-rpc/qvm-copy-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
|
install qubes-rpc/qvm-copy-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
|
||||||
install qubes-rpc/qvm-move-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
|
install qubes-rpc/qvm-move-to-vm.kde $(DESTDIR)$(LIBDIR)/qubes
|
||||||
install qubes-rpc/qvm-move-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
|
install qubes-rpc/qvm-move-to-vm.gnome $(DESTDIR)$(LIBDIR)/qubes
|
||||||
|
install qubes-rpc/xdg-icon $(DESTDIR)$(LIBDIR)/qubes
|
||||||
install qubes-rpc/{vm-file-editor,qfile-agent,qopen-in-vm} $(DESTDIR)$(LIBDIR)/qubes
|
install qubes-rpc/{vm-file-editor,qfile-agent,qopen-in-vm} $(DESTDIR)$(LIBDIR)/qubes
|
||||||
install qubes-rpc/tar2qfile $(DESTDIR)$(LIBDIR)/qubes
|
install qubes-rpc/tar2qfile $(DESTDIR)$(LIBDIR)/qubes
|
||||||
# Install qfile-unpacker as SUID - because it will fail to receive files from other vm
|
# Install qfile-unpacker as SUID - because it will fail to receive files from other vm
|
||||||
|
1
debian/control
vendored
1
debian/control
vendored
@ -19,6 +19,7 @@ Depends:
|
|||||||
initscripts,
|
initscripts,
|
||||||
iptables,
|
iptables,
|
||||||
iptables-persistent,
|
iptables-persistent,
|
||||||
|
librsvg2-bin,
|
||||||
libvchan-xen,
|
libvchan-xen,
|
||||||
locales,
|
locales,
|
||||||
ncurses-term,
|
ncurses-term,
|
||||||
|
@ -1,22 +1,13 @@
|
|||||||
set -e
|
set -e
|
||||||
read filename
|
read filename
|
||||||
|
|
||||||
|
ICON_MAXSIZE=512
|
||||||
|
|
||||||
if [ "${filename%%:*}" = xdgicon ]; then
|
if [ "${filename%%:*}" = xdgicon ]; then
|
||||||
# get biggest icon from hicolor theme
|
filename="$(/usr/lib/qubes/xdg-icon "${filename#*:}" "$ICON_MAXSIZE")"
|
||||||
|
forcesize="$ICON_MAXSIZE"
|
||||||
filename="${filename#*:}.png"
|
|
||||||
candidate=
|
|
||||||
for dir in /usr/share/icons/hicolor/ /usr/share/icons/; do
|
|
||||||
candidate=$(find -L "${dir}" -type f -name "${filename}")
|
|
||||||
if [ -n "${candidate}" ]; then
|
|
||||||
candidate=$(echo "${candidate}" | xargs ls --sort=size | head -1)
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -n "${candidate}" ]
|
|
||||||
filename="${candidate}"
|
|
||||||
|
|
||||||
|
[ -n "${filename}" ]
|
||||||
elif [ "${filename}" = "-" ] || [ "${filename##*:}" = "-" ]; then
|
elif [ "${filename}" = "-" ] || [ "${filename##*:}" = "-" ]; then
|
||||||
tmpfile="$(mktemp /tmp/qimg-XXXXXXXX)"
|
tmpfile="$(mktemp /tmp/qimg-XXXXXXXX)"
|
||||||
cat > "${tmpfile}"
|
cat > "${tmpfile}"
|
||||||
@ -29,11 +20,23 @@ elif ! [ -r "${filename}" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# identify in F18 (6.7) adds implicit '\n' to format,
|
s="$(identify -format '%w %h %m' "$filename")"
|
||||||
# whereas identify in F20 (6.8) does not
|
w="$(echo "$s"|cut -d " " -f 1)"
|
||||||
identify -format '%w %h\n' "$filename" | sed -e '/^$/d'
|
h="$(echo "$s"|cut -d " " -f 2)"
|
||||||
convert -depth 8 "$filename" rgba:-
|
m="$(echo "$s"|cut -d " " -f 3)"
|
||||||
|
if [ "$m" = SVG ]; then
|
||||||
|
if [ -n "$forcesize" ]; then
|
||||||
|
w="$forcesize"
|
||||||
|
h="$forcesize"
|
||||||
|
fi
|
||||||
|
tmpfile2="$(mktemp /tmp/qimg-XXXXXXXX.png)"
|
||||||
|
rsvg-convert -w "$w" -h "$h" -o "$tmpfile2" "$filename"
|
||||||
|
filename="$tmpfile2"
|
||||||
|
fi
|
||||||
|
echo "$w $h"
|
||||||
|
convert -depth 8 -size "${w}x${h}" "$filename" rgba:-
|
||||||
|
|
||||||
[ -n "${tmpfile}" ] && rm -f "${tmpfile}" || true
|
[ -n "${tmpfile}" ] && rm -f "${tmpfile}" || true
|
||||||
|
[ -n "${tmpfile2}" ] && rm -f "${tmpfile2}" || true
|
||||||
|
|
||||||
# vim: ft=sh ts=4 sw=4 et
|
# vim: ft=sh ts=4 sw=4 et
|
||||||
|
21
qubes-rpc/xdg-icon
Executable file
21
qubes-rpc/xdg-icon
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import xdg.IconTheme
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
themes = ['Humanity', 'Adwaita', 'gnome', 'oxygen']
|
||||||
|
themes = themes + sorted([d for d in os.listdir("/usr/share/icons") if d not in themes and os.path.isdir("/usr/share/icons/" + d)])
|
||||||
|
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print "Usage:", sys.argv[0], "ICON SIZE"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
for theme in themes:
|
||||||
|
icon = xdg.IconTheme.getIconPath(sys.argv[1], theme = theme, size = int(sys.argv[2]))
|
||||||
|
if icon is not None:
|
||||||
|
break
|
||||||
|
|
||||||
|
if icon is None:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print icon
|
@ -52,13 +52,14 @@ Requires: initscripts
|
|||||||
# for qubes-desktop-run
|
# for qubes-desktop-run
|
||||||
Requires: pygobject3-base
|
Requires: pygobject3-base
|
||||||
Requires: dbus-python
|
Requires: dbus-python
|
||||||
# for qubes-session-autostart
|
# for qubes-session-autostart, xdg-icon
|
||||||
Requires: pyxdg
|
Requires: pyxdg
|
||||||
%if %{fedora} >= 20
|
%if %{fedora} >= 20
|
||||||
# gpk-update-viewer required by qubes-manager
|
# gpk-update-viewer required by qubes-manager
|
||||||
Requires: gnome-packagekit-updater
|
Requires: gnome-packagekit-updater
|
||||||
%endif
|
%endif
|
||||||
Requires: ImageMagick
|
Requires: ImageMagick
|
||||||
|
Requires: librsvg2-tools
|
||||||
Requires: fakeroot
|
Requires: fakeroot
|
||||||
Requires: desktop-notification-daemon
|
Requires: desktop-notification-daemon
|
||||||
Requires: pygtk2
|
Requires: pygtk2
|
||||||
@ -411,6 +412,7 @@ rm -f %{name}-%{version}
|
|||||||
/usr/lib/qubes/wrap-in-html-if-url.sh
|
/usr/lib/qubes/wrap-in-html-if-url.sh
|
||||||
/usr/lib/qubes/iptables-updates-proxy
|
/usr/lib/qubes/iptables-updates-proxy
|
||||||
/usr/lib/qubes/close-window
|
/usr/lib/qubes/close-window
|
||||||
|
/usr/lib/qubes/xdg-icon
|
||||||
/usr/lib/yum-plugins/yum-qubes-hooks.py*
|
/usr/lib/yum-plugins/yum-qubes-hooks.py*
|
||||||
/usr/lib64/python2.7/site-packages/qubes/xdg.py*
|
/usr/lib64/python2.7/site-packages/qubes/xdg.py*
|
||||||
/usr/sbin/qubes-firewall
|
/usr/sbin/qubes-firewall
|
||||||
|
Loading…
Reference in New Issue
Block a user