trymeout

joined 2 years ago
[–] trymeout@lemmy.world 2 points 1 month ago

Agreed.

I also use this VSCode extension which formats my bash code using shfmt

https://open-vsx.org/extension/foxundermoon/shell-format

[–] trymeout@lemmy.world 1 points 1 month ago (1 children)

You should not need an else if statement to re-enable the internal display. When no displays are enabled, it will enable the internal display. This was the case when I tested it.

[–] trymeout@lemmy.world 3 points 1 month ago (1 children)

What company do you work for in XR?

I got the XReal One as a portable ergonomic monitor and I may use them as my main monitor going forward. I have a sit/stand desk with monitor arms which I can adjust the height and position for an ergonomic design to always look straight at the monitor and not looking down.

From my research currently the XReal Ones are the best AR/XR glasses on the market due to the chip built into them, not needing any other devices or software to run, just plug in play. The XReal One Pros which I think are coming out soon have some better specs but to me, not worth the extra money.

I been using them for regular desktop/laptop task and coding and I prefer to use the anchor mode when doing this. I sometimes also use the ultra-wide mode to simulate 2 monitors. I also been using them for gaming and I will either have it in follow or anchor mode but never use ultra-wide mode for gaming.

 

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