* How to get X Window id from within Emacs?
@ 2024-12-15 17:52 Jean Louis
2024-12-15 18:25 ` Eli Zaretskii
2024-12-15 19:00 ` Alain.Cochard
0 siblings, 2 replies; 7+ messages in thread
From: Jean Louis @ 2024-12-15 17:52 UTC (permalink / raw)
To: Help GNU Emacs
The standard shell commend `xwininfo' gives me the Window id, such as
0x2e000ac and then I can run shell command like `xdotool' to activate
the Emacs window:
$ xwininfo
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x2e000ac "*shell* - GNU Emacs at lco2"
after switching to other workspace, then I can still do:
$ xdotool windowactivate 0x2e000ac
and I would return to Emacs X Window.
Is there a way to get the Window ID from within Emacs?
That will be useful to return to Emacs upon some notifications and
jobs done, during the watching of the movie.
Jean
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get X Window id from within Emacs?
2024-12-15 17:52 How to get X Window id from within Emacs? Jean Louis
@ 2024-12-15 18:25 ` Eli Zaretskii
2024-12-15 21:53 ` Jean Louis
2024-12-16 0:39 ` Po Lu
2024-12-15 19:00 ` Alain.Cochard
1 sibling, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2024-12-15 18:25 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 15 Dec 2024 20:52:13 +0300
> From: Jean Louis <bugs@gnu.support>
>
> The standard shell commend `xwininfo' gives me the Window id, such as
> 0x2e000ac and then I can run shell command like `xdotool' to activate
> the Emacs window:
>
> $ xwininfo
>
> xwininfo: Please select the window about which you
> would like information by clicking the
> mouse in that window.
>
> xwininfo: Window id: 0x2e000ac "*shell* - GNU Emacs at lco2"
>
> after switching to other workspace, then I can still do:
>
> $ xdotool windowactivate 0x2e000ac
>
> and I would return to Emacs X Window.
>
> Is there a way to get the Window ID from within Emacs?
There's the window-id frame parameter, although I'm not sure it is
universally available. Try
M-: (frame-parameter nil 'window-id) RET
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get X Window id from within Emacs?
2024-12-15 17:52 How to get X Window id from within Emacs? Jean Louis
2024-12-15 18:25 ` Eli Zaretskii
@ 2024-12-15 19:00 ` Alain.Cochard
2024-12-15 21:57 ` Jean Louis
1 sibling, 1 reply; 7+ messages in thread
From: Alain.Cochard @ 2024-12-15 19:00 UTC (permalink / raw)
To: Jean Louis; +Cc: Help GNU Emacs
Jean Louis writes on Sun 15 Dec 2024 20:52:
> The standard shell commend `xwininfo' gives me the Window id, such as
> 0x2e000ac and then I can run shell command like `xdotool' to activate
> the Emacs window:
>
> $ xwininfo
>
> xwininfo: Please select the window about which you
> would like information by clicking the
> mouse in that window.
>
> xwininfo: Window id: 0x2e000ac "*shell* - GNU Emacs at lco2"
>
> after switching to other workspace, then I can still do:
>
> $ xdotool windowactivate 0x2e000ac
>
> and I would return to Emacs X Window.
>
> Is there a way to get the Window ID from within Emacs?
Wouldn't 'xwininfo' (or 'wmctrl'), from an Emacs shell, be enough?
> That will be useful to return to Emacs upon some notifications and
> jobs done, during the watching of the movie.
--
EOST (École et Observatoire des Sciences de la Terre)
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | bureau 110, ancien bât.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get X Window id from within Emacs?
2024-12-15 18:25 ` Eli Zaretskii
@ 2024-12-15 21:53 ` Jean Louis
2024-12-16 0:39 ` Po Lu
1 sibling, 0 replies; 7+ messages in thread
From: Jean Louis @ 2024-12-15 21:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
* Eli Zaretskii <eliz@gnu.org> [2024-12-15 21:28]:
> There's the window-id frame parameter, although I'm not sure it is
> universally available. Try
>
> M-: (frame-parameter nil 'window-id) RET
I think that ID is something Emacs related. Or I do not know how to convert it.
Result such as "46153928" I do not know how to use here:
$ sleep 3; xdotool windowactivate 46137524
XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
is it is supposed to look this way:
sleep 3; xdotool windowactivate 0x2e000ac
So do I need to convert it somehow?
(format "%x" 46137524) ➜ "2c000b4"
But it failed:
$ xdotool windowactivate 0x2c000b4
XGetWindowProperty[_NET_WM_DESKTOP] failed (code=1)
I had to get: 0x2c040c4 instead as that was X Window ID, so I am not sure how this works.
Jean
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get X Window id from within Emacs?
2024-12-15 19:00 ` Alain.Cochard
@ 2024-12-15 21:57 ` Jean Louis
0 siblings, 0 replies; 7+ messages in thread
From: Jean Louis @ 2024-12-15 21:57 UTC (permalink / raw)
To: Alain.Cochard; +Cc: Help GNU Emacs
* Alain.Cochard@unistra.fr <Alain.Cochard@unistra.fr> [2024-12-15 22:02]:
> Wouldn't 'xwininfo' (or 'wmctrl'), from an Emacs shell, be enough?
- if I would know how to get result from `xwininfo` at the moment when it is fired out of Emacs, without me clicking on it, then fine.
- wmctrl I do not know how, do you know?
I need it programmatically, without user's interaction.
But now I am thinking to use `(select-frame-set-input-focus (selected-frame))` instead, to bring the user back to Emacs, let me try...
(progn
(sleep-for 10)
(select-frame-set-input-focus (selected-frame)))
So that worked well, I think I must use that method, and case is resolved now.
--
Jean Louis
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get X Window id from within Emacs?
2024-12-15 18:25 ` Eli Zaretskii
2024-12-15 21:53 ` Jean Louis
@ 2024-12-16 0:39 ` Po Lu
2024-12-16 5:20 ` Jean Louis
1 sibling, 1 reply; 7+ messages in thread
From: Po Lu @ 2024-12-16 0:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
>> Date: Sun, 15 Dec 2024 20:52:13 +0300
>> From: Jean Louis <bugs@gnu.support>
>>
>> The standard shell commend `xwininfo' gives me the Window id, such as
>> 0x2e000ac and then I can run shell command like `xdotool' to activate
>> the Emacs window:
>>
>> $ xwininfo
>>
>> xwininfo: Please select the window about which you
>> would like information by clicking the
>> mouse in that window.
>>
>> xwininfo: Window id: 0x2e000ac "*shell* - GNU Emacs at lco2"
>>
>> after switching to other workspace, then I can still do:
>>
>> $ xdotool windowactivate 0x2e000ac
>>
>> and I would return to Emacs X Window.
>>
>> Is there a way to get the Window ID from within Emacs?
>
> There's the window-id frame parameter, although I'm not sure it is
> universally available. Try
>
> M-: (frame-parameter nil 'window-id) RET
This is the ID of Emacs's "inner window", where it displays buffer text
and decorations. The `outer-window-id' frame parameter supplies a
window ID that is suitable for external programs such as xdotool.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to get X Window id from within Emacs?
2024-12-16 0:39 ` Po Lu
@ 2024-12-16 5:20 ` Jean Louis
0 siblings, 0 replies; 7+ messages in thread
From: Jean Louis @ 2024-12-16 5:20 UTC (permalink / raw)
To: Po Lu; +Cc: Eli Zaretskii, help-gnu-emacs
* Po Lu <luangruo@yahoo.com> [2024-12-16 03:42]:
> This is the ID of Emacs's "inner window", where it displays buffer text
> and decorations. The `outer-window-id' frame parameter supplies a
> window ID that is suitable for external programs such as xdotool.
(format "0x%x" (string-to-number (frame-parameter nil 'outer-window-id))) ➜ "0x2c0506f"
This way now it works well, thank you much for looking into it.
--
Jean Louis
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-12-16 5:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-15 17:52 How to get X Window id from within Emacs? Jean Louis
2024-12-15 18:25 ` Eli Zaretskii
2024-12-15 21:53 ` Jean Louis
2024-12-16 0:39 ` Po Lu
2024-12-16 5:20 ` Jean Louis
2024-12-15 19:00 ` Alain.Cochard
2024-12-15 21:57 ` Jean Louis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).