Categories
AI Answers Archive Desktop Home Automation Notes

Changing Screens in Windows via script

TL;DR: .bat scripts below to set video (via native DisplaySwitch.exe) and sound output (via nircmd). To avoid black PC monitor on startup, switch back before shutdown.


It has been a long time bugging me. I use my PC to drive a 34 inch Asus monitor, and sometimes, I use it to drive my TV. However, switching between the two is cumbersome. Sometimes, default audio is not switched and I have to do it manually. And on my TV, sitting on the couch, I have neither keyboard nor mouse. So what I do is, I use Unified Remote on my smartphone. There it’s quite easy to change display, and you have a good mouse, by using your smartphone as a touchpad.

Today I thought, i write two scripts, that make it even easier, and maybe, i can run one or the other after start, so that the correct output is set on startup (because when you forget it on TV, nothing is visible, once you start your PC, when you sit on your monitor).

Anyhow, the scripts require some 32bit/64bit windows quirks, and thanks to Google Gemini Pro 3.1, here they are.

Note: you need the nircmd tool: https://www.nirsoft.net/utils/nircmd.html

Note 2: If you’re using Unified Remote, activate the “Start Application” remote, and put the scripts in this folder:

  • cmd+r: shell:startup — then two folders up in “Start Menu”
  • This will be a folder like this: C:\Users\[youruser]\AppData\Roaming\Microsoft\Windows\Start Menu

Note 3: If you use your TV, and then shutdown, be aware, that you have still selected TV, and the next day you will stare in a black screen. To avoid that, Gemini’s idea, which I think makes sense, is to switch back to PC, and THEN shutdown.

tv.bat

@echo off
echo Switching video output to Second Screen Only...

:: Use Sysnative to bypass Unified Remote's 32-bit redirection
if exist "%windir%\Sysnative\DisplaySwitch.exe" (
    "%windir%\Sysnative\DisplaySwitch.exe" /external
) else (
    "%windir%\System32\DisplaySwitch.exe" /external
)

:: Wait 3 seconds for the TV to wake up and register its audio channel
timeout /t 3 /nobreak >nul

echo Switching audio output to Samsung TV...
:: Using absolute path for NirCmd to prevent PATH errors
C:\apps\nircmd.exe setdefaultsounddevice "SAMSUNG"

echo Done!

pc.bat

@echo off
echo Switching video output to PC Screen Only...

:: Use Sysnative to bypass Unified Remote's 32-bit redirection
if exist "%windir%\Sysnative\DisplaySwitch.exe" (
    "%windir%\Sysnative\DisplaySwitch.exe" /internal
) else (
    "%windir%\System32\DisplaySwitch.exe" /internal
)

:: Wait 3 seconds for the monitor to register its audio channel
timeout /t 3 /nobreak >nul

echo Switching audio output to Asus Monitor...
:: Using absolute path for NirCmd to prevent PATH errors
C:\apps\nircmd.exe setdefaultsounddevice "Asus"

echo Done!

shutdown-switchback.bat

@echo off
echo Switching video output to PC Screen Only...

:: Use Sysnative to bypass Unified Remote's 32-bit redirection
if exist "%windir%\Sysnative\DisplaySwitch.exe" (
    "%windir%\Sysnative\DisplaySwitch.exe" /internal
) else (
    "%windir%\System32\DisplaySwitch.exe" /internal
)

:: Wait 3 seconds for the monitor to register its audio channel
timeout /t 3 /nobreak >nul

echo Switching audio output to Asus Monitor...
:: Using absolute path for NirCmd to prevent PATH errors
C:\apps\nircmd.exe setdefaultsounddevice "Asus"

:: Wait 2 seconds to ensure the display switch registers
timeout /t 2 /nobreak >nul

echo Shutting down the PC...
:: /s = shutdown, /t 0 = wait 0 seconds
shutdown /s /t 0

Categories
Coding Desktop Server

Photoprism upgrade with AI and ollama

🚧Draft – work in progress 🚧

My setup:

  • my NAS runs photoprism in docker
  • I have a workstation with a GPU, where I run ollama with an RTX 3060 (12 GB VRAM)

As suggested by official documentation (Ollama Models – Photoprism) qwen3-vl:latest (8B) gives the best results, and it should fit nicely with my RTX 3060.

One consideration I have, my workstation is not always on…, what happens when I upload new pictures, but ollama is not reachable? Well, I guess we’ll see.

My upgradepath: photoprism/photoprism:250426 => photoprism/photoprism:251130 (new version Changelog)

Notes:

  • I’m using the label and the caption option.
  • I’m using manual mode for testing in the beginning.
  • I pulled on my workstation qwen3-vl:latest or better as not to use latest: qwen3-vl:8b

The vision.yml file (coming later)

labels

docker exec photoprism photoprism vision run -m labels --count 1 --force

Checking the picture that was edited, it seems to work! Great job photoprism team! Out of the box!

captions

# first run
docker exec photoprism photoprism --log-level=trace vision run -m caption --count 1 --force
# subsequent runs, maybe you deleted it in UI or just want to regernate:
docker exec photoprism photoprism --log-level=trace vision run -m caption --count 2 --force --source=vision

faces

Reference:

docker exec photoprism photoprism faces stats

notes

Commands for debugging

# resetting all captions
docker exec photoprism photoprism vision reset --models=caption --source=ollama --yes

# resetting all labels
docker exec photoprism photoprism vision reset --models=labels--source=ollama --yes

checking when ollama offline (or workstation unreachable?)

# first resetting all labels
docker compose exec photoprism photoprism vision reset --models=labels --source=ollama --yes
time="2026-02-15T15:50:30Z" level=debug msg="labels: Post \"http://192.168.1.4:11434/api/generate\": dial tcp 192.168.1.4:11434: i/o timeout in VyChiWebDav/data/PXL_20260212_074248937.jpg"
time="2026-02-15T15:50:30Z" level=info msg="vision: processed 1 picture (no metadata changes detected) [30.227074066s]"
time="2026-02-15T15:50:30Z" level=debug msg="closed database connection"

Output not concise, and further not clear if it is marked as processed, even though AI processor not reachable. Further testing required.

Categories
Desktop

Logitech G Pro X Lightspeed DTS – how to actually enable Surround Sound (spatial sound) Windows 10

So, if you are like me and you just bought the Logitech G Pro X Lightspeed Headset with DTS and read somewhere, that it should have Surround Sound, you might have thought: yeah, that is nice. I need a new headset, so I might have an advantage if I actually hear, where the

You think, what-the-fuck, it sounds an awful lot like stereo. You find out, that it actually is! 🙂

Then ok, wow, there is the option for Spatial Sound (aka Surround sound) and you think, yeah lets enable it.

Bam! It doesn’t work!

  • Downlaod, install and start the DTS-X app.
  • Make sure codec is loaded
  • Go to Sound Settings
  • Enable Surround Sound

Update 2025: Windows 11 is out, now it’s not even possible for me to easily configure it with the trick before. Surround option just disabled. Well, I gave up on Windows, with Windows 11. I only have it because, from time to time I play Fortnite. I couldn’t even be bothered anymore.

Update April 2025: I’m using Kubuntu as my main driver now…, no surround there anyhow. It might be possible somehow, but I couldn’t be bothered. Didn’t really sound like surround anyhow. Also, I have to say, I never really heared the surroundyness of the headphones. You can’t compare it AT ALL, to proper surround sound from like a speaker setup. There you hear all directions, on the headphone, not really.
Funny enough, Kubuntu doesn’t allow me to have my taskbar on the left, but here I cut them some slack 😛