[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#633849: Me too



On 2013-10-30 22:44:45 +0100, Eugen Dedu wrote:
> I have the same bug and I would really love to have it fixed.  Since about 2
> years (before, it worked) I have been forced to execute xmodmap ~/.xmodmap
> after each resume, since the key bindings I use in that file are lost at
> suspend.

There's a workaround: save and restore the settings automatically via
pm-utils. I wrote the attached /etc/pm/sleep.d/40xkb-save-restore script
(I use XKB instead of the obsolete xmodmap solution, but this script
might also work if you have changed the settings with xmodmap, I have
not tried). The following command is needed in ~/.xsession

  xhost +si:localuser:root

since the script is run by root, and root doesn't have the user's
xauth information (for MIT-MAGIC-COOKIE-1) in his environment.

Most often this works perfectly. This solution is not even affected by

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=661295

However the settings are not always restored:

  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=756268

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
#!/bin/sh

# /etc/pm/sleep.d/xkb-save-restore
# See pm-action(8) man page for the documentation.
# See /var/log/pm-suspend.log* for the logs.
#
# "xhost +si:localuser:root" must be run by the user, for instance
# at login time, so that xkbcomp can have access to the display.

set -e

dir=/run/pm-xkb
mkdir -p $dir
displays=$dir/displays
env=$dir/env

unset list

ok()
{
  if [ -n "$list" ]; then
    echo "$1 XKB settings for displays:$list"
  fi
}

xkbsave()
{
  : > $displays
  cd /tmp/.X11-unix
  for file in X*
  do
    d=${file#X}
    if xkbcomp :$d $dir/$d; then
      echo $d >> $displays
      list="$list $d"
    fi
  done
  ok saved
}

xkbrestore()
{
  while read d
  do
    xkbcomp $dir/$d :$d
    list="$list $d"
  done < $displays
  ok restored
}

case $1 in
  suspend|hibernate) xkbsave ;;
  resume|thaw) xkbrestore ;;
  *) echo "unsupported argument" >&2
     exit 1 ;;
esac

# $Id: xkb-save-restore 71569 2014-07-25 22:08:22Z vinc17/xvii $

Reply to: