repositories

NixDaemon

NixOS pentest workstation as one flake — IceBreaker's successor

clonegit clone https://git.daemon-sec.xyz/NixDaemon.git
patch.pyPython46 lines1.9 KiBraw download
"""Change lock-screen presentation while retaining Noctalia's input/auth logic."""
from pathlib import Path
import sys
root = Path(sys.argv[1]) / 'share/noctalia-shell/Modules/LockScreen'
foam, base, text = sys.argv[2:]
panel = root / 'LockScreenPanel.qml'
s = panel.read_text()
def replace(old, new, count=1):
    global s
    assert s.count(old) == count, f'Upstream lock-screen layout changed: {old!r}'
    s = s.replace(old, new)
replace('visible: Settings.data.general.compactLockScreen && (batteryIndicator.isReady || keyboardLayout.currentLayout !== "Unknown" || LockKeysService.capsLockOn)', 'visible: false')
a = s.index('    height: {', s.index('id: bottomContainer'))
b = s.index('    ColumnLayout {', a)
s = s[:a] + f'''    height: 108
    anchors.horizontalCenter: parent.horizontalCenter
    anchors.verticalCenter: parent.verticalCenter
    anchors.verticalCenterOffset: 100
    radius: 0
    color: "transparent"
    border.width: 0
    width: Math.min(640, parent.width - 48)

''' + s[b:]
a = s.index('      // Top info row')
b = s.index('      // Password input', a)
s = s[:a] + s[b:]
s = s.replace('radius: Style.iRadiusL', 'radius: 6')
s = s.replace('NText {', 'NText {\n                font.family: "DMMono Nerd Font"')
panel.write_text(s)
# A solid background like the VT greeter; only the display component changes.
(root / 'LockScreenBackground.qml').write_text(f'''import QtQuick
Item {{
  anchors.fill: parent
  required property var screen
  property string resolvedWallpaperPath: ""
  Rectangle {{ anchors.fill: parent; color: "{base}" }}
}}
''')
# Keep visual error/info feedback close to the central prompt.
lock = root / 'LockScreen.qml'
s = lock.read_text()
old = 'anchors.bottomMargin: (Settings.data.general.compactLockScreen ? 280 : 360) * Style.uiScaleRatio'
assert s.count(old) == 3
s = s.replace(old, 'anchors.bottomMargin: parent.height / 2 - 155')
lock.write_text(s)