xlib

Capture and interpret XI2 RawKeyPress event with python

Deadly 提交于 2019-12-01 10:13:04
问题 Self resolved It's posted below as an answer. Trying to get what xinput test-xi2 --root prints with python xlib. Using version 1.9 from github: https://github.com/python-xlib/python-xlib event._data["data"] contents for aaaaoo: a<class 'Xlib.ext.ge.GenericEvent'>(data = b'\t\x00\xa9!v\x17&\x00\x00\x00\t\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', sequence_number = 15, length = 2, evtype = 13, extension = 131, type = 35) <class 'Xlib.ext.ge.GenericEvent'>(data

How to observe changes in connected monitors via Xlib?

为君一笑 提交于 2019-12-01 09:29:15
I'm trying to write a program that would detect external monitors being plugged in and automatically enable and configure them through Xlib. I know that there is XRandr extension that allows this. My question is, how do I enable receiving XRandr events to my application? What event mask should I use? I know that xev app is able to do this. Xev's source code: http://cgit.freedesktop.org/xorg/app/xev/tree/ Or: git clone git://anongit.freedesktop.org/xorg/app/xev For the second part, I issue the configuration directly to nvidia-settings. I've cobbled together the first part from parts that I was

simple window without titlebar

两盒软妹~` 提交于 2019-12-01 07:27:42
问题 Good afternoon everyone! I have been working on a project that requires a basic window without a titlebar. After browsing a bit on the web I came across this post create window without titlebar with a reply mentioning the use of the "_NET_WM_WINDOW_TYPE_DOCK" atom. I attempted to create one in my project using the following code: Display* d = fl_display; XWindow w = XCreateSimpleWindow(d, RootWindow(d, fl_screen), 0, 0, 400, 100, 0, 0x000000, 0x000000); Atom window_type = XInternAtom(d, "_NET

XFetchName always returns 0

可紊 提交于 2019-12-01 06:11:53
im trying to write a C code to get the title of the Active Window in my Linux System, but the Function XFetchName always returnes zero, i also tried XGetWMName, same result... but using xprop, i can see that there is a string in the "WM_NAME" property can anyone tell me whats wrong with my code? #include <X11/Xlib.h> #include <stdio.h> #include <stdarg.h> int main( int argc, char* argv[] ) { Display *display; Window focus; char *window_name; int revert; display = XOpenDisplay(NULL); XGetInputFocus(display, &focus, &revert); int ret = XFetchName(display, focus, &window_name); printf("ret = %d\n

XFetchName always returns 0

允我心安 提交于 2019-12-01 04:42:59
问题 im trying to write a C code to get the title of the Active Window in my Linux System, but the Function XFetchName always returnes zero, i also tried XGetWMName, same result... but using xprop, i can see that there is a string in the "WM_NAME" property can anyone tell me whats wrong with my code? #include <X11/Xlib.h> #include <stdio.h> #include <stdarg.h> int main( int argc, char* argv[] ) { Display *display; Window focus; char *window_name; int revert; display = XOpenDisplay(NULL);

Python: Xlib — How can I raise(bring to top) windows?

南笙酒味 提交于 2019-12-01 04:38:41
问题 I've tried using: win.configure(stack_mode=X.TopIf) win.set_input_focus(X.RevertToParent, X.CurrentTime) However even without any focus loss prevention on my window manager this does not work, does anyone know of another way to do this? Xlib or not. 回答1: There is a command-line tool called wmctrl which allows you to interact with EWMH/NetWM-compatible X window managers. For example, wmctrl -l lists all the windows managed by the window manager, and wmctrl -a Mozilla makes active the first

Get a screenshot of a window that is cover or not visible or minimized with Xcomposite extension for X11

ぐ巨炮叔叔 提交于 2019-12-01 00:47:04
I have the follow starting code to get a screenshot of a X window (the window can be covered, not visibled, or minimized). #include <stdlib.h> #include <stdio.h> #include <X11/Xlib.h> #include <X11/X.h> #include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xrender.h> int main () { Display *display = XOpenDisplay (NULL); XID xid = 90177543; // xdotool search --name "World of Warcraft" | head -1 // Check if Composite extension is enabled int event_base_return; int error_base_return; if (XCompositeQueryExtension (display, &event_base_return, &error_base_return)) printf ("COMPOSITE IS

Get a screenshot of a window that is cover or not visible or minimized with Xcomposite extension for X11

左心房为你撑大大i 提交于 2019-11-30 19:48:19
问题 I have the follow starting code to get a screenshot of a X window (the window can be covered, not visibled, or minimized). #include <stdlib.h> #include <stdio.h> #include <X11/Xlib.h> #include <X11/X.h> #include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xrender.h> int main () { Display *display = XOpenDisplay (NULL); XID xid = 90177543; // xdotool search --name "World of Warcraft" | head -1 // Check if Composite extension is enabled int event_base_return; int error_base_return;

Equivalent of “Invalidate Rect” / “WM_PAINT” in X11

亡梦爱人 提交于 2019-11-30 18:22:52
I'm Porting some code from Windows to XLib. In the windows code, I can force a redraw by calling InvalidateRect and then handling the corresponding WM_PAINT message. However, I am having trouble finding out how to do this in X11/XLib. I see there is an Expose message but not sure if that is the same thing. If it matters, I need to do this to force the window to render at a certain frame rate for an OpenGL based program. You need to handle Expose events. This tutorial explains with an example how to handle Expose events : #include <stdio.h> #include <stdlib.h> #include <X11/Xlib.h> #include

How can I use python xlib to generate a single keypress?

半城伤御伤魂 提交于 2019-11-30 16:06:21
问题 I want to make a very simple python 3 script that will generate a single keypress (F15). I don't want to use a bunch of libraries to do this as I only need one key to be pressed and don't need support for the whole keyboard. I know I need to use KeyPress and KeyRelease in order to generate a keyboard event. I'm just not sure where exactly to start and the documentation is a little confusing. http://tronche.com/gui/x/xlib/events/keyboard-pointer/keyboard-pointer.html http://python-xlib