blob: 4e8856f4908c3f137fe9b123c22e7ed185a908ed (
plain) (
tree)
|
|
#!/bin/dash
reset_wallpaper_twice=0
hostname="$(hostname | tr 'A-Z' 'a-z')"
if ! test "${hostname}" = zenith; then ## TODO how about the other east,north,hades,hyperion?
# 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
if test -x /usr/lib/mate-settings-daemon/mate-settings-daemon; then
msd=/usr/lib/mate-settings-daemon/mate-settings-daemon
elif test -x /usr/bin/mate-settings-daemon; then
msd=/usr/bin/mate-settings-daemon
elif test -x /usr/libexec/mate-settings-daemon; then
msd=/usr/libexec/mate-settings-daemon
elif test -x /usr/libexec/mate-settings-daemon/mate-settings-daemon; then
msd=/usr/libexec/mate-settings-daemon/mate-settings-daemon
else
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
for file in ~/.config/background.${SESSION_} \
~/.config/background.${SESSION} \
~/.config/background.${DESKTOP_SESSION} \
~/.config/background; do
if test -r "$file"; then
xwallpaper --zoom "$file"
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
|