getInfo 3.19.0

This commit is contained in:
kyodev 2018-02-20 03:59:50 +01:00
parent 22c93246b4
commit 673528e0f7
2 changed files with 167 additions and 127 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
version=3.18.3 version=3.19.0
date="14/02/2018" date="19/02/2018"
projet="simpledeb" projet="simpledeb"
contact="IRC freenode.net ##sdeb ou https://framagit.org/kyodev/kyopages/issues/" contact="IRC freenode.net ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
script="getInfo" script="getInfo"
@ -251,6 +251,23 @@ f__sudo(){ # 26/01/2018
done done
} }
# $1=left|right|all si erreur option: all, $2 variable à trimer
f__trim(){
local tr="$1" display
if [[ ! "$tr" =~ left|right|all ]]; then
echo "${RED}apple trim incorrect$STD"
return 1
fi
while read -r ; do
REPLY=${REPLY// }
[[ "$tr" =~ left|all ]] && REPLY=${REPLY## }
[[ "$tr" =~ right|all ]] && REPLY=${REPLY%% }
display+="$REPLY"$'\n'
done <<< "$2"
echo "$display"
}
# $1=nombre à convertir en ko, affiche ko ou Mo ou Go # $1=nombre à convertir en ko, affiche ko ou Mo ou Go
f__unit_human(){ # 26/01/2018 f__unit_human(){ # 26/01/2018
echo -n "$( awk ' { echo -n "$( awk ' {
@ -399,13 +416,13 @@ f_affichage(){ # 24/01/2018
# un test si variable $2 est vide est fait sauf ':vide' # un test si variable $2 est vide est fait sauf ':vide'
# un test si variable $2 contient 'nofile' (non trouvé par f_grep_file) # un test si variable $2 contient 'nofile' (non trouvé par f_grep_file)
# f_dspl "variable" "type" "titre" "commentaire" # f_dspl "variable" "type" "titre" "commentaire"
f_dspl(){ # 14/12/2017 f_dspl(){ # 15/02/2018
local display='' toDisplay local display='' toDisplay
[ "$text" ] && echo -en "$text" >> "$file_output" # flush, avant fonction, de $text parent [ "$text" ] && echo -en "$text" >> "$file_output" # flush, avant fonction, de $text parent
unset text unset text
[[ "$2" || "$1" =~ :vide ]] || return 0 # test si contenu dans $2 [[ "$2" || "$1" =~ :vide ]] || return 0 # test si contenu dans $2 ou option :vide, sinon retour
toDisplay="$2" toDisplay="$2"
[ "$toDisplay" ] || toDisplay="vide" # cas si :vide [ "$toDisplay" ] || toDisplay="vide" # cas si :vide
# traitement ligne de titre # traitement ligne de titre
@ -418,7 +435,7 @@ f_dspl(){ # 14/12/2017
# traitement contenu # traitement contenu
if [ "$toDisplay" == "nofile" ]; then # nofile renvoyé par f_grep if [ "$toDisplay" == "nofile" ]; then # nofile renvoyé par f_grep
display+="\n* fichier $2 non trouvé \n" display+="\n* fichier $2 non trouvé \n"
elif [[ "$1" =~ :text || "$toDisplay" == "vide" ]]; then elif [[ "$1" =~ :text ]]; then
display+="\n* $toDisplay \n" display+="\n* $toDisplay \n"
else else
display+='``` \n' display+='``` \n'
@ -880,7 +897,7 @@ fi_conf(){ # 09/02/2018
f_dspl cmd "$confs" "grep -Ersv '^#|^$' <fichiers désirés>" f_dspl cmd "$confs" "grep -Ersv '^#|^$' <fichiers désirés>"
} }
fi_cpu(){ # 28/01/2018 fi_cpu(){ # 15/02/2018
local cpu_flags text iflag qte_flags text_flags="" pluriel local cpu_flags text iflag qte_flags text_flags="" pluriel
local alert_microcode local alert_microcode
@ -908,7 +925,7 @@ fi_cpu(){ # 28/01/2018
### ###
f_prnt tit2 "processeur"$pluriel f_prnt tit2 "processeur"$pluriel
f_dspl cmd "$fg_cpu" "lscpu" # affichage proc f_dspl cmd "$fg_cpu" "lscpu" # affichage proc
f_dspl var "$fg_uarch" "µarchitecture processeur" f_dspl var "$fg_uarch" "µ architecture processeur"
f_dspl_alrt "$alert_microcode" "info" f_dspl_alrt "$alert_microcode" "info"
f_prnt 1 "$fg_ucode" '[[ -z "$alert_microcode" && "$fg_ucode" ]]' f_prnt 1 "$fg_ucode" '[[ -z "$alert_microcode" && "$fg_ucode" ]]'
f_prnt f_prnt
@ -1654,7 +1671,7 @@ fi_packagers(){ # 23/11/2017
fi fi
} }
fi_pkg_apt(){ # 02/02/2018 fi_pkg_apt(){ # 15/02/2018
local dateMaj nb_packages ifile info_update text pluriel local dateMaj nb_packages ifile info_update text pluriel
local sources cmt_sources cmd_sources result local sources cmt_sources cmd_sources result
local apt_v apt_version apt_prefs cmt_apt_prefs cmd_apt_prefs alert_non_pref local apt_v apt_version apt_prefs cmt_apt_prefs cmd_apt_prefs alert_non_pref
@ -1667,6 +1684,7 @@ fi_pkg_apt(){ # 02/02/2018
local non_ii qte_non_ii cmt_non_ii cmd_non_ii etat ligne stck_etat local non_ii qte_non_ii cmt_non_ii cmd_non_ii etat ligne stck_etat
local deborphan qte_deborphan cmt_deborphan cmd_deborphan local deborphan qte_deborphan cmt_deborphan cmd_deborphan
local holded qte_holded cmt_holded cmd_holded local holded qte_holded cmt_holded cmd_holded
local pinned qte_pinned cmd_pinned cmt_pinned
local metaPkg cmd_metaPkg cmt_metaPkg kernel cmd_kernel cmt_kernel local metaPkg cmd_metaPkg cmt_metaPkg kernel cmd_kernel cmt_kernel
local alert_https alert_httpsPossible alert_non_list alert_httpredir alert_upgrade alert_full_upgrade local alert_https alert_httpsPossible alert_non_list alert_httpredir alert_upgrade alert_full_upgrade
local alert_apt alert_remove alert_autoclean alert_clean alert_non_ii alert_deborphan local alert_apt alert_remove alert_autoclean alert_clean alert_non_ii alert_deborphan
@ -1884,7 +1902,7 @@ fi_pkg_apt(){ # 02/02/2018
alert_deborphan+="s'installer en cascade" alert_deborphan+="s'installer en cascade"
fi fi
fi fi
# paquets figés # paquets figés (hold)
holded=$( apt-mark showhold ) holded=$( apt-mark showhold )
qte_holded=$( f__wcv "-l" "$holded" ) qte_holded=$( f__wcv "-l" "$holded" )
[ "$holded" ] && holded=$( sort <<< $holded | tr '\n' ' ' ) [ "$holded" ] && holded=$( sort <<< $holded | tr '\n' ' ' )
@ -1892,6 +1910,12 @@ fi_pkg_apt(){ # 02/02/2018
cmt_holded="$qte_holded paquet"$pluriel" figé"$pluriel cmt_holded="$qte_holded paquet"$pluriel" figé"$pluriel
[ "$qte_holded" -eq 0 ] && cmt_holded=${cmt_holded/0 /aucun } [ "$qte_holded" -eq 0 ] && cmt_holded=${cmt_holded/0 /aucun }
cmd_holded="apt-mark showhold" cmd_holded="apt-mark showhold"
# paquets épinglés (pinning)
pinned=$( f__trim all "$( apt-cache policy | grep '\->' )" )
qte_pinned=$( f__wcv "-l" "$pinned" )
[ "$qte_pinned" -gt 1 ] && pluriel="s" || unset pluriel
cmd_pinned="apt-cache policy | grep '\->'"
cmt_pinned="résultat effectif épinglage paquet"$pluriel
# kernel # kernel
# metaPkg=$( dpkg -l | grep -i -E 'linux-(image|headers)-([0-9]{3}|amd)' ) # metaPkg=$( dpkg -l | grep -i -E 'linux-(image|headers)-([0-9]{3}|amd)' )
metaPkg=$( $c_awk ' metaPkg=$( $c_awk '
@ -1939,6 +1963,7 @@ fi_pkg_apt(){ # 02/02/2018
f_dspl_alrt "$alert_deborphan" "info" f_dspl_alrt "$alert_deborphan" "info"
fi fi
f_dspl cmd:vide "$holded" "$cmd_holded" "$cmt_holded" f_dspl cmd:vide "$holded" "$cmd_holded" "$cmt_holded"
f_dspl cmd:vide "$pinned" "$cmd_pinned" "$cmt_pinned"
f_dspl cmd "$metaPkg" "$cmd_metaPkg" "$cmt_metaPkg" f_dspl cmd "$metaPkg" "$cmd_metaPkg" "$cmt_metaPkg"
f_dspl cmd "$kernel" "$cmd_kernel" "$cmt_kernel" f_dspl cmd "$kernel" "$cmd_kernel" "$cmt_kernel"
} }
@ -2027,7 +2052,7 @@ fi_pkg_x(){ # 1/12/2017
f_dspl var "$alert_pkg_todo" "aide souhaitée" f_dspl var "$alert_pkg_todo" "aide souhaitée"
} }
fi_reseau(){ # 09/02/2018 ( configuration ) fi_reseau(){ # 19/02/2018 ( configuration )
local ip4 gw4 ip4_p ip6 gw6 ip_a route netplan interfaces resolv iwconfig canal_wifi text pluriel local ip4 gw4 ip4_p ip6 gw6 ip_a route netplan interfaces resolv iwconfig canal_wifi text pluriel
local imgr netmgrinst netmgrrun ipa adr_temp slaac slaac_mac local imgr netmgrinst netmgrrun ipa adr_temp slaac slaac_mac
local alert_ifconfig alert_slaac local alert_ifconfig alert_slaac
@ -2070,12 +2095,13 @@ fi_reseau(){ # 09/02/2018 ( configuration )
if [ -e "${netmgr[$imgr]}" ]; then if [ -e "${netmgr[$imgr]}" ]; then
netmgrinst+="$imgr " netmgrinst+="$imgr "
fi fi
if [ $( ps -ef | grep -c ${netmgr[$imgr]} ) -ge 2 ]; then if grep -iq "$imgr" <<< $( ps -e ) ; then
netmgrrun+=$( ps -ef | grep -om1 "${netmgr[$imgr]}"".*$" )$'\n' netmgrrun+="$imgr "
fi fi
done done
netmgrinst=${netmgrinst% } # suppression dernier espace netmgrinst=${netmgrinst% } # suppression dernier espace
netmgrrun=${netmgrrun%[[:cntrl:]]} # suppression dernier $'\n' netmgrrun=${netmgrrun% } # suppression dernier espace
[ "$netmgrinst" == "$netmgrrun" ] && unset netmgrinst
# alertes # alertes
if [ $( f__which ifconfig ) ] ; then if [ $( f__which ifconfig ) ] ; then
alert_ifconfig="ifconfig [net-tools](https://github.com/giftnuss/net-tools) est un projet abandonné " alert_ifconfig="ifconfig [net-tools](https://github.com/giftnuss/net-tools) est un projet abandonné "
@ -2144,7 +2170,7 @@ fi_reseau(){ # 09/02/2018 ( configuration )
f_prnt 1 "la configuration ssid utilisée peut être connue (si NetworkManager installé) avec \n \`$DIRNAME""getInfo --ssid\`" f_prnt 1 "la configuration ssid utilisée peut être connue (si NetworkManager installé) avec \n \`$DIRNAME""getInfo --ssid\`"
f_prnt f_prnt
# network manager # network manager
f_prnt 1 "gestionnaire de réseau" '[ "$netmgrinst" ]' f_prnt 1 "gestionnaire de réseau" '[ "$netmgrrun" ]'
[ "$(wc -w <<< $netmgrinst)" -gt 1 ] && pluriel="s" || unset pluriel [ "$(wc -w <<< $netmgrinst)" -gt 1 ] && pluriel="s" || unset pluriel
f_prnt 2 "installé"$pluriel": **$netmgrinst**" '[ "$netmgrinst" ]' f_prnt 2 "installé"$pluriel": **$netmgrinst**" '[ "$netmgrinst" ]'
f_prnt 2 "en fonctionnement: **$netmgrrun**" '[ "$netmgrrun" ]' f_prnt 2 "en fonctionnement: **$netmgrrun**" '[ "$netmgrrun" ]'
@ -2357,6 +2383,7 @@ fi_system(){ # 13/02/2018
[ "$fg_nb_batt" -gt "1" ] && pluriel="s" || unset pluriel [ "$fg_nb_batt" -gt "1" ] && pluriel="s" || unset pluriel
f_prnt l2 "$fg_nb_batt batterie"$pluriel" présente"$pluriel":" '[ "$fg_batt" ]' f_prnt l2 "$fg_nb_batt batterie"$pluriel" présente"$pluriel":" '[ "$fg_batt" ]'
f_prnt l3 "$enum_batt" '[ "$fg_batt" ]' f_prnt l3 "$enum_batt" '[ "$fg_batt" ]'
unset fe_touchpad
[ "$fe_nb_touchpad" -gt "1" ] && pluriel="s" || unset pluriel [ "$fe_nb_touchpad" -gt "1" ] && pluriel="s" || unset pluriel
f_prnt l2 "$fe_nb_touchpad pavé"$pluriel" tactile"$pluriel":" '[ "fe_touchpad" ]' f_prnt l2 "$fe_nb_touchpad pavé"$pluriel" tactile"$pluriel":" '[ "fe_touchpad" ]'
f_prnt l3 "$fe_touchpad" '[ "fe_touchpad" ]' f_prnt l3 "$fe_touchpad" '[ "fe_touchpad" ]'
@ -2443,13 +2470,14 @@ fi_system_analyse(){ # 26/01/2018
} }
# [$1=silent], assigne $fe_touchpad, fe_nb_touchpad # [$1=silent], assigne $fe_touchpad, fe_nb_touchpad
fi_touchpad(){ # 14/02/2018 fi_touchpad(){ # 19/02/2018
local device cmd_device toScrut xfile file_logs type type_pt pilote cmd_pilote cmt_pilote info_driver local device cmd_device toScrut xfile file_logs type type_pt pilote cmd_pilote cmt_pilote info_driver
x_touchpad=1 x_touchpad=1
unset fe_touchpad
fe_nb_touchpad=0
device=$( grep -Ei -B1 -A8 'touchpad|trackpoint|synaptics|alps|etps|elan' /proc/bus/input/devices ) || return 0 device=$( grep -Ei -B1 -A8 'touchpad|trackpoint|synaptics|alps|etps|elan' /proc/bus/input/devices ) || return 0
unset fe_touchpad
while read -r; do while read -r; do
REPLY=${REPLY#*Name=\"} # suppression début REPLY=${REPLY#*Name=\"} # suppression début
REPLY=${REPLY%\"} # suppression fin REPLY=${REPLY%\"} # suppression fin
@ -2478,7 +2506,6 @@ fi_touchpad(){ # 14/02/2018
fe_touchpad+="$type_pt" fe_touchpad+="$type_pt"
fi fi
fe_nb_touchpad=$( f__wcv -l "$fe_touchpad" ) fe_nb_touchpad=$( f__wcv -l "$fe_touchpad" )
[[ "$1" == "silent" ]] && return 0 [[ "$1" == "silent" ]] && return 0
### ###
if [ "$ENV_DEBIAN" ]; then if [ "$ENV_DEBIAN" ]; then
@ -2704,7 +2731,7 @@ figet_batt(){ # 13/02/2018
} }
# assigne $fg_cpu (description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=AMD|Intel, $fg_nb_cpu # assigne $fg_cpu (description cpu), fg_nb_threads, $fg_cpu_arch, $fg_uarch, $fg_vendor=AMD|Intel, $fg_nb_cpu
figet_cpu(){ # 26/01/2018 figet_cpu(){ # 15/02/2018
local cpuinfo speedNom speedMax speedMin speedCpu descrCpu cpu1 cpu2 cpu3 local cpuinfo speedNom speedMax speedMin speedCpu descrCpu cpu1 cpu2 cpu3
x_cpu=1 x_cpu=1
@ -2746,15 +2773,13 @@ figet_cpu(){ # 26/01/2018
# traitement fg_cpu # traitement fg_cpu
cpu1=$( cpu1=$(
$c_awk -v "speedCpu=$speedCpu" -F ':|@' ' $c_awk -v "speedCpu=$speedCpu" -F ':|@' '
/^model name/ { /^model name/ { gsub(/\(R\)|\(TM\)|\(r\)|\(tm\)|CPU| width/,"",$2); cpu=$2 }
gsub(/^ | $|\(R\)|\(TM\)|\(r\)|\(tm\)|CPU| width/,"",$2); gsub(/ /," ",$2)
cpu=$2 }
/^physical id/ { if ($2+1 != nbCpu) nbCpu=$2+1 } /^physical id/ { if ($2+1 != nbCpu) nbCpu=$2+1 }
/cpu cores/ { procCore=sprintf("%d",$2); if (procCore>1) pllc="s" } /cpu cores/ { procCore=sprintf("%d",$2); if (procCore>1) pllc="s" }
/siblings/ { procThread=sprintf("%d",$2); if (procThread>1) pllt="s" } /siblings/ { procThread=sprintf("%d",$2); if (procThread>1) pllt="s" }
/microcode/ { sub(/^ /,"",$2); microCode=$2 } /microcode/ { sub(/^ /,"",$2); microCode=$2 }
END { END {
printf nbCpu" x "cpu " (" procCore "core" pllc ", " procThread "thread" pllt; printf nbCpu " x " cpu " (" procCore "core" pllc ", " procThread "thread" pllt;
print ") {" speedCpu "} microcode:" microCode print ") {" speedCpu "} microcode:" microCode
}' <<< "$cpuinfo " }' <<< "$cpuinfo "
) )
@ -3181,7 +3206,7 @@ figet_cpu_uarch(){ # 14/11/2017
} }
# assigne $fg_de, $fg_de_panel # assigne $fg_de, $fg_de_panel
figet_de(){ # 14/02/2018 # thanks neofetch figet_de(){ # 15/02/2018 # thanks neofetch
local de="n/a" ps local de="n/a" ps
x_de=1 x_de=1
@ -3215,6 +3240,11 @@ figet_de(){ # 14/02/2018 # thanks neofetch
fi fi
fg_de=${de,,} # minuscule fg_de=${de,,} # minuscule
fg_de=${fg_de^} # caractère 1 en majuscule fg_de=${fg_de^} # caractère 1 en majuscule
#~ if [[ "$XDG_CURRENT_DESKTOP" =~ Unity ]]; then de="Unity"
#~ elif [[ "$XDG_CURRENT_DESKTOP" =~ Budgie ]]; then de="Budgie"
#~ elif [[ "$XDG_CURRENT_DESKTOP" =~ LXQt ]]; then de='LXQt'
### ###
# panel # panel
ps=$( ps -A ) ps=$( ps -A )
@ -3345,18 +3375,15 @@ figet_distrib(){ # 14/12/2017
} }
# display manager, assigne $fg_dm (liste éventuelle) ou 'n/a' # display manager, assigne $fg_dm (liste éventuelle) ou 'n/a'
figet_dm(){ # 13/02/2018 figet_dm(){ # 19/02/2018
local dm_list="cdm entranced gdm3 gdm qingy kdm ldm lightdm lxdm mdm nodm orthos sddm slim startx tint2 wdm xdm" local dm_list="cdm entranced gdm3 gdm qingy kdm ldm lightdm lxdm mdm nodm orthos sddm slim startx tint2 wdm xdm"
local idm ps systemctl x11 local idm systemctl x11
x_dm=1 x_dm=1
fg_dm="" fg_dm=""
ps=$(ps -ef) # plus joli pour cmde manuelle: ps=$(ps -auxf)
ps=${ps,,} # tout en minuscules
for idm in $dm_list; do for idm in $dm_list; do
if ps -ef | grep -m1 '$idm' | grep -v 'grep'; then if grep -iq "$idm" <<< $(ps -e) ; then
#~ if [ "$( grep -iq "bin/$idm$" <<< "$ps" )" -ge 2 ]; then # if [ "${ps/*"$idm"*/test}" == "test" ]; then # pb: doublon gdm/gdm3 (speed? grepless)
#~ if [ "${ps/*"$idm"*/test}" == "test" ]; then # pb: doublon gdm/gdm3 (speed? grepless)
fg_dm+="${idm^} " fg_dm+="${idm^} "
elif [[ -e "/var/run/${idm}.pid" || -e "/run/${idm}.pid" || -d "/var/run/$idm/" || -d "/run/$idm/" ]]; then elif [[ -e "/var/run/${idm}.pid" || -e "/run/${idm}.pid" || -d "/var/run/$idm/" || -d "/run/$idm/" ]]; then
fg_dm+="${idm^} " fg_dm+="${idm^} "
@ -3994,126 +4021,129 @@ figet_ucode(){ # 14/12/2017
fi fi
} }
# assigne $fg_wm (compositor, pas en variable publique, pas fiabilisé) # assigne $fg_wm, contient 'n/a' ou égal 'non trouvé' ou WM
figet_wm(){ # 13/02/2018 base départ neofetch figet_wm(){ # 19/02/2018 base départ neofetch
local id wm_brut compositor local id xprop_id wm xprop_root ps_e compositor
x_wm=1 x_wm=1
# 3Dwm abandonné
fg_wm="n/a" fg_wm="n/a"
[ $( f__which xprop ) ] || fg_wm+=":xprop absent" # ! pas de xprop, pas de wm?! [ $( f__which xprop ) ] || fg_wm+=":xprop absent" # pas de xprop, pas de wm?!
[ "$ENV_DISPLAY" ] && fg_wm+=":no Display" [ "$ENV_DISPLAY" ] && fg_wm+=":no Display"
[ "$ENV_SSH" ] && fg_wm+=":ssh" [ "$ENV_SSH" ] && fg_wm+=":ssh"
[[ "$wayland" && "$EUID" -eq 0 ]] && fg_wm+=":wayland root" [[ "$wayland" && "$EUID" -eq 0 ]] && fg_wm+=":wayland root"
[[ "$fg_wm" =~ : ]] && return 0 # retourne n/a ... [[ "$fg_wm" =~ : ]] && return 0 # retourne n/a ...
##
id=$( xprop -root -notype _NET_SUPPORTING_WM_CHECK 2>/dev/null ) # = xprop -root 2>/dev/null | grep '^_NET_SUPPORTING_WM_CHECK.*id' ## WM
id=$( xprop -root -notype _NET_SUPPORTING_WM_CHECK 2>/dev/null )
id=${id##* } # suppression plus grande chaîne au début jusqu"à ' ' id=${id##* } # suppression plus grande chaîne au début jusqu"à ' '
wm_brut=$( xprop -id "$id" -notype -len 100 2>/dev/null ) # xprop -id "$id" -notype _NET_WM_NAME xprop_id=$( xprop -id "$id" -notype 2>/dev/null ) # xprop -id "$id" -notype _NET_WM_NAME
wm_brut=${wm_brut,,} # minuscules xprop_id=${xprop_id,,} # minuscules
fg_wm=${wm_brut/*_net_wm_name = } # suppression jusqu'à 'name = ' wm=${xprop_id/*_net_wm_name = } # suppression jusqu'à 'name = '
fg_wm=${fg_wm/\"} # suppression premier" wm=${wm/\"} # suppression premier "
fg_wm=${fg_wm/\"*} # suppression 2e " avec éventuels caractères suivants wm=${wm/\"*} # suppression 2e " avec éventuels caractères suivants
# Fallback for Wayland wms (sway) wm=${wm,,} # tout en minuscule
[[ "$fg_wm" == "xwlc" ]] && fg_wm=$( ps -e | grep -m1 -Eo 'sway|orbment|velox|orbital' )
if [ -z "$fg_wm" ]; then
fg_wm=$( figet_wm_annexe )
fi
fg_wm=${fg_wm^} # 1er caractère en majuscule
compositor=$( figet_compositor ) if [ -z "$wm" ]; then
[ "${compositor,,}" == "${fg_wm,,}" ] && unset compositor xprop_root=$( xprop -root 2>/dev/null )
#final xprop_root=${xprop_root,,} # tout en minuscule
fg_wm="$fg_wm $compositor" ps_e=$( ps -e )
} ps_e=${ps_e,,} # tout en minuscule
if [[ -z ${xprop_root/*blackbox_pid*/} ]]; then
if [[ -z ${ps_e/*fluxbox*/} ]]; then
wm='fluxbox'
else
wm='blackbox'
fi
elif [[ -z ${xprop_root/*enlightenment*/} ]]; then wm="enlightenment"
elif [[ -z ${xprop_root/*herbstluftwm*/} ]]; then wm="herbstluftwm"
elif [[ -z ${xprop_root/*icewm*/} ]]; then wm="iceWm"
elif [[ -z ${xprop_root/*openbox_pid*/} ]]; then wm="openbox"
elif [[ -z ${xprop_root/*windowmaker*/} ]]; then wm="windowmaker"
# complément (temporaire?) à figet_wm elif [[ -z ${ps_e/*afterstep*/} ]]; then wm='afterstep'
figet_wm_annexe(){ # 13/02/2018 elif [[ -z ${ps_e/*awesome*/} ]]; then wm='awesome'
local de wm xprop psef elif [[ -z ${ps_e/*fvwm*/} ]]; then wm='fvwm'
elif [[ -z ${ps_e/*fvwm-crystal*/} ]]; then wm='fvwm-Crystal'
elif [[ -z ${ps_e/*pekwm*/} ]]; then wm='pekwm'
elif [[ -z ${ps_e/*sawfish*/} ]]; then wm='sawfish'
elif [[ -z ${ps_e/*scrotwm*/} ]]; then wm='scrotwm'
elif [[ -z ${ps_e/*spectrwm*/} ]]; then wm='spectrwm'
elif [[ -z ${ps_e/*xfwm4*/} ]]; then wm='xfwm4'
elif [[ -z ${ps_e/*wmii*/} ]]; then wm='wmii'
elif [[ -z ${ps_e/*wmii2*/} ]]; then wm='wmii2'
#~ if [[ "$XDG_CURRENT_DESKTOP" =~ Unity ]]; then de="Unity" elif [[ -z ${ps_e/*smithay*/} ]]; then wm='smithay' # aveugle
#~ elif [[ "$XDG_CURRENT_DESKTOP" =~ Budgie ]]; then de="Budgie" if [[ "$wm" == +(*wlc|swc|waysome) ]]; then
#~ elif [[ "$XDG_CURRENT_DESKTOP" =~ LXQt ]]; then de='LXQt' wm=$( grep -Eo 'sway|orbment|velox|orbital|waysome|loliwm|Way-Cooler|fireplace' <<< "$ps_e" )
#~ fi fi
[ -z "$DISPLAY" ] && DISPLAY=":0" elif grep -q "/i3_" <<< "$xprop_root"; then wm="i3"
xprop=$( xprop -root -display $DISPLAY ) elif grep -q "/_wm2" <<< "$xprop_root"; then wm="wm2"
psef=$( ps -ef ) elif grep -q "/dwm" <<< "$ps_e"; then wm='dwm'
if [[ -z ${xprop/*blackbox_pid*/} ]]; then elif grep -q "/jwm" <<< "$ps_e"; then wm='jwm'
if [[ -z ${psef/*fluxbox*/} ]]; then wm='Fluxbox'; else wm='Blackbox'; fi elif grep -q "/twm" <<< "$ps_e"; then wm='twm'
elif [[ -z ${xprop/*openbox_pid*/} ]]; then wm="Openbox" fi
elif [[ -z ${xprop/*icewm*/} ]]; then wm="IceWM"
elif [[ -z ${xprop/*enlightenment*/} ]]; then wm="Enlightenment"
elif [[ -z ${xprop/*windowmaker*/} ]]; then wm="WindowMaker"
elif [[ -z ${xprop/*herbstluftwm*/} ]]; then wm="herbstluftwm"
elif [[ -z ${psef/*fvwm-crystal*/} ]]; then wm='FVWM-Crystal'
elif [[ -z ${psef/*fvwm*/} ]]; then wm='FVWM'
elif [[ -z ${psef/*pekwm*/} ]]; then wm='pekwm'
elif [[ -z ${psef/*awesome*/} ]]; then wm='Awesome'
elif [[ -z ${psef/*scrotwm*/} ]]; then wm='Scrotwm'
elif [[ -z ${psef/*spectrwm*/} ]]; then wm='Spectrwm'
elif [[ -z ${psef/*wmii2*/} ]]; then wm='wmii2'
elif [[ -z ${psef/*wmii*/} ]]; then wm='wmii'
elif [[ -z ${psef/*sawfish*/} ]]; then wm='Sawfish'
elif [[ -z ${psef/*afterstep*/} ]]; then wm='AfterStep'
elif grep -q "/i3_" <<< "$xprop"; then wm="i3"
elif grep -q "/_wm2" <<< "$xprop"; then wm="WM2"
elif grep -q "/jwm" <<< "$psef"; then wm='JWM'
elif grep -q "/twm" <<< "$psef"; then wm='Twm'
elif grep -q "/dwm" <<< "$psef"; then wm='dwm'
fi fi
[ "$wm" ] && echo "$wm" ## Compositor
} if [[ "$xprop_id" =~ marco_version ]]; then # Mate, ok
compositor=${xprop_id/*_marco_version = } # suppression jusqu'à ...
# assigne ? ( pas en variable publique, pas fiabilisé), appel dans figet_wm
figet_compositor(){ # 13/02/2018
local compositor
# Compositor, dev en cours, essai version
if [[ "$wm_brut" =~ marco_version ]]; then # Mate, ok
compositor=${wm_brut/*_marco_version = } # suppression jusqu'à ...
compositor=${compositor/\"} # suppression premier" compositor=${compositor/\"} # suppression premier"
compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants
compositor="Marco v$compositor" compositor="Marco v$compositor"
fg_wm=${fg_wm/ (marco)} # suppression (marco) dans wm wm=${wm/ (marco)} # suppression (marco) dans wm
fi fi
if [[ "$wm_brut" =~ mutter_version ]]; then if [[ "$xprop_id" =~ mutter_version ]]; then
compositor=${wm_brut/*_mutter_version = } # suppression jusqu'à ... compositor=${xprop_id/*_mutter_version = } # suppression jusqu'à ...
compositor=${compositor/\"} # suppression premier" compositor=${compositor/\"} # suppression premier"
compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants
compositor="Mutter v$compositor" compositor="Mutter v$compositor"
fi fi
if [[ "$wm_brut" =~ muffin_version ]]; then # cinnamon, ok if [[ "$xprop_id" =~ muffin_version ]]; then # cinnamon, ok
compositor=${wm_brut/*muffin_version = } # suppression jusqu'à ... compositor=${xprop_id/*muffin_version = } # suppression jusqu'à ...
compositor=${compositor/\"} # suppression premier" compositor=${compositor/\"} # suppression premier"
compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants compositor=${compositor/\"*} # suppression 2e " avec éventuels caractères suivants
compositor="Muffin v$compositor" compositor="Muffin v$compositor"
fg_wm=${fg_wm/ (muffin)} # suppression (muffin) dans wm wm=${wm/ (muffin)} # suppression (muffin) dans wm
fi
if [[ "$wm" == kwin ]]; then
compositor=$( kwin --version )
compositor=${compositor/kwin } # suppression kwin, conservation n° version
fi
if [[ "$wm" =~ sway ]]; then
compositor+=$( sway -v )
fi fi
# Gnome2, Metacity
# XFCE, rien pour Xfwm4
# en aveugle, pour test et adaptations futures if [ -z "$compositor" ]; then
[[ "$wm_brut" =~ compiz ]] && compositor+='compiz' # en aveugle, pour test et adaptations futures
[[ "$wm_brut" =~ compton ]] && compositor+='compton' [[ "$xprop_id" =~ compiz ]] && compositor+='compiz'
[[ "$wm_brut" =~ dwc ]] && compositor+='dwc' [[ "$xprop_id" =~ compton ]] && compositor+='compton'
[[ "$wm_brut" =~ fireplace ]] && compositor+='fireplace' [[ "$xprop_id" =~ dwc ]] && compositor+='dwc'
[[ "$wm_brut" =~ gnome-shell ]] && compositor+='gnome-shell' [[ "$xprop_id" =~ fireplace ]] && compositor+='fireplace'
[[ "$wm_brut" =~ grefson ]] && compositor+='grefson' [[ "$xprop_id" =~ gnome-shell ]] && compositor+='gnome-shell'
[[ "$wm_brut" =~ kmscon ]] && compositor+='kmscon' [[ "$xprop_id" =~ grefson ]] && compositor+='grefson'
[[ "$wm_brut" =~ kwin ]] && compositor+='kwin' [[ "$xprop_id" =~ kmscon ]] && compositor+='kmscon'
[[ "$wm_brut" =~ moblin ]] && compositor+='moblin' [[ "$xprop_id" =~ kwin ]] && compositor+='kwin'
[[ "$wm_brut" =~ rustland ]] && compositor+='rustland' [[ "$xprop_id" =~ moblin ]] && compositor+='moblin'
[[ "$wm_brut" =~ sway ]] && compositor+='sway' [[ "$xprop_id" =~ rustland ]] && compositor+='rustland'
[[ "$wm_brut" =~ swc ]] && compositor+='swc' [[ "$xprop_id" =~ sway ]] && compositor+='sway'
[[ "$wm_brut" =~ wayhouse ]] && compositor+='wayhouse' [[ "$xprop_id" =~ swc ]] && compositor+='swc'
[[ "$wm_brut" =~ westford ]] && compositor+='westford' [[ "$xprop_id" =~ wayhouse ]] && compositor+='wayhouse'
[[ "$wm_brut" =~ weston ]] && compositor+='weston' [[ "$xprop_id" =~ westford ]] && compositor+='westford'
[[ "$xprop_id" =~ weston ]] && compositor+='weston'
fi
echo ${compositor^} # caractère 1 en majuscule [ "${compositor^}" == "${wm^}" ] && unset compositor
wm=${wm^} # 1er caractère en majuscule
compositor=${compositor^} # 1er caractère en majuscule
fg_wm="$wm $compositor"
if [ -z "${fg_wm^}" ]; then
fg_wm="non trouvé"
fi
} }
# aiguillage export paste # aiguillage export paste
@ -4306,7 +4336,7 @@ fscript_update(){ # 26/01/2018
rm -rf "$dirTemp/" rm -rf "$dirTemp/"
} }
prg_init(){ # 09/02/2018 prg_init(){ # 19/02/2018
PATH='/usr/sbin:/usr/bin:/sbin:/bin' PATH='/usr/sbin:/usr/bin:/sbin:/bin'
TERM=xterm TERM=xterm
@ -4346,7 +4376,7 @@ prg_init(){ # 09/02/2018
[ "$OS" != "linux" ] && f__error "Linux requis" [ "$OS" != "linux" ] && f__error "Linux requis"
# recherche wayland # recherche wayland
[ "$(ps -ef | grep -c 'wayland')" -gt 1 ] && wayland="wayland" grep -iq 'wayland' <<< $( ps -e ) && wayland="wayland"
[ "$WAYLAND_DISPLAY" ] && wayland="wayland" [ "$WAYLAND_DISPLAY" ] && wayland="wayland"
# test SSH # test SSH
@ -4373,9 +4403,9 @@ if type -p "mawk" &>/dev/null; then
elif type -p "$c_awk" &>/dev/null; then elif type -p "$c_awk" &>/dev/null; then
c_awk="gawk" c_awk="gawk"
fi fi
# essai évitement awk à la voidlinux # essai évitement awk à la voidlinux (souci avec awk -F ou -F ' | ')
if ! awk -F ' ' &>/dev/null; then if ! echo 'abc=123' | mawk -F '=|:' {} &>/dev/null; then
#~ f__error "awk en place va poser problèmes." "Pour participer au débuggage, vous pouvez contacter:" "$contact" f__error "awk en place va poser problème." "Pour participer au débuggage, vous pouvez contacter:" "$contact"
: :
fi fi
@ -4527,7 +4557,7 @@ for j in $options; do # deuxième passe options, actions
# fi_reseau fi_nm # fi_reseau fi_nm
# fi_system_analyse fi_log_xorg fi_journal # fi_system_analyse fi_log_xorg fi_journal
# fi_bluez # long # fi_bluez # long
fi_reseau fi_system
echo; f_prnt_md "$file_output" echo; f_prnt_md "$file_output"
;; # test ;; # test
-c* | all ) -c* | all )

View File

@ -1,6 +1,16 @@
# changelog getInfo # changelog getInfo
## getInfo 3.19.0 19/02/2018
* plus: fi_pkg_apt, paquets épinglés par pinning, résultat effectif
* révision: général, ps -ef
* révision: fi_reseau, manager de réseau
* révision: mineur, figet_cpu, affichage nom cpu
* révision: figet_compositor, figet_wm
* fix: f_dspl, affichage si vide
* fix: fi_touchpad, qte numérique sur zéro touchpad
## getInfo 3.18.3 14/02/2018 ## getInfo 3.18.3 14/02/2018
* plus: figet_de, ajout panels * plus: figet_de, ajout panels