5 Commits
7 changed files with 42 additions and 63 deletions
+1
View File
@@ -50,6 +50,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(QT_NO_PRIVATE_MODULE_WARNING ON)
set(ENABLE_MODULES "plugin;shell;cli;m3shapes" CACHE STRING "Modules to build/install")
set(INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/ZShell" CACHE STRING "Library install dir")
-7
View File
@@ -43,13 +43,6 @@ Scope {
hasBar: root.geometry.barOnBottom
}
Timer {
interval: 5000
running: true
onTriggered: console.log("top height:", top.exclusiveZone, "left width:", left.exclusiveZone, "right width:", right.exclusiveZone, "bottom height:", bottom.exclusiveZone)
}
component ExclusionZone: CustomWindow {
property bool hasBar
+1
View File
@@ -79,6 +79,7 @@ Item {
anchors.centerIn: parent
antialiasing: true
backer.retainWhileLoading: true
color: root.current && !Config.bar.tray.showOnHover ? Colors.palette.m3onPrimary : Colors.palette.m3onSurface
implicitSize: Config.bar.tray.trayIconSize * root.dpr
layer.enabled: Config.bar.tray.recolorIcons
+4 -1
View File
@@ -28,7 +28,10 @@ Item {
for (let i = 0; i < count; i++)
height += (list.itemAtIndex(i) as NotifWrapper)?.nonAnimHeight ?? 0;
if (panels.popouts.hasCurrent && (panels.popouts.currentCenter + (panels.popouts.current?.width / 2)) > panels.notifications.x || screenState.dashboard)
if (panels.popouts.hasCurrent && (panels.popouts.currentCenter + (panels.popouts.current?.width / 2)) > panels.notifications.x)
return 0;
if (screenState.dashboard && (panels.dashboard.x + panels.dashboard.width >= panels.notifications.x))
return 0;
if (screenState.osd) {
-1
View File
@@ -38,7 +38,6 @@ Item {
id: container
anchors.fill: parent
layer.enabled: opacity < 1
objectName: "PageContainer"
Component.onCompleted: root.loadPage(root.sState.currentPageIdx)
+20 -53
View File
@@ -14,9 +14,10 @@
#include <hyprland/src/plugins/PluginAPI.hpp>
#include <hyprland/src/render/OpenGL.hpp>
#include <hyprland/src/render/Renderer.hpp>
#include <hyprland/src/render/Context.hpp>
#undef private
#include <hyprland/src/managers/EventManager.hpp>
#include <hyprland/src/ipc/s2/S2.hpp>
extern "C" {
#include <lua.h>
@@ -27,6 +28,7 @@ extern "C" {
using ZShell::services::kelvinToGain;
using Render::CRenderContext;
using Render::IFramebuffer;
using Render::GL::CHyprOpenGLImpl;
using Render::GL::g_pHyprOpenGL;
@@ -149,25 +151,14 @@ static bool gainIsNeutral(const std::array<float, 3>& gain) {
}
static CFunctionHook* g_pBeginHook = nullptr;
using origBegin = void (*)(
using origBegin = bool (*)(
CHyprOpenGLImpl*,
CRenderContext&,
PHLMONITOR,
const CRegion&,
SP<IFramebuffer>,
std::optional<CRegion>);
static CFunctionHook* g_pSaveMirrorHook = nullptr;
using origSaveMirror = bool (*)(CHyprOpenGLImpl*, const CBox&);
static bool hkSaveBufferForMirror(CHyprOpenGLImpl* thisptr, const CBox& box) {
const bool saved = thisptr->m_applyFinalShader;
thisptr->m_applyFinalShader = false;
const bool result = (*reinterpret_cast<origSaveMirror>(
g_pSaveMirrorHook->m_original))(thisptr, box);
thisptr->m_applyFinalShader = saved;
return result;
}
static void installShader() {
auto* gl = g_pHyprOpenGL.get();
if (!gl) return;
@@ -198,34 +189,33 @@ static void setUniformGain(const std::array<float, 3>& gain) {
shader->setUniformFloat3(SHADER_TINT, gain[0], gain[1], gain[2]);
}
static void hkBegin(
static bool hkBegin(
CHyprOpenGLImpl* thisptr,
CRenderContext& ctx,
PHLMONITOR mon,
const CRegion& damage,
SP<IFramebuffer> fb,
std::optional<CRegion> finalDamage) {
(*reinterpret_cast<origBegin>(
g_pBeginHook->m_original))(thisptr, mon, damage, fb, finalDamage);
const bool ok = (*reinterpret_cast<origBegin>(
g_pBeginHook->m_original))(thisptr, ctx, mon, damage, fb, finalDamage);
if (!ok) return false;
if (fb) {
auto* renderer = g_pHyprRenderer.get();
if (renderer) renderer->m_renderData.blockScreenShader = true;
}
if (fb) ctx.m_data.blockScreenShader = true;
if (!g_active) return;
if (!g_active) return true;
auto* gl = g_pHyprOpenGL.get();
if (!gl) return;
if (!gl) return true;
if (gl->m_finalScreenShader.get() && gl->m_finalScreenShader->program() < 1)
installShader();
if (!gl->m_finalScreenShader.get() ||
gl->m_finalScreenShader->program() < 1)
return;
return true;
if (g_transition.active) {
auto* monPtr = mon.get();
if (!monPtr) return;
if (!monPtr) return true;
const float elapsed =
std::chrono::duration<float>(
std::chrono::steady_clock::now() - g_transition.start)
@@ -265,6 +255,7 @@ static void hkBegin(
} else if (g_uniformMode) {
setUniformGain(g_currentGain);
}
return true;
}
static constexpr int KELVIN_MIN = 2000;
@@ -333,9 +324,10 @@ static int luaNightlightState(lua_State* L) {
}
static void postStateEvent(bool enabled, bool animating) {
if (!g_pEventManager) return;
g_pEventManager->postEvent(
SHyprIPCEvent{
auto& sock = IPC::Socket2::sock();
if (!sock) return;
sock->postEvent(
IPC::Socket2::SEvent{
.event = "zshell-nightlight",
.data = std::format(
"{},{},{},{}",
@@ -377,31 +369,6 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
throw std::runtime_error("[zshell-nightlight] version mismatch");
}
static const auto SAVEMIRROR_METHODS =
HyprlandAPI::findFunctionsByName(PHANDLE, "saveBufferForMirror");
const SFunctionMatch* saveMirrorTarget = findExactMethod(
SAVEMIRROR_METHODS,
manglePrefix("CHyprOpenGLImpl", "saveBufferForMirror"));
if (saveMirrorTarget) {
g_pSaveMirrorHook = HyprlandAPI::createFunctionHook(
PHANDLE,
saveMirrorTarget->address,
reinterpret_cast<void*>(&hkSaveBufferForMirror));
if (g_pSaveMirrorHook && g_pSaveMirrorHook->hook())
dlog(
"saveBufferForMirror hook installed: " +
saveMirrorTarget->signature);
}
if (!g_pSaveMirrorHook)
HyprlandAPI::addNotification(
PHANDLE,
"[zshell-nightlight] WARNING: couldn't hook saveBufferForMirror — "
"captures may still show the nightlight",
CHyprColor{1.f, 0.6f, 0.2f, 1.f},
8000);
static const auto METHODS =
HyprlandAPI::findFunctionsByName(PHANDLE, "begin");
const SFunctionMatch* target =
+16 -1
View File
@@ -1,3 +1,4 @@
import os
import subprocess
import sys
import time
@@ -8,6 +9,15 @@ args = ["qs", "-c", "zshell"]
app = typer.Typer()
qt_logging_rules = (
"qt.qml.warning=false;"
"qt.qpa.wayland.*=false;"
"scene=false;"
"quickshell.service.sni.watcher=false;"
"default.warning=false;"
"default.info=false"
)
@app.command()
def kill():
@@ -19,8 +29,13 @@ def kill():
def start_instance(no_daemon: bool = False) -> None:
env = os.environ.copy()
env["QT_LOGGING_RULES"] = qt_logging_rules
result = subprocess.run(
args + ["-n"] + ([] if no_daemon else ["-d"]), capture_output=True
args + ["-n"] + ([] if no_daemon else ["-d"]),
capture_output=True,
env=env,
)
stdout = result.stdout.decode().strip()
if stdout and "already running" in stdout.lower():