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.
Ridiculous work-around for kdialog ignoring geometry parameters
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.
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
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")
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
Total Comments 0