mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 18:46:00 +01:00
Added custom reserved area per mon
This commit is contained in:
parent
dddb00fbc8
commit
d284aaa2ca
3 changed files with 41 additions and 2 deletions
|
@ -160,8 +160,33 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string
|
|||
|
||||
nextItem();
|
||||
|
||||
if (curitem == "disable" || curitem == "disabled") {
|
||||
newrule.disabled = true;
|
||||
if (curitem == "disable" || curitem == "disabled" || curitem == "addreserved") {
|
||||
if (curitem == "disable" || curitem == "disabled")
|
||||
newrule.disabled = true;
|
||||
else if (curitem == "addreserved") {
|
||||
nextItem();
|
||||
|
||||
int top = std::stoi(curitem);
|
||||
|
||||
nextItem();
|
||||
|
||||
int bottom = std::stoi(curitem);
|
||||
|
||||
nextItem();
|
||||
|
||||
int left = std::stoi(curitem);
|
||||
|
||||
nextItem();
|
||||
|
||||
int right = std::stoi(curitem);
|
||||
|
||||
m_mAdditionalReservedAreas[newrule.name] = {top, bottom, left, right};
|
||||
|
||||
return; // this is not a rule, ignore
|
||||
} else {
|
||||
Debug::log(ERR, "ConfigManager parseMonitor, curitem bogus???");
|
||||
return;
|
||||
}
|
||||
|
||||
// overwrite if exists
|
||||
for (auto& r : m_dMonitorRules) {
|
||||
|
@ -422,6 +447,7 @@ void CConfigManager::loadConfigLoadVars() {
|
|||
m_dWindowRules.clear();
|
||||
g_pKeybindManager->clearKeybinds();
|
||||
g_pAnimationManager->removeAllBeziers();
|
||||
m_mAdditionalReservedAreas.clear();
|
||||
|
||||
const char* const ENVHOME = getenv("HOME");
|
||||
const std::string CONFIGPATH = ENVHOME + (ISDEBUG ? (std::string) "/.config/hypr/hyprlandd.conf" : (std::string) "/.config/hypr/hyprland.conf");
|
||||
|
|
|
@ -30,6 +30,13 @@ struct SMonitorRule {
|
|||
bool disabled = false;
|
||||
};
|
||||
|
||||
struct SMonitorAdditionalReservedArea {
|
||||
int top = 0;
|
||||
int bottom = 0;
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
};
|
||||
|
||||
struct SWindowRule {
|
||||
std::string szRule;
|
||||
std::string szValue;
|
||||
|
@ -55,6 +62,8 @@ public:
|
|||
|
||||
std::vector<SWindowRule> getMatchingRules(CWindow*);
|
||||
|
||||
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;
|
||||
|
||||
// no-op when done.
|
||||
void dispatchExecOnce();
|
||||
|
||||
|
|
|
@ -408,6 +408,10 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
|
|||
PMONITOR->vecReservedTopLeft = Vector2D(usableArea.x, usableArea.y) - PMONITOR->vecPosition;
|
||||
PMONITOR->vecReservedBottomRight = PMONITOR->vecSize - Vector2D(usableArea.width, usableArea.height) - PMONITOR->vecReservedTopLeft;
|
||||
|
||||
const auto ENTRY = g_pConfigManager->m_mAdditionalReservedAreas[PMONITOR->szName];
|
||||
PMONITOR->vecReservedTopLeft = PMONITOR->vecReservedTopLeft + Vector2D(ENTRY.left, ENTRY.top);
|
||||
PMONITOR->vecReservedBottomRight = PMONITOR->vecReservedBottomRight + Vector2D(ENTRY.right, ENTRY.bottom);
|
||||
|
||||
Debug::log(LOG, "Monitor %s layers arranged: reserved: %f %f %f %f", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y, PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue