eww icon indicating copy to clipboard operation
eww copied to clipboard

styling for system tray

Open sagax opened this issue 1 year ago • 11 comments

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

Examples of styling the context menu for icons in the system tray are needed, please

Reproducing the issue

No response

Expected behaviour

No response

Additional context

No response

Platform and environment

Linux, X11, Xmonad, openSUSE Tumbleweed, X64

sagax avatar Dec 13 '24 22:12 sagax

https://github.com/elkowar/eww/issues/1161#issuecomment-2295482424

hypernova7 avatar Dec 14 '24 08:12 hypernova7

Here is something more complete, these styles can be used to add an arrow to the options that are submenus

menu {
  padding: 5px;
  background-color: $black;
  color: #fff;

  menuitem {
    border-radius: 5px;
    padding: 8px 12px;
    background-color: transparent;
    transition: all .2s ease;

    &:backdrop {
      background-color: $background;
    }
  }

  menuitem arrow {
    min-width: 16px;
    min-height: 16px;

    &:dir(ltr) {
      -gtk-icon-source: -gtk-icontheme('pan-end-symbolic');
      margin-left: 10px;
      margin-right: 0;
    }
  }

  menuitem:hover {
    background-color: $blue;
  }
}

hypernova7 avatar Dec 14 '24 08:12 hypernova7

It's work, thanks.

It would be great to create a page about widget styling and widget parts.

sagax avatar Dec 20 '24 08:12 sagax

what about styling the "hover over app to show app name" popup?

kaii-lb avatar May 19 '25 20:05 kaii-lb

an even more complete styling:

menu {
    padding: $default-spacing;
    background-color: $background-color;
    color: $foreground;
    border-radius: 5px;

    menuitem {
        border-radius: 5px;
        padding: $border-size;
        background-color: transparent;
        transition: all 0.2s ease;

        &:backdrop {
            background-color: $background-color;
        }
    }

    menuitem arrow {
        min-width: 16px;
        min-height: 16px;

        &:dir(ltr) {
            -gtk-icon-source: -gtk-icontheme("pan-end-symbolic");
            margin-left: 10px;
            margin-right: 0;
        }
    }

    menuitem:hover {
        background-color: $secondary-color;
    }

    menuitem:disabled label {
        color: #555;
    }

    separator {
        background-color: $secondary-color;
        min-height: 2px;
        margin: 5px 0px;
        border-radius: 5px;
    }
}

noahpolimon avatar Nov 06 '25 01:11 noahpolimon

most complete version with check fields

menu {
  border-radius: 15px;
  background-color: $surface0;
  border: 2px solid $blue;
  color: #fff;

  separator:not(:last-child) {
    margin: 0 8px;
    min-height: 2px;
    background-color: $surface1;
  }

  menuitem {
    margin: 0px;
    border-radius: 15px;
    background-color: transparent;
    transition: all 0s ease-in;
    padding: 8px;

    &:hover {
      color: $surface1;
      background-color: $text;

      arrow {
        color: $surface1;
      }

      check:checked {
        color: $text;
      }
    }

    arrow {
      min-width: 16px;
      min-height: 16px;

      &:dir(ltr) {
        -gtk-icon-source: -gtk-icontheme("pan-end-symbolic");
        margin-left: 10px;
        margin-right: 20px;
      }
    }

    check:checked {
      padding-left: 7px;
      margin-right: 10px;
      min-width: 20px;
      min-height: 15px;
      background-color: $blue;
      -gtk-icon-source: -gtk-icontheme("dino-tick-symbolic");
      color: $surface1;
    }

    &:backdrop {
      background-color: $mantle;
    }
  }
}
Image

hypernova7 avatar Nov 06 '25 08:11 hypernova7

most complete version with check fields

menu { border-radius: 15px; background-color: $surface0; border: 2px solid $blue; color: #fff;

separator:not(:last-child) { margin: 0 8px; min-height: 2px; background-color: $surface1; }

menuitem { margin: 0px; border-radius: 15px; background-color: transparent; transition: all 0s ease-in; padding: 8px;

&:hover {
  color: $surface1;
  background-color: $text;

  arrow {
    color: $surface1;
  }

  check:checked {
    color: $text;
  }
}

arrow {
  min-width: 16px;
  min-height: 16px;

  &:dir(ltr) {
    -gtk-icon-source: -gtk-icontheme("pan-end-symbolic");
    margin-left: 10px;
    margin-right: 20px;
  }
}

check:checked {
  padding-left: 7px;
  margin-right: 10px;
  min-width: 20px;
  min-height: 15px;
  background-color: $blue;
  -gtk-icon-source: -gtk-icontheme("dino-tick-symbolic");
  color: $surface1;
}

&:backdrop {
  background-color: $mantle;
}

} }

Image

Hi thank you for this! spent a few hours trying to make sense of the GTK CSS doc to find those myself.

There is also styling for radio buttons for those who need it:

menuitem radio {
    &:checked {
        -gtk-icon-source: -gtk-icontheme("radio-checked-symbolic");
    }
    -gtk-icon-source: -gtk-icontheme("radio-symbolic");

}
Image

noahpolimon avatar Nov 06 '25 10:11 noahpolimon

@hypernova7 btw, is there any way to make all the icons the same size?

Image

noahpolimon avatar Nov 06 '25 10:11 noahpolimon

@noahpolimon The tray widget has the icon-size attribute.

(tray :icon-size 16 :spacing 4)

hypernova7 avatar Nov 06 '25 19:11 hypernova7

@hypernova7 sorry, i meant the icons in the menus, not the tray

noahpolimon avatar Nov 07 '25 01:11 noahpolimon

@noahpolimon try this https://askubuntu.com/questions/201987/how-do-i-force-a-16x16-icon-size-for-toolbar-icons-in-gtk-3 i think this work for gtk 4 too

hypernova7 avatar Nov 07 '25 01:11 hypernova7