Added pulseaudio sink toggler

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2024-10-22 06:42:24 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2024-10-22 06:42:24 +0200
Commit c7bf7a17a4d523b040b72adce33acdbe95840127 (patch)
-rw-r--r-- i3config 6
-rwxr-xr-x shenanigans.sh 28
2 files changed, 30 insertions, 4 deletions
diff --git a/i3config b/i3config
...
204
    urgent_workspace   #900000 #900000 #FFFFFF
204
    urgent_workspace   #900000 #900000 #FFFFFF
205
    binding_mode       #900000 #900000 #FFFFFF
205
    binding_mode       #900000 #900000 #FFFFFF
206
  }
206
  }
207
  status_command i3status
207
  # status_command i3status
  
208
  status_command i3blocks
208
}
209
}
209
  
210
  
210
focus_follows_mouse no
211
focus_follows_mouse no
  
212
hide_edge_borders both
211
exec --no-startup-id picom --backend glx --vsync -b
213
exec --no-startup-id picom --backend glx --vsync -b
212
bindsym --release $mod+z exec scrot -s - | xclip -selection clipboard -target image/png
214
bindsym --release $mod+z exec scrot -s - | xclip -selection clipboard -target image/png
213
hide_edge_borders both
215
bindsym --release $mod+p exec --no-startup-id bash -c 'source ~/.bashrc && togglesink'
214
  
216
  
diff --git a/shenanigans.sh b/shenanigans.sh
...
98
	cd $CWD
98
	cd $CWD
99
}
99
}
100
  
100
  
  
101
# Simple ticket system based on https://github.com/mitjafelicijan/ticket.
101
export TICKETS=~/Vault/tickets
102
export TICKETS=~/Vault/tickets
102
tt() { # https://github.com/mitjafelicijan/ticket
103
tt() {
103
	if [ "$(uname -s)" != "Linux" ]; then
104
	if [ "$(uname -s)" != "Linux" ]; then
104
		printf "Currently only Linux is supported.\n"
105
		printf "Currently only Linux is supported.\n"
105
		return 1
106
		return 1
...
128
			printf "status: open\n" >> $ticket_file
129
			printf "status: open\n" >> $ticket_file
129
			printf "title: ?\n" >> $ticket_file
130
			printf "title: ?\n" >> $ticket_file
130
			printf "====\n" >> $ticket_file
131
			printf "====\n" >> $ticket_file
131
			printf "Describe your problem here\n" >> $ticket_file
132
			printf "Description...\n" >> $ticket_file
132
			$EDITOR $ticket_file
133
			$EDITOR $ticket_file
133
			;;
134
			;;
134
		-o|-open)
135
		-o|-open)
...
172
	esac
173
	esac
173
}
174
}
174
  
175
  
  
176
# Toggles between pulseaudio sinks in round-robin.
  
177
togglesink() {
  
178
	sinks=($(pactl list short sinks | awk '{print $2}'))
  
179
	current_sink=$(pactl get-default-sink)
  
180
	current_index=-1
  
181
  
  
182
	for i in "${!sinks[@]}"; do
  
183
		if [[ "${sinks[$i]}" == "$current_sink" ]]; then
  
184
			current_index=$i
  
185
			break
  
186
		fi
  
187
	done
  
188
  
  
189
	if [[ $current_index -eq -1 ]]; then
  
190
		next_index=0
  
191
	else
  
192
		next_index=$(( (current_index + 1) % ${#sinks[@]} ))
  
193
	fi
  
194
  
  
195
	pactl set-default-sink "${sinks[$next_index]}"
  
196
	notify-send "Switched to sink: ${sinks[$next_index]}"
  
197
}
  
198