Open emanuele6 opened 4 years ago
I discovered that xdotool
also has getwindowfocus
, that won't work either: it always outputs "276" when the focused bspwm
node is not a leaf (window).
I don't know what 276
(0x00000114
) is supposed to be, but here is the output of xprop -id 276
(there are my Xresources, my xim server, &c so the output on other people's computers may look different, but maybe someone can figure out what this is by looking at the atoms, assuming that knowing what 276
is is even relevant):
_NET_CLIENT_LIST_STACKING(WINDOW): window id # 0x800009, 0x80003c, 0x800028
_NET_ACTIVE_WINDOW(WINDOW): window id # 0x800028
_NET_CLIENT_LIST(WINDOW): window id # 0x800009, 0x800028, 0x80003c
XIM_SERVERS(ATOM) = @server=ibus
GDK_VISUALS(INTEGER) = 215, 266
_NET_CURRENT_DESKTOP(CARDINAL) = 0
_NET_DESKTOP_VIEWPORT(CARDINAL) = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
_NET_DESKTOP_NAMES(UTF8_STRING) = "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"
_NET_NUMBER_OF_DESKTOPS(CARDINAL) = 10
XFree86_DDC_EDID1_RAWDATA(INTEGER) = 0, -1, -1, -1, -1, -1, -1, 0, 48, -28, -96, 64, 0, 0, 0, 0, 0, 20, 1, 3, -128, 31, 17, 120, -22, -114, 53, -109, 88, 86, -112, 41, 32, 80, 84, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 18, 27, 86, 104, 80, 0, 18, 48, 32, 32, 53, 0, 54, -82, 16, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, 76, 71, 32, 68, 105, 115, 112, 108, 97, 121, 10, 32, 32, 0, 0, 0, -2, 0, 76, 80, 49, 52, 48, 87, 72, 50, 45, 84, 76, 77, 50, 0, 59
_NET_SUPPORTING_WM_CHECK(WINDOW): window id # 0xa00000
_NET_SUPPORTED(ATOM) = _NET_SUPPORTED, _NET_SUPPORTING_WM_CHECK, _NET_DESKTOP_NAMES, _NET_DESKTOP_VIEWPORT, _NET_NUMBER_OF_DESKTOPS, _NET_CURRENT_DESKTOP, _NET_CLIENT_LIST, _NET_ACTIVE_WINDOW, _NET_CLOSE_WINDOW, _NET_WM_STRUT_PARTIAL, _NET_WM_DESKTOP, _NET_WM_STATE, _NET_WM_STATE_HIDDEN, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_BELOW, _NET_WM_STATE_ABOVE, _NET_WM_STATE_STICKY, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_NOTIFICATION, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_TOOLBAR
ESETROOT_PMAP_ID(PIXMAP): pixmap id # 0x400001
_XROOTPMAP_ID(PIXMAP): pixmap id # 0x400001
RESOURCE_MANAGER(STRING) = "*.background:\t#252323\n*.color0:\t#252323\n*.color1:\t#cc241d\n*.color10:\t#79740e\n*.color11:\t#b57614\n*.color12:\t#076678\n*.color13:\t#8f3f71\n*.color14:\t#427b58\n*.color15:\t#f9f5d7\n*.color2:\t#98971a\n*.color3:\t#d79921\n*.color4:\t#458588\n*.color5:\t#b16286\n*.color6:\t#689d6a\n*.color7:\t#ebdbb2\n*.color8:\t#32302F\n*.color9:\t#9d0006\n*.cursorColor:\t#bdae93\n*.cursorColor2:\t#252323\n*.foreground:\t#bdae93\ne6theme.acc:\t#458588\ne6theme.bg1:\t#252323\ne6theme.bg2:\t#252323\ne6theme.ext:\t#d79921\ne6theme.fg1:\t#bdae93\ne6theme.fg2:\t#f9f5d7\ne6theme.unf:\t#32302F\ne6theme.urg:\t#cc241d\nurxvt.font:\txft: xos4 Terminus:pixelsize=16:antialias=false, Kochi Gothic:antialias=false, Font Awesome 5 Free:style=Solid:antialias=true\nurxvt.saveLines:\t0\nurxvt.scrollBar:\tfalse\n"
_XKB_RULES_NAMES(STRING) = "evdev", "pc105", "it", "", ""
XFree86_has_VT(INTEGER) = 1
XFree86_VT(INTEGER) = 1
xdo
uses xcb_ewmh_get_active_window()
to get the window id to use when none is provided in the command line arguments.
pfw
uses the focus
property of the reply of xcb_get_input_focus()
.
Is using the xcb equivalent of pfw
's method ok? @baskerville
This problem is not specific to the id
action of course.
I noticed that pfw
also returns 0x00000114
not failing some times: when you run it from an empty desktop.
Test:
sxhkd
hotkey (POSIX sh
):
super + x
notify-send "$(pfw; echo "$?")"
super + x
in an empty bspwm
desktop; 0x00000114
0
bspc query -N -n focused
shouldn't be used to get the id focused of the focused window since it may return a node that is not a window.But
xdo id
can't be used to get that id either: it fails.How to reproduce (in
bspwm
):bspc node @parent -f
;xdo id; echo "$?"
(keep the parent focused while you do itpfw
from wmutils/core works correctly: outputs the id of the focused (active) window.xdotool getactivewindow
fails exiting with 0 and printing this message tostderr
:Since
xdo
is commonly used bybspwm
user, I think it should work correctly in this case (likepfw
).