From 3821e2a16ecdc128fd7cb405948f609014617eab Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sun, 24 Jun 2012 07:03:39 +0000 Subject: [PATCH] new -xx feature for -S, shows display manager running if in X. Supports currently the following: entrance gdm gdm3 kdm kdm-trinity lightdm lxdm mdm nodm slim wdm xdm there's been a relative flood of new display managers, and a few more are probably coming, so it's actually a somewhat useful thing to have this option. This is also going to close issue 30, which is not going to be further handled due to ratrace of trying to support various software packages running on the systems. Also updated man page for that -xx item. --- inxi | 43 +++++++++++++++++++++++++++++++++++++++---- inxi.8 | 4 ++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/inxi b/inxi index e267f8a..9a6f376 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,8 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.8.5 -#### Date: May 27 2012 +#### version: 1.8.6 +#### Date: June 24 2012 #### Patch Number: 00 ######################################################################## #### SPECIAL THANKS @@ -2232,6 +2232,7 @@ show_options() print_screen_output " -M - Adds chassis information, if any data for that is available." print_screen_output " -R - Adds superblock (if present); algorythm, U data. Adds system info line (kernel support," print_screen_output " read ahead, raid events). Adds if present, unused device line. Resync line, shows progress bar." + print_screen_output " -S - Adds display manager (dm) to desktop output, if in X (like kdm, gdm3, lightdm)." print_screen_output " -xx -@ <11-14> - Automatically uploads debugger data tar.gz file to ftp.techpatterns.com." print_screen_output "-z Adds security filters for IP addresses, Mac, and user home directory name. Default on for irc clients." print_screen_output "-Z Absolute override for output filters. Useful for debugging networking issues in irc for example." @@ -3389,6 +3390,32 @@ get_de_app_version() echo $version } +# see which dm has started if any +get_display_manager() +{ + eval $LOGFE + local dm_id_list='entrance/entranced.pid gdm.pid gdm3.pid kdm.pid lightdm.pid lxdm.pid mdm.pid nodm.pid slim.lock wdm.pid xdm.pid' + local dm_id='' dm='' + local x_is_running=$( ps aux | grep '/usr.*/X' | grep -Eivc '(grep|/Xprt)' ) + + for dm_id in $dm_id_list + do + if [[ -e /var/run/$dm_id || -e /run/$dm_id ]];then + dm=$( basename $dm_id | cut -d '.' -f 1 ) + fi + done + # might add this in, but the rate of new dm's makes it more likely it's an unknown dm, so + # we'll keep output to N/A +# if [[ -n $x_is_running && -z $dm ]];then +# dm='startx' +# fi + echo $dm + + log_function_data "display manager: $dm" + + eval $LOGFE +} + # for more on distro id, please reference this python thread: http://bugs.python.org/issue1322 ## return distro name/id if found get_distro_data() @@ -8283,7 +8310,7 @@ print_sensors_data() print_system_data() { eval $LOGFS - local system_data='' bits='' desktop_environment='' + local system_data='' bits='' desktop_environment='' dm_data='' local host_kernel_string='' de_distro_string='' host_string='' desktop_type='Desktop' local host_name=$HOSTNAME local current_kernel=$( uname -rm ) # | gawk '{print $1,$3,$(NF-1)}' ) @@ -8296,6 +8323,13 @@ print_system_data() if [[ -z $desktop_environment ]];then desktop_environment='N/A' fi + if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then + dm_data=$( get_display_manager ) + if [[ -z $dm_data ]];then + dm_data='N/A' + fi + dm_data=" ${C1}dm$SEP3${C2} $dm_data" + fi else if [[ -z $tty_session && $B_CONSOLE_IRC == 'true' ]];then tty_session=$( get_console_irc_tty ) @@ -8306,7 +8340,8 @@ print_system_data() desktop_environment="tty$tty_session" desktop_type='Console' fi - de_distro_string="${C1}$desktop_type$SEP3${C2} $desktop_environment ${C1}Distro$SEP3${C2} $distro" + + de_distro_string="${C1}$desktop_type$SEP3${C2} $desktop_environment$dm_data ${C1}Distro$SEP3${C2} $distro" if [[ $B_EXTRA_DATA == 'true' ]];then gcc_string=$( get_gcc_kernel_version ) if [[ -n $gcc_string ]];then diff --git a/inxi.8 b/inxi.8 index e7e7cf1..337beee 100644 --- a/inxi.8 +++ b/inxi.8 @@ -296,6 +296,10 @@ Show extra, extra data (only works with verbose or line output, not short form): read ahead, raid events). Adds if present, unused device line. If device is resyncing, shows resync progress line as well .TP +.B -xx -S +- Adds, if run in X, display manager type to Desktop information, if present. If none, shows N/A. +Supports most known display managers, like xdm, gdm, kdm, slim, lightdm, or mdm. +.TP .B -xx -@ <11-14> - Automatically uploads debugger data tar.gz file to ftp.techpatterns.com. .TP