From c274475635d410c0e9f812e71d20183cb923cd6b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 18 Feb 2024 13:22:42 +0100 Subject: misc updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- alsa-utils/Makefile | 28 ++++++++++++++++++++++++++++ alsa-utils/headphones | 5 +++++ alsa-utils/speakers | 5 +++++ alsa-utils/xinit | 6 ++++++ 4 files changed, 44 insertions(+) create mode 100644 alsa-utils/Makefile create mode 100755 alsa-utils/headphones create mode 100755 alsa-utils/speakers create mode 100644 alsa-utils/xinit (limited to 'alsa-utils') diff --git a/alsa-utils/Makefile b/alsa-utils/Makefile new file mode 100644 index 0000000..13cc906 --- /dev/null +++ b/alsa-utils/Makefile @@ -0,0 +1,28 @@ +.POSIX: + +XINITRC_ORDER = 90 + +install: + ../check-installed-shebang speakers + ../check-installed-shebang headphones + mkdir -p -- ~/.local/bin + test ! -e ~/.local/bin/speakers || test -L ~/.local/bin/speakers + ln -sf -- ~/.dotfiles/alsa-utils/speakers ~/.local/bin/speakers + test ! -e ~/.local/bin/headphones || test -L ~/.local/bin/headphones + ln -sf -- ~/.dotfiles/alsa-utils/headphones ~/.local/bin/headphones + mkdir -p -- ~/.config/X11/xinit/xinitrc.d + test ! -e ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-alsa-util || \ + test -L ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-alsa-util + ln -sf -- ~/.dotfiles/alsa-util/xinit ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-alsa-util + +uninstall: + +! ../check-installed alsa-utils + -unlink -- ~/.local/bin/speakers + -unlink -- ~/.local/bin/headphones + -unlink -- ~/.config/X11/xinit/xinitrc.d/$(XINITRC_ORDER)-alsa-util + -rmdir -- ~/.config/X11/xinit/xinitrc.d + -rmdir -- ~/.config/X11/xinit + -rmdir -- ~/.config/X11 + +clean: + @: diff --git a/alsa-utils/headphones b/alsa-utils/headphones new file mode 100755 index 0000000..59eb283 --- /dev/null +++ b/alsa-utils/headphones @@ -0,0 +1,5 @@ +#!/bin/dash +amixer -c "${MAIN_ALSA_CARD}" -- set Speaker '0%' mute +amixer -c "${MAIN_ALSA_CARD}" -- set PCM '15%' unmute +amixer -c "${MAIN_ALSA_CARD}" -- set Master '100%' unmute +amixer -c "${MAIN_ALSA_CARD}" -- set Headphone '100%' unmute diff --git a/alsa-utils/speakers b/alsa-utils/speakers new file mode 100755 index 0000000..0d238d3 --- /dev/null +++ b/alsa-utils/speakers @@ -0,0 +1,5 @@ +#!/bin/dash +amixer -c "${MAIN_ALSA_CARD}" -- set Headphone '0%' mute +amixer -c "${MAIN_ALSA_CARD}" -- set PCM '100%' unmute +amixer -c "${MAIN_ALSA_CARD}" -- set Master '100%' unmute +amixer -c "${MAIN_ALSA_CARD}" -- set Speaker '100%' unmute diff --git a/alsa-utils/xinit b/alsa-utils/xinit new file mode 100644 index 0000000..bd9b579 --- /dev/null +++ b/alsa-utils/xinit @@ -0,0 +1,6 @@ +# -*- shell-script -*- + +# Mute speakers and use headphones if using a work computer (TODO if on a laptop) +if iswork; then + headphones || : +fi -- cgit v1.2.3-70-g09d2