Coder Social home page Coder Social logo

Comments (19)

fzwoch avatar fzwoch commented on May 24, 2024

This is indeed a little cumbersome, but Looking Glass is the right idea.

Press Alt + F2, enter lg to start Looking Glass.

Select Windows at the top right and select the app/window you want to capture (First row of each window is the actual window object I believe, if you hit the bottom you get the app, which is not the object we want)

At the popup click Insert on the top right of the popup (The popup now closes).

Select Evaluator on the top right and check the object it returned. From that object you can query the ID. So in case it returned r(0) as the object:

>>> r(0).get_id()

Hopefully you will get an ID for that window that fits into an integer variable:

r(0) = <some integer like ID>

I don't think you can copy paste here so you need to write it down.

Note: The composer will only send an image buffer update if the window actually changed. So it may initially look like it is not working. Force an update of the window (contents inside change, move or resize the window should do it).

If anyone knows how to obtain these IDs programmatically please let me now. But I guess they are not obtainable from user space (in Wayland at least).

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Also, the update mechanism is broken when errors occur, which are likely to happen when you type in your ID into the property page. In this case you should switch scenes back and forth to re-start the source with the correct ID.

It really is a bit rough currently, but gotta start somewhere.

from obs-gnome-screencast.

StripedMonkey avatar StripedMonkey commented on May 24, 2024

Hah, I was messing around with it for ages and never once could get the get_id() to work, I was trying to use the window picker then get_id() Shows what I know.

As for getting them programatically: Yea, as far as I know the guys behind wayland have made it a tenant to not have this possible. It's probably easiest to reach out to to mutter devs and ask, but if it's not already exposed who knows if they'd do that.

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

I doubt they would do it. The design principle why it is that way is quite clear. I guess the proper way would be to have a GNOME shell extension which exposes this info. So - a simpler looking glass functionality which has an API one could query. I have no idea if that's even possible, also I'm not the one to do it. If such a thing exists which can be used I would probably add support for it though.

from obs-gnome-screencast.

StripedMonkey avatar StripedMonkey commented on May 24, 2024

In testing it a second time I have not gotten an ID that fits within the integer value. 2450367572, to be specific. Using an unsigned integer would fix it, but I'm not actually sure what the value range is for these IDs.

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Yeah these are int64_t if I'm not mistaken. There was no such property in OBS unfortunately. So I may need to change it to a text input..

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Try with the latest update. It should cover uint64 IDs just fine. At least the smaller ones I get still work..

from obs-gnome-screencast.

rizaldim avatar rizaldim commented on May 24, 2024

@StripedMonkey , did you manage to get windows id? If you did, how? I tried using Looking Glass by following instructions in README but I got "get_id is not a function".

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Did you select the correct object?

3. Select the Window Name at the top (Not the "App" section)

That is important. If it says "get_id is not a function" the object you have selected is not an actual window. When you click on the object it actually shows a list of the functions that can be used on that selected object.

from obs-gnome-screencast.

rizaldim avatar rizaldim commented on May 24, 2024

You meant the one that I circle below right?

step1

And when I clicked it:

Screenshot from 2020-04-16 21-03-41

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Looks about right except I see a lot more functions on my side. What distribution and GNOME version are you running?

from obs-gnome-screencast.

rizaldim avatar rizaldim commented on May 24, 2024

I am using Debian 10 and Gnome 3.30.2

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Hm, I cannot remember which minimal version I have tested with (I'm on Debian too). For reference, here is how it should work:

https://www.youtube.com/watch?v=vfx4-pgVxug

I have no idea what the minimum GNOME requirements are to get these IDs or if there is something else that needs to be be enabled/installed to make it work.

Since Looking Glass is just a shell extention (is it?) it may be possible to upgrade without touching anything else GNOME related?

from obs-gnome-screencast.

rizaldim avatar rizaldim commented on May 24, 2024

One thing I notice when I watched your video, when you clicked the window, it shows that the window object is of type MetaWindowX11.

Screenshot from 2020-04-17 01-44-29

Mine shows that my window is of type MetaWindowWayland.

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Correct, I had to record the video on another machine since my latest GNOME update on my main broke screen sharing so I could not record with it. That other machine has an NVIDIA card with proprietary drivers so it does not run a Wayland session but a an old X11 one. Therefore the windows are MetaWindowX11.

But it works on the Wayland machine exactly the same. The window can be of the type MetaWindowWayland if it is a native Wayland window or MetaWindowXwayland if it's a legacy window. I get IDs from both just fine.

from obs-gnome-screencast.

wvh-github avatar wvh-github commented on May 24, 2024

I'll just leave this here, it looks like the output is what you'd want.

gdbus call \ --session \ --dest org.gnome.Shell \ --object-path /org/gnome/Shell \ --method org.gnome.Shell.Eval " global .get_window_actors() .map(a=>a.meta_window) .map(w=>({class: w.get_wm_class(),id: w.get_id(), title: w.get_title()}))" \ | sed -E -e "s/^\(\S+, '//" -e "s/'\)$//" \ | jq '.'

I'm trying to get the plugin working on a Ubuntu 21.04 machine, but it segfaults as soon as I enter the window ID.

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Thanks, that code snipped is quite helpful. I should add this to the plugin.

In the meantime b569806 should take care of the segfault you experience. For some reason we may receive empty buffers - maybe for keep-alive reasons.

from obs-gnome-screencast.

wvh-github avatar wvh-github commented on May 24, 2024

Hi @fzwoch thanks for the quick response. I've tested that commit, it doesn't crash anymore but the result is just a black window. Do you want me to open another issue for this?

from obs-gnome-screencast.

fzwoch avatar fzwoch commented on May 24, 2024

Sure, go ahead. Also let me know if you are actually on wayland or x11.

from obs-gnome-screencast.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.