Score:4

Every time the notebook wakes up, it pastes the clipboard into the current application

mx flag

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 
uz flag
Jos
Do you have anything interesting in `/etc/pm/sleep.d`? Or in `/lib/systemd/system-sleep/hdparm`? Suggestions taken from [this question](https://askubuntu.com/questions/92218/how-to-execute-a-command-after-resume-from-suspend).
Adam Ryczkowski avatar
mx flag
@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.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.