Skip to content

Instantly share code, notes, and snippets.

@febnug
Created November 7, 2026 22:18
Show Gist options
  • Select an option

  • Save febnug/07640241810993b601186b59129ee366 to your computer and use it in GitHub Desktop.

Select an option

Save febnug/07640241810993b601186b59129ee366 to your computer and use it in GitHub Desktop.
sudo cp /etc/lightdm/lightdm-gtk-greeter.conf \
/etc/lightdm/lightdm-gtk-greeter.conf.backup
sudo python3 - <<'PY'
from pathlib import Path
import re
path = Path("/etc/lightdm/lightdm-gtk-greeter.conf")
lines = path.read_text().splitlines()
start = next(
(i for i, line in enumerate(lines)
if line.strip() == "[greeter]"),
None
)
if start is None:
raise SystemExit("[ERROR] Section [greeter] tidak ditemukan")
end = next(
(i for i in range(start + 1, len(lines))
if re.match(r'^\s*\[.*\]\s*$', lines[i])),
len(lines)
)
lines = [
line for i, line in enumerate(lines)
if not (
start <= i < end
and re.match(r'^\s*#?\s*(background|user-background)\s*=', line)
)
]
start = next(i for i, line in enumerate(lines)
if line.strip() == "[greeter]")
lines[start + 1:start + 1] = [
"background=/usr/share/backgrounds/xfce/xfce-teal.svg",
"user-background=false"
]
path.write_text("\n".join(lines) + "\n")
print("[OK] LightDM GTK Greeter wallpaper configured.")
PY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment