ickyicky / window-calls

Gnome Extension for getting windows list in wayland
61 stars 17 forks source link

Details not listing dimensions #20

Open r2evans opened 11 months ago

r2evans commented 11 months ago

I'm trying to adapt some scripts for Wayland use, namely the ability to copy the width/height of one window onto another. I really think this extension is the most flexible way to do what I want to do. However, I'm not seeing the dimensions.

I first identify the window, namely by finding the focused window:

$ sleep 3 ; gdbus call --session --dest org.gnome.Shell \
  --object-path /org/gnome/Shell/Extensions/Windows \
  --method org.gnome.Shell.Extensions.Windows.List \
  | cut -c 3- | rev | cut -c4- | rev | jq '.[] | select(.focus)'
{
  "in_current_workspace": true,
  "wm_class": "R_x11",
  "wm_class_instance": "r_x11",
  "pid": 219355,
  "id": 1864199092,
  "frame_type": 5,
  "window_type": 0,
  "focus": true
}

(This is demoed with that window, but it's the same with other windows too, and it reports the same on both of a dual-monitor setup.)

Namely, I automate getting the id by changing the jq expression to jq '.[] | select(.focus) | .id' and I get the integer id.

From there, I look at the .Details:

$ gdbus call --session --dest org.gnome.Shell \
  --object-path /org/gnome/Shell/Extensions/Windows \
  --method org.gnome.Shell.Extensions.Windows.Details 1864199092 \
  | cut -c 3- | rev | cut -c4- | rev  | jq .
{
  "in_current_workspace": true,
  "area_cust": {},
  "wm_class": "R_x11",
  "wm_class_instance": "r_x11",
  "pid": 219355,
  "id": 1864199092,
  "maximized": 0,
  "display": {},
  "frame_type": 5,
  "window_type": 0,
  "layer": 2,
  "monitor": 0,
  "role": null,
  "title": "R Graphics: Device 3 (ACTIVE)",
  "canclose": true,
  "canmaximize": true,
  "canminimize": true,
  "focus": false,
  "moveable": true,
  "resizeable": true,
  "area": {},
  "area_all": {}
}

I'm expecting to see (among others) "width", "height", "x", and "y".

Ubuntu 23.04, gnome 44, libglib2.0-bin 2.76.1-1, window-calls 14.

Thanks!

ickyicky commented 11 months ago

Will look into it, however currently height and width is obtained from meta_window object of the window, which may or may not exist and may or may not have get_height and get_width function. So in order to obtain height of windows without those properties i would have to figure out alternative way of calculating height and width.

Currently, when any property is unobtainable it is not included in JSON result of details call rather than including key and setting the value to null, that's why there is no height or width property.

r2evans commented 11 months ago

I appreciate your response, thanks!

I'm a bit confused though that it (either meta_window or its dimension accessors) exists for none of the windows I tested (emacs, firefox, gnome-terminal, thunderbird). Is that unexpected?

ickyicky commented 11 months ago

To be completely honest I quit using Gnome some time ago, so this project is not in such an active development as it used to be. There might have been some changes in API I am not aware of, will need to check soon.

Core447 commented 7 months ago

Shout be fixed with this.