Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package hyprsunset for openSUSE:Factory checked in at 2026-07-14 13:50:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hyprsunset (Old) and /work/SRC/openSUSE:Factory/.hyprsunset.new.1991 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hyprsunset" Tue Jul 14 13:50:37 2026 rev:2 rq:1365445 version:0.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/hyprsunset/hyprsunset.changes 2026-01-06 17:46:55.511404486 +0100 +++ /work/SRC/openSUSE:Factory/.hyprsunset.new.1991/hyprsunset.changes 2026-07-14 13:51:06.325406687 +0200 @@ -1,0 +2,19 @@ +Mon Jul 13 21:12:02 UTC 2026 - Alessio Biancalana <[email protected]> + +- Update to version 0.4.0: + * version: bump to 0.4.0 + * core: fix high CPU busy-loop in event loop (#91) + * logs: check for trace level in logging (#90) + * core: include headers, add `-fexperimental-library` flag (#89) + * CI: use org-wide actions + * flake.lock: update + * nix: separate overlay with deps + * treewide: alejandra -> nixfmt + * ipc: fix crash in reset & profile with 0 profiles (#77) + * config: fix max-gamma not working with no profiles (#74) + * core: handle exception in gamma IPC req (#70) + * core: add get identity status (#57) + * core: added printing the current profile (#51) (#63) + * core: added resetting to current profile (#52) (#62) + +------------------------------------------------------------------- Old: ---- hyprsunset-0.3.3.tar.zst New: ---- hyprsunset-0.4.0.tar.zst ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hyprsunset.spec ++++++ --- /var/tmp/diff_new_pack.RWuG5Y/_old 2026-07-14 13:51:08.261472910 +0200 +++ /var/tmp/diff_new_pack.RWuG5Y/_new 2026-07-14 13:51:08.261472910 +0200 @@ -17,7 +17,7 @@ Name: hyprsunset -Version: 0.3.3 +Version: 0.4.0 Release: 0 Summary: Blue light filter application for Hyprland License: BSD-3-Clause ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.RWuG5Y/_old 2026-07-14 13:51:08.325475100 +0200 +++ /var/tmp/diff_new_pack.RWuG5Y/_new 2026-07-14 13:51:08.333475373 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/hyprwm/hyprsunset.git</param> - <param name="changesrevision">057feb7a724b7fc0f3a406d6db08b59734db006a</param></service></servicedata> + <param name="changesrevision">25f704346ec22e7623b0873ef8c4573b57ca1512</param></service></servicedata> (No newline at EOF) ++++++ hyprsunset-0.3.3.tar.zst -> hyprsunset-0.4.0.tar.zst ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/.github/workflows/nix-build.yml new/hyprsunset-0.4.0/.github/workflows/nix-build.yml --- old/hyprsunset-0.3.3/.github/workflows/nix-build.yml 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/.github/workflows/nix-build.yml 2026-07-13 20:54:52.000000000 +0200 @@ -1,48 +1,11 @@ name: Build on: [push, pull_request, workflow_dispatch] + jobs: nix: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Install Nix - uses: nixbuild/nix-quick-install-action@v31 - with: - nix_conf: | - keep-env-derivations = true - keep-outputs = true - - - name: Restore and save Nix store - uses: nix-community/cache-nix-action@v6 - with: - # restore and save a cache using this key - primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} - # if there's no cache hit, restore a cache by this prefix - restore-prefixes-first-match: nix-${{ runner.os }}- - # collect garbage until the Nix store size (in bytes) is at most this number - # before trying to save a new cache - # 1G = 1073741824 - gc-max-store-size-linux: 1G - # do purge caches - purge: true - # purge all versions of the cache - purge-prefixes: nix-${{ runner.os }}- - # created more than this number of seconds ago - purge-created: 0 - # or, last accessed more than this number of seconds ago - # relative to the start of the `Post Restore and save Nix store` phase - purge-last-accessed: 0 - # except any version with the key that is the same as the `primary-key` - purge-primary-key: never - - # not needed (yet) - # - uses: cachix/cachix-action@v12 - # with: - # name: hyprland - # authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - - name: Build - run: nix flake check --print-build-logs --keep-going - + if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork) + uses: hyprwm/actions/.github/workflows/nix.yml@main + secrets: inherit + with: + command: nix build --print-build-logs --keep-going diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/CMakeLists.txt new/hyprsunset-0.4.0/CMakeLists.txt --- old/hyprsunset-0.3.3/CMakeLists.txt 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/CMakeLists.txt 2026-07-13 20:54:52.000000000 +0200 @@ -133,6 +133,16 @@ "${CMAKE_SHARED_LINKER_FLAGS} -pg -no-pie -fno-builtin") endif(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) +include(CheckCXXSourceCompiles) +check_cxx_source_compiles([[ + #include <chrono> + int main() { std::chrono::zoned_time{}; } +]] HAVE_STD_ZONED_TIME) + +if (NOT HAVE_STD_ZONED_TIME) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexperimental-library") +endif() + if(NOT DEFINED CMAKE_INSTALL_MANDIR) set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/VERSION new/hyprsunset-0.4.0/VERSION --- old/hyprsunset-0.3.3/VERSION 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/VERSION 2026-07-13 20:54:52.000000000 +0200 @@ -1 +1 @@ -0.3.3 \ No newline at end of file +0.4.0 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/flake.lock new/hyprsunset-0.4.0/flake.lock --- old/hyprsunset-0.3.3/flake.lock 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/flake.lock 2026-07-13 20:54:52.000000000 +0200 @@ -10,11 +10,11 @@ ] }, "locked": { - "lastModified": 1749046714, - "narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=", + "lastModified": 1772460177, + "narHash": "sha256-/6G/MsPvtn7bc4Y32pserBT/Z4SUUdBd4XYJpOEKVR4=", "owner": "hyprwm", "repo": "hyprland-protocols", - "rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330", + "rev": "1cb6db5fd6bb8aee419f4457402fa18293ace917", "type": "github" }, "original": { @@ -36,11 +36,11 @@ ] }, "locked": { - "lastModified": 1750371198, - "narHash": "sha256-/iuJ1paQOBoSLqHflRNNGyroqfF/yvPNurxzcCT0cAE=", + "lastModified": 1772459629, + "narHash": "sha256-/iwvNUYShmmnwmz/czEUh6+0eF5vCMv0xtDW0STPIuM=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "cee01452bca58d6cadb3224e21e370de8bc20f0b", + "rev": "7615ee388de18239a4ab1400946f3d0e498a8186", "type": "github" }, "original": { @@ -59,11 +59,11 @@ ] }, "locked": { - "lastModified": 1749135356, - "narHash": "sha256-Q8mAKMDsFbCEuq7zoSlcTuxgbIBVhfIYpX0RjE32PS0=", + "lastModified": 1772459870, + "narHash": "sha256-xxkK2Cvqxpf/4UGcJ/TyCwrvmiNWsKsJfFzHMp2bxis=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "e36db00dfb3a3d3fdcc4069cb292ff60d2699ccb", + "rev": "e63f3a79334dec49f8eb1691f66f18115df04085", "type": "github" }, "original": { @@ -82,11 +82,11 @@ ] }, "locked": { - "lastModified": 1749145760, - "narHash": "sha256-IHaGWpGrv7seFWdw/1A+wHtTsPlOGIKMrk1TUIYJEFI=", + "lastModified": 1772459835, + "narHash": "sha256-978jRz/y/9TKmZb/qD4lEYHCQGHpEXGqy+8X2lFZsak=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "817918315ea016cc2d94004bfb3223b5fd9dfcc6", + "rev": "0a692d4a645165eebd65f109146b8861e3a925e7", "type": "github" }, "original": { @@ -97,11 +97,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1748929857, - "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=", + "lastModified": 1772433332, + "narHash": "sha256-izhTDFKsg6KeVBxJS9EblGeQ8y+O8eCa6RcW874vxEc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4", + "rev": "cf59864ef8aa2e178cccedbe2c178185b0365705", "type": "github" }, "original": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/flake.nix new/hyprsunset-0.4.0/flake.nix --- old/hyprsunset-0.3.3/flake.nix 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/flake.nix 2026-07-13 20:54:52.000000000 +0200 @@ -31,29 +31,34 @@ }; }; - outputs = { - self, - nixpkgs, - systems, - ... - } @ inputs: let - inherit (nixpkgs) lib; - eachSystem = lib.genAttrs (import systems); - pkgsFor = eachSystem (system: - import nixpkgs { - localSystem.system = system; - overlays = with self.overlays; [default]; - }); - in { - overlays = import ./nix/overlays.nix {inherit inputs lib;}; + outputs = + { + self, + nixpkgs, + systems, + ... + }@inputs: + let + inherit (nixpkgs) lib; + eachSystem = lib.genAttrs (import systems); + pkgsFor = eachSystem ( + system: + import nixpkgs { + localSystem.system = system; + overlays = with self.overlays; [ hyprsunset-with-deps ]; + } + ); + in + { + overlays = import ./nix/overlays.nix { inherit inputs lib; }; - packages = eachSystem (system: { - default = self.packages.${system}.hyprsunset; - inherit (pkgsFor.${system}) hyprsunset; - }); + packages = eachSystem (system: { + default = self.packages.${system}.hyprsunset; + inherit (pkgsFor.${system}) hyprsunset; + }); - checks = eachSystem (system: self.packages.${system}); + checks = eachSystem (system: self.packages.${system}); - formatter = eachSystem (system: pkgsFor.${system}.alejandra); - }; + formatter = eachSystem (system: pkgsFor.${system}.nixfmt-tree); + }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/nix/default.nix new/hyprsunset-0.4.0/nix/default.nix --- old/hyprsunset-0.3.3/nix/default.nix 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/nix/default.nix 2026-07-13 20:54:52.000000000 +0200 @@ -11,42 +11,45 @@ wayland-protocols, wayland-scanner, version ? "git", -}: let +}: +let inherit (lib.sources) cleanSource cleanSourceWith; inherit (lib.strings) hasSuffix; in - stdenv.mkDerivation { - pname = "hyprsunset"; - inherit version; +stdenv.mkDerivation { + pname = "hyprsunset"; + inherit version; - src = cleanSourceWith { - filter = name: _type: let + src = cleanSourceWith { + filter = + name: _type: + let baseName = baseNameOf (toString name); in - ! (hasSuffix ".nix" baseName); - src = cleanSource ../.; - }; + !(hasSuffix ".nix" baseName); + src = cleanSource ../.; + }; - nativeBuildInputs = [ - cmake - pkg-config - hyprwayland-scanner - ]; + nativeBuildInputs = [ + cmake + pkg-config + hyprwayland-scanner + ]; - buildInputs = [ - hyprland-protocols - hyprutils - hyprlang - wayland - wayland-protocols - wayland-scanner - ]; + buildInputs = [ + hyprland-protocols + hyprutils + hyprlang + wayland + wayland-protocols + wayland-scanner + ]; - meta = { - homepage = "https://github.com/hyprwm/hyprsunset"; - description = "An application to enable a blue-light filter on Hyprland"; - license = lib.licenses.bsd3; - platforms = lib.platforms.linux; - mainProgram = "hyprsunset"; - }; - } + meta = { + homepage = "https://github.com/hyprwm/hyprsunset"; + description = "An application to enable a blue-light filter on Hyprland"; + license = lib.licenses.bsd3; + platforms = lib.platforms.linux; + mainProgram = "hyprsunset"; + }; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/nix/overlays.nix new/hyprsunset-0.4.0/nix/overlays.nix --- old/hyprsunset-0.3.3/nix/overlays.nix 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/nix/overlays.nix 2026-07-13 20:54:52.000000000 +0200 @@ -1,27 +1,38 @@ { lib, inputs, -}: let - mkDate = longDate: (lib.concatStringsSep "-" [ - (builtins.substring 0 4 longDate) - (builtins.substring 4 2 longDate) - (builtins.substring 6 2 longDate) - ]); +}: +let + mkDate = + longDate: + (lib.concatStringsSep "-" [ + (builtins.substring 0 4 longDate) + (builtins.substring 4 2 longDate) + (builtins.substring 6 2 longDate) + ]); version = lib.removeSuffix "\n" (builtins.readFile ../VERSION); -in { +in +{ default = inputs.self.overlays.hyprsunset; - hyprsunset = lib.composeManyExtensions [ + hyprsunset-with-deps = lib.composeManyExtensions [ inputs.hyprland-protocols.overlays.default inputs.hyprlang.overlays.default inputs.hyprutils.overlays.default inputs.hyprwayland-scanner.overlays.default - (final: prev: { - hyprsunset = prev.callPackage ./default.nix { - stdenv = prev.gcc15Stdenv; - version = version + "+date=" + (mkDate (inputs.self.lastModifiedDate or "19700101")) + "_" + (inputs.self.shortRev or "dirty"); - }; - }) + inputs.self.overlays.hyprsunset ]; + + hyprsunset = final: prev: { + hyprsunset = prev.callPackage ./default.nix { + stdenv = prev.gcc15Stdenv; + version = + version + + "+date=" + + (mkDate (inputs.self.lastModifiedDate or "19700101")) + + "_" + + (inputs.self.shortRev or "dirty"); + }; + }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/src/ConfigManager.cpp new/hyprsunset-0.4.0/src/ConfigManager.cpp --- old/hyprsunset-0.3.3/src/ConfigManager.cpp 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/src/ConfigManager.cpp 2026-07-13 20:54:52.000000000 +0200 @@ -59,15 +59,17 @@ size_t separator = time.find(':'); - if (separator == std::string::npos) - RASSERT(false, "Invalid time format for profile {}", key); + if (separator == std::string::npos) { + Debug::log(ERR, "Invalid time format: {}, skipping profile {}", time, key); + continue; + } int hour = 0, minute = 0; try { hour = std::stoi(time.substr(0, separator)); minute = std::stoi(time.substr(separator + 1).c_str()); } catch (const std::exception& e) { - Debug::log(ERR, "Invalid time format: {}, skipping this profile", time); + Debug::log(ERR, "Invalid time format: {}, skipping profile {}", time, key); continue; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/src/Hyprsunset.cpp new/hyprsunset-0.4.0/src/Hyprsunset.cpp --- old/hyprsunset-0.3.3/src/Hyprsunset.cpp 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/src/Hyprsunset.cpp 2026-07-13 20:54:52.000000000 +0200 @@ -1,12 +1,15 @@ #include "ConfigManager.hpp" #include "helpers/Log.hpp" #include "IPCSocket.hpp" +#include <algorithm> #include <cstring> #include <mutex> +#include <optional> #include <thread> #include <chrono> #include <sys/poll.h> #include <sys/timerfd.h> +#include <unistd.h> #include <wayland-client-core.h> #define TIMESPEC_NSEC_PER_SEC 1000000000L @@ -103,7 +106,7 @@ state.wlDisplay = wl_display_connect(nullptr); if (!state.wlDisplay) { - Debug::log(NONE, "✖ Couldn't connect to a wayland compositor", KELVIN); + Debug::log(NONE, "✖ Couldn't connect to a wayland compositor"); return 0; } @@ -133,7 +136,7 @@ makeShared<SOutput>(makeShared<CCWlOutput>((wl_proxy*)wl_registry_bind((wl_registry*)state.pRegistry->resource(), name, &wl_output_interface, 3)), name)); if (state.initialized) { - Debug::log(NONE, "┣ already initialized, applying CTM instantly", name); + Debug::log(NONE, "┣ already initialized, applying CTM instantly"); o->applyCTM(&state); commitCTMs(); } @@ -145,7 +148,7 @@ wl_display_roundtrip(state.wlDisplay); if (!state.pCTMMgr) { - Debug::log(NONE, "✖ Compositor doesn't support hyprland-ctm-control-v1, are you running on Hyprland?", KELVIN); + Debug::log(NONE, "✖ Compositor doesn't support hyprland-ctm-control-v1, are you running on Hyprland?"); return 0; } @@ -181,6 +184,8 @@ }, }; + bool wlEventsPending = false; + std::thread pollThread([&]() { while (1) { bool preparedToRead = wl_display_prepare_read(state.wlDisplay) == 0; @@ -209,6 +214,8 @@ Debug::log(TRACE, "[core] got poll event"); std::lock_guard<std::mutex> lg(m_sEventLoopInternals.loopRequestMutex); m_sEventLoopInternals.shouldProcess = true; + if (!preparedToRead || (pollfds[0].revents & POLLIN)) + wlEventsPending = true; m_sEventLoopInternals.loopSignal.notify_one(); } } @@ -227,7 +234,8 @@ m_sEventLoopInternals.shouldProcess = false; - if (pollfds[0].revents & POLLIN) { + if (wlEventsPending) { + wlEventsPending = false; wl_display_dispatch_pending(state.wlDisplay); wl_display_flush(state.wlDisplay); } @@ -280,7 +288,8 @@ } void CHyprsunset::loadCurrentProfile() { - profiles = g_pConfigManager->getSunsetProfiles(); + profiles = g_pConfigManager->getSunsetProfiles(); + MAX_GAMMA = g_pConfigManager->getMaxGamma(); Debug::log(NONE, "┣ Loaded {} profiles", profiles.size()); @@ -302,7 +311,6 @@ KELVIN = profile.temperature; GAMMA = profile.gamma; identity = profile.identity; - MAX_GAMMA = g_pConfigManager->getMaxGamma(); Debug::log(NONE, "┣ Applying profile from: {}:{}", profile.time.hour.count(), profile.time.minute.count()); } @@ -330,6 +338,14 @@ return profiles.size() - 1; } +std::optional<SSunsetProfile> CHyprsunset::getCurrentProfile() { + int current = currentProfile(); + if (current < 0) + return std::nullopt; + + return profiles[current]; +} + void CHyprsunset::schedule() { std::thread([&]() { while (true) { @@ -344,10 +360,10 @@ if (now >= time) time += std::chrono::days(1); - + while (time >= std::chrono::zoned_time(std::chrono::current_zone(), std::chrono::system_clock::now()).get_local_time() + std::chrono::minutes(1)) std::this_thread::sleep_for(std::chrono::minutes(1)); - + auto system_time = std::chrono::zoned_time{std::chrono::current_zone(), time}.get_sys_time(); std::this_thread::sleep_until(system_time); @@ -356,7 +372,7 @@ if (newcurrent == -1) break; - SSunsetProfile newProfile = profiles[newcurrent]; + SSunsetProfile newProfile = profiles[newcurrent]; std::lock_guard<std::mutex> lg(m_sEventLoopInternals.loopRequestMutex); KELVIN = newProfile.temperature; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/src/Hyprsunset.hpp new/hyprsunset-0.4.0/src/Hyprsunset.hpp --- old/hyprsunset-0.3.3/src/Hyprsunset.hpp 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/src/Hyprsunset.hpp 2026-07-13 20:54:52.000000000 +0200 @@ -3,6 +3,7 @@ #include <wayland-client.h> #include <vector> #include <mutex> +#include <optional> #include <condition_variable> #include "protocols/hyprland-ctm-control-v1.hpp" #include "protocols/wayland.hpp" @@ -44,18 +45,19 @@ class CHyprsunset { public: - float MAX_GAMMA = 1.0f; // default - float GAMMA = 1.0f; // default - unsigned long long KELVIN = 6000; // default - bool kelvinSet = false, identity = false; - SState state; - bool m_bTerminate = false; - - int calculateMatrix(); - int init(); - void tick(); - void loadCurrentProfile(); - void terminate(); + float MAX_GAMMA = 1.0f; // default + float GAMMA = 1.0f; // default + unsigned long long KELVIN = 6000; // default + bool kelvinSet = false, identity = false; + SState state; + bool m_bTerminate = false; + + int calculateMatrix(); + int init(); + void tick(); + void loadCurrentProfile(); + std::optional<SSunsetProfile> getCurrentProfile(); + void terminate(); struct { std::condition_variable loopSignal; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/src/IPCSocket.cpp new/hyprsunset-0.4.0/src/IPCSocket.cpp --- old/hyprsunset-0.3.3/src/IPCSocket.cpp 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/src/IPCSocket.cpp 2026-07-13 20:54:52.000000000 +0200 @@ -6,6 +6,7 @@ #include <cstdio> #include <cstdlib> #include <cstring> +#include <format> #include <netinet/in.h> #include <sys/socket.h> #include <sys/stat.h> @@ -119,20 +120,19 @@ std::string args = copy.substr(spaceSeparator + 1); float gamma = g_pHyprsunset->GAMMA * 100; float maxGamma = g_pHyprsunset->MAX_GAMMA * 100; - if (args[0] == '+' || args[0] == '-') { - try { + try { + if (args[0] == '+' || args[0] == '-') { if (args[0] == '-') gamma -= std::stof(args.substr(1)); else gamma += std::stof(args.substr(1)); - } catch (std::exception& e) { - m_szReply = "Invalid gamma value (should be in range 0-" + std::to_string(maxGamma) + "%)"; - return false; - } - - gamma = std::clamp(gamma, 0.0f, maxGamma); - } else - gamma = std::stof(args); + gamma = std::clamp(gamma, 0.0f, maxGamma); + } else + gamma = std::stof(args); + } catch (std::exception& e) { + m_szReply = "Invalid gamma value (should be in range 0-" + std::to_string(maxGamma) + "%)"; + return false; + } if (gamma < 0 || gamma > maxGamma) { m_szReply = "Invalid gamma value (should be in range 0-" + std::to_string(maxGamma) + "%)"; @@ -176,8 +176,74 @@ } if (copy.find("identity") == 0) { - g_pHyprsunset->identity = true; - return true; + int spaceSeparator = copy.find_first_of(' '); + if (spaceSeparator == -1) { + g_pHyprsunset->identity = true; + return true; + } + + std::string args = copy.substr(spaceSeparator + 1); + if (args == "get") { + m_szReply = g_pHyprsunset->identity ? "true" : "false"; + return false; + } else if (args == "true") { + g_pHyprsunset->identity = true; + return true; + } else if (args == "false") { + g_pHyprsunset->identity = false; + return true; + } else { + m_szReply = "Invalid identity value (should be true or false)"; + return false; + } + } + + if (copy.find("reset") == 0) { + int spaceSeparator = copy.find_first_of(' '); + + // Reset whole profile + if (spaceSeparator == -1) { + g_pHyprsunset->loadCurrentProfile(); + return true; + } + + if (auto profileOpt = g_pHyprsunset->getCurrentProfile()) { + auto profile = profileOpt.value(); + std::string args = copy.substr(spaceSeparator + 1); + + if (args == "temperature") { + g_pHyprsunset->KELVIN = profile.temperature; + return true; + } else if (args == "gamma") { + g_pHyprsunset->GAMMA = profile.gamma; + return true; + } else if (args == "identity") { + g_pHyprsunset->identity = profile.identity; + return true; + } else { + m_szReply = "Invalid reset value (should be either temperature, gamma or identity)"; + return false; + } + } + m_szReply = "No profile is currently loaded"; + return false; + } + + if (copy.find("profile") == 0) { + if (auto profileOpt = g_pHyprsunset->getCurrentProfile()) { + auto profile = profileOpt.value(); + + int hrs = profile.time.hour.count(); + int mins = profile.time.minute.count(); + auto temp = profile.temperature; + float gamma = profile.gamma; + bool ident = profile.identity; + + m_szReply = std::format("Time: {:0>2}:{:0>2}\nTemperature: {}\nGamma: {}\nIdentity: {}", hrs, mins, temp, gamma, ident); + return true; + } + m_szReply = "No profile is currently loaded"; + return false; } m_szReply = "invalid command"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hyprsunset-0.3.3/src/helpers/Log.hpp new/hyprsunset-0.4.0/src/helpers/Log.hpp --- old/hyprsunset-0.3.3/src/helpers/Log.hpp 2025-10-04 00:29:52.000000000 +0200 +++ new/hyprsunset-0.4.0/src/helpers/Log.hpp 2026-07-13 20:54:52.000000000 +0200 @@ -28,7 +28,7 @@ template <typename... Args> void log(LogLevel level, std::format_string<Args...> fmt, Args&&... args) { - if (!trace && (level == LOG || level == INFO)) + if (!trace && (level == LOG || level == INFO || level == TRACE)) return; switch (level) { ++++++ hyprsunset.obsinfo ++++++ --- /var/tmp/diff_new_pack.RWuG5Y/_old 2026-07-14 13:51:08.525481940 +0200 +++ /var/tmp/diff_new_pack.RWuG5Y/_new 2026-07-14 13:51:08.541482488 +0200 @@ -1,5 +1,5 @@ name: hyprsunset -version: 0.3.3 -mtime: 1759530592 -commit: 057feb7a724b7fc0f3a406d6db08b59734db006a +version: 0.4.0 +mtime: 1783968892 +commit: 25f704346ec22e7623b0873ef8c4573b57ca1512
