Re: [dev] [st] Multiple monitors dpi autoswitch

From: ssd <ssd_AT_mailless.org>
Date: Fri, 29 Dec 2017 14:02:47 +0100

Hi,

I very rarely use both internal and external monitor simultaneously. I have a
similar problem but with working on the internal (fine) XOR the external
(coarse). It does not only affect st, but also browsers, dmenu, dwm status...

I've tried setting the dpi with `zoom in` [1] when I plug in/out the external one
and invoking st with a heuristic as in [2]: fontsize = dpi / 8

It's all dirty and inconvenient and involve manual steps and guessing...
Not sure it gets much better anyway.

The most suckless way is probably what arg suggested: buy a laptop with lower
resolution display :o)

good luck to make it work properly and cover all use cases.

cheers
--s

1: zoom:

        #!/bin/sh

        cur=`xrdb -query Xft.dpi | (read _ dpi; echo $dpi)`

        [ -z "$1" ] && echo "usage: zoom in|out|<dpi>; now: $cur" && exit 0

        case "$1" in
                out)
                        new=$(($cur - 12))
                ;;
                in)
                        new=$(($cur + 12))
                ;;
                *)
                        new=$(($1 * 1))
                ;;
        esac

        echo Xft.dpi: $new | xrdb -merge
        xrdb -query Xft.dpi


2: st invocation
        dpi=`xrdb -query Xft.dpi | (read _ dpi; echo $dpi)`
        [ x$dpi = x ] && dpi=96
        
        fontsize=$(($dpi / 8))
        font="Liberation Mono:pixelsize=$fontsize:antialias=true:autohint=true"
        
        /usr/local/bin/st -f "$font" "$_AT_"
Received on Fri Dec 29 2017 - 14:02:47 CET

This archive was generated by hypermail 2.3.0 : Fri Dec 29 2017 - 14:12:20 CET