mirror of
https://github.com/smxi/inxi.git
synced 2024-11-17 00:31:19 +00:00
new feature, shows which desktop user is running, should work for gnome, kde 3.5, 4, 5, xfce 4, 5, fluxbox, lxde, openbox,
blackbox, awesome, fvwm, fvwm-crystal, and we'll add more with user data
This commit is contained in:
parent
06bae0e38e
commit
92b73233c9
70
inxi
70
inxi
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
########################################################################
|
||||
#### Script Name: inxi
|
||||
#### version: 1.4.98
|
||||
#### Date: May 6 2011
|
||||
#### version: 1.4.99
|
||||
#### Date: May 18 2011
|
||||
########################################################################
|
||||
#### SPECIAL THANKS
|
||||
########################################################################
|
||||
|
@ -2536,6 +2536,62 @@ get_cpu_ht_multicore_smp_data()
|
|||
eval $LOGFE
|
||||
}
|
||||
|
||||
# Detect desktop environment in use, logic from: compiz-check
|
||||
# http://forlong.blogage.de/entries/pages/Compiz-Check
|
||||
detect_desktop_environment()
|
||||
{
|
||||
eval $LOGFS
|
||||
|
||||
# set the default, this function only runs in X, if null, don't print data out
|
||||
local desktop_environment='N/A' xprop_root='' ps_aux=''
|
||||
|
||||
# note, GNOME_DESKTOP_SESSION_ID is deprecated so we'll see how that works out
|
||||
# https://bugzilla.gnome.org/show_bug.cgi?id=542880
|
||||
if [[ ! -z $GNOME_DESKTOP_SESSION_ID ]]; then
|
||||
desktop_environment='GNOME'
|
||||
# assume 5 will id the same, why not, no need to update in future
|
||||
elif [[ $KDE_SESSION_VERSION == '5' ]]; then
|
||||
desktop_environment='KDE 5'
|
||||
elif [[ $KDE_SESSION_VERSION == '4' ]]; then
|
||||
desktop_environment='KDE 4'
|
||||
# KDE_FULL_SESSION property is only available since KDE 3.5.5.
|
||||
# src: http://humanreadable.nfshost.com/files/startkde
|
||||
elif [[ $KDE_FULL_SESSION == 'true' ]]; then
|
||||
desktop_environment='KDE 3.5'
|
||||
# note: fluxbox has a positive PID for blackbox, so I think most desktops can be detected
|
||||
# with some work.
|
||||
elif [[ -n $( type -p xprop ) ]];then
|
||||
xprop_root="$( xprop -root 2>/dev/null )"
|
||||
ps_aux="$( ps aux )"
|
||||
if [[ -n $( grep -is '\"xfce4\"' <<< "$xprop_root" ) ]];then
|
||||
desktop_environment='Xfce4'
|
||||
elif [[ -n $( grep -is '\"xfce5\"' <<< "$xprop_root" ) ]];then
|
||||
desktop_environment='Xfce5'
|
||||
elif [[ -n $( grep -is 'BLACKBOX_PID' <<< "$xprop_root" ) ]];then
|
||||
if [[ -n $( grep -is 'fluxbox' <<< "$ps_aux" | grep -v 'grep' ) ]];then
|
||||
desktop_environment='Fluxbox'
|
||||
else
|
||||
desktop_environment='Blackbox'
|
||||
fi
|
||||
elif [[ -n $( grep -is 'OPENBOX_PID' <<< "$xprop_root" ) ]];then
|
||||
if [[ -n $( grep -is 'lxde' <<< "$ps_aux" | grep -v 'grep' ) ]];then
|
||||
desktop_environment='LXDE'
|
||||
else
|
||||
desktop_environment='Openbox'
|
||||
fi
|
||||
# a few manual hacks for things that don't id with xprop, these are just good guesses
|
||||
elif [[ -n $( grep -is 'fvwm-crystal' <<< "$ps_aux" | grep -v 'grep' ) ]];then
|
||||
desktop_environment='FVWM-Crystal'
|
||||
elif [[ -n $( grep -is 'fvwm' <<< "$ps_aux" | grep -v 'grep' ) ]];then
|
||||
desktop_environment='FVWM'
|
||||
elif [[ -n $( grep -is 'awesome' <<< "$ps_aux" | grep -v 'grep' ) ]];then
|
||||
desktop_environment='Awesome'
|
||||
fi
|
||||
fi
|
||||
echo $desktop_environment
|
||||
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()
|
||||
|
@ -5961,10 +6017,16 @@ print_sensors_data()
|
|||
print_system_data()
|
||||
{
|
||||
eval $LOGFS
|
||||
local system_data='' bits=''
|
||||
local system_data='' bits='' desktop_environment=''
|
||||
local host_name=$( hostname )
|
||||
local current_kernel=$( uname -rm ) # | gawk '{print $1,$3,$(NF-1)}' )
|
||||
local distro="$( get_distro_data )"
|
||||
|
||||
# I think these will work, maybe, if logged in as root and in X
|
||||
if [[ $B_RUNNING_IN_X == 'true' ]];then
|
||||
desktop_environment="${C1}Desktop${C2} $( detect_desktop_environment ) "
|
||||
fi
|
||||
|
||||
# check for 64 bit first
|
||||
if [[ -n $( uname -m | grep -o 'x86_64' ) ]];then
|
||||
bits="(64 bit)"
|
||||
|
@ -5977,7 +6039,7 @@ print_system_data()
|
|||
else
|
||||
system_data=$( create_print_line "System:" "${C1}Kernel${C2}" )
|
||||
fi
|
||||
system_data="$system_data $current_kernel $bits ${C1}Distro${C2} $distro"
|
||||
system_data="$system_data $current_kernel $bits $desktop_environment${C1}Distro${C2} $distro"
|
||||
print_screen_output "$system_data"
|
||||
eval $LOGFE
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue