LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Ridiculous work-around for kdialog ignoring geometry parameters

Posted 11-30-2023 at 03:55 PM by the dsc
Updated 01-29-2024 at 01:25 PM by the dsc

Have kdialog preceeded by (or succeeded after an "&" if the context allows it, and if it's preferable for some reason) a loop that has wmctrl "grepping"/activating" the unique name of the kdialog window, followed by xdotool resizing it, and breaking the loop.

Code:
( while  true ; do
sleep 0.2 # reduces CPU load if the loop never breaks for some reason
wmctrl -a "relevant and ideally unique title for kdialog window"  && xdotool getactivewindow windowsize 250 330 >/dev/null && break
done ) &
          
  answer_from_kdialog=$(kdialog [..parameters...] --title "relevant and ideally unique title for kdialog window")
If the kdialog title isn't unique, wmctrl will focus any "random" window with the same title, and xdotool will resize it.

It's perhaps also a good measure to make the loop have a finite lifespan based on time somehow or, or in loops themselves just in case something goes wrong and the kdialog never shows up or something, then you're left with an invisible loop wasting power for no reason.

"for loops in {1..1000}" instead of "while true" will would try the wmctrl command 1000 times before giving up, for example.


PS.: oddly enough, kdialog doesn't seem to be totally ignoring "geometry" as I thought, somehow. There's the X-native "-geometry" with only one hyphen, ignored by kdialog, but it does respect some of its own double-hyphen "--geometry," although maybe not for all dialog types. Weird, I could swear I had tried it with two hyphens too, without making any difference.

PS 2: even weirder, not only kdialog ignores some geometry parameters (window size), or at least has some arbitrary hard-wired limits, but that can't be changed with xdotool
Posted in Uncategorized
Views 141 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 05:53 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration