DEV Community

Cover image for Dual Monitor Setup in Linux in i3wm
sureshsaragadam
sureshsaragadam

Posted on

Dual Monitor Setup in Linux in i3wm

Challenges

I keep disconnecting the Extended monitor when required, keep the dpi settings sync with both the Laptop and Extended Monitor, so that both the Laptop and Extended monitor feel with the same dpi resolution

**

- Need to setup a 4k Monitor as extended Monitor in Linux

**

tools needed xrandr

xrandr automatically detects the external monitor, First after the 4k monitor detected as extended monitor i noticed that my font size is too small for the 4k Monitor, so we need to adjust the 4k Monitor font size to the desired dpi with the .Xresources file in my home directory.

Create a file .Xresources and make an entry in this file to set the desired dpi

Xft.dpi: 144

Enter fullscreen mode Exit fullscreen mode


xrdb -merge .Xresources

So the settings of the Xft.dpi to 144 in the file .Xresources IN MY SCENARIO it is 144 you can adjust to your desired value.

Now after adjusting the Dpi i found that Laptop resolution is
not working as desired, So i need to scale and test the laptop dpi with xrandr to the desired settings from terminal first before applying the settings.

My working i3wm configuration

workspace 1 output eDP
workspace 2 output DP-1-0
workspace 3 output HDMI-A-0
# Moving workspaces between screens 

exec --no-startup-id feh --bg-fill /home/*user*/Pictures/Wallpapers/laptop.jpg
exec --no-startup-id xrandr  --output eDP --primary --mode 1920x1080 --scale 1.6 --output HDMI-A-0 --off --output DP-1-0 --off


# This is the configuration for the BENQ Programmer Series Monitor
bindsym $mod+n exec --no-startup-id "xrandr --fb 7680x2560 --output DP-1-0 --mode 3840x2560 --scale 1 --pos 0x0  --output eDP --primary --mode 1920x1080 --scale 1.6 --pos 3840x0 --output HDMI-A-0 --off ;  feh --bg-fill /home/*user*/Pictures/Wallpapers/laptop.jpg  --bg-fill /home/suresh/Pictures/Wallpapers/benq.png"

bindsym $mod+m exec --no-startup-id "xrandr --fb 3840x2560 --output DP-1-0 --primary --mode 3840x2560 --pos 0x0 --rotate normal --output eDP  --off --output HDMI-A-0 --off; feh --bg-fill /home/suresh/Pictures/Wallpapers/benq.png"

bindsym $mod+l exec --no-startup-id "xrandr  --output eDP --primary --mode 1920x1080 --scale 1.6 --output HDMI-A-0 --off --output DP-1-0 --off; feh --bg-fill /home/*user*/Pictures/Wallpapers/laptop.jpg"


Enter fullscreen mode Exit fullscreen mode

Image description

i have three different shortcuts to work with only extended monitor, or only laptop or to work with both laptop and extended monitor

$mod+m $mod+l $mod+n respectively

Top comments (2)

Collapse
 
sureshsaragadam profile image
sureshsaragadam

You can use this xrandr configuration command from the i3wm config details in the above blog as a reference, so that you can apply your altered xrandr configuration to your desktop environment accordingly whether it is a gnome kde or xfce....or any

Collapse
 
sureshsaragadam profile image
sureshsaragadam

i have different shortcuts to work with laptop and monitor to work together and laptop and monitor individually