4

I want to get rid of the minor annoyance I have for over a year.

I have a Dell XPS 9500 notebook with Ubuntu 20.04, and i3wm installed on top of it.

Every time my notebook wakes from suspend, it pastes the contents of the clipboard. How can I prevent it?

The problem is that I don't know how to even start troubleshooting it;

  • is it because something sends a "ctrl+V" keyboard shortcut?
  • maybe some strange udev rule? There are plenty of udev rules on my system. How do I know which one is suspicious (or even non-standard?)

update:

Power management scripts

The contents of /etc/pm/sleep.d/10_grub-common:

# Tell grub that resume was successful

case "$1" in
    thaw)
        [ -s /boot/grub/grubenv ] || rm -f /boot/grub/grubenv
        mkdir -p /boot/grub
        grub-editenv /boot/grub/grubenv unset recordfail
        ;;
esac

contents of /etc/pm/sleep.d/xboxdrv:

case $1 in
     suspend|suspend_hybrid|hibernate)
    systemctl stop xboxdrv || :
        ;;
     resume|thaw)
    systemctl start xboxdrv || :
        ;;
esac

Contents of /etc/pm/sleep.d/10_unattended-upgrades-hibernate

PATH=/sbin:/usr/sbin:/bin:/usr/bin
SHUTDOWN_HELPER=/usr/share/unattended-upgrades/unattended-upgrade-shutdown

if [ -x /usr/bin/python3 ]; then
    PYTHON=python3
else
    PYTHON=python
fi

if [ ! -x /usr/share/unattended-upgrades/unattended-upgrade-shutdown ]; then
    exit 0
fi

case "${1}" in
        hibernate)
                if [ -e $SHUTDOWN_HELPER ]; then
                $PYTHON $SHUTDOWN_HELPER --stop-only
                fi
                ;;
        resume|thaw)
        # nothing
                ;;
esac

Contents of /lib/systemd/system-sleep/hdparm:

case $1 in
  post)
    /usr/lib/pm-utils/power.d/95hdparm-apm resume
    ;;
esac

(The command sudo /usr/lib/pm-utils/power.d/95hdparm-apm resume does not cause clipboard pasting)

systemd system-sleep:

The contents of /lib/systemd/system-sleep/nvidia:

case "$1" in
    post)
        /usr/bin/nvidia-sleep.sh "resume"
        ;;
esac

(The command /usr/bin/nvidia-sleep.sh "resume" does not cause clipboard pasting)

The contents of sudo /lib/systemd/system-sleep/unattended-upgrades:

set -e

if [ "$2" = "hibernate" ] || [ "$2" = "hybrid-sleep" ]; then
    case "$1" in
        pre)
            /usr/share/unattended-upgrades/unattended-upgrade-shutdown --stop-only
            ;;
    esac
fi

(The command sudo /usr/share/unattended-upgrades/unattended-upgrade-shutdown --stop-only does not cause clipboard pasting)

The contents of sudo /lib/systemd/system-sleep/tlp:

case $1 in
    pre)  tlp suspend ;;
    post) tlp resume  ;;
esac

(The command sudo tlp resume does not cause clipboard pasting)

There are other system-sleep directories. Are they eligible as well?:

$ fd system-sleep
snap/core20/1328/usr/lib/systemd/system-sleep
snap/core20/1361/usr/lib/systemd/system-sleep
snap/core18/2284/lib/systemd/system-sleep
snap/core18/2253/lib/systemd/system-sleep
snap/core/12725/lib/systemd/system-sleep
usr/lib/elogind/system-sleep
usr/lib/systemd/system-sleep 
2
  • 1
    Do you have anything interesting in /etc/pm/sleep.d? Or in /lib/systemd/system-sleep/hdparm? Suggestions taken from this question.
    – Jos
    Mar 2, 2022 at 14:34
  • @Jos I've updated the question. I think there is nothing there... Anyway, afaik those places do not have access to the clipboard, as the clipboard depends on the user's X-window graphical context. Mar 2, 2022 at 16:02

0

You must log in to answer this question.

Browse other questions tagged .