diff --git a/.gitignore b/.gitignore index 2cdeb0a..1293a96 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ build compile_commands.json result +.idea diff --git a/css/style.css b/css/style.css index 9e2118c..af5cad1 100644 --- a/css/style.css +++ b/css/style.css @@ -30,6 +30,11 @@ color: #6272a4; } +.lock-button { + font-size: 28px; + color: #6272a4; +} + .exit-button { font-size: 28px; color: #6272a4; @@ -135,69 +140,38 @@ highlight { color: #1793D1; } -.disk-util-progress { +.disk-widget * { color: #bd93f9; background-color: #44475a; font-size: 16px; } -.disk-data-text { - color: #bd93f9; - font-size: 16px; -} - -.vram-util-progress { +.vram-widget * { color: #ffb86c; background-color: #44475a; } -.vram-data-text { - color: #ffb86c; - font-size: 16px; -} - -.ram-util-progress { +.ram-widget * { color: #f1fa8c; background-color: #44475a; } -.ram-data-text { - color: #f1fa8c; - font-size: 16px; -} - -.gpu-util-progress { +.gpu-widget * { color: #8be9fd; background-color: #44475a; } -.gpu-data-text { - color: #8be9fd; - font-size: 16px; -} - -.cpu-util-progress { +.cpu-widget * { color: #50fa7b; background-color: #44475a; - font-size: 16px; } -.cpu-data-text { - color: #50fa7b; - font-size: 16px; -} - -.battery-util-progress { +.battery-widget * { color: #ff79c6; background-color: #44475a; font-size: 16px; } -.battery-data-text { - color: #ff79c6; - font-size: 16px; -} - .battery-charging { color: #ffb86c; } @@ -384,5 +358,3 @@ highlight { animation-timing-function: linear; animation-fill-mode: forwards; } - -/*# sourceMappingURL=style.css.map */ diff --git a/css/style.scss b/css/style.scss index 398fd43..8f1aec1 100644 --- a/css/style.scss +++ b/css/style.scss @@ -55,6 +55,11 @@ $textsize: 16px; color: $darkblue; } +.lock-button { + font-size: 28px; + + color: $darkblue; +} .exit-button { font-size: 28px; @@ -177,64 +182,38 @@ highlight { color: $btblue; } -.disk-util-progress { +.disk-widget * { color: $purple; background-color: $inactive; font-size: $textsize; } -.disk-data-text { - color: $purple; - font-size: $textsize; -} -.vram-util-progress { +.vram-widget * { color: $orange; background-color: $inactive; } -.vram-data-text { - color: $orange; - font-size: $textsize; -} -.ram-util-progress { +.ram-widget * { color: $yellow; background-color: $inactive; } -.ram-data-text { - color: $yellow; - font-size: $textsize; -} -.gpu-util-progress { +.gpu-widget * { color: $cyan; background-color: $inactive; } -.gpu-data-text { - color: $cyan; - font-size: $textsize; -} -.cpu-util-progress { +.cpu-widget * { color: $green; background-color: $inactive; - font-size: $textsize; -} -.cpu-data-text { - color: $green; - font-size: $textsize; } -.battery-util-progress { +.battery-widget * { color: $pink; background-color: $inactive; font-size: $textsize; } -.battery-data-text { - color: $pink; - font-size: $textsize; -} - .battery-charging { color: $orange } diff --git a/src/Bar.cpp b/src/Bar.cpp index 4f30048..fa7dba0 100644 --- a/src/Bar.cpp +++ b/src/Bar.cpp @@ -417,14 +417,18 @@ namespace Bar #endif } - void WidgetSensor(Widget& parent, TimerCallback&& callback, const std::string& sensorClass, const std::string& textClass, Text*& textPtr, + void WidgetSensor(Widget& parent, TimerCallback&& callback, const std::string& sensorName, Text*& textPtr, Side side) { auto eventBox = Widget::Create(); Utils::SetTransform(*eventBox, {-1, false, SideToAlignment(side)}); { auto box = Widget::Create(); + auto widgetClass = sensorName + "-widget"; box->SetSpacing({0, false}); + box->SetClass(widgetClass); + box->AddClass("widget"); + box->AddClass("sensor"); box->SetOrientation(Utils::GetOrientation()); { std::unique_ptr revealer = nullptr; @@ -440,8 +444,9 @@ namespace Bar }); { auto text = Widget::Create(); - text->SetClass(textClass); text->SetAngle(Utils::GetAngle()); + auto textClass = sensorName + "-data-text"; + text->SetClass(textClass); // Since we don't know, on which side the text is, add padding to both sides. // This creates double padding on the side opposite to the sensor. // TODO: Remove that padding. @@ -452,7 +457,6 @@ namespace Bar } auto sensor = Widget::Create(); - sensor->SetClass(sensorClass); double angle = -90; switch (Config::Get().location) { @@ -462,6 +466,8 @@ namespace Bar case 'R': angle = RotatedIcons() ? -90 : 0; break; } sensor->SetStyle({angle}); + auto sensorClass = sensorName + "-util-progress"; + sensor->SetClass(sensorClass); sensor->AddTimer(std::move(callback), DynCtx::updateTime); Utils::SetTransform(*sensor, {(int)Config::Get().sensorSize, true, Alignment::Fill}); @@ -562,6 +568,17 @@ namespace Bar { auto box = Widget::Create(); box->SetSpacing({8, false}); + box->AddClass("widget"); + switch (type) + { + case AudioType::Input: + box->AddClass("mic"); + break; + case AudioType::Output: + box->AddClass("audio"); + break; + } + Utils::SetTransform(*box, {-1, false, SideToAlignment(side)}); box->SetOrientation(Utils::GetOrientation()); { @@ -643,6 +660,7 @@ namespace Bar text->SetText(""); text->SetVisible(false); text->SetClass("package-empty"); + text->AddClass("widget"); text->SetAngle(Utils::GetAngle()); text->AddTimer(DynCtx::UpdatePackages, 1000 * Config::Get().checkUpdateInterval, TimerDispatchBehaviour::ImmediateDispatch); @@ -660,6 +678,8 @@ namespace Bar { auto box = Widget::Create(); box->SetSpacing({0, false}); + box->AddClass("widget"); + box->AddClass("bluetooth"); box->SetOrientation(Utils::GetOrientation()); Utils::SetTransform(*box, {-1, false, SideToAlignment(side)}); { @@ -723,6 +743,8 @@ namespace Bar { auto box = Widget::Create(); box->SetSpacing({0, false}); + box->AddClass("widget"); + box->AddClass("network"); box->SetOrientation(Utils::GetOrientation()); { auto revealer = Widget::Create(); @@ -781,21 +803,26 @@ namespace Bar void WidgetSensors(Widget& parent, Side side) { - WidgetSensor(parent, DynCtx::UpdateDisk, "disk-util-progress", "disk-data-text", DynCtx::diskText, side); + auto box = Widget::Create(); + box->SetClass("sensors"); + { + WidgetSensor(*box, DynCtx::UpdateDisk, "disk", DynCtx::diskText, side); #if defined WITH_NVIDIA || defined WITH_AMD - if (RuntimeConfig::Get().hasNvidia || RuntimeConfig::Get().hasAMD) - { - WidgetSensor(parent, DynCtx::UpdateVRAM, "vram-util-progress", "vram-data-text", DynCtx::vramText, side); - WidgetSensor(parent, DynCtx::UpdateGPU, "gpu-util-progress", "gpu-data-text", DynCtx::gpuText, side); - } + if (RuntimeConfig::Get().hasNvidia || RuntimeConfig::Get().hasAMD) + { + WidgetSensor(*box, DynCtx::UpdateVRAM, "vram", DynCtx::vramText, side); + WidgetSensor(*box, DynCtx::UpdateGPU, "gpu", DynCtx::gpuText, side); + } #endif - WidgetSensor(parent, DynCtx::UpdateRAM, "ram-util-progress", "ram-data-text", DynCtx::ramText, side); - WidgetSensor(parent, DynCtx::UpdateCPU, "cpu-util-progress", "cpu-data-text", DynCtx::cpuText, side); - // Only show battery percentage if battery folder is set and exists - if (System::GetBatteryPercentage() >= 0) - { - WidgetSensor(parent, DynCtx::UpdateBattery, "battery-util-progress", "battery-data-text", DynCtx::batteryText, side); + WidgetSensor(*box, DynCtx::UpdateRAM, "ram", DynCtx::ramText, side); + WidgetSensor(*box, DynCtx::UpdateCPU, "cpu", DynCtx::cpuText, side); + // Only show battery percentage if battery folder is set and exists + if (System::GetBatteryPercentage() >= 0) + { + WidgetSensor(*box, DynCtx::UpdateBattery, "battery", DynCtx::batteryText, side); + } } + parent.AddChild(std::move(box)); } void WidgetPower(Widget& parent, Side side) @@ -834,6 +861,7 @@ namespace Bar { auto powerBox = Widget::Create(); powerBox->SetClass("power-box"); + powerBox->AddClass("widget"); powerBox->SetSpacing({0, false}); powerBox->SetOrientation(Utils::GetOrientation()); { @@ -874,7 +902,7 @@ namespace Bar }); auto lockButton = Widget::Create