From a081ad2bec7ee2a491ed3ab87883a690022f9e3a Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 15 Jun 2018 00:54:52 -0400 Subject: bin/xsession: Add column headings to sessions list --- (limited to 'bin') diff --git a/bin/xsession b/bin/xsession index 9b985f6..4166354 100755 --- a/bin/xsession +++ b/bin/xsession @@ -3,16 +3,21 @@ set -eu actions_icons='/usr/share/icons/gnome/16x16/actions' -awk_who_script=' +awk_who=' BEGIN { display_ere = " [(]" display "[)]$"; printed = 0; } - { + NR == 1 { + headings = $0; + } + NR > 1 { if (!match($0, display_ere)) { if (!printed) { print("\n\nThe following sessions will be " \ "hung up:\n"); + print(" " headings \ + ""); printed = 1; } print(" " $0 ""); @@ -35,8 +40,8 @@ do_shutdown() { zenity --question --title='Shut Down' \ --window-icon="${actions_icons}/system-shutdown.png" \ - --text="Are you sure you want to shut down this system?$(who | \ - awk -v "display=${DISPLAY}" "${awk_who_script}")" \ + --text="Are you sure you want to shut down this system?$(\ + who -H | awk -v "display=${DISPLAY}" "${awk_who}")" \ --ok-label='Shut Down' --cancel-label='Cancel' && \ sudo shutdown -hP now @@ -47,8 +52,8 @@ do_reboot() { zenity --question --title='Reboot' \ --window-icon="${actions_icons}/system-shutdown.png" \ - --text="Are you sure you want to reboot this system?$(who | \ - awk -v "display=${DISPLAY}" "${awk_who_script}")" \ + --text="Are you sure you want to reboot this system?$(\ + who -H | awk -v "display=${DISPLAY}" "${awk_who}")" \ --ok-label='Reboot' --cancel-label='Cancel' && \ sudo reboot -- cgit v0.9.1