RDP with dual monitor on Slackware and I3 Window Manager

Published: 2020-04-14 | Last Updated: 2021-02-02 | ~6 Minute Read

Why?

Recently I have been required to change my work dynamic 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 Windows based). 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 enable 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 made it work for me 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.

Update January 2021

After the update in hardware I did on my computer the above instructions no longer worked, rdesktop would only show half of the windows desktop on one of my monitors instead of covering both monitors (workspace 1 and 2 in i3).

Upon doing some research I found a feature from i3 that I had not been aware of before. That feature is the fullscreen toggle global configuration option and it’s explained in the i3 documentation. The feature is pretty straight forward, the client window selected spans all available displays.

That feature in combination with a revisited version of the initial xfreerdp command got me to have a true dual monitor setup (The Windows server detects that I have two separate monitors instead of one large monitor made up by both of my physical monitors like it was the case with rdesktop).

The xfreerdp command is the following:

$ xfreerdp /u:username /v:<server-ip-sddress>:<port> /sec:tls /multimon /monitors:0,1 /rfx -grab-keyboard +fonts +smart-sizing /audio-mode:1

The new sections of this command compared to the previous one I had tried are /monitors:0,1 and /audio-mode:1.

The way to determine what numbers to set on the /monitors: directive is by executing the xfreerdp /monitor-list command:

bash-5.1$ xfreerdp /monitor-list
      * [0] 1920x1080   +0+0
        [1] 1920x1080   +1920+0
bash-5.1$ 

We see that I have displays 0 and 1 available, so that’s what I used, it may be different for you depending to your setup.

The final option I added was the /audio-mode: directive. The 1 here is simply to indicate that I wanted the audio to stay on the server. Oddly enough the available options were not explained on the xfreerdp man page, I found the option details on their github repository.

I have not tested redirecting the sound to my Slackware system as I had issues with it the last time around but the /multimedia:sys:alsa option from the xfreerdp man page seems promising.

The last bit of configuration I did was to add a Keybinding in the i3 config file that looks like the following:

bindsym $mod+Shift+f fullscreen toggle global

Since the default keybinding to make an application full screen is $mod+f I chose to use $mod+Shift+f since it seemed to be similar enough. Since this keybinding is applied in i3’s config instead of freeRDP I can use it for any application I would like, which is a nice plus in terms of flexibility.

The main difference between the use of xfreerdp and rdesktop from this experience is that with xfreerdp I’m able to easily minimize the window and have access to my Slackware system thanks to the i3 keybinding (As I would have expected from the beginning). When using rdesktop I had to switch to a TTY by pressing Ctrl+Alt+F2 or similar to kill the rdesktop process since there was no way to minimize the screen once it occupied both screens.

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~grokkingnix/blog@lists.sr.ht [mailing list etiquette] [mailing list archive]


Posts from blogs I follow:

Introducing a Falkon extension RSS Finder

This weekend I decided to semi automate the process of searching for RSS feeds on websites while using Falkon web brosers. Many websites provide RSS feeds but do not provide any visible link or icon to access them (eg. many Wordpress based sites) and I ha…

via My land January 23, 2022
Help Chile write free software values, privacy, and digital sovereignty into their constitution

For those out of the loop, a group which included myself up until recently,1 Chile is in the midst of a revolution. They’re fighting against the increased cost of living, privatization of essential services, and worsening inequality — problems facing everyon…

via Drew DeVault's blog January 19, 2022
A warning to business owners and managers, you are a big part of the problem!

In my last couple of articles, mainly So-called modern web developers are the culprits and Is the madness ever going to end? I have written about some of the major problems with so-called modern web development and I have addressed the issues to the devel…

via unixsheikh.com January 13, 2022

Generated by openring