Using RDP with dual monitor on Slackware + i3 window manager

April 14, 2020 | ~6 Minute Read

Why?

Recently I have been required to change my work dynamic, yes due to the current pandemic, and I thought it’d be fun to have a setup where I remote into my work machine from Slackware and still have access to my Linux system (my work system is using Windows as an OS). I can easily disconnect when I’m done working and start working on other activities from Linux. Connecting via RDP to my remote system should be simple enough to achieve, but I found myself wondering how to achieve this simple task on my current setup.

My Desktop Setup

As you may know from my one of my previous posts I currently use the i3 window manager on my Slackware system. This has been great ever since that last post and no issues have come up whatsoever. I recently added another monitor to my setup and with that and my idea to remote into my work system I found myself in one of those situations where you have your setup just right and it’s perfect but another variable just creeps in and now you have to figure out how to make a very specific setup work.

In my case this specific scenario is the following: I want to RDP from my dual monitor system to my non dual monitor system and I want to be able to use the remote system as if it were connected to both of my displays…on i3.

Specifically I wanted to be able to use both screens that I have on my client system (Slackware) as if they were physically connected to my remote system {Windows}, i.e. open a browser on one monitor and my email application on another monitor and have them both be full screen, and have audio input from my client system be sent to the remote system as well as audio from the remote system be sent back to the client system.

Initial Dabbling

I went on to Google and did some homework, I found other posts related to my same scenario, thankfully, which helped me get some sort of direction as this is the first time I deal with this sort of setup. Specifically I found this reddit post which sort of detailed what I was facing, then this other post which further expanded on the first.

These two posts and additional google results got me to a point where I could RDP in successfully, which was a great start point, but neither of the two main requirements were met yet, so I was gonna have to keep digging into the matter.

What I was able to come up with after the initial research was this command for xfreerdp:

  xfreerdp /u:username /v:ipaddress /sec:tls /multimon /rfx -grab-keyboard +fonts

The above still did not make the remote session use both of my available monitors. (Although I’m sure this is only due to the fact that I’m using i3, if I was using a desktop environment I’m confident it would have worked at this point.)

Getting Multi-monitor to work

After additional research I found some ways that had worked for others on different Linux systems, however after trying for a couple of hours I was not able to get them to work as expected on i3.

I wasn’t going to give up just yet though, xfreerdp seemed like a great tool and I was hopeful that it would redirect sound as well so that I could listen to music from the remote system when I wanted to and maybe take an occasional meeting if necessary. So I kept looking around for a way to have xfreerdp make use of both of my monitors without any luck.

After a while I stumbled upon another RDP client, rdesktop and I thought I’d give it a shot. After only a few minutes I was in my windows session with rdesktop, I just had to figure out the sound and the +fonts flag which I had really liked from xfreerdp. I was able to get the sound sort of working but for some reason it wasn’t working properly, it was all garbled up. I have a feeling that’s due to the pulse audio system on my machine rather than something with the RDP client. After some testing I was able to get most of the features I wanted and just kept the sound on the remote system.

This was the final rdesktop command that worked for me:

  $rdesktop -f -r sound:remote ip-address -a 32 -x 0x80

The above command allows takes me to a login prompt for windows so I can input my login credentials. There’s no need for me to specify additional flags, like I had to do for xfreerdp, for the security settings of my RDP session, or the release of the keyboard (Although I did see that this is set by default starting on version 2.0 of xfreerdp which was recently released). Not having to specify additional flags for these options made it a shorter command, but there was really no other benefit.

The real trick was in rdesktop’s -f flag, which enables full screen mode. This made the remote session window span over both of my monitors over the i3 workspaces and claiming my entire screen real estate. This worked great for me because I was able to use the Windows feature of automatically resizing windows when dragging them to the corners of the screen. I simply made the windows “half” of my working desktop space and that set the program windows to “full screen” on either one of my monitors.

Font Smoothing

This setting is actually an interesting one as it is not on the man page for the command itself. I was able to find it by chance during my research on a great blog post referenced by this ubuntu forum question.

This enabled that feature I had really liked from xfreerdp previously, so it was an amazing find!

Conclusion

Once I was able to get my Windows session spanning over both of my monitors I simply added an alias for the rdesktop command that had all the flags I needed by editing my .bashrc file and adding the following line:

  alias work="rdesktop -f -r sound:remote ip-address -a 32 -x 0x80"

So with this, I was happily able to use my Windows system from Slackware while using i3.