From e33ad4f128fb8fef2119cf2c71371eaf9c19bd29 Mon Sep 17 00:00:00 2001 From: Sylvain Herlédan Date: Sat, 3 Jun 2017 12:52:03 +0200 Subject: Initial setup with basic tools: vim/dein, tmux, st, tup, X --- bin/notify.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/notify.sh (limited to 'bin/notify.sh') diff --git a/bin/notify.sh b/bin/notify.sh new file mode 100755 index 0000000..9271b67 --- /dev/null +++ b/bin/notify.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -o nounset +set -o errexit +set -o pipefail + +readonly PROGNAME="$(basename "${0}")"; +readonly PROGDIR="$(readlink -m "$(dirname "${0}")")"; +readonly ARGS="${@}"; + +function main() +{ + local username="${1}"; shift; + local message="${@}"; + local userid=$(id -u "${username}"); + sudo -u ${username} \ + DISPLAY=":0" \ + DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${userid}/bus" \ + notify-send -u critical -a IT "Message from tech" "${message}" +} + +main ${ARGS} +exit 0 -- cgit v1.2.3-70-g09d2