clean up some real old shit

This commit is contained in:
notgne2 2025-10-22 13:41:13 -07:00
parent fb8f6800a8
commit ab4c6db5dd
No known key found for this signature in database
2 changed files with 45 additions and 88 deletions

View file

@ -1,34 +0,0 @@
diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc
index 4afa399..fbaaf06e 100644
--- a/ui/gtk/native_theme_gtk.cc
+++ b/ui/gtk/native_theme_gtk.cc
@@ -116,6 +116,13 @@
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
base::BindRepeating(AddGtkNativeCoreColorMixer));
+ // Add the web native theme as an observer to stay in sync with dark mode,
+ // high contrast, and preferred color scheme changes.
+ color_scheme_observer_ =
+ std::make_unique<NativeTheme::ColorSchemeNativeThemeObserver>(
+ NativeTheme::GetInstanceForWeb());
+ AddObserver(color_scheme_observer_.get());
+
OnThemeChanged(gtk_settings_get_default(), nullptr);
}
diff --git a/ui/gtk/native_theme_gtk.h b/ui/gtk/native_theme_gtk.h
index 876a738..ad3b88d41 100644
--- a/ui/gtk/native_theme_gtk.h
+++ b/ui/gtk/native_theme_gtk.h
@@ -93,6 +93,11 @@
mutable absl::optional<SkColor> color_cache_[kColorId_NumColors];
ScopedCssProvider theme_css_override_;
+
+ // Used to notify the web native theme of changes to dark mode, high
+ // contrast, and preferred color scheme.
+ std::unique_ptr<NativeTheme::ColorSchemeNativeThemeObserver>
+ color_scheme_observer_;
};
} // namespace gtk

View file

@ -22,6 +22,12 @@ in {
default = false;
};
batch = mkOption {
type = types.bool;
description = "idfk";
default = cfg.usbSoundcard;
};
periodSize = mkOption {
type = types.int;
description = ''
@ -50,75 +56,60 @@ in {
services.pipewire = {
enable = lib.mkDefault true;
jack.enable = lib.mkDefault true;
alsa.enable = lib.mkDefault true;
alsa.support32Bit = lib.mkDefault true;
pulse.enable = lib.mkDefault true;
wireplumber.enable = lib.mkDefault true;
};
environment.systemPackages = with pkgs; [
# pactl is required for pipewire-pulse
pulseaudio
];
extraConfig = {
pipewire."92-low-latency" = mkIf cfg.lowLatency {
"context.properties" = {
"default.clock.rate" = cfg.rate;
"default.clock.quantum" = cfg.quantum;
"default.clock.min-quantum" = cfg.quantum;
"default.clock.max-quantum" = cfg.quantum;
};
};
services.pipewire.extraConfig.pipewire."92-low-latency" = mkIf cfg.lowLatency {
context.properties = {
default.clock.rate = cfg.rate;
default.clock.quantum = cfg.quantum;
default.clock.min-quantum = cfg.quantum;
default.clock.max-quantum = cfg.quantum;
pipewire-pulse."92-low-latency" = mkIf cfg.lowLatency {
context.modules = [
{
name = "libpipewire-module-protocol-pulse";
args = {
pulse.min.req = qr;
pulse.default.req = qr;
pulse.max.req = qr;
pulse.min.quantum = qr;
pulse.max.quantum = qr;
};
}
];
stream.properties = {
node.latency = qr;
resample.quality = 1;
};
};
};
};
services.pipewire.extraConfig.pipewire-pulse."92-low-latency" = mkIf cfg.lowLatency {
context.modules = [
wireplumber.extraConfig."99-alsa-lowlatency"."alsa_monitor.rules" = [
{
name = "libpipewire-module-protocol-pulse";
args = {
pulse.min.req = qr;
pulse.default.req = qr;
pulse.max.req = qr;
pulse.min.quantum = qr;
pulse.max.quantum = qr;
matches = [ { "node.name" = "matches:alsa_output.*"; } ];
apply_properties = {
"audio.format" = "S32LE";
"audio.rate" = toString (cfg.rate * (if cfg.usbSoundcard then 2 else 1)); # for USB soundcards it should be twice your desired rate
"api.alsa.period-size" = toString cfg.periodSize; # defaults to 1024, tweak by trial-and-error
"api.alsa.disable-batch" = if cfg.batch then "false" else "true"; # generally, USB soundcards use the batch mode
};
}
];
stream.properties = {
node.latency = qr;
resample.quality = 1;
};
};
services.pipewire.wireplumber.configPackages =
[
(pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'')
]
++ optional cfg.lowLatency (pkgs.writeTextDir "share/wireplumber/main.lua.d/99-alsa-lowlatency.lua" ''
alsa_monitor.rules = {
{
matches = {{{ "node.name", "matches", "alsa_output.*" }}};
apply_properties = {
["audio.format"] = "S32LE",
["audio.rate"] = "${toString (cfg.rate
* (
if cfg.usbSoundcard
then 2
else 1
))}", -- for USB soundcards it should be twice your desired rate
["api.alsa.period-size"] = ${toString cfg.periodSize}, -- defaults to 1024, tweak by trial-and-error
-- ["api.alsa.disable-batch"] = true, -- generally, USB soundcards use the batch mode
},
},
}
'');
environment.systemPackages = with pkgs; [
# pactl is required for lots of scripts still
pulseaudio
];
};
}