Remove xterm from desktop config, fix audio interface resetting still not working after sleeping/hibernating

This commit is contained in:
Curt Spark 2024-03-15 19:48:37 +00:00
parent 5db22491db
commit 470ee9c26a
5 changed files with 59 additions and 27 deletions

View File

@ -23,16 +23,26 @@
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
services.xserver = {
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver.enable = true; enable = true;
# Enable the KDE Plasma Desktop Environment. # Remove/disable xterm, we are using Konsole.
services.xserver.displayManager.sddm.enable = true; desktopManager.xterm.enable = false;
services.xserver.displayManager.sddm.wayland.enable = true; excludePackages = with pkgs; [ xterm ];
services.desktopManager.plasma6.enable = true;
# Enable the SDDM display manager
displayManager.sddm = {
enable = true;
wayland.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager). # Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true; # libinput.enable = true;
};
# Enable the KDE Plasma Desktop Environment.
services.desktopManager.plasma6.enable = true;
environment.plasma6.excludePackages = with pkgs.kdePackages; [ elisa ];
# GTK themes are not applied in Wayland applications / Window Decorations missing / Cursor looks different # GTK themes are not applied in Wayland applications / Window Decorations missing / Cursor looks different
programs.dconf.enable = true; programs.dconf.enable = true;
@ -58,33 +68,42 @@
}; };
# My audio interface has issues after coming out from suspend/hibernate, this will reset it to fix it when necessary. # My audio interface has issues after coming out from suspend/hibernate, this will reset it to fix it when necessary.
systemd.services.audiointerface-reset = {
description = "Resets audio interface to clear up any issues"; systemd.services.audiointerface-reset-unbind = {
description = "Resets audio interface to clear up any issues - de-initialises audio interface before sleeping/hibernating";
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ]; wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
after = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ]; before = [ "systemd-suspend.service" "systemd-hibernate.service" "systemd-hybrid-sleep.service" ];
path = with pkgs; [ bash coreutils kmod ]; path = with pkgs; [ bash coreutils kmod ];
enable = true; enable = true;
serviceConfig = { serviceConfig = {
User = "root"; User = "root";
Group = "root"; Group = "root";
ExecStart = };
let script = "
script = pkgs.writeShellScript "audiointerface-reset"
''
# Unbind audio interface # Unbind audio interface
echo 3-3 > /sys/bus/usb/drivers/usb/unbind echo `grep 0a73 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6` > /sys/bus/usb/drivers/usb/unbind
# Remove snd_usb_audio once no longer in use # Remove snd_usb_audio once no longer in use
while ! modprobe -r snd_usb_audio; do while ! modprobe -r snd_usb_audio; do
sleep 1 sleep 1
done done
";
};
systemd.services.audiointerface-reset-bind = {
description = "Resets audio interface to clear up any issues - re-initialises audio interface after sleeping/hibernating";
wantedBy = [ "suspend.target" "hibernate.target" "hybrid-sleep.target" ];
after = [ "systemd-suspend.service" "systemd-hibernate.service" "systemd-hybrid-sleep.service" ];
path = with pkgs; [ bash coreutils kmod systemd ];
enable = true;
serviceConfig = {
User = "root";
Group = "root";
};
script = "
systemctl stop audiointerface-reset-unbind.service
modprobe snd_usb_audio modprobe snd_usb_audio
# Rebind audio interface # Rebind audio interface
echo 3-3 > /sys/bus/usb/drivers/usb/bind echo `grep 0a73 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6` > /sys/bus/usb/drivers/usb/bind
''; ";
in
"${script}";
};
}; };
# Home Manager Configuration # Home Manager Configuration
@ -126,4 +145,12 @@
nvtop-amd nvtop-amd
]; ];
# Set konsole to be default terminal
environment.sessionVariables = {
TERM = "konsole";
};
environment.variables = {
TERM = "konsole";
};
} }

View File

@ -78,6 +78,10 @@
}; };
}; };
home.sessionVariables = {
TERM = "konsole";
};
programs.bash.shellAliases = { programs.bash.shellAliases = {
sudo = "sudo "; sudo = "sudo ";
doas = "doas "; doas = "doas ";

View File

@ -57,6 +57,7 @@ in
lsp-plugins lsp-plugins
yabridge yabridge
yabridgectl yabridgectl
MIDIVisualizer
kdenlive kdenlive
vlc vlc
@ -106,7 +107,7 @@ in
Categories=Other; Categories=Other;
Icon=konsole Icon=konsole
Type=Application Type=Application
Exec=konsole -e ncmpcpp Exec=$TERM -e ncmpcpp
Terminal=false Terminal=false
''; '';
}; };

View File

@ -13,7 +13,7 @@ loginctl terminate-session $session
# My audio interface has issues after coming out from a suspended type state, this will reset it to fix it when necessary. # My audio interface has issues after coming out from a suspended type state, this will reset it to fix it when necessary.
# Unbind audio interface # Unbind audio interface
echo 3-3 > /sys/bus/usb/drivers/usb/unbind echo `grep 0a73 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6` > /sys/bus/usb/drivers/usb/unbind
# Remove snd_usb_audio once no longer in use # Remove snd_usb_audio once no longer in use
while ! modprobe -r snd_usb_audio; do while ! modprobe -r snd_usb_audio; do
sleep 1 sleep 1

View File

@ -3,7 +3,7 @@ set -x
# My audio interface has issues after coming out from a suspended type state, this will reset it to fix it when necessary. # My audio interface has issues after coming out from a suspended type state, this will reset it to fix it when necessary.
modprobe snd_usb_audio modprobe snd_usb_audio
# Rebind audio interface # Rebind audio interface
echo 3-3 > /sys/bus/usb/drivers/usb/bind echo `grep 0a73 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6` > /sys/bus/usb/drivers/usb/bind
# Remove vfio modules # Remove vfio modules
modprobe -r vfio_pci modprobe -r vfio_pci