update
This commit is contained in:
parent
e33dd9172f
commit
0d12ae9ef7
4 changed files with 56 additions and 4 deletions
47
.config/scripts/audioswitch.sh
Executable file
47
.config/scripts/audioswitch.sh
Executable file
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Use pactl to get the name and description pairs
|
||||||
|
output=$(pactl list sinks | grep -E 'Name:|Description:' | sed 's/^ *//')
|
||||||
|
|
||||||
|
# Initialize an empty array to store the sink info
|
||||||
|
declare -A sinks
|
||||||
|
|
||||||
|
# Initialize variables
|
||||||
|
name=""
|
||||||
|
description=""
|
||||||
|
i=0
|
||||||
|
|
||||||
|
# Loop through the lines of the output
|
||||||
|
while read -r line; do
|
||||||
|
if [[ "$line" =~ ^Name: ]]; then
|
||||||
|
name="${line#Name: }" # Extract the name
|
||||||
|
elif [[ "$line" =~ ^Description: ]]; then
|
||||||
|
description="${line#Description: }" # Extract the description
|
||||||
|
# Store the name and description in the associative array
|
||||||
|
sinks[$description]="$name" # Store name by description key
|
||||||
|
# Increment the index
|
||||||
|
((i++))
|
||||||
|
fi
|
||||||
|
done <<<"$output"
|
||||||
|
|
||||||
|
# Create wofi options string
|
||||||
|
options=$(printf "%s\n" "${!sinks[@]}")
|
||||||
|
|
||||||
|
# Run wofi and capture the selected description
|
||||||
|
selected_description=$(echo "$options" | wofi -dmenu -i -p "Select Audio Source" --columns 1)
|
||||||
|
|
||||||
|
# Check if wofi returned a value (user made a selection)
|
||||||
|
if [ -n "$selected_description" ]; then
|
||||||
|
|
||||||
|
# Get the corresponding name from the sinks array
|
||||||
|
selected_name="${sinks[$selected_description]}"
|
||||||
|
|
||||||
|
# Check if we found a name for the selected description
|
||||||
|
if [ -n "$selected_name" ]; then
|
||||||
|
pactl set-default-sink "$selected_name"
|
||||||
|
notify-send "Set audio device to: $selected_description"
|
||||||
|
# **********************************************************************
|
||||||
|
else
|
||||||
|
notify-send "Error: Could not find name for selected description."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
@ -19,6 +19,7 @@ set $files nautilus
|
||||||
set $browser flatpak run io.gitlab.librewolf-community
|
set $browser flatpak run io.gitlab.librewolf-community
|
||||||
set $bitwarden flatpak run com.bitwarden.desktop
|
set $bitwarden flatpak run com.bitwarden.desktop
|
||||||
set $menu wofi
|
set $menu wofi
|
||||||
|
set $scripts "$HOME/.config/scripts"
|
||||||
set $newScript "$HOME/.config/scripts/sessions.sh"
|
set $newScript "$HOME/.config/scripts/sessions.sh"
|
||||||
|
|
||||||
set $next_or_new swaymsg -r -t get_workspaces | jq -r --arg OUTPUT $(swaymsg -t get_outputs -r | jq -r '.[] | select(.focused == true) | .name') '(. | (max_by(.num) | .num)) as $max | [.[] | select(.output == $OUTPUT)] | (max_by(.num) | .num) as $maxOutput | (.[] | select(.focused == true) | .num) as $current | if $maxOutput > $current then "next_on_output" else $max + 1 end'
|
set $next_or_new swaymsg -r -t get_workspaces | jq -r --arg OUTPUT $(swaymsg -t get_outputs -r | jq -r '.[] | select(.focused == true) | .name') '(. | (max_by(.num) | .num)) as $max | [.[] | select(.output == $OUTPUT)] | (max_by(.num) | .num) as $maxOutput | (.[] | select(.focused == true) | .num) as $current | if $maxOutput > $current then "next_on_output" else $max + 1 end'
|
||||||
|
|
@ -93,6 +94,9 @@ bindsym $mod+control+n exec swaync-client -t -sw
|
||||||
# Start your goland
|
# Start your goland
|
||||||
bindsym $mod+n exec 'zsh -c ". $newScript new"'
|
bindsym $mod+n exec 'zsh -c ". $newScript new"'
|
||||||
bindsym $mod+Shift+n exec 'zsh -c ". $newScript goland-new"'
|
bindsym $mod+Shift+n exec 'zsh -c ". $newScript goland-new"'
|
||||||
|
|
||||||
|
# Audio Switch
|
||||||
|
bindsym $mod+Shift+s exec 'bash -c ". $scripts/audioswitch.sh"'
|
||||||
|
|
||||||
# Drag floating windows by holding down $mod and left mouse button.
|
# Drag floating windows by holding down $mod and left mouse button.
|
||||||
# Resize them with right mouse button + $mod.
|
# Resize them with right mouse button + $mod.
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
"default": ["\uf026", "\uf027", "\uf028"]
|
"default": ["\uf026", "\uf027", "\uf028"]
|
||||||
},
|
},
|
||||||
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
|
"on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle",
|
||||||
"on-click-right": "pavucontrol",
|
"on-click-right": "$HOME/.config/scripts/audioswitch.sh",
|
||||||
"format-muted": "\uf00d {volume}%"
|
"format-muted": "\uf00d {volume}%"
|
||||||
},
|
},
|
||||||
"tray": {
|
"tray": {
|
||||||
|
|
|
||||||
7
.zshrc
7
.zshrc
|
|
@ -92,9 +92,10 @@ bindkey -e
|
||||||
bindkey '^p' history-search-backward
|
bindkey '^p' history-search-backward
|
||||||
bindkey '^n' history-search-forward
|
bindkey '^n' history-search-forward
|
||||||
bindkey '^[w' kill-region
|
bindkey '^[w' kill-region
|
||||||
bindkey "^[[1~" beginning-of-line
|
bindkey "^[n" beginning-of-line
|
||||||
bindkey "^[[4~" end-of-line
|
bindkey "^[." end-of-line
|
||||||
bindkey '^[[3~' delete-char
|
bindkey "^[l" forward-word
|
||||||
|
bindkey "^[h" backward-word
|
||||||
|
|
||||||
# History
|
# History
|
||||||
HISTSIZE=5000
|
HISTSIZE=5000
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue