aboutsummaryrefslogtreecommitdiffstats
path: root/xorg-xrandr/resolution-changed
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-xrandr/resolution-changed')
-rwxr-xr-xxorg-xrandr/resolution-changed42
1 files changed, 36 insertions, 6 deletions
diff --git a/xorg-xrandr/resolution-changed b/xorg-xrandr/resolution-changed
index a53c7b6..e1457ce 100755
--- a/xorg-xrandr/resolution-changed
+++ b/xorg-xrandr/resolution-changed
@@ -1,11 +1,23 @@
#!/bin/dash
-# Reset rat size in case DPI change modified scaling
-xsetroot -cursor_name left_ptr || :
+reset_wallpaper_twice=0
-# Reset rat speed in case DPI changed
-if test "${DESKTOP_SESSION}" = xmonad && test ! "${NO_MATE}" = y; then
- (exec mate-settings-daemon --replace &) || :
+if ! test "$(hostname | tr '[A-Z]' '[a-z]')" = zenith; then
+ # 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
+ msd=/usr/lib/mate-settings-daemon/mate-settings-daemon
+ if ! test -x "$msd"; then
+ msd=mate-settings-daemon
+ fi
+ (exec $msd --replace &) || :
+ # mate-settings-daemon will change the keyboard layout
+ (sleep 1; setkeys) &
+ # mate-settings-daemon may change the wallpaper
+ reset_wallpaper_twice=1
+ fi
fi
# Reset background in case resolution change damaged it
@@ -15,6 +27,24 @@ for file in ~/.config/background.${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
+ if test ${reset_wallpaper_twice} = 1; then
+ # Again, with delay, in case mate-settings-daemon changes it
+ (sleep 2 ; xwallpaper --zoom "$file") &
+ fi
fi
done
+
+# Broadcast resolution change
+if test -n "${XDG_RUNTIME_DIR}"; then
+ if test -n "${DISPLAY}"; then
+ mkdir -p -- "${XDG_RUNTIME_DIR}/x-display/${DISPLAY}/"
+ printf -- '%ix%i%+i%+i\n' "$@" > "${XDG_RUNTIME_DIR}/x-display/${DISPLAY}/resolution~"
+ mv -- "${XDG_RUNTIME_DIR}/x-display/${DISPLAY}/resolution~" "${XDG_RUNTIME_DIR}/x-display/${DISPLAY}/resolution"
+ fi
+ if test -z "${BUS_VIDEO}"; then
+ BUS_VIDEO="${XDG_RUNTIME_DIR}/@bus/video"
+ fi
+fi
+if test -n "${BUS_VIDEO}"; then
+ bus broadcast "${BUS_VIDEO}" "resolution changed:$(printf -- ' %ix%i%+i%+i' "$@")"
+fi