DE/WM information has been converted to a Golang function

This commit is contained in:
2024-05-15 09:15:15 +03:00
parent a29a8f1dd9
commit 4c72295972
6 changed files with 60 additions and 29 deletions
+2 -3
View File
@@ -11,11 +11,10 @@ if [ ! -z "$GPU_MODEL" ]; then
fi
echo -e "${C3}Memory: ${C4}${MEM_USED} MiB / ${MEM_TOTAL} MiB"
if xhost >& /dev/null ; then
if get_de_wm &> /dev/null; then
echo -e "${C3}DE/WM: ${C4}$(get_de_wm)"
if [ ! -z "$DE_WM" ]; then
echo -e "${C3}DE/WM: ${C4}${DE_WM}"
fi
if command_exists xdpyinfo ; then
echo -e "${C3}Screen Resolution: ${C4}$(get_screen_resolution)"
fi
fi
-26
View File
@@ -34,32 +34,6 @@ get_shell() {
esac
}
get_de_wm() {
if ps -e | grep "plasmashell" &> /dev/null ; then
echo "KDE Plasma $(plasmashell --version | awk '{print $2}')"
elif ps -e | grep "gnome-session" &> /dev/null ; then
echo "Gnome $(gnome-shell --version | awk '{print $3}')"
elif ps -e | grep "xfce4-session" &> /dev/null ; then
echo "XFCE $(xfce4-session --version | grep xfce4-session | awk '{print $2}')"
elif ps -e | grep "cinnamon" &> /dev/null ; then
echo "Cinnamon $(cinnamon --version | awk '{print $2}')"
elif ps -e | grep "mate-panel" &> /dev/null ; then
echo "Mate $(mate-about --version | awk '{print $4}')"
elif ps -e | grep "lxsession" &> /dev/null ; then
echo "LXDE"
elif ps -e | grep "sway" &> /dev/null ; then
echo "Sway $(sway --version | awk '{print $2}')"
elif ps -e | grep "bspwm" &> /dev/null ; then
echo "Bspwm $(bspwm -v)"
elif ps -e | grep "icewm-session" &> /dev/null ; then
echo "IceWM $(icewm --version | awk '{print $2}' | sed 's/,//g')"
elif [ ! -z $DESKTOP_SESSION ]; then
echo "$DESKTOP_SESSION"
else
return 1
fi
}
get_screen_resolution() {
if xhost >& /dev/null && command_exists xdpyinfo; then
xdpyinfo | grep dimensions | tr -s ' ' | cut -d " " -f3