aboutsummaryrefslogtreecommitdiffstats
path: root/xorg-xrandr
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2023-11-18 23:23:40 +0100
committerMattias Andrée <maandree@kth.se>2023-11-18 23:23:40 +0100
commit0f1df0db903ba576fd17b08197d3066af7a61e5f (patch)
treea59c04307b1382257afa3c3512ec3abadf7e0e47 /xorg-xrandr
parentUse losetup -d instead of --detach and add clean up (diff)
downloaddotfiles-0f1df0db903ba576fd17b08197d3066af7a61e5f.tar.gz
dotfiles-0f1df0db903ba576fd17b08197d3066af7a61e5f.tar.bz2
dotfiles-0f1df0db903ba576fd17b08197d3066af7a61e5f.tar.xz
A lot of changes
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'xorg-xrandr')
-rw-r--r--xorg-xrandr/Makefile24
-rwxr-xr-xxorg-xrandr/resolution-changed20
-rw-r--r--xorg-xrandr/xinit2
3 files changed, 36 insertions, 10 deletions
diff --git a/xorg-xrandr/Makefile b/xorg-xrandr/Makefile
index d135e27..0968b2a 100644
--- a/xorg-xrandr/Makefile
+++ b/xorg-xrandr/Makefile
@@ -1,26 +1,32 @@
.POSIX:
-include ../common.mk
XINITRC_ORDER = 15
# Testing that xwallpaper is installed because setres calls it
# Testing that python3 is installed because setres is written in it
install:
- $(CHECK_INSTALLED) xwallpaper
- $(CHECK_INSTALLED) python3
+ ../check-in-path xwallpaper
+ ../check-in-path python3
+ ../check-installed-shebang resolution-changed
mkdir -p -- ~/.config/X11/xinit/xinitrc.d
- test ! -d ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr
+ test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr || \
+ test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr
ln -sf -- ~/.dotfiles/xorg-xrandr/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr
mkdir -p -- ~/.local/bin
- make -C setres
- ln -sf -- ~/.dotfiles/xorg-xrandr/setres/setres ~/.local/bin
+ cd setres && $(MAKE)
+ test ! -e ~/.local/bin/setres || test -L ~/.local/bin/setres
+ ln -sf -- ~/.dotfiles/xorg-xrandr/setres/setres ~/.local/bin/setres
+ test ! -e ~/.config/resolution-changed || test -L ~/.config/resolution-changed
+ ln -sf -- ~/.dotfiles/xorg-xrandr/resolution-changed ~/.config/resolution-changed
uninstall:
+ +! ../check-installed xorg-xrandr
+ +! ../check-installed xrandr
+ +! ../check-installed x11-xserver-utils
-unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-xorg-xrandr
-rmdir -- ~/.config/X11/xinit/xinitrc.d
-rmdir -- ~/.config/X11/xinit
-rmdir -- ~/.config/X11
+ -unlink -- ~/.config/resolution-changed
-rmdir -- ~/.local/bin/setres
- -make -C setres reallyclean
-
-.PHONY: install uninstall
+ +cd setres && $(MAKE) reallyclean
diff --git a/xorg-xrandr/resolution-changed b/xorg-xrandr/resolution-changed
new file mode 100755
index 0000000..a53c7b6
--- /dev/null
+++ b/xorg-xrandr/resolution-changed
@@ -0,0 +1,20 @@
+#!/bin/dash
+
+# Reset rat size in case DPI change modified scaling
+xsetroot -cursor_name left_ptr || :
+
+# Reset rat speed in case DPI changed
+if test "${DESKTOP_SESSION}" = xmonad && test ! "${NO_MATE}" = y; then
+ (exec mate-settings-daemon --replace &) || :
+fi
+
+# Reset background in case resolution change damaged it
+for file in ~/.config/background.${SESSION_} \
+ ~/.config/background.${SESSION} \
+ ~/.config/background.${DESKTOP_SESSION} \
+ ~/.config/background; do
+ if test -r "$file"; then
+ xwallpaper --zoom "$file"
+ (sleep 2 ; xwallpaper --zoom "$file") & # Again, with delay, in case mate-settings-daemon changes it
+ fi
+done
diff --git a/xorg-xrandr/xinit b/xorg-xrandr/xinit
index 1185a86..2f6e033 100644
--- a/xorg-xrandr/xinit
+++ b/xorg-xrandr/xinit
@@ -1,4 +1,4 @@
# -*- shell-script -*-
# Set screen layout, resolution and calibration
-setres || true
+setres || :