From fa8fb212ab2e77ba72ef4a46aa3084eeb10eb5ab Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sat, 22 Dec 2018 16:22:24 -0500 Subject: [PATCH 1/4] xresources: Don't explicitly set DPI This caused some problems when the ~/.Xresources DPI was 192 and the screen resolution was 96 DPI. Since I now know how to manipulate cursor size even after X is started, manually setting Xft.dpi in ~/.Xresources to 96 or 192 DPI is no longer needed. --- xresources/.Xresources | 3 --- 1 file changed, 3 deletions(-) diff --git a/xresources/.Xresources b/xresources/.Xresources index a01a45b..1631c22 100644 --- a/xresources/.Xresources +++ b/xresources/.Xresources @@ -1,9 +1,6 @@ ! New Start: A modern Arch workflow built with an emphasis on functionality. ! Copyright (C) 2017-2018 Donovan Glover -! Use 2x (192/96) scaling for 4k (Effectively 1920x1080) -Xft.dpi: 192 - ! Make it easier to distinguish between letters (Required for dpi < 300) Xft.hinting: true From e4eb86bdeb7d4a5df9179041df76033d76d467fb Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sat, 22 Dec 2018 16:35:33 -0500 Subject: [PATCH 2/4] xeventbind: Set a default Xft.dpi if none is found Since our scripts depend on Xft.dpi being set, we first set the variable to a reasonable default before doing anything else. --- xeventbind/.config/xeventbind/on-resolution-change.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xeventbind/.config/xeventbind/on-resolution-change.sh b/xeventbind/.config/xeventbind/on-resolution-change.sh index 3a65d0e..5a61b4d 100755 --- a/xeventbind/.config/xeventbind/on-resolution-change.sh +++ b/xeventbind/.config/xeventbind/on-resolution-change.sh @@ -5,6 +5,11 @@ HOST_WIDTH=$(bspc query -T -m | jq '.rectangle.width') CURSOR_THEME=${XCURSOR_THEME:-breeze_cursors} +# If the DPI is not set, set it to 96 by default +if [ -z "$(xrdb -query | grep dpi)" ]; then + X_DPI=96 +fi + # Determine the DPI based on screen width if [ "$HOST_WIDTH" -eq "1920" ]; then X_DPI=96 From dac1e40a2b328cf10d3f8dff790b9f6cc5d216b4 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sat, 22 Dec 2018 16:54:50 -0500 Subject: [PATCH 3/4] bspwm: Set DPI before starting polybar This change makes it so that DPI is determined when bspwm is started instead of relying on ~/.Xresources to always have the correct DPI. --- bspwm/.config/bspwm/bspwmrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc index 0bf7839..52d7f6d 100755 --- a/bspwm/.config/bspwm/bspwmrc +++ b/bspwm/.config/bspwm/bspwmrc @@ -48,8 +48,8 @@ xset s off -dpms # Start compton compton -b -# Start polybar -~/.config/polybar/launch.sh main +# Start polybar and other things based on DPI +~/.config/xeventbind/on-resolution-change.sh # bspc rules bspc rule -a mpv state=floating From 0483131b62c6270f27e661ebcbc5a17edb8ba040 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sat, 22 Dec 2018 17:02:37 -0500 Subject: [PATCH 4/4] bspwm: Run xeventbind in the background if found This makes it so that the X DPI and other components are automatically changed on resolution change. --- bspwm/.config/bspwm/bspwmrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc index 52d7f6d..66ecdcf 100755 --- a/bspwm/.config/bspwm/bspwmrc +++ b/bspwm/.config/bspwm/bspwmrc @@ -51,6 +51,10 @@ compton -b # Start polybar and other things based on DPI ~/.config/xeventbind/on-resolution-change.sh +if hash xeventbind 2>/dev/null; then + xeventbind resolution $HOME/.config/xeventbind/on-resolution-change.sh & +fi + # bspc rules bspc rule -a mpv state=floating bspc rule -a feh state=floating