Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Show-truncated in labels and buttons #1083

Open
3 tasks done
gh0stzk opened this issue Apr 22, 2024 · 3 comments
Open
3 tasks done

[BUG] Show-truncated in labels and buttons #1083

gh0stzk opened this issue Apr 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@gh0stzk
Copy link

gh0stzk commented Apr 22, 2024

Checklist before submitting an issue

  • I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • I have specifically verified that this bug is not a common user error
  • 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.

Shot-2024-04-22-083934

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,

Shot-2024-04-22-085947

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
@Rayzeq
Copy link
Contributor

Rayzeq commented Apr 23, 2024

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

@kStor2poche
Copy link

Yup, I already fixed it this way, thanks anyway.

@gh0stzk
Copy link
Author

gh0stzk commented Apr 23, 2024

Thank you, already fix it adding a label to the buttons.

MathiasPius added a commit to MathiasPius/my-leftwm-theme that referenced this issue May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants