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.wireless.enable = true; # Enables wireless support via wpa_supplicant.
services.xserver = {
# Enable the X11 windowing system.
services.xserver.enable = true;
enable = true;
# Enable the KDE Plasma Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.displayManager.sddm.wayland.enable = true;
services.desktopManager.plasma6.enable = true;
# Remove/disable xterm, we are using Konsole.
desktopManager.xterm.enable = false;
excludePackages = with pkgs; [ xterm ];
# Enable the SDDM display manager
displayManager.sddm = {
enable = true;
wayland.enable = true;
};
# 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
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.
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" ];
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 ];
enable = true;
serviceConfig = {
User = "root";
Group = "root";
ExecStart =
let
script = pkgs.writeShellScript "audiointerface-reset"
''
};
script = "
# 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
while ! modprobe -r snd_usb_audio; do
sleep 1
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
# Rebind audio interface
echo 3-3 > /sys/bus/usb/drivers/usb/bind
'';
in
"${script}";
};
echo `grep 0a73 /sys/bus/usb/devices/*/idVendor | cut -d '/' -f 6` > /sys/bus/usb/drivers/usb/bind
";
};
# Home Manager Configuration
@ -126,4 +145,12 @@
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 = {
sudo = "sudo ";
doas = "doas ";

View File

@ -57,6 +57,7 @@ in
lsp-plugins
yabridge
yabridgectl
MIDIVisualizer
kdenlive
vlc
@ -106,7 +107,7 @@ in
Categories=Other;
Icon=konsole
Type=Application
Exec=konsole -e ncmpcpp
Exec=$TERM -e ncmpcpp
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.
# 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
while ! modprobe -r snd_usb_audio; do
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.
modprobe snd_usb_audio
# 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
modprobe -r vfio_pci