From 51d2f2a7cc51bf8757edafeceee4de0b263ac0ce Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 27 Apr 2025 22:51:18 +0200 Subject: [PATCH] Added fix for 18ch audio. Updated scripts --- config/hypr/hyprland_CMBOX.conf | 8 +++++++- config/hypr/hyprland_STEAMBOX.conf | 8 +++++++- set-xr18-2ch.sh | 29 +++++++++++++++++++++++++++++ update_arch.sh | 6 +++--- 4 files changed, 46 insertions(+), 5 deletions(-) create mode 100755 set-xr18-2ch.sh diff --git a/config/hypr/hyprland_CMBOX.conf b/config/hypr/hyprland_CMBOX.conf index 2272d81..fd22f9b 100644 --- a/config/hypr/hyprland_CMBOX.conf +++ b/config/hypr/hyprland_CMBOX.conf @@ -7,7 +7,6 @@ monitor=,2560x1440,auto,1 ### MY PROGRAMS ### ################### $terminal = kitty -$fileManager = dolphin $browser = brave --new-window --hide-crash-restore-bubble $moonlight = com.moonlight_stream.Moonlight @@ -18,6 +17,7 @@ exec = gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark" # fo exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec-once = /home/cm/linuxbox/set-xr18-2ch.sh exec-once = udiskie exec-once = waybar exec-once = systemctl --user start sunshine @@ -180,6 +180,7 @@ bind = $mainMod, D, togglespecialworkspace, discord bind = $mainMod, W, togglespecialworkspace, web bind = $mainMod, F, togglespecialworkspace, fzfmenu bind = $mainMod, V, togglespecialworkspace, mixer +bind = $mainMod, A, togglespecialworkspace, ranger # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l @@ -266,6 +267,11 @@ windowrulev2 = float, onworkspace:special:btop windowrulev2 = size 80% 80%, onworkspace:special:btop workspace = special:btop, on-created-empty:kitty btop +# Ranger +windowrulev2 = float, onworkspace:special:ranger +windowrulev2 = size 80% 80%, onworkspace:special:ranger +workspace = special:ranger, on-created-empty:kitty ranger + # Discord windowrulev2 = size 450 253, initialTitle:^(Discord Popout)$ windowrulev2 = float, onworkspace:special:discord diff --git a/config/hypr/hyprland_STEAMBOX.conf b/config/hypr/hyprland_STEAMBOX.conf index 95d3f09..a0985db 100644 --- a/config/hypr/hyprland_STEAMBOX.conf +++ b/config/hypr/hyprland_STEAMBOX.conf @@ -7,7 +7,6 @@ monitor=,2560x1440,auto,1 ### MY PROGRAMS ### ################### $terminal = kitty -$fileManager = kitty ranger $browser = brave --new-window --hide-crash-restore-bubble ################# @@ -17,6 +16,7 @@ exec = gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark" # fo exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +exec-once = /home/cm/linuxbox/set-xr18-2ch.sh exec-once = udiskie exec-once = sudo udisksctl mount -b /dev/sda1 exec-once = waybar @@ -178,6 +178,7 @@ bind = $mainMod, D, togglespecialworkspace, discord bind = $mainMod, W, togglespecialworkspace, web bind = $mainMod, F, togglespecialworkspace, fzfmenu bind = $mainMod, V, togglespecialworkspace, mixer +bind = $mainMod, A, togglespecialworkspace, ranger # Move focus with mainMod + arrow keys bind = $mainMod, left, movefocus, l @@ -264,6 +265,11 @@ windowrulev2 = float, onworkspace:special:btop windowrulev2 = size 80% 80%, onworkspace:special:btop workspace = special:btop, on-created-empty:kitty btop +# Ranger +windowrulev2 = float, onworkspace:special:ranger +windowrulev2 = size 80% 80%, onworkspace:special:ranger +workspace = special:ranger, on-created-empty:kitty ranger + # Discord windowrulev2 = size 450 253, initialTitle:^(Discord Popout)$ windowrulev2 = float, onworkspace:special:discord diff --git a/set-xr18-2ch.sh b/set-xr18-2ch.sh new file mode 100755 index 0000000..1506c76 --- /dev/null +++ b/set-xr18-2ch.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Wait a bit for the device to be ready +sleep 2 + +# Function to find the sink +find_sink() { + pactl list short sinks | grep "alsa_output.usb-BEHRINGER_X18" | awk '{print $2}' +} + +# Wait until the sink is found +SINK_NAME="" +while [ -z "$SINK_NAME" ]; do + SINK_NAME=$(find_sink) + if [ -n "$SINK_NAME" ]; then + echo "Sink found: $SINK_NAME" + else + echo "Sink not found. Retrying..." + sleep 2 # Wait for 2 seconds before trying again + fi +done + +# Force to stereo (2 channels) once the sink is found +if [ -n "$SINK_NAME" ]; then + if ! pactl list short modules | grep -q "sink_name=xr18_stereo"; then + pactl load-module module-remap-sink sink_name=xr18_stereo master=$SINK_NAME channels=2 channel_map=front-left,front-right + pactl set-default-sink xr18_stereo + fi +fi diff --git a/update_arch.sh b/update_arch.sh index 849dcaa..3aacdda 100755 --- a/update_arch.sh +++ b/update_arch.sh @@ -24,7 +24,7 @@ echo -e ' \e[H\e[2J \e[1;32mCMtec '$HOSTNAME' install/Update script\e[0;37m ' -sleep 3 +sleep 1 # Create backup/snapshot if pacman -Qs timeshift >/dev/null; then @@ -170,7 +170,7 @@ sudo touch /etc/security/autologin.conf # Install udisk printf -- '\033[33m Installing udisk\n\033[37m' sudo pacman --noconfirm --needed -S udisks2 udiskie -echo 'ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"' | sudo tee /etc/udev/rules.d/99-udisks2.rules +echo 'ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{UDISKS_FILESYSTEM_SHARED}="1"' | sudo tee /lib/udev/rules.d/99-udisks2.rules echo 'D /media 0755 root root 0 -' | sudo tee /etc/tmpfiles.d/media.conf if [ "$HOSTNAME" == "STEAMBOX" ]; then echo "$USER ALL=(ALL:ALL) NOPASSWD: /usr/sbin/udisksctl mount -b /dev/sda1" | sudo tee /etc/sudoers.d/udisksctl @@ -452,7 +452,7 @@ sudo pacman --noconfirm --needed -S timeshift printf -- '\033[33m Installing Sunshine\n\033[37m' sudo pacman --noconfirm --needed -S intel-media-driver yay --noconfirm --needed -S sunshine -echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | sudo tee /etc/udev/rules.d/60-sunshine.rules +# echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | sudo tee /lib/udev/rules.d/60-sunshine.rules mkdir -p ~/.config/systemd/user cp -f ~/linuxbox/config/systemd/user/sunshine.service ~/.config/systemd/user/sunshine.service sudo udevadm control --reload-rules