eww
eww copied to clipboard
[BUG] Show-truncated in labels and buttons
Checklist before submitting an issue
- [X] I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
- [X] I have specifically verified that this bug is not a common user error
- [X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)
Description of the bug
In the new version eww 0.6.0 my calendar widget broke showing 3 points instead of the time "08:35" for example.
I solved it by adding :show-truncated "false" to labels.
I don't know why it was truncated, it's only 2 digits... anyway...
My powermenu widget uses eventbox and a buttons, not labels and is broken, this is how it looks now,
It should show the glyphs for shutdown, restart, etc.
I don't know if this is related to :show-truncated
Reproducing the issue
My powermenu.yuck
(defwidget powermenu []
(box :class "powermenu"
:orientation "v"
:space-evenly "false"
(lock-power-restart)))
(defwidget lock-power-restart []
(box :class "powermenu"
:orientation "v"
:spacing 10
(eventbox :cursor "pointer"
(button :class "powermenu lock"
:onclick "physlock -d"
:tooltip "Lock session"
""))
(eventbox :cursor "pointer"
(button :class "powermenu exit"
:onclick "bspc quit"
:tooltip "Logout bspwm"
""))
(eventbox :cursor "pointer"
(button :class "powermenu reboot"
:onclick "systemctl reboot"
:tooltip "Restart"
""))
(eventbox :cursor "pointer"
(button :class "powermenu shutdown"
:onclick "systemctl poweroff"
:tooltip "Shutdown"
""))
)
)
;; Power Menu ;;
(defwindow powermenu
:geometry (geometry :x "0%"
:y "0%"
:anchor "center right")
:wm-ignore false
(powermenu))
My powermenu.scss
window>.powermenu {
margin: 0.5rem;
background-color: $bg;
}
.powermenu {
font-family: "Font Awesome 6 Free Solid";
font-size: 1.5rem;
padding: 0.3rem;
border-radius: 0.5rem;
&.shutdown {
color: $red;
}
&.reboot {
color: $green;
}
&.lock {
color: $yellow;
}
&.exit {
color: $magenta;
}
button {
background-color: $bg-alt;
padding: 1.2rem;
&:hover {
background-color: lighten($color: $bg-alt, $amount: 4%);
}
}
}
Expected behaviour
Power buttons must show a glyphs
Additional context
Eww log shows nothing..
2024-04-22T15:18:37.171Z [0m[32mINFO [0m [0m[1meww::app [0m > Opening window powermenu as 'powermenu'
2024-04-22T15:18:37.171Z [0m[32mINFO [0m [0m[1meww::ipc_server[0m > IPC server initialized
This is because eww now uses gtk's truncation system, and gtk somehow decided that there wasn't enough space to display your text. Setting :show-truncated "false"
solves the problem because this feature isn't supported by gtk, so eww reverts to the old truncation system, which won't truncate anything if you don't set :limit-with
.
I made a pull request to disable truncation by default (see #1084), but while waiting for it to be merged, you can indeed use :show-truncated "false"
to disable it. It may also be possible to disable it by using :hexpand
or :width
on the right widgets.
For anything that isn't a label, having a string as a child implicitly creates a label, which means that
(button "a")
is exactly the same as
(button (label :text "a"))
So, for your powermenu, you'd fix it by using
(button :class "powermenu shutdown"
:onclick "systemctl poweroff"
:tooltip "Shutdown"
(label :show-truncated false
:text ""))
@kStor2poche may also be interested in this post
Yup, I already fixed it this way, thanks anyway.
Thank you, already fix it adding a label to the buttons.