mirror of
https://github.com/hyprwm/hypridle.git
synced 2026-05-04 20:27:58 +02:00
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.
This commit is contained in:
parent
4f1c165d3e
commit
4f6bc4dbab
2 changed files with 15 additions and 3 deletions
|
|
@ -46,6 +46,7 @@ void CConfigManager::init() {
|
|||
m_config.addConfigValue("general:after_sleep_cmd", Hyprlang::STRING{""});
|
||||
m_config.addConfigValue("general:ignore_dbus_inhibit", Hyprlang::INT{0});
|
||||
m_config.addConfigValue("general:ignore_systemd_inhibit", Hyprlang::INT{0});
|
||||
m_config.addConfigValue("general:ignore_wayland_inhibit", Hyprlang::INT{0});
|
||||
m_config.addConfigValue("general:inhibit_sleep", Hyprlang::INT{2});
|
||||
|
||||
// track the file in the circular dependency chain
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ void CHypridle::run() {
|
|||
exit(1);
|
||||
}
|
||||
|
||||
static const auto IGNOREWAYLANDINHIBIT = g_pConfigManager->getValue<Hyprlang::INT>("general:ignore_wayland_inhibit");
|
||||
static const auto notificationFunc = *IGNOREWAYLANDINHIBIT ? &CCExtIdleNotifierV1::sendGetInputIdleNotification : &CCExtIdleNotifierV1::sendGetIdleNotification;
|
||||
|
||||
const auto RULES = g_pConfigManager->getRules();
|
||||
m_sWaylandIdleState.listeners.resize(RULES.size());
|
||||
|
||||
|
|
@ -65,7 +68,10 @@ void CHypridle::run() {
|
|||
l.onRestore = r.onResume;
|
||||
l.onTimeout = r.onTimeout;
|
||||
|
||||
l.notification = makeShared<CCExtIdleNotificationV1>(m_sWaylandIdleState.notifier->sendGetIdleNotification(r.timeout * 1000 /* ms */, m_sWaylandState.seat->resource()));
|
||||
l.notification = makeShared<CCExtIdleNotificationV1>(
|
||||
(*(m_sWaylandIdleState.notifier).*(notificationFunc))
|
||||
(r.timeout * 1000 /* ms */, m_sWaylandState.seat->resource()));
|
||||
|
||||
l.notification->setData(&m_sWaylandIdleState.listeners[i]);
|
||||
|
||||
l.notification->setIdled([this](CCExtIdleNotificationV1* n) { onIdled((CHypridle::SIdleListener*)n->data()); });
|
||||
|
|
@ -288,6 +294,9 @@ void CHypridle::onInhibit(bool lock) {
|
|||
}
|
||||
|
||||
if (m_iInhibitLocks == 0 && isIdled) {
|
||||
static const auto IGNOREWAYLANDINHIBIT = g_pConfigManager->getValue<Hyprlang::INT>("general:ignore_wayland_inhibit");
|
||||
static const auto notificationFunc = *IGNOREWAYLANDINHIBIT ? &CCExtIdleNotifierV1::sendGetInputIdleNotification : &CCExtIdleNotifierV1::sendGetIdleNotification;
|
||||
|
||||
const auto RULES = g_pConfigManager->getRules();
|
||||
|
||||
for (size_t i = 0; i < RULES.size(); ++i) {
|
||||
|
|
@ -296,8 +305,10 @@ void CHypridle::onInhibit(bool lock) {
|
|||
|
||||
l.notification->sendDestroy();
|
||||
|
||||
l.notification =
|
||||
makeShared<CCExtIdleNotificationV1>(m_sWaylandIdleState.notifier->sendGetIdleNotification(r.timeout * 1000 /* ms */, m_sWaylandState.seat->resource()));
|
||||
l.notification = makeShared<CCExtIdleNotificationV1>(
|
||||
(*(m_sWaylandIdleState.notifier).*(notificationFunc))
|
||||
(r.timeout * 1000 /* ms */, m_sWaylandState.seat->resource()));
|
||||
|
||||
l.notification->setData(&m_sWaylandIdleState.listeners[i]);
|
||||
|
||||
l.notification->setIdled([this](CCExtIdleNotificationV1* n) { onIdled((CHypridle::SIdleListener*)n->data()); });
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue