i3ipc-python icon indicating copy to clipboard operation
i3ipc-python copied to clipboard

Con.floating is None in sway

Open tmarkov opened this issue 3 years ago • 5 comments

i3ipc-python version: 2.2.1 sway: 1.6.1 python: 3.9.6

I run the following code:

from i3ipc import Connection, Event
i3 = Connection()
focused = i3.get_tree().find_focused()
print(focused.name) # gives proper name
print(focused.floating) # gives None

And the floating attribute is None (it's also None for the parents and I think all nodes on the tree).

tmarkov avatar Jul 25 '21 20:07 tmarkov

It seems that sway itself doesn't provide this field in swaymsg -t get_tree so it's not related to i3ipc-python.

suconakh avatar Apr 14 '22 02:04 suconakh

Using window.type == "floating_con" seems to work as workaround for me

SpiritCroc avatar Sep 08 '22 11:09 SpiritCroc

@SpiritCroc May I ask how to get window.type in sway? as when I use i3ipc.Con#type(), it just give me a useless string "con".

ch3n9w avatar Feb 19 '23 13:02 ch3n9w

@SpiritCroc May I ask how to get window.type in sway? as when I use i3ipc.Con#type(), it just give me a useless string "con".

When I do

i3ipc.Connection().get_tree().find_focused().type

I get con if my focused window is in normal tiled layout, and floating_con if it's floating. In my sway config I have

bindsym $mod+Shift+space floating toggle

to get a window to floating or back, which I used for testing.

SpiritCroc avatar Feb 19 '23 15:02 SpiritCroc

My bad, I always use tabbed mode in scratchpad, the tabbed window is con while its parent node is floating_con

ch3n9w avatar Feb 20 '23 02:02 ch3n9w