From 4d219d23a598fccdad462f5cf0094432ce1f78c0 Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Sun, 24 Jun 2012 08:30:14 +0000 Subject: [PATCH] by special Mint request, adding shell/panel type extra extra extra output to desktop, this is so easy to do I decided to just add an -xxx option, for extra extra extra data, no output if nothing detected. No big support issues, and Mint has used inxi by default for a while, so I think it's fine to add this for them. --- inxi | 53 +++++++++++++++++++++++++++++++++++++++++++++-------- inxi.8 | 4 ++++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/inxi b/inxi index a81dea7..7515752 100755 --- a/inxi +++ b/inxi @@ -1,7 +1,7 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.8.6 +#### version: 1.8.7 #### Date: June 24 2012 #### Patch Number: 00 ######################################################################## @@ -1995,9 +1995,10 @@ get_parameters() B_SHOW_FULL_OPTICAL='true' B_SHOW_PARTITIONS_FULL='true' B_SHOW_UNMOUNTED_PARTITIONS='true' + B_EXTRA_EXTRA_DATA='true' fi if [[ $OPTARG -ge 7 ]];then - B_EXTRA_EXTRA_DATA='true' + B_EXTRA_EXTRA_EXTRA_DATA='true' B_SHOW_IP='true' B_SHOW_RAID_R='true' fi @@ -2010,11 +2011,14 @@ get_parameters() V) print_version_info exit 0 ;; - # this will trigger either with xx or with Fx but not with xF - x) if [[ $B_EXTRA_DATA == 'true' ]];then + # this will trigger either with x, xx, xxx or with Fx but not with xF + x) if [[ $B_EXTRA_EXTRA_DATA == 'true' ]];then + B_EXTRA_EXTRA_EXTRA_DATA='true' + elif [[ $B_EXTRA_DATA == 'true' ]];then B_EXTRA_EXTRA_DATA='true' + else + B_EXTRA_DATA='true' fi - B_EXTRA_DATA='true' ;; z) B_OUTPUT_FILTER='true' ;; @@ -2234,6 +2238,8 @@ show_options() 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 "-xxx Show extra, extra, extra data (only works with verbose or line output, not short form): " + print_screen_output " -S - Adds panel/shell information to desktop output, if in X (like gnome-shell, cinnamon, )." 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." print_screen_output " " @@ -3353,6 +3359,31 @@ get_desktop_environment() eval $LOGFE } +get_desktop_extra_data() +{ + eval $LOGFS + local de_data=$( ps -A | gawk ' + BEGIN { + IGNORECASE=1 + desktops="" + separator="" + } + /cinnamon|gnome-shell|gnome-panel|lxpanel|mate-panel|plasma-desktop|xfce4-panel/ { + # only one entry per type, can be multiple + if ( desktops !~ $NF ) { + desktops = desktops separator $NF + separator = "," + } + } + END { + print desktops + } + ' ) + echo $de_data + + eval $LOGFE +} + # note: gawk doesn't support white spaces in search string, gave errors, so use [[:space:]] instead # args: $1 - desktop command for --version; $2 - search string; $3 - gawk print number get_de_app_version() @@ -3393,7 +3424,7 @@ get_de_app_version() # see which dm has started if any get_display_manager() { - eval $LOGFE + eval $LOGFS 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='' separator='' local x_is_running=$( ps aux | grep '/usr.*/X' | grep -Eivc '(grep|/Xprt)' ) @@ -8312,7 +8343,7 @@ print_sensors_data() print_system_data() { eval $LOGFS - local system_data='' bits='' desktop_environment='' dm_data='' + local system_data='' bits='' desktop_environment='' dm_data='' de_extra_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)}' ) @@ -8332,6 +8363,12 @@ print_system_data() fi dm_data=" ${C1}dm$SEP3${C2} $dm_data" fi + if [[ $B_EXTRA_EXTRA_EXTRA_DATA == 'true' ]];then + de_extra_data=$( get_desktop_extra_data ) + if [[ -n $de_extra_data ]];then + de_extra_data=" ${C1}info$SEP3${C2} $de_extra_data" + fi + fi else if [[ -z $tty_session && $B_CONSOLE_IRC == 'true' ]];then tty_session=$( get_console_irc_tty ) @@ -8343,7 +8380,7 @@ print_system_data() desktop_type='Console' fi - de_distro_string="${C1}$desktop_type$SEP3${C2} $desktop_environment$dm_data ${C1}Distro$SEP3${C2} $distro" + de_distro_string="${C1}$desktop_type$SEP3${C2} $desktop_environment$de_extra_data$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 337beee..00a776d 100644 --- a/inxi.8 +++ b/inxi.8 @@ -303,6 +303,10 @@ Supports most known display managers, like xdm, gdm, kdm, slim, lightdm, or mdm. .B -xx -@ <11-14> - Automatically uploads debugger data tar.gz file to ftp.techpatterns.com. .TP +.B -xxx -S +- Adds, if run in X, shell/panel type info to Desktop information, if present. If none, shows nothing. +Supports some current desktop extras like gnome-panel, lxde-panel, and others. Added mainly for Mint support. +.TP .B -z Adds security filters for IP addresses, Mac, and user home directory name. Default on for irc clients. .TP