Recent

Author Topic: Another alternative in Linux (FindWindow)?  (Read 10068 times)

Onjahyr

  • Guest
Another alternative in Linux (FindWindow)?
« on: April 23, 2010, 10:07:36 pm »
Lazarus 0.9.29 in Linux

How to find caption of a program to use in a THandle?

On Windows you use FindWindow, and Linux?

Tanks

lazguy

  • Jr. Member
  • **
  • Posts: 78
Re: Another alternative in Linux (FindWindow)?
« Reply #1 on: May 01, 2010, 11:37:03 am »
until now i had no need to do that in Lazarus, so i have no experience.

I got interested with your question, so i made a little research and i found something that can help you as a first step.

Take a look at

http://lists.lazarus.freepascal.org/pipermail/lazarus/2008-August/037407.html

maybe is interesting to study the libraries gtk2 and gdk2x

have a nice day.

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1933
Re: Another alternative in Linux (FindWindow)?
« Reply #2 on: May 02, 2010, 11:29:47 pm »
I have some code to do this using xlib. (enumerate top-level windows by XIDs, get their Unicode title names, PIDs and program names, activate and bring-to-front one of them using  XRaiseWindow, XSetInputFocus, XMapwindow and a _NET_ACTIVE_WINDOW message to the WM).

But I'm not sure if this is really what you want/need.

And I can not guarantee that it works on all WM's.
I have only tested it on KWin (KDE) and there it is able to switch desktops and to raise and activate iconized windows.
OTOH, it uses plain X, so it's the WM's problem if it doesn't behave.
I had a hard time to get this working.
« Last Edit: May 03, 2010, 12:07:46 am by theo »

jack_

  • New Member
  • *
  • Posts: 23
  • Poland
Re: Another alternative in Linux (FindWindow)?
« Reply #3 on: February 03, 2015, 11:18:33 pm »
It's old topic but the proper function is FormToX11Window() from gtk2proc unit.

Usefull could be also to run in bash# wmctrl -l

Basile B.

  • Guest
Re: Another alternative in Linux (FindWindow)?
« Reply #4 on: February 04, 2015, 12:55:41 am »
would this also work on a KDE desktop ?

jack_

  • New Member
  • *
  • Posts: 23
  • Poland
Re: Another alternative in Linux (FindWindow)?
« Reply #5 on: February 10, 2015, 10:11:45 am »
I don't know - tested on Ubuntu 14.04 with gtk2 - Cinnamon.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Another alternative in Linux (FindWindow)?
« Reply #6 on: February 10, 2015, 04:41:32 pm »
would this also work on a KDE desktop ?
It's the backend that matters, it should work as long as you use gtk2 under X11 compatible display server (wayland included).

 

TinyPortal © 2005-2018