--width --geometry and --wrap don't seem to work
If I have long text in Yad, the window will resize itself width wise to the length of the text even if the length is otu of the bounds of the screen.
Using --wrap or --width or --geometry even in conjunction with --fixed doesn't have any effect on the issue at all.
I would have expected word wrapping to be default behavior too.
You can see in the pic the window goes outside the bounds of the screen and cuts off, this should never really happen by default, and there should be an actual way to prevent this from happening but none of the suggested options do anything.
I cannot even resize the window down to a sensible size after it opens either it refuses to shrink width below the length of the text.
(I'm not the developer)
Without the actual full command that generated the picture it's hard to offer precise advice. So I'm going to write something quite generic.
Yad has two "text" options: --text and --text-info. These are completely different functions, and don't exclude each other. Which text option are you walking about?
The --wrap option only applies to --text-info; see the yad manual.
The other options you mentioned apply to the window frame, not to its contents.
To wrap the text in the --text option, the text must include some white space for GTK (mind not yad), to be able to wrap it automatically.
GTK cannot wrap this:
#> yad --width=300 --text="sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss"
GTK can and will wrap this:
#> yad --width=300 --text="sssssssssssss ssssssssssss sssssssssssssssss ssssssssssssssssssss sssssssssssssss sssssssssssssssssssss ssssssssssssssssssss sssssssssssssssss ssssssssssssssssss ssssssssssssssssssssss"
It seems the text in your picture includes spaces, unless those are ~~hard~~ non-breaking spaces, which don't wrap.
Without the actual full command that generated the picture it's hard to offer precise advice. So I'm going to write something quite generic.
They are hard spaces yeah, it's a command. I actually just gave up on yad and went back to zenity.
I have observed a similar, not quite as stated but perhaps related, problem for years and I'm pretty sure it's been reported before. This worked, or rather failed to work, the same way on previous hardware setups and previous operating systems so it is not unique to a plain Openbox "DE" (if you want to call it that) under Ubuntu 18.04, nor to dual monitors or large monitors. But, for context:
$ xrandr |grep '' <--That's supposed to be an asterisk wrapped in single quotation marks.
1366x768 60.02+ 40.01
3840x2160 30.00*+ 25.00 24.00 29.97 23.98
The small monitor is built in to my laptop. The larger, on the second line, is primary, and where all of these examples are happening.
yad --width=3800 --posx=1 --posy=1 --text="sssss ssssss" works exactly as it should
yad --width=3800 --posx=1 --posy=1 --text="sssss ssssss sss" adds empty vertical space below the text, like additional blank lines or invisible space characters making the window bigger than it needs to be.
Constraining such invocations with the --height=n option has no effect. So yad --width=3800 --height=15 --posx=1 --posy=1 --text="sssss ssssss sss" still shows the extra vertical space.
The longer the text, the larger the amount of useless space added is and the larger the RATIO of empty space to text grows. This, with the --height option at 15 as shown, or at 1500, or with no height option, all have the same effect- the yad window will have far more empty space than text, so much that the buttons are below the bottom edge of my monitor and can only be seen or clicked by dragging the window up.: yad --width=3800 --posx=1 --posy=1 --height=15 --text="sssssssssssss ssssssssssss sssssssssssssssss ssssssssssssssssssss sssssssssssssss sssssssssssssssssssss ssssssssssssssssssss sssssssssssssssss ssssssssssssssssss ssssssssssssssssssssss sssssssssssss ssssssssssss sssssssssssssssss ssssssssssssssssssss sssssssssssssss sssssssssssssssssssss ssssssssssssssssssss sssssssssssssssss ssssssssssssssssss ssssssssssssssssssssss sssssssssssss sssss sssss"
In contrast, using --text-info, also fails, but quite differently: $ echo "sssssssssssss ssssssssssss sssssssssssssssss ssssssssssssssssssss sssssssssssssss sssssssssssssssssssss ssssssssssssssssssss sssssssssssssssss ssssssssssssssssss ssssssssssssssssssssss sssssssssssss ssssssssssss sssssssssssssssss ssssssssssssssssssss sssssssssssssss sssssssssssssssssssss ssssssssssssssssssss sssssssssssssssss ssssssssssssssssss ssssssssssssssssssssss sssssssssssss sssss sssss" > temp $ yad --width=3800 --posx=1 --posy=1 --text-info --filename=temp The resulting window is 3800 in width as specified but the there are TWO problems with it:
- It is collapsed vertically showing only the title bar and buttons and the text is completely invisible.
- I can resize the window by dragging down the bottom edge until the beginning of the text is visible, BUT it runs out of the box on the right edge and there is no scroll bar. Without the --width option, yad --posx=1 --posy=1 --text-info --filename=temp it's even worse. The window is collapsed vertically AND horizontally and is just big enough to show the default buttons. If I use the --no-buttons option yad --posx=1 --posy=1 --text-info --filename=temp --no-buttons it collapses a bit less vertically, showing the beginning of the text and one empty line below it, but collapses EVEN MORE horizontally, and is rendered just wide enough to show the close and maximize buttons in the title bar. If I add --undecorated yad --posx=1 --posy=1 --text-info --filename=temp --no-buttons --undecorated it doesn't shrink further though, apart from leaving off the title bar. Adding the --wrap option yad --width=3800 --posx=1 --posy=1 --text-info --filename=temp --wrap does, indeed, make the text wrap, but the window is still collapsed vertically, showing no text area at all. To see the text you have to manually resize the window. The only way around this is to force the height to a specified number, like this: yad --width=3800 --posx=1 --posy=1 --text-info --filename=temp --wrap --height=1500
In summary "--text" doesn't work worth a hoot with long text strings even if they are broken up into short words with spaces. And --text-info, in addition to being a lot more trouble to use, still ain't right, although you can force it to be good enough to be useful. If you have more than a few words to show, you might want to consider using something besides yad. Because this has been broken for a LONG time.
As a work-around, you can also use a script like this, giving it the string as an argument or arguments, with or without single or double quotation marks, to break up long words and lines, pre-wrapping them into 60 character lines in effect. Of course you can change 60 to whatever number you like. You can use it like this: yad --text="$(script.sh argument anothersuperextrareallylooooooooooooooooooooooooooooongassargument yetanotherargument $(cat War_and_Peace_by_Tolstoy.txt))"
ADDED: [ sorry, I had to edit the 10 line bash script back out because I can't get the code tags to work correctly, nor does it show properly if I just paste it in.] ADDED LATER: I pasted it here: https://spaste.us/doc/wbtbzjwa
Before 'yad --text' broke and started throwing in extra space, I used to use this a lot. Now, not so often, since you still have the problem of empty vertical space that makes yad useless for long text strings.
A couple of more things:
-
"hard non-breaking spaces" step- "They are hard spaces yeah, it's a command." Rabcor (OP) I believe you misunderstood what step- meant. I think he was referring to a character used in word processors that looks like a space (it has the same glyph) but isn't a space. There is no easy way to type it into a terminal or a script (unless you write scripts with a word processor, which is a horrible idea). The only way they'd get there would be if you fed them in from a file created with a word processor, by using something like $(cat document.doc) or maybe with copy and paste. And even then you'd have to work at it. They don't get in there unless you take extra trouble to put them in.
-
--geometry, while it still works, at least with short strings, may be deprecated. If I'm right about that you might want to get in the habit of using --width, --height, --posx, and --posy instead.