aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorthejch <[email protected]>2024-04-20 17:50:08 -0700
committerGitHub <[email protected]>2024-04-21 01:50:08 +0100
commit7c3bd4c19fe47f2d92463b81d9b38651b7a1a268 (patch)
tree3e56cd0dabf888e433d54386bf568d5186ea5e73
parent30e4b404f2a30230f57c946b655c2365b3bf8e3d (diff)
downloadHyprland-7c3bd4c19fe47f2d92463b81d9b38651b7a1a268.tar.gz
Hyprland-7c3bd4c19fe47f2d92463b81d9b38651b7a1a268.zip
workspace: Add fullscreen workspace selector (#5640)
* add fullscreen selector * use stoi
-rw-r--r--src/desktop/Workspace.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/desktop/Workspace.cpp b/src/desktop/Workspace.cpp
index 25015c5a..7ab75fd5 100644
--- a/src/desktop/Workspace.cpp
+++ b/src/desktop/Workspace.cpp
@@ -252,6 +252,8 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
// w - windowCount: w[1-4] or w[1], optional flag t or f for tiled or floating and
// flag g to count groups instead of windows, e.g. w[t1-2], w[fg4]
// flag v will count only visible windows
+ // f - fullscreen state : f[-1], f[0], f[1], or f[2] for different fullscreen states
+ // -1: no fullscreen, 0: fullscreen, 1: maximized, 2: fullscreen without sending fs state to window
const auto NEXTSPACE = selector.find_first_of(' ', i);
std::string prop = selector.substr(i, NEXTSPACE == std::string::npos ? std::string::npos : NEXTSPACE - i);
@@ -442,6 +444,44 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
continue;
}
+ if (cur == 'f') {
+ if (!prop.starts_with("f[") || !prop.ends_with("]")) {
+ Debug::log(LOG, "Invalid selector {}", selector);
+ return false;
+ }
+
+ prop = prop.substr(2, prop.length() - 3);
+ int FSSTATE = -1;
+ try {
+ FSSTATE = std::stoi(prop);
+ } catch (std::exception& e) {
+ Debug::log(LOG, "Invalid selector {}", selector);
+ return false;
+ }
+
+ switch (FSSTATE) {
+ case -1: // no fullscreen
+ if (m_bHasFullscreenWindow)
+ return false;
+ break;
+ case 0: // fullscreen full
+ if (!m_bHasFullscreenWindow || m_efFullscreenMode != FULLSCREEN_FULL)
+ return false;
+ break;
+ case 1: // maximized
+ if (!m_bHasFullscreenWindow || m_efFullscreenMode != FULLSCREEN_MAXIMIZED)
+ return false;
+ break;
+ case 2: // fullscreen without sending fullscreen state to window
+ if (!m_bHasFullscreenWindow || m_efFullscreenMode != FULLSCREEN_FULL || !g_pCompositor->getFullscreenWindowOnWorkspace(m_iID) ||
+ !g_pCompositor->getFullscreenWindowOnWorkspace(m_iID)->m_bDontSendFullscreen)
+ return false;
+ break;
+ default: break;
+ }
+ continue;
+ }
+
Debug::log(LOG, "Invalid selector {}", selector);
return false;
}