aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlittleblack111 <[email protected]>2024-11-23 22:32:13 +0800
committerGitHub <[email protected]>2024-11-23 14:32:13 +0000
commit65f66dcf0d38533a383212ca440fdea0163be276 (patch)
tree203193582cff5e9e7861d9501dfcf44c8671acbf
parent451d7a41fc87529854c4116c96a7c6a46568a1ee (diff)
downloadHyprland-65f66dcf0d38533a383212ca440fdea0163be276.tar.gz
Hyprland-65f66dcf0d38533a383212ca440fdea0163be276.zip
binds: add option to allow fullscreening a pinned window (#8526)
-rw-r--r--src/Compositor.cpp15
-rw-r--r--src/config/ConfigDescriptions.hpp6
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/desktop/Window.hpp3
4 files changed, 23 insertions, 2 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 3fe5acec..53eaa467 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -2245,7 +2245,8 @@ void CCompositor::setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFull
}
void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenState state) {
- static auto PDIRECTSCANOUT = CConfigValue<Hyprlang::INT>("render:direct_scanout");
+ static auto PDIRECTSCANOUT = CConfigValue<Hyprlang::INT>("render:direct_scanout");
+ static auto PALLOWPINFULLSCREEN = CConfigValue<Hyprlang::INT>("binds:allow_pin_fullscreen");
if (!validMapped(PWINDOW) || g_pCompositor->m_bUnsafeState)
return;
@@ -2259,7 +2260,17 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenS
const eFullscreenMode CURRENT_EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)PWINDOW->m_sFullscreenState.internal);
const eFullscreenMode EFFECTIVE_MODE = (eFullscreenMode)std::bit_floor((uint8_t)state.internal);
- const bool CHANGEINTERNAL = !(PWINDOW->m_bPinned || CURRENT_EFFECTIVE_MODE == EFFECTIVE_MODE || (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->isFullscreen()));
+ if (*PALLOWPINFULLSCREEN && !PWINDOW->m_bPinFullscreened && !PWINDOW->isFullscreen() && PWINDOW->m_bPinned) {
+ PWINDOW->m_bPinned = false;
+ PWINDOW->m_bPinFullscreened = true;
+ }
+
+ const bool CHANGEINTERNAL = !(PWINDOW->m_bPinned || CURRENT_EFFECTIVE_MODE == EFFECTIVE_MODE || (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->isFullscreen()));
+
+ if (*PALLOWPINFULLSCREEN && PWINDOW->m_bPinFullscreened && PWINDOW->isFullscreen() && !PWINDOW->m_bPinned && state.internal == FSMODE_NONE) {
+ PWINDOW->m_bPinned = true;
+ PWINDOW->m_bPinFullscreened = false;
+ }
// TODO: update the state on syncFullscreen changes
if (!CHANGEINTERNAL && PWINDOW->m_sWindowData.syncFullscreen.valueOrDefault())
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index 45379140..bb3d4e0e 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -1206,6 +1206,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{true},
},
+ SConfigOptionDescription{
+ .value = "binds:allow_pin_fullscreen",
+ .description = "Allows fullscreen to pinned windows, and restore their pinned status afterwards",
+ .type = CONFIG_OPTION_BOOL,
+ .data = SConfigOptionDescription::SBoolData{true},
+ },
/*
* xwayland:
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 32f64f0a..3429db24 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -536,6 +536,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("binds:movefocus_cycles_fullscreen", Hyprlang::INT{1});
m_pConfig->addConfigValue("binds:disable_keybind_grabbing", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:window_direction_monitor_fallback", Hyprlang::INT{1});
+ m_pConfig->addConfigValue("binds:allow_pin_fullscreen", Hyprlang::INT{0});
m_pConfig->addConfigValue("gestures:workspace_swipe", Hyprlang::INT{0});
m_pConfig->addConfigValue("gestures:workspace_swipe_fingers", Hyprlang::INT{3});
diff --git a/src/desktop/Window.hpp b/src/desktop/Window.hpp
index ac81e5ef..5dd59437 100644
--- a/src/desktop/Window.hpp
+++ b/src/desktop/Window.hpp
@@ -332,6 +332,9 @@ class CWindow {
// For pinned (sticky) windows
bool m_bPinned = false;
+ // For preserving pinned state when fullscreening a pinned window
+ bool m_bPinFullscreened = false;
+
// urgency hint
bool m_bIsUrgent = false;