Release Vulpes OS 2.7-preview.24

This commit is contained in:
OverSu 2026-11-04 12:52:20 +01:00
commit 97ef99f827
135 changed files with 7717 additions and 2524 deletions

View file

@ -86,6 +86,7 @@ def control(p):
wake_recovery.deadline = None
maximum = int((BACKLIGHT/'max_brightness').read_text())
(BACKLIGHT/'brightness').write_text(str(max(1, round(maximum * level)) if enabled else 0))
set_session_idle(not enabled)
elif p.get('operation') == 'vibrate':
vibration.start(p.get('pattern'))
elif p.get('operation') == 'volume':
@ -103,6 +104,29 @@ def control(p):
raise ValueError('NOT_SUPPORTED')
return True
def set_session_idle(idle):
"""Tell logind that Gaia has switched the display between active and idle."""
try:
result = subprocess.run(['/usr/bin/loginctl', 'list-sessions', '--no-legend', '--no-pager'],
capture_output=True, text=True, timeout=3, check=True)
sessions = []
for line in result.stdout.splitlines():
fields = line.split()
if len(fields) >= 2 and fields[1] == '32011' and fields[0].isalnum():
sessions.append(fields[0])
if not sessions:
raise RuntimeError('No Tundra logind sessions found')
value = 'true' if idle else 'false'
for session in sessions:
subprocess.run(['/usr/bin/busctl', '--system', 'call', 'org.freedesktop.login1',
'/org/freedesktop/login1/session/'+session,
'org.freedesktop.login1.Session', 'SetIdleHint', 'b', value],
capture_output=True, text=True, timeout=3, check=True)
return True
except (OSError, RuntimeError, subprocess.SubprocessError) as error:
print('TUNDRA_LOGIND_IDLE_FAILED '+str(error), file=sys.stderr, flush=True)
return False
def serve():
SOCKET.parent.mkdir(parents=True, exist_ok=True)
SOCKET.unlink(missing_ok=True)