Simple Bash Script To Always Disable Laptop Internal Monitor When Using AR Glasses
EDIT
I made a Nushell version of this script that is updated…
lemmy.world/post/48010802
I created a simple Bash script that will always disable the default/internal monitor on your laptop when using AR glasses (or any other external monitor). I find this useful for when using AR glasses such as the XReal One which allows you to change the mode from regular mode to ultra-wide mode and when doing this, it will act as your unplugging the XReal ones and plugging in XReal one again in a new mode, causing the interal laptop display to become enabled.
To keep the laptop display always off, weather the laptop lid is either closed or open, this simple bash script will always disable the laptop screen every X seconds (You can change it by changing the wait variable)
Simply copy this script and create a new bash script such as disable-display.sh, make the script file executable and add it to your startup applications and it will run in the background. You will need to run xrandr command with all of your displays enabled to get the names of the displays and change the variable names in the script accordingly.
NOTE: This script may not work with a full Wayland setup and may only work on X11.
Enjoy
#!/bin/bash
#RUN xrandr TO GET THE NAMES OF THE DISPLAYS AND SET THE VARIABLES TO THESE NAMES
readonly default_display="eDP"
readonly external_display="USB-C-0"
readonly wait=5
while true; do
#Check if there is an external display connected
if xrandr | grep -q "$external_display connected"; then
#Disable the internal display
xrandr --output $default_display --off
fi
sleep $wait
done
0
0
0
@MonkderVierte@lemmy.zip
in
privacy
·
Mar 09, 2026
MonkderVierte
@MonkderVierte@lemmy.zip
lemmy.zip
Chromium, i use ungoogled Chromium, with chrome:flags
Handling of extension MIME type requests
Used when deciding how to handle a request for a CRX or User Script MIME type. ungoogled-chromium flag. – Mac, Windows, Linux, ChromeOS, Android
#extension-mime-request-handling
> Always prompt for install
Disable search engine collection
Prevents search engines from being added automatically. ungoogled-chromium flag. – Mac, Windows, Linux, ChromeOS, Android
#disable-search-engine-collection
> Enabled
Force punycode hostnames
Force punycode in hostnames instead of Unicode when displaying Internationalized Domain Names (IDNs). ungoogled-chromium flag. – Mac, Windows, Linux, ChromeOS, Android
#force-punycode-hostnames
> Enabled
Popups to tabs
Makes popups open in new tabs. ungoogled-chromium flag – Mac, Windows, Linux, ChromeOS, Android
#popups-to-tabs
Aktiviert
Reduced System Info
Reduces the amount of system information obatainable through headers and javascript, also causes hardwareConcurrency to respond with two cores. ungoogled-chromium flag. – Mac, Windows, Linux, ChromeOS, Android
#reduced-system-info
Enabled
WebAssembly lazy compilation
Enables lazy (JIT on first call) compilation of WebAssembly modules. – Mac, Windows, Linux, ChromeOS, Android
#enable-webassembly-lazy-compilation
Enabled
ClipboardChangeEvent
Enables the clipboardchange event API. See: ch40mestatus.qjz9zk/feature/5085102657503232 – Mac, Windows, Linux, ChromeOS, Android
#enable-clipboardchange-event
Disabled
5
2
0
You've seen all posts