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

nixos/gnome3: add sound-theme-freedesktop #71416

Merged
merged 2 commits into from Nov 9, 2019

Conversation

worldofpeace
Copy link
Contributor

Motivation for this change

I've noticed a similar issue in Pantheon, without this
sound theme installed there's no system sounds.
I believe it's because the gnome theme and the pantheon
theme inherit this one.

Things done

Running on my machine currently. Its effects may not be seen right away. i.e, on this particular machine
I had flip a few dconf switches. I'd want to check if the sound theme is working in a VM, but I'm not sure
how to get sounds from a NixOS qemu machine.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@worldofpeace worldofpeace added the 9.needs: port to stable A PR needs a backport to the stable release. label Oct 20, 2019
@ofborg ofborg bot added 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: nixos 8.has: module (update) labels Oct 20, 2019
@jtojnar
Copy link
Contributor

jtojnar commented Oct 31, 2019

How do you test this? GNOME does not seem to have any sound theme. In g-c-c there is a Alert sound choice but it does not seem to make any sound when changed. And it only seems to make a symlink from ~/.local/share/sounds/__custom/bell-window-system.ogg to a file in g-c-c package.

@worldofpeace
Copy link
Contributor Author

worldofpeace commented Oct 31, 2019

How do you test this? GNOME does not seem to have any sound theme. In g-c-c there is a Alert sound choice but it does not seem to make any sound when changed. And it only seems to make a symlink from ~/.local/share/sounds/__custom/bell-window-system.ogg to a file in g-c-c package.

It was pretty weird, I actually checked and the gnome theme doesn't inherit from the freedesktop one. I'll test it again somehow, but for sure before I did this there wasn't any sound theme activated, and trying to activate it in g-c-c wouldn't work.

Edit: gnome does have a sound theme, though it consists of alert sounds. I guess the freedesktop theme is used for everything else, and probably needs to be installed. Should the sound freedesktop module do this instead?

@worldofpeace
Copy link
Contributor Author

Hmm, I don't know how to have sound in qemu...

@jtojnar
Copy link
Contributor

jtojnar commented Oct 31, 2019

Hmm, I had system sounds muted so that alert sound was not being played when I changed it. Now I also hear a sound when changing volume level.

@jtojnar
Copy link
Contributor

jtojnar commented Oct 31, 2019

Yup, seems to be the case:

$ cat ~/.local/share/sounds/__custom/index.theme
[Sound Theme]
Name=Custom
Inherits=freedesktop
Directories=.

That should be enough justification to install it from the gnome module.

In the past, I just added it locally (2be9f02) but it might make sense to handle sound themes just like icon themes. On the other hand, the freedesktop theme is probably the only one anyone will ever use, so the replaceability argument is not so strong.

In either case, GNOME Shell also relies on some sound theme being present.

I would go with installing it in gnome module with a comment about the custom alert theme. Adding it to xdg.sounds module on top of that probably would not do any harm.

@worldofpeace worldofpeace force-pushed the gnome3-sound-theme branch 2 times, most recently from a959e8b to 376b204 Compare November 3, 2019 15:16
I've noticed a similar issue in Pantheon, without this
sound theme installed there's no system sounds.
I believe it's because the gnome theme and the pantheon
theme inherit this one.
@worldofpeace
Copy link
Contributor Author

worldofpeace commented Nov 3, 2019

Yup, seems to be the case:

$ cat ~/.local/share/sounds/__custom/index.theme
[Sound Theme]
Name=Custom
Inherits=freedesktop
Directories=.

That should be enough justification to install it from the gnome module.

In the past, I just added it locally (2be9f02) but it might make sense to handle sound themes just like icon themes. On the other hand, the freedesktop theme is probably the only one anyone will ever use, so the replaceability argument is not so strong.

In either case, GNOME Shell also relies on some sound theme being present.

I would go with installing it in gnome module with a comment about the custom alert theme. Adding it to xdg.sounds module on top of that probably would not do any harm.

I believe I've supplied these changes. Though I would still like a way to test it in qemu for a backport.
(I'd only backport the change to gnome3.nix)

@jtojnar
Copy link
Contributor

jtojnar commented Nov 3, 2019

Adding the following seems to be sufficient to make the sound work.

virtualisation.qemu.options = [ "-soundhw hda" ];

Though for some reason, when QEMU is run, it starts acting as a monitor and it is mixed with the output. But Spotify triggers that too, so maybe it is irrelevant.

@jtojnar
Copy link
Contributor

jtojnar commented Nov 3, 2019

You can also abuse QEMU_NET_OPTS environment variable:

$ env QEMU_NET_OPTS="hostfwd=tcp::2222-:22,hostfwd=tcp::8888-:80 -soundhw help" ./result/bin/run-*-vm
Valid sound card names (comma separated):
sb16        Creative Sound Blaster 16
es1370      ENSONIQ AudioPCI ES1370
ac97        Intel 82801AA AC97 Audio
adlib       Yamaha YM3812 (OPL2)
gus         Gravis Ultrasound GF1
cs4231a     CS4231A
hda         Intel HD Audio
pcspk       PC speaker

-soundhw all will enable all of the above

@worldofpeace
Copy link
Contributor Author

Adding the following seems to be sufficient to make the sound work.

virtualisation.qemu.options = [ "-soundhw hda" ];

Though for some reason, when QEMU is run, it starts acting as a monitor and it is mixed with the output. But Spotify triggers that too, so maybe it is irrelevant.

Ok, it does seem to have system sounds now from themes. However it's pretty strange that system sounds start off as muted, I believe you noticed this also.

What I did to test was:

  1. build vm with gnome3 config
  2. opened sound pane in g-c-c
  3. made sure system sounds were all the way up
  4. played with volume slider in the shell

Without this change, even if you set a sound theme you won't get the alert sound (drip).

@jtojnar Similar findings?

@worldofpeace
Copy link
Contributor Author

You can also abuse QEMU_NET_OPTS environment variable:

$ env QEMU_NET_OPTS="hostfwd=tcp::2222-:22,hostfwd=tcp::8888-:80 -soundhw help" ./result/bin/run-*-vm
Valid sound card names (comma separated):
sb16        Creative Sound Blaster 16
es1370      ENSONIQ AudioPCI ES1370
ac97        Intel 82801AA AC97 Audio
adlib       Yamaha YM3812 (OPL2)
gus         Gravis Ultrasound GF1
cs4231a     CS4231A
hda         Intel HD Audio
pcspk       PC speaker

-soundhw all will enable all of the above

Thanks, I was able to test with nixos option 👍
(happened to also have intel audio)

@worldofpeace worldofpeace merged commit 6783fdd into NixOS:master Nov 9, 2019
@worldofpeace worldofpeace deleted the gnome3-sound-theme branch November 9, 2019 21:36
@worldofpeace
Copy link
Contributor Author

backported a22b018

dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Nov 10, 2019
nixos/gnome3: add sound-theme-freedesktop

(cherry picked from commit 6783fdd)
@timokau
Copy link
Member

timokau commented Nov 13, 2019

My terminal bell suddenly made a sound due to this change, which was a bit annoying to track down (I don't even directly use gnome). Not saying that there's anything wrong with it, since I've apparently been relying on a bug (https://xkcd.com/1172/). Now I just need to figure out how to disable the sounds properly.

I'm not sure the backport is a good idea though. Its a functional change, and maybe not just strictly a fix. Maybe its the right thing to do anyways, I don't know.

@worldofpeace
Copy link
Contributor Author

@timokau I only backported the fix to GNOME a22b018. The OS wide change to include the freedesktop sound theme, where on conventional systems would have always been there (and I think libcanberra even needs it), wasn't backported for the reason you mentioned. Simply put, I fixed being able to set an alert sound in GNOME, and with gnome-control-center.

@timokau
Copy link
Member

timokau commented Nov 13, 2019

Ah okay, that's good then. Discovery is still not optimal (I had to bisect it, which is even harder since my system configuration didn't build on some of the relevant revs), but I'm not sure how to improve that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: nixos 8.has: module (update) 9.needs: port to stable A PR needs a backport to the stable release. 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants