Merge pull request #189 from JakeStanger/fix/icon-classes

fix: add sensible class names for icon labels
This commit is contained in:
Jake Stanger 2023-06-14 20:34:13 +01:00 committed by GitHub
commit 6f7af07cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 286 additions and 344 deletions

547
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -98,7 +98,7 @@ zbus = { version = "3.13.1", optional = true }
# workspaces
swayipc-async = { version = "2.0.1", optional = true }
hyprland = { version = "0.3.1", optional = true }
hyprland = { version = "=0.3.1", optional = true }
futures-util = { version = "0.3.21", optional = true }
# shared

View File

@ -86,6 +86,9 @@ end:
|--------------------------------------|------------------------------------------------------|
| `.clipboard` | Clipboard widget. |
| `.clipboard .btn` | Clipboard widget button. |
| `.clipboard .btn .icon` | Clipboard widget button icon (any type). |
| `.clipboard .btn .text-icon` | Clipboard widget button icon (textual only). |
| `.clipboard .btn .image` | Clipboard widget button icon (image only). |
| `.popup-clipboard` | Clipboard popup box. |
| `.popup-clipboard .item` | Clipboard row item inside the popup. |
| `.popup-clipboard .item .btn` | Clipboard row item radio button. |

View File

@ -134,19 +134,31 @@ and will be replaced with values from the currently playing track:
## Styling
| Selector | Description |
|-------------------------------------|------------------------------------------|
|---------------------------------------------|-------------------------------------------------------|
| `.music` | Tray widget button |
| `.music .contents` | Tray widget button contents box |
| `.music .contents .icon` | Tray widget button icon (any type) |
| `.music .contents .text-icon` | Tray widget button icon (textual only) |
| `.music .contents .image` | Tray widget button icon (image only) |
| `.popup-music` | Popup box |
| `.popup-music .album-art` | Album art image inside popup box |
| `.popup-music .title` | Track title container inside popup box |
| `.popup-music .title .icon` | Track title icon label inside popup box |
| `.popup-music .title .icon-box` | Track title icon container inside popup box |
| `.popup-music .title .icon-box .icon` | Track title icon inside its container (any type) |
| `.popup-music .title .icon-box .text-icon` | Track title icon inside its container (textual only) |
| `.popup-music .title .icon-box .image` | Track title icon inside its container (image only) |
| `.popup-music .title .label` | Track title label inside popup box |
| `.popup-music .album` | Track album container inside popup box |
| `.popup-music .album .icon` | Track album icon label inside popup box |
| `.popup-music .album .icon-box` | Track album icon container inside popup box |
| `.popup-music .album .icon-box .icon` | Track album icon inside its container (any type) |
| `.popup-music .album .icon-box .text-icon` | Track album icon inside its container (textual only) |
| `.popup-music .album .icon-box .image` | Track album icon inside its container (image only) |
| `.popup-music .album .label` | Track album label inside popup box |
| `.popup-music .artist` | Track artist container inside popup box |
| `.popup-music .artist .icon` | Track artist icon label inside popup box |
| `.popup-music .artist .icon-box` | Track artist icon container inside popup box |
| `.popup-music .artist .icon-box .icon` | Track artist icon inside its container (any type) |
| `.popup-music .artist .icon-box .text-icon` | Track artist icon inside its container (textual only) |
| `.popup-music .artist .icon-box .image` | Track artist icon inside its container (image only) |
| `.popup-music .artist .label` | Track artist label inside popup box |
| `.popup-music .controls` | Controls container inside popup box |
| `.popup-music .controls .btn-prev` | Previous button inside popup box |

View File

@ -90,9 +90,12 @@ end:
## Styling
| Selector | Description |
|-----------------------------|--------------------------------------|
|--------------------------------|--------------------------------------|
| `.workspaces` | Workspaces widget box |
| `.workspaces .item` | Workspace button |
| `.workspaces .item.focused` | Workspace button (workspace focused) |
| `.workspaces .item .icon` | Workspace button icon (any type) |
| `.workspaces .item .text-icon` | Workspace button icon (textual only) |
| `.workspaces .item .image` | Workspace button icon (image only) |
For more information on styling, please see the [styling guide](styling-guide).

View File

@ -10,6 +10,7 @@ pub fn new_icon_button(input: &str, icon_theme: &IconTheme, size: i32) -> Button
if ImageProvider::is_definitely_image_input(input) {
let image = Image::new();
add_class(&image, "image");
add_class(&image, "icon");
match ImageProvider::parse(input, icon_theme, size)
.map(|provider| provider.load_into_image(image.clone()))
@ -35,6 +36,7 @@ pub fn new_icon_label(input: &str, icon_theme: &IconTheme, size: i32) -> gtk::Bo
if ImageProvider::is_definitely_image_input(input) {
let image = Image::new();
add_class(&image, "icon");
add_class(&image, "image");
container.add(&image);
@ -43,7 +45,8 @@ pub fn new_icon_label(input: &str, icon_theme: &IconTheme, size: i32) -> gtk::Bo
.map(|provider| provider.load_into_image(image));
} else {
let label = Label::new(Some(input));
add_class(&label, "label");
add_class(&label, "icon");
add_class(&label, "text-icon");
container.add(&label);
}

View File

@ -454,7 +454,7 @@ impl IconLabel {
let icon = new_icon_label(icon_input, icon_theme, 24);
let label = Label::new(label);
add_class(&icon, "icon");
add_class(&icon, "icon-box");
add_class(&label, "label");
container.add(&icon);