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
Member

worldofpeace commented Oct 20, 2019

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.
@jtojnar

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member 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

This comment has been minimized.

Copy link
Member Author

worldofpeace commented Oct 31, 2019

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

@jtojnar

This comment has been minimized.

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

This comment has been minimized.

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 worldofpeace:gnome3-sound-theme branch 2 times, most recently from a959e8b to 376b204 Nov 2, 2019
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 worldofpeace force-pushed the worldofpeace:gnome3-sound-theme branch from 376b204 to 4e2161f Nov 3, 2019
@worldofpeace

This comment has been minimized.

Copy link
Member 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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member Author

worldofpeace 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.

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

This comment has been minimized.

Copy link
Member Author

worldofpeace 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

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
12 checks passed
12 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A darwin-tested
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release-combined.nix -A tested
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A manual
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./nixos/release.nix -A options
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A manual
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A tarball
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="ofborg"; } ./pkgs/top-level/release.nix -A unstable
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
@worldofpeace worldofpeace deleted the worldofpeace:gnome3-sound-theme branch Nov 9, 2019
@worldofpeace

This comment has been minimized.

Copy link
Member Author

worldofpeace commented Nov 9, 2019

backported a22b018

dtzWill added 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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member Author

worldofpeace commented Nov 13, 2019

@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

This comment has been minimized.

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
Projects
None yet
3 participants
You can’t perform that action at this time.