desktop: restore invisible floating window alpha/opacity when focused over fullscreen (#12994)

This commit is contained in:
Naufal Hisyam Muzakki 2026-01-21 22:55:12 +07:00 committed by GitHub
parent 6c3ebed76e
commit e7985ca4c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 51 additions and 0 deletions

View file

@ -296,6 +296,24 @@ static SDispatchResult checkRule(std::string in) {
return {};
}
static SDispatchResult floatingFocusOnFullscreen(std::string in) {
const auto PLASTWINDOW = Desktop::focusState()->window();
if (!PLASTWINDOW)
return {.success = false, .error = "No window"};
if (!PLASTWINDOW->m_isFloating)
return {.success = false, .error = "Window must be floating"};
if (PLASTWINDOW->m_alpha != 1.f)
return {.success = false, .error = "floating window doesnt restore it opacity when focused on fullscreen workspace"};
if (!PLASTWINDOW->m_createdOverFullscreen)
return {.success = false, .error = "floating window doesnt get flagged as createdOverFullscreen"};
return {};
}
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
@ -309,6 +327,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:test:keybind", ::keybind);
HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:test:add_rule", ::addRule);
HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:test:check_rule", ::checkRule);
HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:test:floating_focus_on_fullscreen", ::floatingFocusOnFullscreen);
// init mouse
g_mouse = CTestMouse::create(false);

View file

@ -378,6 +378,26 @@ static void testMaximizeSize() {
EXPECT(Tests::windowCount(), 0);
}
static void testFloatingFocusOnFullscreen() {
NLog::log("{}Testing floating focus on fullscreen", Colors::GREEN);
EXPECT(spawnKitty("kitty_A"), true);
OK(getFromSocket("/dispatch togglefloating"));
EXPECT(spawnKitty("kitty_B"), true);
OK(getFromSocket("/dispatch fullscreen 1"));
OK(getFromSocket("/dispatch cyclenext"));
OK(getFromSocket("/dispatch plugin:test:floating_focus_on_fullscreen"));
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();
NLog::log("{}Expecting 0 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 0);
}
static void testGroupFallbackFocus() {
NLog::log("{}Testing group fallback focus", Colors::GREEN);
@ -994,6 +1014,7 @@ static bool test() {
testGroupRules();
testMaximizeSize();
testFloatingFocusOnFullscreen();
testBringActiveToTopMouseMovement();
testGroupFallbackFocus();
testInitialFloatSize();