Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Make it display the audio server on GNU/Linux #1454

Closed
Twig6943 opened this issue Dec 20, 2024 · 16 comments
Closed

[FEAT] Make it display the audio server on GNU/Linux #1454

Twig6943 opened this issue Dec 20, 2024 · 16 comments
Labels
enhancement New feature or request

Comments

@Twig6943
Copy link

Wanted features:

Make fastfetch display audio server on GNU/Linux (Pipewire/PulseAudio) by default

(I know I said by default but that being said I don't know if this can be done via a conf if it is possible please let me know)

Motivation:

Fastfetch does display the user's session type (Wayland/xorg) & GPU by default I think this is also needed.

@Twig6943 Twig6943 added the enhancement New feature or request label Dec 20, 2024
@CarterLi
Copy link
Member

CarterLi commented Dec 21, 2024

It's easy to know wether Pipewire server is running.

However, Pipewire also provides a PulseAudio server. How can you know wether it's a real PulseAudio server, or a Pipewire server wrapper?

Same as JACK and others.

@Twig6943
Copy link
Author

afaik "pactl info" does specify which one the user is using

@nafanz
Copy link

nafanz commented Jan 6, 2025

I also find this feature useful, I hope it will be implemented.

If I had known earlier what the difference is between PipeWire and PulseAudio. It would have saved me a lot of time while I was figuring out why the microphone on my Bluetooth headphones doesn't work in Ubuntu 22.04.

Thanks to Stack Overflow and distribution reviews, where I learned that Ubuntu 22.10 switches to PipeWire and my problem was solved magically.

But I still don't understand how to independently check which of them (and what version) I have installed.

@Twig6943
Copy link
Author

Twig6943 commented Jan 6, 2025

I also find this feature useful, I hope it will be implemented.

If I had known earlier what the difference is between PipeWire and PulseAudio. It would have saved me a lot of time while I was figuring out why the microphone on my Bluetooth headphones doesn't work in Ubuntu 22.04.

Thanks to Stack Overflow and distribution reviews, where I learned that Ubuntu 22.10 switches to PipeWire and my problem was solved magically.

But I still don't understand how to independently check which of them (and what version) I have installed.

Run this command pactl info | grep -E "Server Name" to check

@nafanz
Copy link

nafanz commented Jan 7, 2025

@Twig6943
Ubuntu 24.10

pactl info
Command 'pactl' not found, but can be installed with:
sudo apt install pulseaudio-utils

I understand that it can be installed, but I don't want to drag PulseAudio dependencies into the system, because of which the microphone on my headphones did not work.

In addition, I suppose that there may be a false positive and detection that PulseAudio is used after installing pulseaudio-utils.

It seems to me that there should be another, cleaner way to determine PipeWire or PulseAudio.

CarterLi added a commit that referenced this issue Jan 7, 2025
@CarterLi
Copy link
Member

CarterLi commented Jan 7, 2025

Hello! Can you test the dev build with fastfetch -s sound --format json? It should print the version of pipewire if you have pipewire-pulse installed

@Twig6943
Copy link
Author

Twig6943 commented Jan 7, 2025

Hello! Can you test the dev build with fastfetch -s sound --format json? It should print the version of pipewire if you have pipewire-pulse installed

@CarterLi just compiled using the fastfetch-git pkg from the arch user repositories. Output of fastfetch -s sound --format json :
image

@CarterLi
Copy link
Member

CarterLi commented Jan 7, 2025

That's it. fastfetch -s sound --sound-format '{platform-api}' should print the audio server.

Worth noting that it simply reports Server Name reported by pactl info. It doesn't work if someone running both pipewire and pulseaudio.

@nafanz
Copy link

nafanz commented Jan 8, 2025

@CarterLi
Ubuntu 24.10

fastfetch -s sound --format json for comparison, I did it on two versions:

  • fastfetch 2.33.0 (x86_64)
[
  {
    "type": "Sound",
    "result": [
      {
        "active": true,
        "main": true,
        "volume": 0,
        "name": "Встроенное аудио Аналоговый стерео",
        "identifier": "alsa_output.pci-0000_00_1b.0.analog-stereo"
      }
    ]
  }
]
  • fastfetch 2.33.0-50 (x86_64)
[
  {
    "type": "Sound",
    "error": "Fastfetch was built without libpulse support"
  }
]

Details of how I did the assembly:

git clone [email protected]:fastfetch-cli/fastfetch.git
cd fastfetch
sudo snap install cmake --classic
mkdir -p build
cd build
cmake ..
make
sudo cmake --install . --prefix /usr/local

Not sure if it was needed make, I saw this here

https://github.com/fastfetch-cli/fastfetch?tab=readme-ov-file#manual
https://github.com/fastfetch-cli/fastfetch/wiki/Building

I was confused that the information here was different (and it was not entirely clear to me) so I decided to do another search on the Internet and found the instructions above.
The result was a combo of all these instructions.

I still haven't installed pulseaudio-utils (to use pactl info), it was interesting to see the behavior without this package.

In version 2.33.0 I was getting minimal information, but now I'm getting an error Fastfetch was built without libpulse support. Did I make a mistake in the assembly?

@CarterLi
Copy link
Member

CarterLi commented Jan 8, 2025

You need to install the pulseaudio-dev before running cmake ..

I suggest that you should download the prebuilt binaries here: https://github.com/fastfetch-cli/fastfetch/actions/runs/12663235503

@nafanz
Copy link

nafanz commented Jan 8, 2025

@CarterLi
Thanks for pointing out the pre-built nightly builds, but it didn't change anything.

I still try to stay away from packages that mention pulseaudio, as it seems weird to me to install it just to get information from fastfetch.

And I think I found one of the alternative ways to not depend on pulseaudio-utils, pulseaudio-dev or something like that.

systemctl --user status pipewire.socket pipewire.service pulseaudio.service pulseaudio.socket

Tested on PC and two boards Raspberry Pi.

  • Ubuntu 24.10 x86_64
Unit pulseaudio.service could not be found.
Unit pulseaudio.socket could not be found.
● pipewire.socket - PipeWire Multimedia System Sockets
     Loaded: loaded (/usr/lib/systemd/user/pipewire.socket; enabled; preset: enabled)
     Active: active (running) since Wed 2025-01-08 11:05:58 +05; 2h 21min ago
 Invocation: 15a995febd364811a7d4522a1b7ce4fb
   Triggers: ● pipewire.service
     Listen: /run/user/1000/pipewire-0 (Stream)
             /run/user/1000/pipewire-0-manager (Stream)
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/pipewire.socket

янв 08 11:05:58 nafanz-To-Be-Filled-By-O-E-M systemd[2008]: Listening on pipewire.socket - PipeWire Multimedia System Sockets.

● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Wed 2025-01-08 11:05:58 +05; 2h 21min ago
 Invocation: 3a2d618d3c954e2fa95c832080e814e5
TriggeredBy: ● pipewire.socket
   Main PID: 2032 (pipewire)
      Tasks: 3 (limit: 8807)
     Memory: 5.4M (peak: 7.3M)
        CPU: 1.807s
     CGroup: /user.slice/user-1000.slice/[email protected]/session.slice/pipewire.service
             └─2032 /usr/bin/pipewire

янв 08 11:05:58 nafanz-To-Be-Filled-By-O-E-M systemd[2008]: Started pipewire.service - PipeWire Multimedia Service.
  • Debian GNU/Linux bookworm 12.8 aarch64 (Raspberry Pi 4 Model B Rev 1.4)
● pipewire.socket - PipeWire Multimedia System Sockets
     Loaded: loaded (/usr/lib/systemd/user/pipewire.socket; enabled; preset: enabled)
     Active: active (running) since Tue 2025-01-07 22:55:55 +05; 14h ago
   Triggers: ● pipewire.service
     Listen: /run/user/1000/pipewire-0 (Stream)
             /run/user/1000/pipewire-0-manager (Stream)
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/pipewire.socket

янв 07 22:55:55 tv systemd[850]: Listening on pipewire.socket - PipeWire Multimedia System Sockets.

● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/usr/lib/systemd/user/pipewire.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-01-07 22:55:55 +05; 14h ago
TriggeredBy: ● pipewire.socket
   Main PID: 879 (pipewire)
      Tasks: 3 (limit: 8731)
        CPU: 129ms
     CGroup: /user.slice/user-1000.slice/[email protected]/session.slice/pipewire.service
             └─879 /usr/bin/pipewire

янв 07 22:55:55 tv systemd[850]: Started pipewire.service - PipeWire Multimedia Service.

○ pulseaudio.service - Sound Service
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.service; enabled; preset: enabled)
     Active: inactive (dead)
TriggeredBy: ○ pulseaudio.socket

○ pulseaudio.socket - Sound System
     Loaded: loaded (/usr/lib/systemd/user/pulseaudio.socket; enabled; preset: enabled)
     Active: inactive (dead)
   Triggers: ● pulseaudio.service
     Listen: /run/user/1000/pulse/native (Stream)
  • Raspbian GNU/Linux bullseye 11 armv7l (Raspberry Pi 2 Model B Rev 1.1)
    It may not work because of the server version of the operating system (no GUI).
Unit pipewire.socket could not be found.
Unit pipewire.service could not be found.
Unit pulseaudio.service could not be found.
Unit pulseaudio.socket could not be found.

@CarterLi
Copy link
Member

CarterLi commented Jan 8, 2025

I still try to stay away from packages that mention pulseaudio, as it seems weird to me to install it just to get information from fastfetch.

You don't install pulseaudio server, you install the pipewire - pulseaudio compatibility layer. You are still running pipewire. You just provide an API / library wrapper to programs that uses pulseaudio APIs. The programs think they are using pulseaudio, but they are using pipewire through a wrapper in fact.

@CarterLi
Copy link
Member

CarterLi commented Jan 8, 2025

Thanks for pointing out the pre-built nightly builds, but it didn't change anything.

What binary did you download? The CI log said they were fine.

@nafanz
Copy link

nafanz commented Jan 8, 2025

You don't install pulseaudio server, you install the pipewire - pulseaudio compatibility layer. You are still running pipewire. You just provide an API / library wrapper to programs that uses pulseaudio APIs. The programs think they are using pulseaudio, but they are using pipewire through a wrapper in fact.

I feel like I need to explain my thinking a bit.

After a clean install OS (before installing various apps), I like to save historical data from fastfetch. Mostly out of curiosity, so I can go back and compare it to the current data.

The Pipewire or PulseAudio information itself is interesting to me, but not critical, so I don't want to install additional packages to get it.

Eventually all modern distros I use switched to Pipewire. I know this from various reviews.

What binary did you download? The CI log said they were fine.

https://github.com/fastfetch-cli/fastfetch/actions/runs/12663235503/artifacts/2399260195

The package itself is fine, it works.
The error occurs when starting fastfetch -s sound --format json

[
  {
    "type": "Sound",
    "error": "Fastfetch was built without libpulse support"
  }
]

I understand that this is most likely due to the fact that I do not have pulseaudio-utils installed, which you rely on to obtain data.

But as I wrote above, on the latest stable version I received at least some data using -s sound --format json

This is a normal launch fastfetch.

                             ....              nafanz@nafanz-To-Be-Filled-By-O-E-M
              .',:clooo:  .:looooo:.           -----------------------------------
           .;looooooooc  .oooooooooo'          OS: Ubuntu 24.10 x86_64
        .;looooool:,''.  :ooooooooooc          Kernel: Linux 6.11.0-13-generic
       ;looool;.         'oooooooooo,          Uptime: 2 hours, 51 mins
      ;clool'             .cooooooc.  ,,       Packages: 1920 (dpkg), 16 (snap)
         ...                ......  .:oo,      Shell: bash 5.2.32
  .;clol:,.                        .loooo'     Display (DELL U2412M): 1920x1200 @ 60 Hz in 24" [External]
 :ooooooooo,                        'ooool     DE: GNOME
'ooooooooooo.                        loooo.    WM: Mutter (Wayland)
'ooooooooool                         coooo.    WM Theme: Yaru
 ,loooooooc.                        .loooo.    Theme: Yaru [GTK3]
   .,;;;'.                          ;ooooc     Icons: Yaru [GTK3]
       ...                         ,ooool.     Cursor: DMZ-White
    .cooooc.              ..',,'.  .cooo.      Terminal: GNOME Terminal 3.54.0
      ;ooooo:.           ;oooooooc.  :l.       CPU: Intel(R) Celeron(R) G530 (2) @ 2.40 GHz
       .coooooc,..      coooooooooo.           GPU: AMD Radeon HD 7750/8740 / R7 250E [Discrete]
         .:ooooooolc:. .ooooooooooo'           Memory: 1.96 GiB / 7.24 GiB (27%)
           .':loooooo;  ,oooooooooc            Swap: 0 B / 4.00 GiB (0%)
               ..';::c'  .;loooo:'             Disk (/): 16.93 GiB / 109.47 GiB (15%) - ext4
                                               Disk (/media/nafanz/ced3ffaa-10d2-41e5-981c-040e42e9cdcf): 117.73 MiB / 1.79 TiB (0%) - ext4
                                               Local IP (enp3s0): 192.168.88.239/24
                                               Locale: ru_RU.UTF-8

@CarterLi
Copy link
Member

CarterLi commented Jan 8, 2025

Fastfetch uses neither pulseaudio-utils nor pactl info. Fastfetch calls pulseaudio APIs directly. The entire Sound module uses pulseaudio API, including audio device name and volume detection. It is always been like this. If 2.33.0 works, you already have the compatibility layer installed. The problem of your local build doesnt work is that you dont have necessary development packages installed. These development packages are necessary only when you build fastfetch yourself. They have nothing to do with the real pulseaudio server, pulseaudio-utils or whatever. They are just some text files.

I wrote the code. I know how it works.

@CarterLi
Copy link
Member

CarterLi commented Jan 8, 2025

As the issue author have reported that it works for him, I am closing this issue.

@CarterLi CarterLi closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants