Skip to content

Instantly share code, notes, and snippets.

@andrew-sayers
andrew-sayers / user-on-seat.c
Last active April 26, 2025 08:24
Get notified when the user in on-seat
// SPDX-License-Identifier: CC0-1.0
/*
* Linux systems can have multiple sessions logged in at once.
* For example, siblings with separate accounts on a family laptop
* can use the "switch user" function to share access without
* closing all their programs every time.
*
* Systemd provides user services to handle services that run for
* each user, but this can be a problem for services that should only
* run for the current user. For example, audio notifications