dispvm: close all windows after apps prerun (#872)
Killing Xorg makes "unclean" termination of applications. Some apps (Firefox) complains about that at next startup.
This commit is contained in:
parent
eeb66ad8e9
commit
fd42d99803
1
Makefile
1
Makefile
@ -64,6 +64,7 @@ install-vm:
|
||||
install -d $(DESTDIR)/usr/lib/yum-plugins/
|
||||
install -m 0644 misc/yum-qubes-hooks.py* $(DESTDIR)/usr/lib/yum-plugins/
|
||||
install -D -m 0644 misc/yum-qubes-hooks.conf $(DESTDIR)/etc/yum/pluginconf.d/yum-qubes-hooks.conf
|
||||
install -D misc/close-window $(DESTDIR)/usr/lib/qubes/close-window
|
||||
|
||||
install -d $(DESTDIR)/var/lib/qubes
|
||||
|
||||
|
1
misc/.gitignore
vendored
1
misc/.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
meminfo-writer
|
||||
xenstore-watch
|
||||
close-window
|
||||
|
@ -1,8 +1,10 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -Wextra -Werror -g -O3
|
||||
all: xenstore-watch python
|
||||
all: xenstore-watch python close-window
|
||||
xenstore-watch: xenstore-watch.o
|
||||
$(CC) -o xenstore-watch xenstore-watch.o -lxenstore
|
||||
close-window: close-window.c
|
||||
$(CC) -lX11 -o $@ $<
|
||||
python:
|
||||
python -m compileall .
|
||||
python -O -m compileall .
|
||||
|
31
misc/close-window.c
Normal file
31
misc/close-window.c
Normal file
@ -0,0 +1,31 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int close_window(Display *d, XID window) {
|
||||
XClientMessageEvent ev;
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
ev.type = ClientMessage;
|
||||
ev.display = d;
|
||||
ev.window = window;
|
||||
ev.format = 32;
|
||||
ev.message_type = XInternAtom(d, "WM_PROTOCOLS", False);
|
||||
ev.data.l[0] = XInternAtom(d, "WM_DELETE_WINDOW", False);;
|
||||
return XSendEvent(ev.display, ev.window, True, 0, (XEvent *) & ev);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
Display *d;
|
||||
|
||||
d = XOpenDisplay(NULL);
|
||||
if (!d)
|
||||
exit(1);
|
||||
for (i=1; i<argc; i++) {
|
||||
close_window(d, strtoul(argv[i], NULL, 0));
|
||||
}
|
||||
XSync(d, False);
|
||||
XCloseDisplay(d);
|
||||
return 0;
|
||||
}
|
@ -27,6 +27,10 @@ done
|
||||
|
||||
ps ax > /tmp/dispvm-prerun-proclist.log
|
||||
|
||||
echo "Closing windows..."
|
||||
/usr/lib/qubes/close-window `xwininfo -root -children|tail -n +7 |awk '{print $1}'`
|
||||
sleep 1
|
||||
|
||||
if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
|
||||
cp -af /rw/home/user /home/
|
||||
else
|
||||
|
@ -373,6 +373,7 @@ rm -f %{name}-%{version}
|
||||
/usr/lib/qubes/vm-file-editor
|
||||
/usr/lib/qubes/wrap-in-html-if-url.sh
|
||||
/usr/lib/qubes/iptables-yum-proxy
|
||||
/usr/lib/qubes/close-window
|
||||
/usr/lib/yum-plugins/yum-qubes-hooks.py*
|
||||
/usr/sbin/qubes-firewall
|
||||
/usr/sbin/qubes-netwatcher
|
||||
|
Loading…
Reference in New Issue
Block a user