Add screensaver auto-lock, lynx/gsocket/apexrc defaults, htoprc, and Bantam updates
This commit is contained in:
1 parent
b7dca4f15f
commit
c12ed68d19
36 files changed
+1421
-75
No files matched your search
@@ -61,6 +61,50 @@ geminux_profile_params_t geminux_policy_params(geminux_profile_t prof, bool on_a
|
||||
return out;
|
||||
}
|
||||
|
||||
geminux_idle_action_t geminux_policy_eval_idle(
|
||||
const geminux_power_policy_t *p,
|
||||
geminux_idle_stage_t stage,
|
||||
uint64_t elapsed_ms,
|
||||
uint64_t *next_wait_ms) {
|
||||
if (next_wait_ms) *next_wait_ms = 0;
|
||||
if (!p || p->lid_closed || p->hdmi_connected || p->inhibit_count > 0) {
|
||||
return IDLE_ACT_NONE;
|
||||
}
|
||||
|
||||
geminux_profile_params_t par = geminux_policy_params(p->profile, p->on_ac_power);
|
||||
uint64_t dim_ms = (par.dim_timeout_s > 0) ? (uint64_t)par.dim_timeout_s * 1000ULL : 0;
|
||||
uint64_t susp_ms =
|
||||
(!p->on_ac_power && par.suspend_timeout_s > 0) ? (uint64_t)par.suspend_timeout_s * 1000ULL : 0;
|
||||
|
||||
if (susp_ms > 0) {
|
||||
if (elapsed_ms >= susp_ms) {
|
||||
if (next_wait_ms) *next_wait_ms = 0;
|
||||
return IDLE_ACT_SUSPEND;
|
||||
}
|
||||
if (dim_ms > 0 && dim_ms < susp_ms) {
|
||||
if (elapsed_ms >= dim_ms) {
|
||||
if (next_wait_ms) *next_wait_ms = susp_ms - elapsed_ms;
|
||||
return (stage == IDLE_STAGE_ACTIVE) ? IDLE_ACT_DIM : IDLE_ACT_NONE;
|
||||
}
|
||||
if (next_wait_ms) *next_wait_ms = dim_ms - elapsed_ms;
|
||||
return IDLE_ACT_NONE;
|
||||
}
|
||||
if (next_wait_ms) *next_wait_ms = susp_ms - elapsed_ms;
|
||||
return IDLE_ACT_NONE;
|
||||
}
|
||||
|
||||
if (dim_ms > 0) {
|
||||
if (elapsed_ms >= dim_ms) {
|
||||
if (next_wait_ms) *next_wait_ms = 0;
|
||||
return (stage != IDLE_STAGE_LOCKED_BLANK) ? IDLE_ACT_LOCK_BLANK : IDLE_ACT_NONE;
|
||||
}
|
||||
if (next_wait_ms) *next_wait_ms = dim_ms - elapsed_ms;
|
||||
return IDLE_ACT_NONE;
|
||||
}
|
||||
|
||||
return IDLE_ACT_NONE;
|
||||
}
|
||||
|
||||
bool geminux_policy_add_inhibit(geminux_power_policy_t *p, const char *tag) {
|
||||
if (!p || !tag || !tag[0]) return false;
|
||||
for (int i = 0; i < p->inhibit_count; i++) {
|
||||
|
||||
Reference in new issue
Block a user