Xfce Forum

Sub domains
 

You are not logged in.

#1 2026-09-21 00:04:20

bitrat
Member
Registered: 2023-07-19
Posts: 22
LinuxFirefox 140.0

activate a graphical application from a script, via process id

Hi,

on debian, as per the title, I'd like to activate an app window (atril) from a script, preferably using the app's process id.

I have a feeling I've done this before, maybe using one of the xwininfo family? ...

Sorry if this is an old question, or obvious, or impossible...  I have searched.

Cheers,
bitrat

Offline

#2 2026-09-21 00:38:08

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 12,698
LinuxFirefox 156.0

Re: activate a graphical application from a script, via process id

bitrat wrote:

I'd like to activate an app window (atril) from a script, preferably using the app's process id.

Which means the application must already be running. You can use wmctrl to raise a minimized window, but it would use it's windowID:

wmctrl -i -a $(wmctrl -lvpx | grep -i atril | awk '{print $1}')

Is this what you were thinking?


Mark solved threads as [SOLVED] to make it easier for others to find solutions.
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2026-09-21 08:35:19

bitrat
Member
Registered: 2023-07-19
Posts: 22
LinuxFirefox 140.0

Re: activate a graphical application from a script, via process id

ToZ wrote:

Is this what you were thinking?

Yes, thank you!

Even better is that

wmctrl -lvpx | grep -i atril

gives me the process id as well as the window id, so I can triangulate with pstree.

As a side note, if the atril command is run with a file argument that's already open, it just activates the app, without changing the location in the document.

I was having an issue where it was activating but scrolling to the first page, hence my inquiry.  I was going to use a long winded brute force workaround...

However, atril seems to have reverted to the original (correct) behaviour, so I don't need this fiddle now.  However, I suspect I'll have other uses for it, since I run a number of graphics programs in headless mode (eg: libreoffice, inkscape, ...) and use apps like ristretto to view outputs.

Anyway, thanks again.   smile

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.011 seconds, 7 queries executed - Memory usage: 526.96 KiB (Peak: 527.94 KiB) ]