mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 06:29:50 +01:00
Added fullscreen rule
This commit is contained in:
parent
29aab21033
commit
78bf88ba60
8 changed files with 35 additions and 16 deletions
|
@ -1116,3 +1116,17 @@ bool CCompositor::workspaceIDOutOfBounds(const int& id) {
|
||||||
|
|
||||||
return std::clamp(id, lowestID, highestID) != id;
|
return std::clamp(id, lowestID, highestID) != id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode mode) {
|
||||||
|
if (!windowValidMapped(pWindow))
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(pWindow, mode, on);
|
||||||
|
|
||||||
|
g_pXWaylandManager->setWindowFullscreen(pWindow, pWindow->m_bIsFullscreen && mode == FULLSCREEN_FULL);
|
||||||
|
// make all windows on the same workspace under the fullscreen window
|
||||||
|
for (auto& w : g_pCompositor->m_lWindows) {
|
||||||
|
if (w.m_iWorkspaceID == pWindow->m_iWorkspaceID)
|
||||||
|
w.m_bCreatedOverFullscreen = false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -132,6 +132,7 @@ public:
|
||||||
int getNextAvailableMonitorID();
|
int getNextAvailableMonitorID();
|
||||||
void moveWorkspaceToMonitor(CWorkspace*, SMonitor*);
|
void moveWorkspaceToMonitor(CWorkspace*, SMonitor*);
|
||||||
bool workspaceIDOutOfBounds(const int&);
|
bool workspaceIDOutOfBounds(const int&);
|
||||||
|
void setWindowFullscreen(CWindow*, bool, eFullscreenMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAllSignals();
|
void initAllSignals();
|
||||||
|
|
|
@ -489,6 +489,7 @@ void CConfigManager::handleWindowRule(const std::string& command, const std::str
|
||||||
&& RULE.find("monitor") != 0
|
&& RULE.find("monitor") != 0
|
||||||
&& RULE != "nofocus"
|
&& RULE != "nofocus"
|
||||||
&& RULE != "noblur"
|
&& RULE != "noblur"
|
||||||
|
&& RULE != "fullscreen"
|
||||||
&& RULE.find("animation") != 0
|
&& RULE.find("animation") != 0
|
||||||
&& RULE.find("rounding") != 0
|
&& RULE.find("rounding") != 0
|
||||||
&& RULE.find("workspace") != 0) {
|
&& RULE.find("workspace") != 0) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->m_bIsFloating) {
|
if (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->m_bIsFloating) {
|
||||||
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
|
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
|
||||||
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PFULLWINDOW, FULLSCREEN_FULL);
|
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PFULLWINDOW, FULLSCREEN_FULL, false);
|
||||||
g_pXWaylandManager->setWindowFullscreen(PFULLWINDOW, PFULLWINDOW->m_bIsFullscreen);
|
g_pXWaylandManager->setWindowFullscreen(PFULLWINDOW, PFULLWINDOW->m_bIsFullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(PWINDOW);
|
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(PWINDOW);
|
||||||
std::string requestedWorkspace = "";
|
std::string requestedWorkspace = "";
|
||||||
bool workspaceSilent = false;
|
bool workspaceSilent = false;
|
||||||
|
bool requestsFullscreen = false;
|
||||||
|
|
||||||
for (auto& r : WINDOWRULES) {
|
for (auto& r : WINDOWRULES) {
|
||||||
if (r.szRule.find("monitor") == 0) {
|
if (r.szRule.find("monitor") == 0) {
|
||||||
|
@ -129,6 +130,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
PWINDOW->m_bNoFocus = true;
|
PWINDOW->m_bNoFocus = true;
|
||||||
} else if (r.szRule == "noblur") {
|
} else if (r.szRule == "noblur") {
|
||||||
PWINDOW->m_sAdditionalConfigData.forceNoBlur = true;
|
PWINDOW->m_sAdditionalConfigData.forceNoBlur = true;
|
||||||
|
} else if (r.szRule == "fullscreen") {
|
||||||
|
requestsFullscreen = true;
|
||||||
} else if (r.szRule.find("rounding") == 0) {
|
} else if (r.szRule.find("rounding") == 0) {
|
||||||
try {
|
try {
|
||||||
PWINDOW->m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
PWINDOW->m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
||||||
|
@ -256,6 +259,10 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (requestsFullscreen) {
|
||||||
|
g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_FULL);
|
||||||
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
|
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,9 +393,9 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
|
||||||
const auto REQUESTED = &PWINDOW->m_uSurface.xdg->toplevel->requested;
|
const auto REQUESTED = &PWINDOW->m_uSurface.xdg->toplevel->requested;
|
||||||
|
|
||||||
if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen)
|
if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen)
|
||||||
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL);
|
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL, true);
|
||||||
} else {
|
} else {
|
||||||
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL);
|
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Window %x fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen);
|
Debug::log(LOG, "Window %x fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen);
|
||||||
|
|
|
@ -676,21 +676,24 @@ void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
||||||
g_pCompositor->moveWindowToTop(pWindow);
|
g_pCompositor->moveWindowToTop(pWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode) {
|
void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode, bool on) {
|
||||||
if (!g_pCompositor->windowValidMapped(pWindow))
|
if (!g_pCompositor->windowValidMapped(pWindow))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (on == pWindow->m_bIsFullscreen)
|
||||||
|
return; // ignore
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow && !pWindow->m_bIsFullscreen) {
|
if (PWORKSPACE->m_bHasFullscreenWindow && on) {
|
||||||
// if the window wants to be fullscreen but there already is one,
|
// if the window wants to be fullscreen but there already is one,
|
||||||
// ignore the request.
|
// ignore the request.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, accept it.
|
// otherwise, accept it.
|
||||||
pWindow->m_bIsFullscreen = !pWindow->m_bIsFullscreen;
|
pWindow->m_bIsFullscreen = on;
|
||||||
PWORKSPACE->m_bHasFullscreenWindow = !PWORKSPACE->m_bHasFullscreenWindow;
|
PWORKSPACE->m_bHasFullscreenWindow = !PWORKSPACE->m_bHasFullscreenWindow;
|
||||||
|
|
||||||
if (!pWindow->m_bIsFullscreen) {
|
if (!pWindow->m_bIsFullscreen) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
virtual void onEndDragWindow();
|
virtual void onEndDragWindow();
|
||||||
virtual void onMouseMove(const Vector2D&);
|
virtual void onMouseMove(const Vector2D&);
|
||||||
virtual void onWindowCreatedFloating(CWindow*);
|
virtual void onWindowCreatedFloating(CWindow*);
|
||||||
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode);
|
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool);
|
||||||
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
|
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
|
||||||
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
|
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
|
||||||
virtual void switchWindows(CWindow*, CWindow*);
|
virtual void switchWindows(CWindow*, CWindow*);
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
The layout sets all the fullscreen flags.
|
The layout sets all the fullscreen flags.
|
||||||
It can either accept or ignore.
|
It can either accept or ignore.
|
||||||
*/
|
*/
|
||||||
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode) = 0;
|
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool) = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called when a dispatcher requests a custom message
|
Called when a dispatcher requests a custom message
|
||||||
|
|
|
@ -366,14 +366,7 @@ void CKeybindManager::fullscreenActive(std::string args) {
|
||||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, args == "1" ? eFullscreenMode::FULLSCREEN_MAXIMIZED : eFullscreenMode::FULLSCREEN_FULL);
|
g_pCompositor->setWindowFullscreen(PWINDOW, !PWINDOW->m_bIsFullscreen, args == "1" ? FULLSCREEN_MAXIMIZED : FULLSCREEN_FULL);
|
||||||
|
|
||||||
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen && (args == "0" || args == ""));
|
|
||||||
// make all windows on the same workspace under the fullscreen window
|
|
||||||
for (auto& w : g_pCompositor->m_lWindows) {
|
|
||||||
if (w.m_iWorkspaceID == PWINDOW->m_iWorkspaceID)
|
|
||||||
w.m_bCreatedOverFullscreen = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||||
|
|
Loading…
Reference in a new issue