Using a micro computer for second monitor

02 Jun 2023

I only use my second monitor for a webbrowser playing some video on youtube. But I have always been annoyed when the video or music stops because my tinkering forces me to reboot my machine. So I got my hands on a cheap old HP ProDesk 400 G2 micro computer. Now I will have Discord and a webbrowser running even though I have to reboot my main machine.

HP ProDesk 400 G2

The small micro computer I bought has an Intel Core I5-6500t, 8Gb of ram and a tiny SSD with 120Gb of space, more than enough for me.

hp-prodesk-400-g2-mini
HP Prodesk 400 G2 mini

Software setup

I like Debian so I have installed a fresh install of Debian Bookworm. Currently testing but it will be the stable version soon. I’m no fan of a custom desktop with a tiling window manager so I’m running KDE.

Then I have installed Flatpak so I can install newer applications than what Debian usually offers. The installation of Flatpak on Debian is easy

$ sudo apt install -y flatpak plasma-discover-backend-flatpak

and to add the Flathub repo

$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

I will probably not install much more than my Webbrowser, Spotify and Discord using flatpak. Because the computer will only be used for Discord and playing music or watching some Youtube videos.

Well it is a bit clunky to control multiple computers with two keyboards and mice. I don’t have space for that on my computer desk.

Barrier for seamless dual monitor

This is where Barrier is used. This cool software will allow you to setup any computer on your network to be used as a secondary monitor. With this software you can drag your mouse across to the other screen even though it’s another computer.

Barrier server setup

Barrier-main-window
Barrier main window
My main computer will be running the Barrier software as a server. To configure the server you just press the Configure... button in the Barrier main window.

Barrier-server-configuration-window
Barrier server configuration window
In the Server Configuration window you can drag the computer monitor icon in the top right corner and place it at a position next to the center monitor that represents your computer. This will tell barrier where you have your second monitor so when you drag your mouse arrow over to the second monitor your keyboard and mouse will control that second machine.

Barrier-server-configuration-screen-settings
Barrier server configuration screen settings
Double click the new screen to give it a name that will match the client name.

Press start to start the server.

Barrier client setup

Configure the client is easier, just tick the Client box and untick the Auto config enter the IP address of your Server computer and press start. The barrier client will try to connect to the server as long as the client is running.

I have setup KDE to autologin and auto start Barrier which will try to connect to the server, this way I don’t need a keyboard connected to my machine.

Audio using Pipewire-pulse over network

I have connected my Behringer X502USB to my micro computer so I can use Discord on that computer, no more “BRB, have to reboot”. And I can listen to my music from that computer. but I no longer have my main computer hooked up to my speakers/headphones. So now I’m streaming my Audio from my main computer to my secondary computer using Pipewire-pulse.

Installing pipewire (Debian stable)

To install pipewire on Debian 12 you just need to install pipewire and pulseaudio-module-zeroconf package

$ sudo apt install pipewire pipewire-pulse pulseaudio-module-zeroconf

Audio server

I have created the file ~/.config/pipewire/pipewire-pulse.conf.d/pipewire-puls-server.conf with the content

context.exec = [
  { path = "pactl" args = "load-module module-native-protocol-tcp listen=0.0.0.0" }
  { path = "pactl" args = "load-module module-zeroconf-publish" }
]

This will load the pipewire pulseaudio module for exposing your audio device over the network. The zeroconf-publish module will allow clients to auto discover the audio devices exposed by this machine.

Audio client

I have created the file ~/.config/pipewire/pipewire-pulse.conf.d/pipewire-puls-client.conf with the content

context.exec = [
  { path = "pactl" args ="load-module module-tunnel-sink server=192.168.0.103" }
]

This will instruct pipewire to load the pulsaudio tunnel-sink module, this should now auto-connect to the pulse audio server running on my micro computer. You may have to manually choose the new Audio device in the settings.

When it works it works very good, I have not noticed any audio lip-sync issues when playing Youtube videos. But my client computer randomly disconnect from the server, and it will not reconnect anymore and I’m not sure why. Running avahi-browse --all will not show anything, just hang there so I think the problem is on my Main machine.

UPDATE 2023-09-27: Changed to use the module-tunne-sink to directly connect to the server. The other issues with random disconnects seems to be some kind of OpenSUSE Tumbleweed issue. Because I’m back on Debian now, been running Debian Sid for few month now without any random disconnects.