From e4b5ebf91ae3b2bbe180cab41210aea4f58ee879 Mon Sep 17 00:00:00 2001 From: Meisterlala <6453306+Meisterlala@users.noreply.github.com> Date: Sun, 16 Nov 2025 23:46:21 +0000 Subject: [PATCH] Update .config/bspwm/bspwmrc --- dot_config/bspwm/executable_bspwmrc | 1 + dot_config/picom.conf | 2 ++ dot_config/pipewire/pipewire.conf.d/scrcpy.conf | 24 ++++++++++++++++-------- dot_config/powershell/Async/scrcpy.ps1 | 79 +++++++++++++++++++++++++++++++++++++++++++++---------------------------------- 4 file(s) changed, 64 insertion(s)(+), 42 deletion(s)(-) diff --git a/dot_config/bspwm/executable_bspwmrc b/dot_config/bspwm/executable_bspwmrc --- a/dot_config/bspwm/executable_bspwmrc +++ b/dot_config/bspwm/executable_bspwmrc @@ -66,6 +66,7 @@ bspc rule -a Code desktop="code" follow=on focus=on bspc rule -a Sylpheed desktop="mail" follow=off focus=off bspc rule -a thunderbird desktop="mail" follow=off focus=off bspc rule -a discord desktop="text" follow=on focus=on +bspc rule -a vesktod desktop="text" follow=on focus=on bspc rule -a telegram desktop="text" follow=on focus=on bspc rule -a WebCord desktop="text" follow=on focus=on bspc rule -a Zathura state=tiled diff --git a/dot_config/picom.conf b/dot_config/picom.conf --- a/dot_config/picom.conf +++ b/dot_config/picom.conf @@ -146,6 +146,8 @@ # # opacity-rule = [ "100:name *= 'GeoGebra'", + "0:class_g *= 'scrcpy'", + "100:class_g *= 'discord'", "100:name ~= 'mpv$'", "100:name ~= 'VLC media player'", "100:name ~= 'Jellyfin Media Player'", diff --git a/dot_config/pipewire/pipewire.conf.d/scrcpy.conf b/dot_config/pipewire/pipewire.conf.d/scrcpy.conf --- a/dot_config/pipewire/pipewire.conf.d/scrcpy.conf +++ b/dot_config/pipewire/pipewire.conf.d/scrcpy.conf @@ -1,12 +1,20 @@ -context.objects = [ - { - factory = adapter +context.modules = [ + { name = libpipewire-module-loopback args = { - factory.name = support.null-audio-sink - node.name = "scrcpySource" - node.description = "scrcpy" - media.class = "Audio/Source/Virtual" - audio.position = "FL,FR" + audio.position = [ FL FR ] + node.name = "scrcpy-output" + node.description = "Loopback from scrcpy-sink" + capture.props = { + media.class = Audio/Sink + node.name = scrcpy-sink + node.description = "scrcpy-sink" + } + playback.props = { + media.class = Audio/Source + node.name = "scrcpy-output" + node.descripton = "scrcpy-output" + node.passive = false + } } } ] diff --git a/dot_config/powershell/Async/scrcpy.ps1 b/dot_config/powershell/Async/scrcpy.ps1 --- a/dot_config/powershell/Async/scrcpy.ps1 +++ b/dot_config/powershell/Async/scrcpy.ps1 @@ -1,52 +1,63 @@ function Link-ScrcpyToVirtualMic { param( - [string]$AppNodeName = "scrcpy", - [string]$VirtualMicName = "scrcpySource" + [string]$App = "scrcpy", + [string]$Sink = "scrcpy-sink" ) # wait until both nodes exist do { $nodes = pw-cli ls Node - $appExists = $nodes -match "node.name = `"$AppNodeName`"" - $micExists = pw-link -i | Select-String $VirtualMicName + $appExists = $nodes -match "node.name = `"$App`"" + $sinkExists = $nodes -match "node.name = `"$Sink`"" - if (-not ($appExists -and $micExists)) + if (-not ($appExists -and $sinkExists)) { Start-Sleep -Milliseconds 200 } - } until ($appExists -and $micExists) + } until ($appExists -and $sinkExists) + +# Get all nodes +$Nodes = pw-cli ls Node + +# Function to extract node id by matching a line +function Get-NodeId($Nodes, $MatchText) { + $NodeId = 0 + $CurrentId = 0 + foreach ($Line in $Nodes) { + if ($Line -match 'id (\d+),') { + $CurrentId = $matches[1] + } + if ($Line -match [regex]::Escape($MatchText)) { + $NodeId = $CurrentId + break + } + } + return $NodeId +} + + +# Get app node id +$AppId = Get-NodeId $Nodes "application.name = `"$App`"" + +# Get sink node id +$SinkId = Get-NodeId $Nodes "node.name = `"$Sink`"" + + $linkList = pw-link -lI + foreach ($link in $linkList) { + if ($link -match "\b$AppId\b") { + # unlink the old link + if ($link -match '(\d+):') { + $linkId = $matches[1] + Write‑Host "Removing old link id $linkId" + pw‑link ‑d $linkId + } + } + } - # remove existing links from the app - # $nodes = pw-cli ls Node - # $appNodeId = $nodes | Select-String "node.name = `"$AppNodeName`"" | ForEach-Object { - # if ($_.Line -match 'id (\d+),') - # { $matches[1] - # } - # } - # - # $links = pw-cli ls Link - # $linkIdsToRemove = $links | ForEach-Object { - # if ($_ -match 'id (\d+),') - # { $linkId = $matches[1] - # } - # $outputNodeMatch = $_ -match 'link\.output\.node = "(\d+)"' - # $inputNodeMatch = $_ -match 'link\.input\.node = "(\d+)"' - # if ($outputNodeMatch -and $matches[1] -eq $appNodeId) - # { $linkId - # } elseif ($inputNodeMatch -and $matches[2] -eq $appNodeId) - # { $linkId - # } - # } - # foreach ($linkId in $linkIdsToRemove | Where-Object { $_ }) - # { - # pw-link -d $linkId | Out-Null - # } + pw-link -L $AppId $SinkId | Out-Null - # create new links quietly - pw-link "${AppNodeName}:output_FL" "${VirtualMicName}:input_FL" | Out-Null - pw-link "${AppNodeName}:output_FR" "${VirtualMicName}:input_FR" | Out-Null } -- tangled.sh