popcorn/crates/popcorn-d/ui/osd-popup.slint
Candifloss 5207826108 Begin restructuring
- Daemon `popcorn-d` handles the UI rendering
- `popcorn` acts as cli tool
2025-12-21 22:47:43 +05:30

87 lines
2.5 KiB
Plaintext

export component OSDpopup inherits Window {
in property <int> popup_width;
in property <int> popup_height;
in property <int> popup_border_radius;
in property <int> popup_padding;
in property <color> osd_bg_color;
in property <color> fill_color;
in property <int> value_font_size;
in property <color> value_font_color;
in property <string> value_font;
in property <int> percent_value;
in property <int> icon_size;
in property <color> icon_font_color;
in property <string> icon_font;
in property <string> icon_glyph;
no-frame: true;
always-on-top: true;
background: transparent;
width: popup_width *1px;
height: popup_height *1px;
// Background
osd_bg:= Rectangle {
height: 100%;
width: 100%;
y: 0;
border-width: 0px;
border-radius: popup_border_radius *1px;
background: osd_bg_color;
}
// Filled color
osd_fill:= Rectangle {
height: 100%;
width: (popup_width/100) * percent_value *1px;
y: 0;
x: 0;
border-width: 0px;
border-top-left-radius: popup_border_radius *1px;
border-bottom-left-radius: self.border-top-left-radius;
border-top-right-radius:
self.width > osd_bg.width - popup_border_radius * 1px
? popup_border_radius *1px
: 0px;
border-bottom-right-radius: self.border-top-right-radius;
background: fill_color;
}
HorizontalLayout {
padding-left: popup_padding *1px;
padding-right: popup_padding *1px;
// Icon: Volume, Brightness, Battery, etc.
icon_symbol:= Rectangle {
//background: #a0c932; // For testing
Text {
width: 100%;
height: 100%;
text: icon_glyph;
vertical-alignment: center;
horizontal-alignment: left;
font-family: icon_font;
color: icon_font_color;
font-size: icon_size *1px;
}
}
// Percentage value
value_text:= Rectangle {
//background: #309968; // For testing
Text {
width: 100%;
height: 100%;
text: percent_value + "%";
vertical-alignment: center;
horizontal-alignment: right;
font-family: value_font;
color: value_font_color;
font-size: value_font_size *1px;
}
}
}
}