Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-12-20 10:52:00

Mike_P
Member
Registered: 2017-12-20
Posts: 6

Dual Monitor HDPI script

Just registered to share my script to automatically adjust resolution and settings for single monitor (3200x1800) and dual monitor (3200x1800 left, 1920x1080 right) for XFCE. It can be adjusted to match different situations when a hdpi-laptop (Dell XPS13 in my case) is used in combination with a lower res monitor. This way, I have automatic setups for work and travel/mobile use.
When I use dual monitors, I do not need large fonts and icons, but Conky position and resolutions should be adjusted to obtain a nice desktop spanning over both monitors.
Please modify it according to your settings and needs. Adjust resolutions, monitor output label (HDMI, VGA, eDPI), path to Conky (if you use it), themes and fonts, icon sizes according to your preferences and needs.

Works great for me, but be careful and test the critical commands with your own settings using the terminal before adding it to your startup.

#!/bin/bash

mon=$(xrandr | grep -sw 'connected' | wc -l)
export DISPLAY=":0.0"
export XAUTHORITY=/home/mike/.Xauthority

if [ $mon == "1" ]; then
/usr/bin/conky --quiet -c ~/.conky/conky.conf.11
xfconf-query -c xfwm4 -p /general/theme -s "Default-xhdpi"
xfconf-query -c xsettings -p /Gtk/title_font -s "IBM Plex Sans Medium 12"
xfconf-query -c xsettings -p /Gtk/font -s "IBM Plex Sans Medium 15"
xfconf-query -c xsettings -p /Gtk/icon_sizes -s "gtk-large-toolbar=48,48:gtk-small-toolbar=48,48:gtk-menu=48,48:gtk-button=48,48:panel-applications-menu=48,48:panel-directory-menu=48,48:panel-tasklist-menu=48,48:gtk-dialog=88,88:gtk-dnd=48,48"
notify-send -i "Settings" "$mon Monitors: Single Monitor mode"
else
if xrandr | grep -q 'HDMI1 connected' ; then
xrandr --display :0.0 --fb 6388x1800
xrandr --display :0.0 --output HDMI1 --scale 1.66x1.66 --mode 1920x1080 --pos 0x0
xrandr --display :0.0 --output eDP1 --pos 3187x0
fi
sleep 2 &&
/usr/bin/conky --quiet -c ~/.conky/conky.conf.11
xfconf-query -c xfwm4 -p /general/theme -s "Default-hdpi"
xfconf-query -c xsettings -p /Gtk/title_font -s "IBM Plex Sans Medium 10"
xfconf-query -c xsettings -p /Gtk/font -s "IBM Plex Sans Medium 12"
xfconf-query -c xsettings -p /Gtk/icon_sizes -s "gtk-large-toolbar=32,32:gtk-small-toolbar=32,32:gtk-menu=32,32:gtk-button=32,32:panel-applications-menu=32,32:panel-directory-menu=32,32:panel-tasklist-menu=32,32:gtk-dialog=88,88:gtk-dnd=32,32"
notify-send -i "Settings" "$mon Monitors: Dual Monitor mode"
fi
exit 0

Currently on Xubuntu 16.04, Kernel 4.4.0-104

Regards,

Mike

Offline

#2 2017-12-20 23:57:21

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,006

Re: Dual Monitor HDPI script

Hello and welcome and thank you for sharing.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Board footer

Powered by FluxBB