Better handling of Wayland compositors (#1539)
* Better handling of Wayland compositors * Reinstate setting ps_flags, it's used elsewhere * Try another incantation * Try another incantation * Try another incantation * Use short options and a newline to reduce line-length * Rework to handle the "better way" failing on some systems and fall back to the old method (which has the virtue of working most of the time).
This commit is contained in:
parent
77bac34cc5
commit
fb57277036
1 changed files with 37 additions and 29 deletions
66
neofetch
66
neofetch
|
@ -1815,35 +1815,43 @@ get_wm() {
|
|||
*) ps_flags=(-e) ;;
|
||||
esac
|
||||
|
||||
if [[ $WAYLAND_DISPLAY ]]; then
|
||||
wm=$(ps "${ps_flags[@]}" | grep -m 1 -o -F \
|
||||
-e arcan \
|
||||
-e asc \
|
||||
-e clayland \
|
||||
-e dwc \
|
||||
-e fireplace \
|
||||
-e gnome-shell \
|
||||
-e greenfield \
|
||||
-e grefsen \
|
||||
-e kwin \
|
||||
-e lipstick \
|
||||
-e maynard \
|
||||
-e mazecompositor \
|
||||
-e motorcar \
|
||||
-e orbital \
|
||||
-e orbment \
|
||||
-e perceptia \
|
||||
-e rustland \
|
||||
-e sway \
|
||||
-e ulubis \
|
||||
-e velox \
|
||||
-e wavy \
|
||||
-e way-cooler \
|
||||
-e wayfire \
|
||||
-e wayhouse \
|
||||
-e westeros \
|
||||
-e westford \
|
||||
-e weston)
|
||||
if [[ -O "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY:-wayland-0}" ]]; then
|
||||
if tmp_pid="$(lsof -t "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY:-wayland-0}" 2>&1)" ||
|
||||
tmp_pid="$(fuser "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY:-wayland-0}" 2>&1)"; then
|
||||
wm="$(ps -p "${tmp_pid}" -ho comm=)"
|
||||
else
|
||||
# lsof may not exist, or may need root on some systems. Similarly fuser.
|
||||
# On those systems we search for a list of known window managers, this can mistakenly
|
||||
# match processes for another user or session and will miss unlisted window managers.
|
||||
wm=$(ps "${ps_flags[@]}" | grep -m 1 -o -F \
|
||||
-e arcan \
|
||||
-e asc \
|
||||
-e clayland \
|
||||
-e dwc \
|
||||
-e fireplace \
|
||||
-e gnome-shell \
|
||||
-e greenfield \
|
||||
-e grefsen \
|
||||
-e kwin \
|
||||
-e lipstick \
|
||||
-e maynard \
|
||||
-e mazecompositor \
|
||||
-e motorcar \
|
||||
-e orbital \
|
||||
-e orbment \
|
||||
-e perceptia \
|
||||
-e rustland \
|
||||
-e sway \
|
||||
-e ulubis \
|
||||
-e velox \
|
||||
-e wavy \
|
||||
-e way-cooler \
|
||||
-e wayfire \
|
||||
-e wayhouse \
|
||||
-e westeros \
|
||||
-e westford \
|
||||
-e weston)
|
||||
fi
|
||||
|
||||
elif [[ $DISPLAY && $os != "Mac OS X" && $os != "macOS" && $os != FreeMiNT ]]; then
|
||||
type -p xprop &>/dev/null && {
|
||||
|
|
Loading…
Reference in a new issue