dotfiles/bin/executable_suspend-if-docked

15 lines
455 B
Bash

#!/usr/bin/env bash
SWAYSOCK=/run/user/$(id -u)/sway-ipc.sock
DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus"
export SWAYSOCK
export DBUS_SESSION_BUS_ADDRESS
if thinkpad-is-docked; then
if [[ $(emacsclient -n -e "(org-clocking-p)") == "t" ]]; then
notify-send "OrgMode $(org-get-current-clock-task)" "Clocking out of current task because of inactivity."
org-clock-out
fi;
doas /run/current-system/sw/bin/systemctl suspend;
fi;