export struct ButtonStyle { btn_width: int, btn_height: int, btn_border_radius: int, btn_bg_normal: color, btn_bg_hover: color, btn_bg_clicked: color, option_icon_height: int, icon_font_size: int, icon_font: string, icon_font_color: color, option_text_height: int, option_text_font_size: int, option_text_font: string, option_text_color: color, } component PowerMenuButton { in property option_icon: ""; in property option_text: "Menu Option"; in property button_style; callback menu_btn_callback(); Rectangle { width: button_style.btn_width *1px; height: button_style.btn_height *1px; border-radius: button_style.btn_border_radius *1px; drop-shadow-color: #232323; drop-shadow-blur: 10px; drop-shadow-offset-x: 0; drop-shadow-offset-y: 0; background: touch_area.pressed ? button_style.btn_bg_clicked : touch_area.has-hover ? button_style.btn_bg_hover : button_style.btn_bg_normal; VerticalLayout { padding: 0; spacing: 0; Text { text: option_icon; font-size: button_style.icon_font_size *1px; width: button_style.btn_width *1px; height: button_style.option_icon_height *1px; vertical-alignment: center; horizontal-alignment: center; font-family: button_style.icon_font; color: button_style.icon_font_color; } Text { text: option_text; font-size: button_style.option_text_font_size *1px; width: button_style.btn_width *1px; height: button_style.option_text_height *1px; vertical-alignment: center; horizontal-alignment: center; font-family: button_style.option_text_font; color: button_style.option_text_color; } } touch_area := TouchArea { clicked => { menu_btn_callback(); } } } } export component PowerMenu inherits Window { in property screen_width: 1920; in property screen_height: 1080; in property screen_bg: #a3a3a320; in property button_style: { btn_width: 120, btn_height: 120, btn_border_radius: 20, btn_bg_normal: #91919175, btn_bg_hover: #92929284, btn_bg_clicked: #9b9b9bab, option_icon_height: 90, icon_font_size: 80, icon_font: "IosevkaTermSlab Nerd Font Mono", icon_font_color: #ffffff, option_text_height: 30, option_text_font_size: 14, option_text_font: "IosevkaTermSlab Nerd Font Mono", option_text_color: #ffffff, }; in property menu_padding_x: 20; in property menu_padding_y: menu_padding_x; in property menu_spacing: menu_padding_x; in property menu_border_radius: menu_padding_x; in property menu_width: (button_style.btn_width*4 + menu_spacing*3 + menu_padding_x*2); in property menu_height: (button_style.btn_height + menu_padding_y*2); in property menu_pos_x: (screen_width - menu_width)/2; in property menu_pos_y: (screen_height - menu_height)/2; in property menu_bg: #7a7a7a28; in property ico_lockscreen: ""; in property ico_logout: ""; in property ico_reboot: ""; in property ico_poweroff: ""; in property text_lockscreen: "Lock screen"; in property text_logout: "Log Out"; in property text_reboot: "Reboot"; in property text_poweroff: "Power Off"; no-frame: true; always-on-top: true; background: transparent; width: screen_width *1px; height: screen_height *1px; // Power menu screen Rectangle { width: 100%; height: 100%; x: 0; y:0; background: screen_bg; // Menu pop-up Rectangle { background: menu_bg; border-radius: menu_border_radius *1px; width: menu_width *1px; height: menu_height * 1px; x: menu_pos_x *1px; y: menu_pos_y *1px; // Buttons HorizontalLayout { padding: menu_padding_x *1px; spacing: menu_spacing *1px; // Lock screen PowerMenuButton { option_icon: ico_lockscreen; option_text: text_lockscreen; button_style: root.button_style; } // Log out PowerMenuButton { option_icon: ico_logout; option_text: text_logout; button_style: root.button_style; } // Reboot PowerMenuButton { option_icon: ico_reboot; option_text: text_reboot; button_style: root.button_style; } // Power off PowerMenuButton { option_icon: ico_poweroff; option_text: text_poweroff; button_style: root.button_style; } } } } }