Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RStudio HiDPI support

Tags:

r

rstudio

RStudio is great IDE for R development. I wonder if there is any way for nice support HiDPI resolution?
I currently have 13 inch display and 3200x1800 resolution, it is even hard to read RStudio options to adjust more appropriate setting.
This is of course not an RStudio issue but general issue related to high resolution display which requires HiDPI support to make it reasonably usable.
Posting it here as question because RStudio still doesn't allow to fill questions/issues on github.

like image 980
jangorecki Avatar asked Jun 14 '15 10:06

jangorecki


3 Answers

RStudio is a Qt application. I've solved this by setting a scaling factor in Qt with this environment variable (note it must be an integer):

export QT_DEVICE_PIXEL_RATIO=2

The Arch wiki has some excellent advice on getting HiDPI working.

like image 178
RobinGower Avatar answered Nov 18 '22 00:11

RobinGower


UPDATE: This solution is only for WINDOWS!

There is a simple solution for you, it comes from the option "Compatibility" of the execute file.

  1. Close all current RStudio windows.
  2. Right click on the shortcut of RStudio (or the original exe file) and choose Properties
  3. In the RStudio Properties pop-up windows, choose the tab Compatibility
  4. Tick on option Override hide DPI scaling... and then choose System from the drop-down list.
  5. Apply > OK.
  6. (Re)open Rstudio to see the change

Note that, on the HiDPI screen, resolution of modified RStudio is not so good but it really solved the bad scale problem.

You can also apply this technique to other apps without supporting HiDPI.

like image 39
Anh-Thi DINH Avatar answered Nov 18 '22 01:11

Anh-Thi DINH


I use the following bash script to determine the current screen resolution and substitute the scaling factor by 1 (normal resolution) or 1.75 (high resolution) in the RStudio desktop file:

#!/bin/bash

# Determine resolution
width=$(xdpyinfo | grep 'dimensions:' | grep -o -E '[0-9]+' | head -1 | sed -e 's/^0\+//')

echo "Screen width is $width pixels"

if [ $width -gt 3000 ]; then
        echo "High resolution detected -> setting zoom level to 1.75"
        sed -i 's/view.zoomLevel.*/view.zoomLevel=1.75/' ~/.config/RStudio/desktop.ini
else
        echo "Normal resolution detected -> setting zoom level to 1.0"
        sed -i 's/view.zoomLevel.*/view.zoomLevel=1/' ~/.config/RStudio/desktop.ini
fi

QT_QPA_PLATFORMTHEME=gtk2 /usr/lib/rstudio/bin/rstudio %F

I am on Ubuntu 17.10. If I want to use the GTK theme, I have to set the QT_QPA_PLATFORMTHEME environment variable.

like image 2
Daniel Avatar answered Nov 18 '22 01:11

Daniel