Updated screen toggling stuff to be more generic.
This commit is contained in:
@@ -284,18 +284,26 @@ class VoicedMenu:
|
|||||||
self.draw_menu()
|
self.draw_menu()
|
||||||
|
|
||||||
def toggle_screen(self, screenType):
|
def toggle_screen(self, screenType):
|
||||||
"""Toggle between HDMI screen and headless mode"""
|
"""Toggle between screen output and headless mode"""
|
||||||
# Remove any existing configuration
|
|
||||||
try:
|
try:
|
||||||
os.system("sudo rm /etc/X11/xorg.conf.d/10-*.conf")
|
# Platform-specific handling
|
||||||
|
is_x86 = platform.machine() == "x86_64"
|
||||||
# Copy the appropriate configuration file
|
|
||||||
if screenType == "headless":
|
if screenType == "headless":
|
||||||
|
if is_x86:
|
||||||
|
# On x86, remove all 10-* files for best compatibility
|
||||||
|
os.system("sudo rm -f /etc/X11/xorg.conf.d/10-*.conf")
|
||||||
|
else:
|
||||||
|
# On Pi, only remove non-essential files, preserve fbdev
|
||||||
|
os.system("sudo rm -f /etc/X11/xorg.conf.d/10-screen.conf")
|
||||||
|
|
||||||
configFile = "/home/stormux/.local/files/10-headless.conf"
|
configFile = "/home/stormux/.local/files/10-headless.conf"
|
||||||
message = "HDMI Screen disabled."
|
message = "Screen disabled."
|
||||||
else:
|
else:
|
||||||
|
# For enabling screen, remove any existing configuration first
|
||||||
|
os.system("sudo rm -f /etc/X11/xorg.conf.d/10-*.conf")
|
||||||
configFile = "/home/stormux/.local/files/10-screen.conf"
|
configFile = "/home/stormux/.local/files/10-screen.conf"
|
||||||
message = "HDMI Screen enabled."
|
message = "Screen enabled."
|
||||||
|
|
||||||
# Copy the configuration file
|
# Copy the configuration file
|
||||||
os.system(f"sudo cp {configFile} /etc/X11/xorg.conf.d/")
|
os.system(f"sudo cp {configFile} /etc/X11/xorg.conf.d/")
|
||||||
@@ -958,8 +966,8 @@ if __name__ == "__main__":
|
|||||||
menu.add_item("System", "Install System to Hard Drive", "GAME='Install to Disk' /home/stormux/.clirc")
|
menu.add_item("System", "Install System to Hard Drive", "GAME='Install to Disk' /home/stormux/.clirc")
|
||||||
|
|
||||||
menu.add_item("System", "Internet Configuration", "GAME=\"Network Configuration\" /home/stormux/.clirc")
|
menu.add_item("System", "Internet Configuration", "GAME=\"Network Configuration\" /home/stormux/.clirc")
|
||||||
menu.add_item("System", "Use HDMI Screen", lambda: menu.toggle_screen("screen"))
|
menu.add_item("System", "Enable Screen", lambda: menu.toggle_screen("screen"))
|
||||||
menu.add_item("System", "Disable HDMI Screen", lambda: menu.toggle_screen("headless"))
|
menu.add_item("System", "Disable Screen", lambda: menu.toggle_screen("headless"))
|
||||||
menu.add_item("System", "Set System Default Speech Rate", "/usr/local/bin/speechd_rate.py")
|
menu.add_item("System", "Set System Default Speech Rate", "/usr/local/bin/speechd_rate.py")
|
||||||
menu.add_item("System", "Set Default Voice", "/usr/local/bin/set-voice.py")
|
menu.add_item("System", "Set Default Voice", "/usr/local/bin/set-voice.py")
|
||||||
menu.add_item("System", "Set Timezone", "GAME='Set Timezone' /home/stormux/.clirc")
|
menu.add_item("System", "Set Timezone", "GAME='Set Timezone' /home/stormux/.clirc")
|
||||||
|
|||||||
Reference in New Issue
Block a user