Skip to content

Instantly share code, notes, and snippets.

@Elliria
Last active April 23, 2026 19:15
Show Gist options
  • Select an option

  • Save Elliria/53eff83be4ec37a9c27e680581cc0dc5 to your computer and use it in GitHub Desktop.

Select an option

Save Elliria/53eff83be4ec37a9c27e680581cc0dc5 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Stop on error:
set -e
# User-detection with fallbacks:
user=$(logname 2>/dev/null) || user=${SUDO_USER:-root}
case "$1" in
remove|deconfigure)
if [ "$user" != "root" ]; then
# Remove the user from the input group:
if [ -e /dev/uinput ]; then
usermod -r -G "input" "$user" || true
fi
# Remove the GNOME Shell Extension if present:
if command -v gnome-extensions >/dev/null 2>&1; then
su -c 'gnome-extensions uninstall "autokey-gnome-extension@autokey"' "$user" || true
rm -fr "/home/$user/.local/share/gnome-shell/extensions/autokey-gnome-extension@autokey" || true
fi
fi
# Remove non-root write access to udev rules:
if [ -e /dev/uinput ]; then
rm -f '/etc/udev/rules.d/10-autokey.rules'
udevadm control --reload-rules > /dev/null 2>&1 || true
#udevadm trigger > /dev/null 2>&1 || true
udevadm trigger --sysname-match='/devices/virtual/misc/uinput' > /dev/null 2>&1 || true
fi
;;
esac
#DEBHELPER#
exit 0
@Elliria

Elliria commented Apr 23, 2026

Copy link
Copy Markdown
Author

Caution

When copying this file to overwrite it at your end, it should have a blank line at the end. To get the true contents, use the Raw link and copy them from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment