Handle "urgent" window state in tab bar

This commit is contained in:
outfoxxed 2023-06-03 02:00:50 -07:00
parent b9568783b1
commit 7a7a8c79af
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
3 changed files with 12 additions and 4 deletions

View file

@ -55,6 +55,9 @@ plugin {
# active tab bar segment color
col.active = <color>
# urgent tab bar segment color
col.urgent = <color>
# inactive tab bar segment color
col.inactive = <color>

View file

@ -50,6 +50,7 @@ void Hy3TabBarEntry::setUrgent(bool urgent) {
void Hy3TabBarEntry::prepareTexture(float scale, wlr_box& box) {
static const auto* rounding_setting = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue;
static const auto* col_active = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:col.active")->intValue;
static const auto* col_urgent = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:col.urgent")->intValue;
static const auto* col_inactive = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:col.inactive")->intValue;
auto width = box.width;
@ -78,14 +79,17 @@ void Hy3TabBarEntry::prepareTexture(float scale, wlr_box& box) {
cairo_restore(cairo);
// set brush
CColor c;
if (this->focused) {
auto c = CColor(*col_active);
cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
c = CColor(*col_active);
} else if (this->urgent) {
c = CColor(*col_urgent);
} else {
auto c = CColor(*col_inactive);
cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
c = CColor(*col_inactive);
}
cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
// outline bar shape
cairo_move_to(cairo, 0, rounding);
cairo_arc(cairo, rounding, rounding, rounding, -180.0 * (M_PI / 180.0), -90.0 * (M_PI / 180.0));

View file

@ -109,6 +109,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:height", SConfigValue{.intValue = 15});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:padding", SConfigValue{.intValue = 5});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:col.active", SConfigValue{.intValue = 0xff32b4ff});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:col.urgent", SConfigValue{.intValue = 0xffff4f4f});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:col.inactive", SConfigValue{.intValue = 0x80808080});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:from_top", SConfigValue{.intValue = 0});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:rounding", SConfigValue{.intValue = 3});