Skip to main content

pipewire switch headphone/speaker (port)

switch with pactl

 $ pactl set-sink-port 0 analog-output-headphones
$ pactl set-sink-port 0 analog-output-speaker


 find ports name

pactl list sinks

Sink #52
    State: SUSPENDED
    Name: alsa_output.pci-0000_00_1f.3.analog-stereo

 Ports:
        analog-output-speaker: Speakers (type: Speaker, priority: 10000, availability group: Legacy 3, availability unknown)
        analog-output-headphones: Headphones (type: Headphones, priority: 9900, availability group: Legacy 2, availability unknown)
    Active Port: analog-output-headphones

 

see in ports:


pactl list sinks short
52    alsa_output.pci-0000_00_1f.3.analog-stereo    PipeWire    s32le 2ch 48000Hz    SUSPENDED


man pactl

 set-sink-port SINK PORT
              Set the specified sink (identified by its symbolic name or
              numerical index) to the specified port (identified by its
              symbolic name).




oldconfig

 bindsym $mod1+slash exec  pactl set-sink-port 0 analog-output-headphones


bindsym $mod1+shift+slash exec  pactl set-sink-port 0 analog-output-speaker

 

sink new name is  SINK=alsa_output.pci-0000_00_1f.3.analog-stereo 

 

using proaudio sink 

  pactl set-sink-port alsa_output.pci-0000_00_1f.3.pro-output-0  analog-output-headphones

pactl set-sink-port alsa_output.pci-0000_00_1f.3.pro-output-0  analog-output-speaker 

 

 

nano ~/.local/bin/switch_output

--------------------------------------------------

 if [[ $(pactl list | grep "Active Port: analog-output") == *"headphones"* ]]; then
    pactl set-sink-port 0 analog-output-speaker
else
    pactl set-sink-port 0 analog-output-headphones
fi

------------------------------------------------------
set $r_vol exec  pkill -RTMIN+1 i3blocks

bindsym F9 exec switch_output  ; $r_vol

## my dell has free f9 without need to press fn key


##get active port

 pactl list | grep "Active Port: analog-output" | cut -d':' -f 2

 pactl list | grep "Active Port: analog-input" | cut -d':' -f 2

 


i3blocks volume 

--------------------------------------------

#!/bin/sh

# Prints the current volume or 🔇 if muted.
case $BLOCK_BUTTON in
         2) pamixer -t  >>/dev/null ;;
         4)  pamixer -i 5 >>/dev/null ;;
         5)  pamixer -d 5 >>/dev/null ;;
         6) foot -e "$EDITOR" "$0" ;;
 esac


vol=$(pamixer  --get-volume-human)
[ "$vol" = "muted" ] && echo 🔇 && exit


hed=$(pactl list | grep "Active Port: analog-output" | cut -d':' -f 2)
if [[ "$hed" == *"headphones"* ]]; then
 icon="🎧"
fi

if [[ "$hed" == *"speaker"* ]]; then
icon="🔉"
fi


echo "$icon $vol"

------------------------------------------------------------------------------------------------------------


pw-cli list-objects Node

pw-cli list-objects Device



src:

https://unix.stackexchange.com/questions/726288/having-trouble-using-cli-to-switch-between-playback-devices-with-pipewire

https://www.kailashkatheth.com.np/2021/06/headphoneearphone-switch-script.html

https://gist.github.com/miyl/40cdf1a66b360ad8ec0b19e2ffa56194 


Comments

Popular posts from this blog

sxhkd volume andbrightness config for dwm on void

xbps-install  sxhkd ------------ mkdir .config/sxhkd cd .config/sxhkd nano/vim sxhkdrc -------------------------------- XF86AudioRaiseVolume         amixer -c 1 -- sset Master 2db+ XF86AudioLowerVolume         amixer -c 1 -- sset Master 2db- XF86AudioMute         amixer -c 1 -- sset Master toggle alt + shift + Escape         pkill -USR1 -x sxhkd XF86MonBrightnessUp          xbacklight -inc 20 XF86MonBrightnessDown          xbacklight -dec 20 ------------------------------------------------------------- amixer -c card_no -- sset Interface volume run alsamixer to find card no and interface names xbps-install -S git git clone https://git.suckless.org/dwm xbps-install -S base-devel libX11-devel libXft-devel libXinerama-devel  vim config.mk # FREETYPEINC = ${X11INC}/freetype2 #comment for non-bsd make clean install   cp config.def.h config.h vim config.h xbps-install -S font-symbola #for emoji on statusbar support     void audio config xbps-i

Hidden Wiki

Welcome to The Hidden Wiki New hidden wiki url 2015 http://zqktlwi4fecvo6ri.onion Add it to bookmarks and spread it!!! Editor's picks Bored? Pick a random page from the article index and replace one of these slots with it. The Matrix - Very nice to read. How to Exit the Matrix - Learn how to Protect yourself and your rights, online and off. Verifying PGP signatures - A short and simple how-to guide. In Praise Of Hawala - Anonymous informal value transfer system. Volunteer Here are five different things that you can help us out with. Plunder other hidden service lists for links and place them here! File the SnapBBSIndex links wherever they go. Set external links to HTTPS where available, good certificate, and same content. Care to start recording onionland's history? Check out Onionland's Museum Perform Dead Services Duties. Introduction Points Ahmia.fi - Clearnet search engine for Tor Hidden Services (allows you

fix idm integration on chrome

Chrome Browser Integration I do not see IDM extension in Chrome extensions list. How can I install it?  How to configure IDM extension for Chrome? Please note that all IDM extensions that can be found in Google Store are fake and should not be used. You need to install IDM extension manually from IDM installation folder. Read in step 2 how to do it . 1. Please update IDM to the latest version by using  "IDM Help->Check for updates..."  menu item 2.  I don't see  "IDM Integration module"  extension in the list of extensions in  Chrome . How can I install it? Press on  Chrome  menu ( arrow 1  on the image), select  "Settings"  menu item ( arrow 2  on the image) and then select  "Extensions"  tab ( arrow 3  on the image). After this open IDM installation folder ( "C:\Program Files (x86)\Internet Download Manager"  by default,  arrow 4  on the image) and drag and drop  "IDMGCExt.crx"  ( arrow 5  on the image) file int