diff --git a/src/Hyprsunset.cpp b/src/Hyprsunset.cpp index ffbc7f0..ade75b8 100644 --- a/src/Hyprsunset.cpp +++ b/src/Hyprsunset.cpp @@ -87,7 +87,7 @@ int CHyprsunset::init() { const std::string IFACE = interface; if (IFACE == hyprland_ctm_control_manager_v1_interface.name) { - auto targetVersion = std::min(version, 2u); + auto targetVersion = std::min(version, 2u); Debug::log(NONE, "┣ Found hyprland-ctm-control-v1 supported with version {}, binding to v{}", version, targetVersion); state.pCTMMgr = makeShared( diff --git a/src/helpers/Log.hpp b/src/helpers/Log.hpp index e006b67..603b5c6 100644 --- a/src/helpers/Log.hpp +++ b/src/helpers/Log.hpp @@ -16,8 +16,13 @@ enum LogLevel { }; namespace Debug { + inline bool trace = false; + template void log(LogLevel level, std::format_string fmt, Args&&... args) { + if (!trace && (level == LOG || level == INFO)) + return; + switch (level) { case NONE: break; case LOG: std::cout << "[LOG] "; break; diff --git a/src/main.cpp b/src/main.cpp index 6a62339..c6642ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,13 +6,13 @@ static void printHelp() { Debug::log(NONE, "┣ --gamma_max → Set the maximum display gamma (default 100%, maximum 200%)"); Debug::log(NONE, "┣ --temperature -t → Set the temperature in K (default 6000)"); Debug::log(NONE, "┣ --identity -i → Use the identity matrix (no color change)"); + Debug::log(NONE, "┣ --verbose → Print more logging"); + Debug::log(NONE, "┣ --version -v → Print the version"); Debug::log(NONE, "┣ --help -h → Print this info"); Debug::log(NONE, "╹"); } int main(int argc, char** argv, char** envp) { - Debug::log(NONE, "┏ hyprsunset v{} ━━╸\n┃", HYPRSUNSET_VERSION); - g_pHyprsunset = std::make_unique(); for (int i = 1; i < argc; ++i) { @@ -64,6 +64,11 @@ int main(int argc, char** argv, char** envp) { } else if (argv[i] == std::string{"-h"} || argv[i] == std::string{"--help"}) { printHelp(); return 0; + } else if (argv[i] == std::string{"-v"} || argv[i] == std::string{"--version"}) { + Debug::log(NONE, "hyprsunset v{}", HYPRSUNSET_VERSION); + return 0; + } else if (argv[i] == std::string{"--verbose"}) { + Debug::trace = true; } else { Debug::log(NONE, "✖ Argument not recognized: {}", argv[i]); printHelp(); @@ -71,6 +76,8 @@ int main(int argc, char** argv, char** envp) { } } + Debug::log(NONE, "┏ hyprsunset v{} ━━╸\n┃", HYPRSUNSET_VERSION); + if (!g_pHyprsunset->calculateMatrix()) return 1; if (!g_pHyprsunset->init())