config

OpenBSD system configuration
git clone git://jacobedwards.org/config
Log | Files | Refs | README

commit 415738b1aebb322c0097349d6d18607ff3f8b8e8
parent 176971b17d20460111988630554503fd5eaedcf6
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Sun,  7 Feb 2021 21:49:33 -0800

Add script to send notifications to dwm's status bar

Diffstat:
Amodules/scripts/.local/bin/sron | 27+++++++++++++++++++++++++++
1 file changed, 27 insertions(+), 0 deletions(-)

diff --git a/modules/scripts/.local/bin/sron b/modules/scripts/.local/bin/sron @@ -0,0 +1,27 @@ +#!/bin/sh +# Copywrite 2021 Jacob R. Edwards +# License: GPLv3 (see <https://www.gnu.org/licenses/>) +# +# sron -- set root name +# +# Set the root window's name temporarily, restoring the previous +# name and slstatus to there original states afterwords. This is +# useful for notifications when using dwm(1) and it also works along +# side slstatus(1). + +main() +{ + name="`xprop -root WM_NAME | cut -d'"' -f2`" + pids=`pgrep slstatus` + + test -n "$pids" && + kill $pids + xsetroot -name " $* " && { + sleep 4 + xsetroot -name "$name" + } + test -n "$pids" && + exec slstatus +} + +main $* &