60 lines
1.3 KiB
Bash
Executable File
60 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Change between dummy and fbdev driver for X session.
|
|
|
|
active_screen() {
|
|
cat << EOF | sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf &> /dev/null
|
|
Section "Device"
|
|
Identifier "FBdev"
|
|
Driver "fbdev"
|
|
EndSection
|
|
EOF
|
|
}
|
|
|
|
headless() {
|
|
cat << EOF | sudo "${sudoFlags[@]}" tee /etc/X11/xorg.conf.d/10-screendriver.conf &> /dev/null
|
|
Section "Monitor"
|
|
Identifier "dummy_monitor"
|
|
HorizSync 28.0-80.0
|
|
VertRefresh 48.0-75.0
|
|
Modeline "1920x1080" 172.80 1920 2040 2248 2576 1080 1081 1084 1118
|
|
EndSection
|
|
|
|
Section "Device"
|
|
Identifier "dummy_card"
|
|
Driver "dummy"
|
|
VideoRam 256000
|
|
Option "UseFBDev" "false"
|
|
EndSection
|
|
|
|
Section "Screen"
|
|
Identifier "dummy_screen"
|
|
Device "dummy_card"
|
|
Monitor "dummy_monitor"
|
|
SubSection "Display"
|
|
Depth 24
|
|
Modes "1920x1080"
|
|
EndSubSection
|
|
EndSection
|
|
|
|
Section "ServerLayout"
|
|
Identifier "dummy_layout"
|
|
Screen 0 "dummy_screen"
|
|
EndSection
|
|
EOF
|
|
}
|
|
|
|
|
|
source ./.includes/functions.sh
|
|
source ./.includes/ui.sh
|
|
answer=$(yesno "Do you have a physical screen attached?")
|
|
if [[ "${answer}" == "Yes" ]]; then
|
|
active_screen
|
|
msgbox "Settings for physical screen applied."
|
|
restart
|
|
else
|
|
headless
|
|
msgbox "Headless mode applied."
|
|
restart
|
|
fi
|