Xlib: XCreateSimpleWindow steal steals focus - linux

I have a question regarding the XCreateSimpleWindow function in Xlib.
I have a small screen on my graphical panel, which steals the keyboard input once this function gets called, and does not allow me to navigate/do anything, on the rest of the screen, e.g. use keys to navigate in the menu or similar.
The small screen is used for video streaming, and I have tried to use the function XSetInputFocus on the parent window, but that does not seem to help. I would be grateful if somebody could give me some ideas on how to solve this issue. Please let me know if more info is needed.

Related

Writing panels/docks with pyQt

I want to write something like a taskbar/dock/panel(like tint2,...) with pyQt5.
I know how to write regular GUI applications with it, but my tiling window manager(herbstluftwm) maximizes my panels and openbox makes them resizable etc.
My question : How can I make pyQt show my application as a panel instead of a window? I haven't found anything about that in the documentation.
Thank you.
Thanks to musicamente's help, i could find that the function setWindowFlags() is what I need. It allows to change the behavior of a window.
A website explaining this function is https://pythonprogramminglanguage.com/pyqt5-window-flags/

Hide window (pywinauto)

import pywinauto
from pywinauto.application import Application
PATH = 'c:/Users/User/PycharmProjects/InviterChannel/Telegram/Telegram.exe'
app = Application().start(PATH)
app.Telegram.ClickInput(coords=(330, 530)) # This is what the user should not see
Is it possible to hide the window while continuing to click in it?
How to do it?
The task is to hide from the user what the algorithm does (keyboard input, mouse clicks, etc.)
Both .click_input() and .type_keys() methods require active window.
There is only workaround for keyboard input that is sometimes possible for minimized window (after app.Telegram.minimize()):
.send_keys() and .send_keystrokes() (the difference may appear for some special keys that may work or may not).
I haven't heard about similar possibilities for mouse actions. Maybe app.Telegram.move_window(x=-1000, y=-1000) would help. The window will have negative coordinates. It will be in focus, but invisible to user. So usual .click_input() and .type_keys() should work, but these actions may bother a user. So you'll have to remember mouse cursor (by win32api.GetCursorPos()) and get it back by win32api.SetCursorPos(...) quickly. Also need to switch focus back to previous active window.
P.S. I'm in doubt moving Telegram window would work, because it's not movable by hands as far as I remember. They made some defense against this probably. :)

Python: Click by coordinate inside a window

The goal of the program i'm trying to write is a bot that can click and play flash games and press keys inside a window webpage even when I do not have the window selected. My question is very similar to this. What I want to know is how to use win32, selenium, and PIL to take screenshots, analyze the screenshots, and click and press buttons accordingly from the bot. I've looked through the win32api documentation and found little about how to click inside a window in the background.
If someone could give a link to someone who has done this before or just a little nudge in the right direction would be amazing!
pywinauto is even simpler, but it may not recognize Flash controls. The code should just look a bit shorter:
import pywinauto
app = pywinauto.Application().connect(path='process_name.exe')
app.MainDialog.click_input(coords=(953, 656))
To check which controls are visible:
app.MainDialog.print_control_identifiers()
P.S. If you work with Python 3.x, this clone is compatible with Py3.
If your goal is detecting and interacting with images on screen, you might want to take a look at Sikuli. This is exactly what it does. Sikuli automates anything you see on the screen. It uses image recognition to identify and control GUI components. It is especially useful when there is no easy access to a GUI's internal or source code. More info here.

slide-in animation while opening new applications in linux

I am looking to achieve the following :
when an application stars up, I want it to slide in from the left of the screen
Is this possible to do in linux ? How do I go about achieving it ? I could not find any resources online, so if anyone could point me in the right direction, that would be great.
I am open to programming a solution for this too. It would be great if i can get an answer on how to program something like this.
Presumably you have control over the placement of the window. Place the window off screen, then set up a loop that moves it over one pixel at a time. Exactly how to do that depends on your GUI toolkit.

fb request dialog appearing party out of window

I am asking for help, we have a request dialog in our app, but it appears partly out of the screen so its croped a bit on the right side.
We would like to center it so it wouldn`t be croped. Would anyone know how to fix that please?
Thanks
I had the same problem. I'm not sure about the way how to position dialog itself. IMHO it can also depend on location of click event. Anyway, I've found ugly, but quite functional way to fix it with JavaScript:
setInterval("$('.fb_dialog').css('left', '0');", 1500);
The dialog itself cannot be repositioned.
Are you using iframes in your code by any chance?
Try changing the width in your CSS file to something smaller and see if it makes a difference. The Request Dialog usually positions itself in the middle of a page by detecting the size of the page / frame.

Resources