Files
hypr-chrome/src/GlobalState.hpp
T
darmanandClaude Opus 5 a22403d603
Version Bump / check-bump-label (pull_request) Skipped
Version Bump / apply-version-bump (pull_request) Successful in 23s
Add a solid outline tracing the frame's outer edge
New plugin:hyprchrome:outline_size (px, 0 = off) and outline_color
(default white) stroke the frame's outer silhouette - chamfers, title bar
plateau and side notches - with a flat color, so it reads as a drawn line
against the gradient-filled frame underneath. Off by default.

The line sits inside the frame rather than centred on the silhouette. The
outer path runs along the texture's own bounds, so half of a centred
stroke would fall off the surface and vanish on exactly those sides;
stroking at double width leaves the inner half, which comes to
outline_size on every edge.

The clip is the whole ring rather than just the outer path, so an outline
thicker than the frame stops at the window's edge instead of spilling
across the ring onto the window, and a miter spike at the plateau's dip
stays confined to the frame.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 02:00:06 +02:00

99 lines
4.3 KiB
C++

#pragma once
#include "Common.hpp"
#include "ChromeConfig.hpp"
#include <vector>
class ChromeDecoration;
struct GlobalState {
ChromeConfig config;
std::vector<WP<ChromeDecoration>> decorations;
GlobalState(HANDLE plugin) {
config = ChromeConfig{
.enabled = makeShared<BoolValue>(
"plugin:hyprchrome:enabled",
"Whether the border decoration is enabled",
true),
.extent = makeShared<IntValue>(
"plugin:hyprchrome:extent",
"How far the border extends past each window edge, in pixels",
12),
.followHyprlandBorderColor = makeShared<BoolValue>(
"plugin:hyprchrome:follow_hyprland_border_color",
"Whether the border tracks Hyprland's own active/inactive border color instead of active_color/inactive_color",
true),
.activeColor = makeShared<GradientValue>(
"plugin:hyprchrome:active_color",
"Color (or gradient) of the border on the focused window, used when follow_hyprland_border_color is false",
CHyprColor{RGBAToARGB(0xFFD063FF)}),
.inactiveColor = makeShared<GradientValue>(
"plugin:hyprchrome:inactive_color",
"Color (or gradient) of the border on unfocused windows, used when follow_hyprland_border_color is false",
CHyprColor{RGBAToARGB(0x6C6C6CFF)}),
.glowSize = makeShared<IntValue>(
"plugin:hyprchrome:glow_size",
"How far the border's glow bleeds inward over the window, in pixels (0 disables it)",
0,
IntValueOptions{.min = 0}),
.glowStrength = makeShared<FloatValue>(
"plugin:hyprchrome:glow_strength",
"Peak opacity of the inward glow at the window edge, 0-1",
0.35F,
FloatValueOptions{.min = 0.F, .max = 1.F}),
.outlineSize = makeShared<IntValue>(
"plugin:hyprchrome:outline_size",
"Thickness of the solid outline tracing the frame's edges, in pixels (0 disables it)",
0,
IntValueOptions{.min = 0}),
.outlineColor = makeShared<ColorValue>(
"plugin:hyprchrome:outline_color",
"Color of the outline tracing the frame's edges",
RGBAToARGB(0xFFFFFFFF)),
.shadowSize = makeShared<IntValue>(
"plugin:hyprchrome:shadow_size",
"How far the frame's drop shadow reaches past its outline, in pixels (0 disables it)",
0,
IntValueOptions{.min = 0}),
.shadowColor = makeShared<ColorValue>(
"plugin:hyprchrome:shadow_color",
"Color of the frame's drop shadow; its alpha is the shadow's opacity",
RGBAToARGB(0x000000B3)),
.shadowOffset = makeShared<Vec2Value>(
"plugin:hyprchrome:shadow_offset",
"How far the shadow is displaced from the frame, in pixels (positive is right/down)",
Config::VEC2{0.F, 0.F}),
.titlebarHeight = makeShared<IntValue>(
"plugin:hyprchrome:titlebar_height",
"Height of the title bar hanging off the floating top-border cutout, in pixels",
8),
.titlebarTextSize = makeShared<IntValue>(
"plugin:hyprchrome:titlebar_text_size",
"Font size of the title bar's text, in pixels",
12),
.titlebarFont = makeShared<StringValue>(
"plugin:hyprchrome:titlebar_font",
"Font family of the title bar's text",
"sans-serif"),
};
HyprlandAPI::addConfigValueV2(plugin, config.enabled);
HyprlandAPI::addConfigValueV2(plugin, config.extent);
HyprlandAPI::addConfigValueV2(plugin, config.followHyprlandBorderColor);
HyprlandAPI::addConfigValueV2(plugin, config.activeColor);
HyprlandAPI::addConfigValueV2(plugin, config.inactiveColor);
HyprlandAPI::addConfigValueV2(plugin, config.glowSize);
HyprlandAPI::addConfigValueV2(plugin, config.glowStrength);
HyprlandAPI::addConfigValueV2(plugin, config.outlineSize);
HyprlandAPI::addConfigValueV2(plugin, config.outlineColor);
HyprlandAPI::addConfigValueV2(plugin, config.shadowSize);
HyprlandAPI::addConfigValueV2(plugin, config.shadowColor);
HyprlandAPI::addConfigValueV2(plugin, config.shadowOffset);
HyprlandAPI::addConfigValueV2(plugin, config.titlebarHeight);
HyprlandAPI::addConfigValueV2(plugin, config.titlebarTextSize);
HyprlandAPI::addConfigValueV2(plugin, config.titlebarFont);
}
};