Add color / padding bar settings

This commit is contained in:
outfoxxed 2023-06-02 01:25:53 -07:00
parent f240c66ab6
commit 9a5b7c1940
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
3 changed files with 16 additions and 6 deletions

View file

@ -121,8 +121,9 @@ void Hy3Node::recalcSizePosRecursive(bool force) {
auto tpos = this->position + Vector2D(outer_gaps, outer_gaps);
auto tsize = this->size - Vector2D(outer_gaps * 2, outer_gaps * 2);
static const auto* tab_bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:bar_height")->intValue;
double tab_height_offset = *gaps_in + *tab_bar_height;
static const auto* tab_bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
static const auto* tab_bar_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:padding")->intValue;
double tab_height_offset = *tab_bar_height + *tab_bar_padding;
if (this->data.type != Hy3NodeData::Group) {
this->data.as_window->setHidden(this->hidden);

View file

@ -4,6 +4,8 @@
#include <hyprland/src/Compositor.hpp>
#include <cairo/cairo.h>
#include <hyprland/src/helpers/Color.hpp>
#include <hyprland/src/plugins/PluginAPI.hpp>
#include <hyprland/src/render/OpenGL.hpp>
#include <pixman.h>
@ -47,6 +49,8 @@ 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_inactive = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:col.inactive")->intValue;
auto width = box.width;
auto height = box.height;
@ -75,9 +79,11 @@ void Hy3TabBarEntry::prepareTexture(float scale, wlr_box& box) {
// set brush
if (this->focused) {
cairo_set_source_rgba(cairo, 0.2, 0.7, 1.0, 1.0);
auto c = CColor(*col_active);
cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
} else {
cairo_set_source_rgba(cairo, 0.5, 0.5, 0.5, 1.0);
auto c = CColor(*col_inactive);
cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
}
// outline bar shape
@ -266,7 +272,7 @@ void Hy3TabGroup::updateWithGroup(Hy3Node& node) {
Debug::log(LOG, "updated tab bar for %p", &node);
static const auto* gaps_in = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_in")->intValue;
static const auto* gaps_out = &HyprlandAPI::getConfigValue(PHANDLE, "general:gaps_out")->intValue;
static const auto* bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:bar_height")->intValue;
static const auto* bar_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:height")->intValue;
auto gaps = node.parent == nullptr ? *gaps_out : *gaps_in;
auto tpos = node.position + Vector2D(gaps, gaps);

View file

@ -106,7 +106,10 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
selection_hook::init();
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:no_gaps_when_only", SConfigValue{.intValue = 0});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:bar_height", SConfigValue{.intValue = 15});
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.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});