hypridle/src/config/ConfigManager.hpp

42 lines
1 KiB
C++
Raw Normal View History

2024-02-17 19:30:11 +00:00
#pragma once
#include "../helpers/Log.hpp"
#include <hyprlang.hpp>
#include <set>
2024-02-17 19:30:11 +00:00
#include <vector>
#include <memory>
class CConfigManager {
public:
CConfigManager(std::string configPath);
2024-02-17 19:30:11 +00:00
void init();
struct STimeoutRule {
core: add an option to ignore idle inhibition per-listener (#158) * Add ability to ignore Wayland idle inhibitors config: general:ignore_wayland_inhibit (bool) If the config value general:ignore_wayland_inhibit is true, the CCExtIdleNotifierV1 function used will be: sendGetInputIdleNotification. This instructs the compositor (hyprland) to return all idle/resume events, ignoring any Wayland inhibitors. If the config value general:ignore_wayland_inhibit is false/unset, it will use the default function sendGetIdleNotification, which obeys Wayland inhibitors. * Ignore idle inhibition per-listener Add `ignore_inhibit` option (bool) to listener section of config file, to allow ignoring idle inhibition per-listener. When set to true, all types of inhibitors are ignored (systemd, dbus/ScreenSaver, Wayland). Default value: false (the rule will obey inhibition) Example: listener { timeout = 5 on-timeout = logger 'should obey idle inhibition' } listener { timeout = 6 on-timeout = logger 'should ignore idle inhibition' ignore_inhibit = true } * Add ability to ignore Wayland idle inhibitors config: general:ignore_wayland_inhibit (bool, default: false) If the config value general:ignore_wayland_inhibit is true, use sendGetInputIdleNotification to create the idle notification object. (Wayland protocol: ext_idle_notifier_v1::get_input_idle_notification) This instructs the compositor to return all idle/resume events, ignoring any Wayland inhibitors. If the config value general:ignore_wayland_inhibit is false (default), it will use sendGetIdleNotification, which obeys Wayland inhibitors. (Wayland protocol: ext_idle_notifier_v1::get_idle_notification) * clang-format * Update flake.lock * Add newline at end of file: src/core/Hypridle.cpp
2025-06-03 12:45:20 -06:00
uint64_t timeout = 0;
std::string onTimeout = "";
std::string onResume = "";
bool ignoreInhibit = false;
2024-02-17 19:30:11 +00:00
};
std::vector<STimeoutRule> getRules();
std::optional<std::string> handleSource(const std::string&, const std::string&);
std::string configCurrentPath, configHeadPath;
std::set<std::string> alreadyIncludedSourceFiles;
template <typename T>
Hyprlang::CSimpleConfigValue<T> getValue(const std::string& name) {
return Hyprlang::CSimpleConfigValue<T>(&m_config, name.c_str());
}
2024-02-17 19:30:11 +00:00
private:
Hyprlang::CConfig m_config;
std::vector<STimeoutRule> m_vRules;
Hyprlang::CParseResult postParse();
};
2024-02-17 22:13:06 +00:00
inline std::unique_ptr<CConfigManager> g_pConfigManager;