Looking for a segment of neofetch [SOLVED]

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Post Reply
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Looking for a segment of neofetch [SOLVED]

Post by Logansfury »

Hello all,

My neofetch displays on my terminal a Windows Manager field, populated with the value:

WM: Mutter (Muffin)

Does anyone know the script neofetch uses to display this?

Thank you,

Logan
Last edited by Logansfury on Wed Mar 20, 2024 9:34 am, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
vimes666
Level 6
Level 6
Posts: 1241
Joined: Tue Jan 19, 2016 6:08 pm

Re: Looking for a segment of neofetch

Post by vimes666 »

It depends on your system. In your case it is likely it uses xprop for it.
In the neofetch script itself it is determined in the function get_wm() in /usr/bin/neofetch
The portion that you are interested in is probably this:

Code: Select all

id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
id=${id##* }
wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)
wm=${wm/*WM_NAME = }
wm=${wm/\"}
wm=${wm/\"*}
echo "$wm"
I added the last line to display the result.
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking for a segment of neofetch

Post by Logansfury »

vimes666 wrote: Wed Mar 20, 2024 8:34 am It depends on your system. In your case it is likely it uses xprop for it.
In the neofetch script itself it is determined in the function get_wm() in /usr/bin/neofetch
The portion that you are interested in is probably this:

Code: Select all

id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
id=${id##* }
wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)
wm=${wm/*WM_NAME = }
wm=${wm/\"}
wm=${wm/\"*}
echo "$wm"
I added the last line to display the result.
Hey Vimes how are you?

That displays exactly what I want it to!

I wanted to use this in conky, can it be done in one line?
Last edited by Logansfury on Wed Mar 20, 2024 9:34 am, edited 1 time in total.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
vimes666
Level 6
Level 6
Posts: 1241
Joined: Tue Jan 19, 2016 6:08 pm

Re: Looking for a segment of neofetch

Post by vimes666 »

I dont know about conky but this may do it (as one line):

Code: Select all

id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK) && id=${id##* } && wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t) && wm=${wm/*WM_NAME = } && wm=${wm/\"} && wm=${wm/\"*} && echo "$wm"
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking for a segment of neofetch

Post by Logansfury »

vimes666 wrote: Wed Mar 20, 2024 9:33 am I dont know about conky but this may do it:

Code: Select all

id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK) && id=${id##* } && wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t) && wm=${wm/*WM_NAME = } && wm=${wm/\"} && wm=${wm/\"*} && echo "$wm"
My conky is displaying the WM info perfectly!

Thank you for taking the time to help :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
vimes666
Level 6
Level 6
Posts: 1241
Joined: Tue Jan 19, 2016 6:08 pm

Re: Looking for a segment of neofetch [SOLVED]

Post by vimes666 »

But you could also use

Code: Select all

neofetch wm
instead ;)
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking for a segment of neofetch [SOLVED]

Post by Logansfury »

vimes666 wrote: Wed Mar 20, 2024 9:40 am But you could also use

Code: Select all

neofetch wm
instead ;)
I see! It needs editing for conky however, it's displaying as "wm: Mutter (Muffin)" and I need just "Mutter (Muffin)"
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 6
Level 6
Posts: 1237
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking for a segment of neofetch [SOLVED]

Post by Logansfury »

Logansfury wrote: Wed Mar 20, 2024 9:47 am
vimes666 wrote: Wed Mar 20, 2024 9:40 am But you could also use

Code: Select all

neofetch wm
instead ;)
I see! It needs editing for conky however, it's displaying as "wm: Mutter (Muffin)" and I need just "Mutter (Muffin)"
Got it!!

Code: Select all

neofetch wm | awk -F ': ' '{print $2}'
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
vimes666
Level 6
Level 6
Posts: 1241
Joined: Tue Jan 19, 2016 6:08 pm

Re: Looking for a segment of neofetch [SOLVED]

Post by vimes666 »

Then use this:

Code: Select all

a=$(neofetch wm) && echo "${a#* }"
vimes666
Level 6
Level 6
Posts: 1241
Joined: Tue Jan 19, 2016 6:08 pm

Re: Looking for a segment of neofetch [SOLVED]

Post by vimes666 »

Ok you got it now :)
Post Reply

Return to “Scripts & Bash”