#!/bin/sh
# $Id: apm-suspend,v 1.7 2021/11/23 02:53:38 nanons Exp $
#
# This script performs some administrative actions on system suspend.
#
# Don't execute the script directly, instead copy it to /etc/apm/suspend
# and to /etc/apm/hibernate.  Make sure the file is owned and executable
# by root and not writable.
#
# The apmd(8) daemon must be enabled:
#
#	# rcctl enable apmd
#	# rcctl start apmd

# Lock the X11 session if xidle(1) is running
# To enable xidle(1), see xenocara/dot.xsession
pkill -USR1 xidle

# Lock all tmux(1) sessions
# Most likely unnecessary for X(7) and xidle(1) users; this is intended for
# console-only users.
for sock in /tmp/tmux-*/*; do
        tmux -S "$sock" lock-server
done
