You are not logged in.
I want to get the properties of the window under the mouse pointer in OpenBox. For that purpose I am using xdotool to get the window id and pass that to obxprop:
obxprop --id $(xdotool getmouselocation | cut -d: -f 5)The output of this command is nothing. What I am doing wrong?
Last edited by barney (2024-03-29 08:36:15)
Offline
What is the window under the mouse pointer?
The command itself is fine, but not every window has window properties set.
And since you're not just using xprop I suspect this is some popup menu?
Online
What is the window under the mouse pointer?
How to explain what is the window under the mouse pointer? If I have few open windows, if the mouse is within some window (that window needs not to be in focus) that window is under the mouse pointer.
The command itself is fine, but not every window has window properties set.
I know that all the widows on my desktop have some properties set, I can confirm that using the obxprop and xprop commands without the id option.
And since you're not just using xprop I suspect this is some popup menu?
No it is not the popup menu the obxprop command is similar to xprop command. It is interesting that the following command:
xprop -id $(xdotool getmouselocation | cut -d: -f 5)also gives nothing. It is ok for me to use xprop command, it is not needed that the obxconf command must be used.
Offline
How to explain what is the window under the mouse pointer?
xdotool getmouselocation
xwininfo -int -id <the_id_from_above>I know that all the widows on my desktop have some properties set
I know that that is wrong.
The decorated windows you see will for pretty much sure, yes.
All windows? No. Pretty much guaranteed.
Online
How to explain what is the window under the mouse pointer?
xdotool getmouselocation xwininfo -int -id <the_id_from_above>
This gives some properties, but I am not interested in them.
I know that all the widows on my desktop have some properties set
I know that that is wrong.
The decorated windows you see will for pretty much sure, yes.
All windows? No. Pretty much guaranteed.
OK, I can agree with that.
Does the
xdotool getmouselocation returns the id that can be uset with the -id options of the xprop.
I am interested in the "_OB_APP_CLASS(UTF8_STRING)" property and xprop is returning that property.
Offline
This gives some properties, but I am not interested in them.
No, it does not - but it tells you what the window actuall is and the idea was that you post that here.
Online
This gives some properties, but I am not interested in them.
No, it does not - but it tells you what the window actuall is and the idea was that you post that here.
I have impression that you are not giving me all the information about windows. You want I to infer the knowledge that I need. But I can't without your help.
Offline
And we can't really tell you what you're looking for if you do not post the properties you're given.
Generally what seth is likely thinking here. The window you're trying to grab information from is not handled by OB like e.g. a notification bubble or a context menu or some such sort -- as such obxprop will not show you anything because it's looking for a specific set of properties. Trying to give you all the possible answers of what could be the case when you have all the tools at your disposal to give us the information on what is actually the case is a much more fruitful endeavour. And it's more useful to give an explanation if we have all the context of the issue.
Offline
According to the OP xprop is likewise empty, but generally yes - I suspect the OP is testing something they don't perceive as a "window" and that simply has no properties set at all.
@barney, the one sitting on critical information (xwininfo) and not sharing them is /you/.
Online
According to the OP xprop is likewise empty, but generally yes - I suspect the OP is testing something they don't perceive as a "window" and that simply has no properties set at all.
@barney, the one sitting on critical information (xwininfo) and not sharing them is /you/.
I must admit that I don't have enough knowledge to properly explain what I want to achieve.
I will use simple words. Lets say I have two windows (applications) on my desktop, firefox and (Libre Office) writer. In any moment the mouse can be in one of two positions, within firefox (I don't know if this is application or window) or within writer. All I want is when the mouse is within the firefox (this does not mean that firefox is active window), to get the text "firefox", or when it is within writer I want to get the text "writer" all this from terminal emulator.
And I don't know what do you mean by "OP".
Offline
You're the OP and we've a pretty good idea what you want to achive, just not what you're doing there, so please post the xwininfo output (and you can also try to manually get the xprop output, bn. that it'll require you to pass "-int" b/c you're getting the ID in decimal from xdotool)
Fyi, the window under the mouse is the window under the mouse - not the window under the window under the mouse.
If you want to test for general intersection, you'll have to traverse the window tree (or at least check all top level windows) and match their geometry against the cursor position.
Online
The output of
xprop -id $(xdotool getmouselocation | cut -d: -f 5) is empty.
The output from
xwininfo -all -int -id $(xdotool getmouselocation | cut -d: -f 5)is:
xwininfo: Window id: 4225094 (has no name)
Root window id: 628 (the root window) (has no name)
Parent window id: 628 (the root window) (has no name)
24 children:
75497515 "Properties of the window under the mouse pointer in OpenBox / Newbie Corner / Arch Linux Forums — Mozilla Firefox": ("Navigator" "firefox") 1243x1023+1+22 +676+22
2 children:
75497528 (has no name): () 1243x1023+0+0 +676+22
75497516 (has no name): () 1x1+-1+-1 +675+21
4225138 (has no name): () 26x1+1218+1049 +1893+1049
4225137 (has no name): () 26x1+1218+1045 +1893+1045
4225136 (has no name): () 1x25+1244+1025 +1919+1025
4225135 (has no name): () 26x1+1+1049 +676+1049
4225134 (has no name): () 26x1+1+1045 +676+1045
4225133 (has no name): () 1x25+0+1025 +675+1025
4225132 (has no name): () 1191x1+27+1049 +702+1049
4225131 (has no name): () 1191x1+27+1045 +702+1045
4225126 (has no name): () 1243x3+1+1046 +676+1046
4 children:
4225130 (has no name): () 1x3+1217+0 +1893+1046
4225129 (has no name): () 1x3+25+0 +701+1046
4225128 (has no name): () 25x3+1218+0 +1894+1046
4225127 (has no name): () 25x3+0+0 +676+1046
4225118 (has no name): () 1x1000+1244+26 +1919+26
4225117 (has no name): () 1x1000+0+26 +675+26
4225111 (has no name): () 1243x1+1+21 +676+21
4225110 (has no name): () 1x25+1244+1 +1919+1
4225109 (has no name): () 26x1+1219+0 +1894+0
4225108 (has no name): () 26x1+0+0 +675+0
4225107 (has no name): () 1193x1+26+0 +701+0
4225106 (has no name): () 1x25+0+1 +675+1
4225105 (has no name): () 1243x20+1+1 +676+1
12 children:
4225125 (has no name): () 14x14+1189+3 +1865+4
4225124 (has no name): () 16x16+4+2 +680+3
4225123 (has no name): () 14x14+0+0 +676+1
4225122 (has no name): () 14x14+0+0 +676+1
4225121 (has no name): () 14x14+1225+3 +1901+4
4225120 (has no name): () 14x14+1207+3 +1883+4
4225119 (has no name): () 1161x16+24+2 +700+3
4225116 (has no name): () 4x20+1239+0 +1915+1
4225115 (has no name): () 25x3+1218+0 +1894+1
4225114 (has no name): () 4x20+0+0 +676+1
4225113 (has no name): () 25x3+0+0 +676+1
4225112 (has no name): () 1193x3+25+0 +701+1
4225100 (has no name): () 1x1+0+0 +675+0
2 children:
4225102 (has no name): () 1x1+0+0 +675+0
4225101 (has no name): () 1x1+0+0 +675+0
4225099 (has no name): () 1x1+0+0 +675+0
1 child:
4225104 (has no name): () 1x1+0+0 +675+0
4225098 (has no name): () 1x1+0+0 +675+0
4225097 (has no name): () 1x1+0+0 +675+0
1 child:
4225103 (has no name): () 1x1+0+0 +675+0
4225095 (has no name): () 1243x1023+1+22 +676+22
1 child:
4225096 (has no name): () 1243x1023+0+0 +676+22
Absolute upper-left X: 675
Absolute upper-left Y: 0
Relative upper-left X: 675
Relative upper-left Y: 0
Width: 1245
Height: 1050
Depth: 24
Visual: 0x21
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +675+0 -1920+0 -1920-30 +675-30
-geometry 1245x1050+675+0
Bit gravity: ForgetGravity
Window gravity: NorthWestGravity
Backing-store hint: NotUseful
Backing-planes to be preserved: 0xffffffff
Backing pixel: 0
Save-unders: No
Someone wants these events:
ButtonPress
ButtonRelease
EnterWindow
LeaveWindow
SubstructureRedirect
FocusChange
Do not propagate these events:
Override redirection?: No
No window manager hints defined
Window manager hints:
Process id: (unknown)
No normal window size hints defined
No zoom window size hints defined
No window shape defined
No border shape definedWindow under mouse is firefox with this forum thread, and it's position is not changed between the two commands.
Please do not use terminology like "bn." "b/c" I cannot understand you.
Last edited by barney (2024-03-28 16:06:28)
Offline
Window under mouse is firefox with this forum thread
No it's not:
wininfo: Window id: 4225094 (has no name)
-geometry 1245x1050+675+0
75497515 "Properties of the window under the mouse pointer in OpenBox / Newbie Corner / Arch Linux Forums — Mozilla Firefox": ("Navigator" "firefox") 1243x1023+1+22 +676+22Looks like the WM parent to encapsulate window and decoration - is the mouse over the window or its titlebar?
Online
is the mouse over the window or its titlebar?
Under the window.
Offline
There's maybe another oddity - according to your xwininfo output the only named window is firefox, but there probably should be a terminal window where you've been running this??
What is the exact environment? Just openbox on bare metal? No wayland/VM/xephyr?
Is firefox the only affected client? Does this work with eg. xterm?
Is firefox a flatpak or appimage etc.?
Online
There's maybe another oddity - according to your xwininfo output the only named window is firefox, but there probably should be a terminal window where you've been running this??
There are more applications: alacritty (three windows), obkey (one window) nyxt (one window) and thunar (one window). I have tested the two previous commands on all windows, and the situation is the same. If you want I can post the output of the xwininfo for the other windows? The output for the xprop is always empty.
What is the exact environment? Just openbox on bare metal? No wayland/VM/xephyr?
openbox on bare metal (one monitor and one TV, 4 desktops, all the windows are on desktop 1 and the monitor, not on the TV.
Is firefox the only affected client? Does this work with eg. xterm?
All applications that I have tested are affected. The situation is the same with xterm.
Is firefox a flatpak or appimage etc.?
All applications are installed from official arch repositories. (I have some applications from AUR, for example deadbeef. Tested on deadbeef, situation the same.
Offline
Ok, just tried - xdotool misbehaves itr w/ openbox (other WMs incl. even fluxbox work as expected)
=> https://github.com/jordansissel/xdotool/issues
On a glimpse, the window stack looks reversed on openbox, so xdotool might want to introduce a flag to reverse the search strategy.
Online
And we can't really tell you what you're looking for if you do not post the properties you're given.
My English is not so good, my fault. Sorry. But sometimes Seth is using English "shortcuts" which I cannot understand. Again, My fault.
Offline
It's maybe more that I originally only implied to post the xwininfo.
Try
obxprop --id $(xwininfo -children -int -id $(xdotool getmouselocation | cut -d: -f 5) | sed '/^$/d;/^ /!d;/(has no name)/d;/ children:$/d;s/ *\([0-9]*\) \+.*/\1/g')Online
The output of the
obxprop --id $(xwininfo -children -int -id $(xdotool getmouselocation | cut -d: -f 5) | sed '/^$/d;/^ /!d;/(has no name)/d;/ children:$/d;s/ *\([0-9]*\) \+.*/\1/g')Offline
Did you look at it?
Online
Did you look at it?
To be honest, no. Because I was thinking that that information is only important for diagnostic purposes.
Now I can see that I can extract the
_OB_APP_GROUP_NAME(UTF8_STRING) = "firefox"property.
Thanks.
Offline
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
You still might want to file a bug against xdotool rather than relying on the somewhat sketchy approach to filter the children of the found window for a named one.
Online
Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.
Done.
You still might want to file a bug against xdotool rather than relying on the somewhat sketchy approach to filter the children of the found window for a named one.
I don't know how to describe the problem to fill a bug. Is it enough to say that "xdotool getmouselocation | cut -d: -f 5" is not returning what is expected to return?
Now I have a bizarre problem with escaping the quotation mark in xml file. I want to take the screenshots of the window under the mouse pointer. To do that I use the following command:
sh -c "import ~/pictures/screenshots/$(date '+%Y%m%d-%H%M%S')-$(obxprop --id $(xwininfo -children -int -id $(xdotool getmouselocation | cut -d: -f 5) | sed '/^$/d;/^ /!d;/(has no name)/d;/ children:$/d;s/ *\([0-9]*\) \+.*/\1/g') | grep _OB_APP_NAME | cut -d '"' -f 2).png"This works as expected from terminal emulator, but when I put this command in obkey and associate a key I get this message:
Text ended before matching quote was found for '.(The text was "sh -c "import ~/pictures/screenshots/$(date '+%Y%m%d-%H%M%S')-$(obxprop --id $(xwininfo -children -int -id $(xdotool getmouselocation | cut -d: -f 5) | sed '/^$/d;/^ /!d;/(has no name)/d;/ children:$/d;s/ *\([0-9]*\) \+.*/\1/g') | grep _OB_APP_NAME | cut -d '"' -f 2).png"")The problem is that escaping characters in xml file is not the same like escaping characters in the shell. I don't know how to solve this problem.
Offline
I don't know how to describe the problem to fill a bug.
xdotool getmouselocation on some WMs (openbox) searches the stack in the wrong direction and finds the (unnamed) WM container instead of the actual client
Now I have a bizarre problem with escaping the quotation mark in xml file.
is veering off-topic…
#!/bin/sh
window_under_mouse="$(xwininfo -children -int -id $(xdotool getmouselocation | cut -d: -f 5) | sed '/^$/d;/^ /!d;/(has no name)/d;/ children:$/d;s/ *\([0-9]*\) \+.*/\1/g')"
OB_APP_NAME="$(obxprop --id $window_under_mouse _OB_APP_NAME | cut -d '"' -f 2)"
import ~"/pictures/screenshots/$(date '+%Y%m%d-%H%M%S')-$OB_APP_NAME.png"Online