hyprbars: make part_of_window configurable

closes #48
This commit is contained in:
Vaxry 2023-11-12 12:46:32 +00:00
parent 2cc193e6dc
commit 69e596af68
3 changed files with 5 additions and 1 deletions

View file

@ -32,6 +32,8 @@ plugin {
`bar_text_font` -> (str) bar's title text font (default "Sans") `bar_text_font` -> (str) bar's title text font (default "Sans")
`bar_part_of_window` -> (bool) whether the bar is a part of the main window (if it is, stuff like shadows render around it)
## Buttons Config ## Buttons Config
Use the `hyprbars-button` keyword. Use the `hyprbars-button` keyword.

View file

@ -466,7 +466,8 @@ eDecorationLayer CHyprBar::getDecorationLayer() {
} }
uint64_t CHyprBar::getDecorationFlags() { uint64_t CHyprBar::getDecorationFlags() {
return DECORATION_ALLOWS_MOUSE_INPUT | DECORATION_PART_OF_MAIN_WINDOW; static auto* const PPART = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hyprbars:bar_part_of_window")->intValue;
return DECORATION_ALLOWS_MOUSE_INPUT | (*PPART ? DECORATION_PART_OF_MAIN_WINDOW : 0);
} }
CBox CHyprBar::assignedBoxGlobal() { CBox CHyprBar::assignedBoxGlobal() {

View file

@ -70,6 +70,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:col.text", SConfigValue{.intValue = configStringToInt("rgba(ffffffff)")}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:col.text", SConfigValue{.intValue = configStringToInt("rgba(ffffffff)")});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_size", SConfigValue{.intValue = 10}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_size", SConfigValue{.intValue = 10});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", SConfigValue{.strValue = "Sans"}); HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_text_font", SConfigValue{.strValue = "Sans"});
HyprlandAPI::addConfigValue(PHANDLE, "plugin:hyprbars:bar_part_of_window", SConfigValue{.intValue = 1});
HyprlandAPI::addConfigKeyword(PHANDLE, "hyprbars-button", [&](const std::string& k, const std::string& v) { onNewButton(k, v); }); HyprlandAPI::addConfigKeyword(PHANDLE, "hyprbars-button", [&](const std::string& k, const std::string& v) { onNewButton(k, v); });
HyprlandAPI::registerCallbackDynamic(PHANDLE, "preConfigReload", [&](void* self, SCallbackInfo& info, std::any data) { onPreConfigReload(); }); HyprlandAPI::registerCallbackDynamic(PHANDLE, "preConfigReload", [&](void* self, SCallbackInfo& info, std::any data) { onPreConfigReload(); });