Skip to content

Instantly share code, notes, and snippets.

View NishargShah's full-sized avatar
🙄
Eat Sleep Code Repeat

Nisharg Shah NishargShah

🙄
Eat Sleep Code Repeat
View GitHub Profile
@NishargShah
NishargShah / toggle-bluetooth-profile.sh
Last active January 10, 2022 11:19
Help to toggle sound profile from a2dp to hsp or hsp to a2dp
#!/bin/bash
SINK=$(pacmd list-cards | grep bluez)
MAC=${SINK:19:17}
SINK=$(pacmd list-sinks | grep index | grep -vw "index: 0")
INDEX=${SINK:11:2}
BT_SINK="bluez_card.$MAC"
A2DP="a2dp_sink"
HSP="headset_head_unit"
SINK=$(pacmd list-sinks | grep bluetooth.protocol)
@NishargShah
NishargShah / toggle-touchpad.sh
Created January 8, 2022 08:21
Help to toggle touchpad on/off
#!/bin/bash
device=11
state=`xinput list-props "$device" | grep "Device Enabled" | grep -o "[01]$"`
if [ $state == '1' ];then
xinput --disable $device
else
xinput --enable $device
fi
@NishargShah
NishargShah / toggle-bluetooth-device.sh
Last active January 10, 2022 11:18
Help to toggle sound device
#!/bin/bash
SINK=$(pacmd list-sinks | grep index)
INDEX_1=${SINK:11:2}
SINK=$(pacmd list-sinks | grep index | grep -vw "index: 1")
INDEX_2=${SINK:11:2}
SINK=$(pacmd list-sinks | grep "* index")
ACTIVE_SINK=${SINK:11:2}
if [ $ACTIVE_SINK = $INDEX_2 ]; then