aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nnoll523@gmail.com>2020-06-26 19:40:25 +0200
committerNicholas Noll <nnoll523@gmail.com>2020-06-26 19:40:25 +0200
commit476516d4b144e6bcd9211e0d23c829f34c0b7833 (patch)
treec7e5a36d4d89b131573b02bb92995ddf3f33d63a
parenta0655a2088282eedc184dc3195b2eda0a01f2c83 (diff)
feat: simplified volume command
-rwxr-xr-xbin/vol17
-rw-r--r--sys/cmd/dwm/client.c2
-rw-r--r--sys/cmd/dwm/config.h6
3 files changed, 21 insertions, 4 deletions
diff --git a/bin/vol b/bin/vol
new file mode 100755
index 0000000..ea7c7a0
--- /dev/null
+++ b/bin/vol
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+case $1 in
+ mute)
+ pactl set-sink-mute @DEFAULT_SINK@ toggle
+ ;;
+ [+-]*%)
+ pactl set-sink-volume @DEFAULT_SINK@ $1
+ ;;
+ *)
+ exit 1
+esac
+
+PID=$(ps -a | awk '/status/ {print $1; exit}')
+if [ $PID ]; then
+ kill -35 $PID
+fi
diff --git a/sys/cmd/dwm/client.c b/sys/cmd/dwm/client.c
index 50d4da9..383dca9 100644
--- a/sys/cmd/dwm/client.c
+++ b/sys/cmd/dwm/client.c
@@ -362,7 +362,7 @@ setfocus(Client *c)
void
setfullscreen(Client *c, int fullscreen)
{
- static ulong opacity = 0xFFFFFFFFul;
+ static uint32 opacity = 0xFFFFFFFFul;
if (fullscreen && !c->isfullscreen) {
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (uchar*)&netatom[NetWMFullscreen], 1);
diff --git a/sys/cmd/dwm/config.h b/sys/cmd/dwm/config.h
index 6875304..e0183b6 100644
--- a/sys/cmd/dwm/config.h
+++ b/sys/cmd/dwm/config.h
@@ -60,9 +60,9 @@ static Layout layouts[] = {
static char *menucmd[] = { "menu_run", nil };
static char *termcmd[] = { "term", nil };
static char *webscmd[] = { "qutebrowser", nil };
-static char *upvolcmd[] = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "+5%", nil };
-static char *lovolcmd[] = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "-5%", nil };
-static char *novolcmd[] = { "pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", nil };
+static char *upvolcmd[] = { "vol", "+5%", nil };
+static char *lovolcmd[] = { "vol", "-5%", nil };
+static char *novolcmd[] = { "vol", "mute", nil };
#define XK_lovol XF86XK_AudioLowerVolume
#define XK_upvol XF86XK_AudioRaiseVolume