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.
Precarious work-around to the inability of setting a default pre-selected/focused button on Y.A.D.
While apparently default button sets like ok/cancel pair or some other that has some additional over those have a default set automatically, so one can just press enter without mouse-clicking the button. But for more custom buttoms it seems that the default focus disappears, and hitting enter does nothing. At least depending on the entirety of the dialog, maybe it has some nonsensical focus on some other area where it doesn't really respond to "enter," like "--picture," maybe it's focused.
Whatever the case may be, while searching on how to set a default button, I could only find people asking this question, but no answer, the "closest" thing seems to require switching the position from okay to cancel or vice-versa, for those cases where an enter indeed clicks some default button.
But a hackish/dumb alternative that leaves the button sequence unaltered is to precede the yad command by xdotool, like this:
Which in my case selects the first button.
The key sequence will obviously vary from whatever set of buttons one has and what one wishes to be the one set by default. Possibly there's the risk that a too-short sleep time in some cases will result in fewer xdotool fake key presses being captured by YAD, then resulting in the wrong button being focused by this fake-default shameless cheat. So do enough dry-run tests, and use with caution, ideally in things where the wrong "default" being confirmed doesn't do something too disastrous and irreversible.
A better approach for such fake-default with xdotool would be if we could set-up "action keys" on YAD, by which I mean those underlined letters in some menus that would select that entry if the key is pressed, although maybe it also already confirms it rather than just selecting, which is not what's intended. I don't think we can set up such action-key shortcuts anyway, so it's really neither a problem nor an alternative solution.
PS.: on some search engines at least, it may be convenient to add some term like "linux" on YAD-related searches, to avoid surprisingly highly common unrelated results, regarding some kind of Jewish thing.
Whatever the case may be, while searching on how to set a default button, I could only find people asking this question, but no answer, the "closest" thing seems to require switching the position from okay to cancel or vice-versa, for those cases where an enter indeed clicks some default button.
But a hackish/dumb alternative that leaves the button sequence unaltered is to precede the yad command by xdotool, like this:
Code:
xdotool sleep 0.3 key Down Left & yad --parameters --etc
The key sequence will obviously vary from whatever set of buttons one has and what one wishes to be the one set by default. Possibly there's the risk that a too-short sleep time in some cases will result in fewer xdotool fake key presses being captured by YAD, then resulting in the wrong button being focused by this fake-default shameless cheat. So do enough dry-run tests, and use with caution, ideally in things where the wrong "default" being confirmed doesn't do something too disastrous and irreversible.
A better approach for such fake-default with xdotool would be if we could set-up "action keys" on YAD, by which I mean those underlined letters in some menus that would select that entry if the key is pressed, although maybe it also already confirms it rather than just selecting, which is not what's intended. I don't think we can set up such action-key shortcuts anyway, so it's really neither a problem nor an alternative solution.
PS.: on some search engines at least, it may be convenient to add some term like "linux" on YAD-related searches, to avoid surprisingly highly common unrelated results, regarding some kind of Jewish thing.
Total Comments 0