Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Run commands as the currently-active X11 user

branch: master
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md more README September 26, 2012
Octocat-spinner-32 xuserrun fix whitespace December 12, 2012
README.md

xuserrun

Run commands as the currently-active X11 user

Usage: xuserrun [arg1 arg2 ...]

Dependencies

  • systemd
  • coreutils

Overview

This uses loginctl to determine the active session. If it is an X11 session, then the display and username are obtained from loginctl. command and all additional arguments are executed after switching to the active user and setting the DISPLAY variable appropriately.

Example Usage

On arch-linux, ACPI events are handled by /etc/acpid/handler.sh, which runs as root. To send notifications the the current user, add a line to this script like:

/path/to/xuserrun notify-send "AC Adapter" "Plugged in"

Limitations

This currently assumes that the user is on the default loginctl 'seat', and will need to be modified if you require multi-seat support (see Multi-Seat on Linux for more information).

Something went wrong with that request. Please try again.