From 391791f6165653ebe4c4f25af953841a3b0fc6c7 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 25 Nov 2023 19:23:41 +0100 Subject: Update setres MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- xorg-xrandr/resolution-changed | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'xorg-xrandr/resolution-changed') 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 -- cgit v1.2.3-70-g09d2