From 7afa985b0772506ff4075e6671118cc15b92984e Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 31 Aug 2021 13:56:09 +0800 Subject: [PATCH] feat: stop/resume mpd playing inbetween locking --- bin/lock.sh | 10 ++++++++++ gui/dwm/autostart | 2 +- gui/sysutils.sh | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 bin/lock.sh diff --git a/bin/lock.sh b/bin/lock.sh new file mode 100755 index 0000000..f5e9089 --- /dev/null +++ b/bin/lock.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +if mpc status | grep -F '[playing]'; then + mpc pause + RESTORE=1 +fi +slock +if [ "$RESTORE" = 1 ]; then + mpc play +fi diff --git a/gui/dwm/autostart b/gui/dwm/autostart index 830ef47..e9f3ad4 100755 --- a/gui/dwm/autostart +++ b/gui/dwm/autostart @@ -10,7 +10,7 @@ statusbar xset s off xset dpms 300 300 300 killall xss-lock -xss-lock "$(command -v slock)" & +xss-lock "$(command -v lock.sh)" & launchapp () { ! command -v "$1" >/dev/null && return # command doesn't exist diff --git a/gui/sysutils.sh b/gui/sysutils.sh index 1a6869c..d391f04 100755 --- a/gui/sysutils.sh +++ b/gui/sysutils.sh @@ -60,6 +60,10 @@ case "$PM" in bluez bluez-utils blueman sudo systemctl enable bluetooth sudo systemctl start bluetooth + # bluetoothctl devices + # bluetoothctl pair + # bluetoothctl trust + # bluetoothctl connect fi if is_laptop; then sudo pacman -S --noconfirm --needed \