View Full Version : widgets on bottom
kernel_panic
18th August 2007, 22:05
how can i set widgets on the bottom on desktop?
not on top, under all other windows. on linux
and if it somebody knows, how can i get the desktop wallet?
or how can i grab a virtual Desktop, which only has the desktop wallet?
jpn
24th August 2007, 13:15
how can i set widgets on the bottom on desktop?
not on top, under all other windows. on linux
Try _NET_WM_STATE_BELOW (http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html#id2522991).
kernel_panic
7th September 2007, 23:36
how can i use this with Qt? with python.
jpn
9th September 2007, 09:03
I can't say about Python but in C++ you could do something like this:
#include <QApplication>
#include <QWidget>
#include <QX11Info>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
QWidget widget;
widget.setWindowTitle("Bottom");
widget.show();
Display* display = QX11Info::display();
Atom state = XInternAtom(display, "_NET_WM_STATE", True);
Atom below = XInternAtom(display, "_NET_WM_STATE_BELOW", True);
XEvent event;
event.xclient.type = ClientMessage;
event.xclient.message_type = state;
event.xclient.display = display;
event.xclient.window = widget.winId();
event.xclient.format = 32;
event.xclient.data.l[0] = 1; // turn on
event.xclient.data.l[1] = below;
event.xclient.data.l[2] = 0l;
event.xclient.data.l[3] = 0l;
event.xclient.data.l[4] = 0l;
XSendEvent(display, QX11Info::appRootWindow(), False,
(SubstructureRedirectMask | SubstructureNotifyMask), &event);
return a.exec();
}
GuS
11th September 2007, 18:31
Hi!
Could someone translate this to PyQt?
Thanks in advance.
Cheers.
jpn
15th September 2007, 11:24
I'm no python-xlib export but here's something that should get you pretty close ;)
import sys
from PyQt4 import QtGui
from Xlib import X, display, protocol
app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
widget.setWindowTitle("Bottom")
widget.show()
disp = display.Display()
state = disp.intern_atom("_NET_WM_STATE")
below = disp.intern_atom("_NET_WM_STATE_BELOW")
data = [1, below, 0, 0, 0]
event = protocol.event.ClientMessage(
window = widget.winId(),
client_type = state,
data = (32, data))
disp.send_event(disp.screen().root, event,
(X.SubstructureRedirectMask | X.SubstructureNotifyMask))
sys.exit(app.exec_())
GuS
19th October 2007, 21:07
Hi!!
First thanks to translate it to Python language.
Second, this code does absolutely nothing, but if i change the import Xlib line as:
from Xlib import X
from Xlib.protocol import display
from Xlib.protocol.request import *
I get this error:
state = display.intern_atom("_NET_WM_STATE")
AttributeError: Display instance has no attribute 'intern_atom'
My code:
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
app.setQuitOnLastWindowClosed(False)
mainApp = OpenCoffee_Client()
mainApp.show()
## Colocamos la aplicación por debajo de las demás ventanas y eliminamos la entrada en el taskbar.
## Para esto es necesario usar las caracterÃ*sticas del servidor X, importando la librerÃ*a xlib de python.
## TODO: seguir trabajando en esto
display = display.Display(":0")
state = display.intern_atom("_NET_WM_STATE")
placeBelow = display.intern_atom("_NET_WM_STATE_BELOW")
hideTaskbar = display.intern_atom("_NET_WM_STATE_SKIP_TASKBAR")
data = [1, placeBelow, hideTaskbar, 0, 0]
event = protocol.event.ClientMessage(window = mainApp.winId(), client_type = state, data = (32, data))
disp.send_event(disp.screen().root, event, (X.SubstructureRedirectMask | X.SubstructureNotifyMask))
sys.exit(app.exec_())
Just in case, the full code is in here: http://opencoffee.lnxteam.org/trac/browser/trunk/opencoffee-client
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.