Skip to content

Commit

Permalink
feat(window): add option to disable maximized hints
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Feb 16, 2025
1 parent 897ee27 commit 33710f4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/config/ConfigDescriptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
.type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{false},
},
SConfigOptionDescription{
.value = "misc:disable_maximized_state",
.description = "disable telling windows they are maximized, which can help with windows remembering their size",
.type = CONFIG_OPTION_BOOL,
.data = SConfigOptionDescription::SBoolData{false},
},
SConfigOptionDescription{
.value = "misc:lockdead_screen_delay",
.description = "the delay in ms after the lockdead screen appears if the lock screen did not appear after a lock event occurred.",
Expand Down
1 change: 1 addition & 0 deletions src/config/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("misc:render_unfocused_fps", Hyprlang::INT{15});
m_pConfig->addConfigValue("misc:disable_xdg_env_checks", Hyprlang::INT{0});
m_pConfig->addConfigValue("misc:disable_hyprland_qtutils_check", Hyprlang::INT{0});
m_pConfig->addConfigValue("misc:disable_maximized_state", Hyprlang::INT{0});
m_pConfig->addConfigValue("misc:lockdead_screen_delay", Hyprlang::INT{1000});

m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
Expand Down
5 changes: 4 additions & 1 deletion src/protocols/XDGShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "core/Seat.hpp"
#include "core/Compositor.hpp"
#include "protocols/core/Output.hpp"
#include "../config/ConfigManager.hpp"
#include <cstring>
#include <ranges>

Expand Down Expand Up @@ -392,8 +393,10 @@ CXDGSurfaceResource::CXDGSurfaceResource(SP<CXdgSurface> resource_, SP<CXDGWMBas
}

if (surface->current.texture && !mapped) {
static auto* const PDISABLEMAXIMIZEDSTATE = (int* const*)g_pConfigManager->getConfigValuePtr("misc:disable_maximized_state");

// this forces apps to not draw CSD.
if (toplevel)
if (toplevel && !**PDISABLEMAXIMIZEDSTATE)
toplevel->setMaximized(true);

mapped = true;
Expand Down
5 changes: 4 additions & 1 deletion src/xwayland/XWM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "../managers/SeatManager.hpp"
#include "../protocols/XWaylandShell.hpp"
#include "../protocols/core/Compositor.hpp"
#include "../config/ConfigManager.hpp"
using namespace Hyprutils::OS;

#define XCB_EVENT_RESPONSE_TYPE_MASK 0x7f
Expand Down Expand Up @@ -993,14 +994,16 @@ void CXWM::sendState(SP<CXWaylandSurface> surf) {
return;
}

static auto* const PDISABLEMAXIMIZEDSTATE = (int* const*)g_pConfigManager->getConfigValuePtr("misc:disable_maximized_state");

std::vector<uint32_t> props;
// reserve to avoid reallocations
props.reserve(6); // props below
if (surf->modal)
props.push_back(HYPRATOMS["_NET_WM_STATE_MODAL"]);
if (surf->fullscreen)
props.push_back(HYPRATOMS["_NET_WM_STATE_FULLSCREEN"]);
if (surf->maximized) {
if (surf->maximized && !**PDISABLEMAXIMIZEDSTATE) {
props.push_back(HYPRATOMS["NET_WM_STATE_MAXIMIZED_VERT"]);
props.push_back(HYPRATOMS["NET_WM_STATE_MAXIMIZED_HORZ"]);
}
Expand Down

0 comments on commit 33710f4

Please sign in to comment.