add audio controls

This commit is contained in:
Sakooooo 2023-07-30 20:17:55 +03:00
parent 33c57baa91
commit e658ae93f9
Signed by: sako
GPG key ID: 3FD715D87D7725E0
2 changed files with 13 additions and 0 deletions

View file

@ -1,5 +1,9 @@
/* See LICENSE file for copyright and license details. */
/* includes */
#include <X11/XF86keysym.h>
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int gappx = 15; /* gaps between windows */
@ -82,6 +86,10 @@ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn()
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *roficmd[] = { "rofi", "-show-icons", "-show", "drun", NULL };
static const char *termcmd[] = { "kitty", NULL };
// audio
static const char *upvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "+5%", NULL };
static const char *downvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "-5%", NULL };
static const char *mutevol[] = { "/usr/bin/pactl", "set-sink-mute", "0", "toggle",
static const Key keys[] = {
/* modifier key function argument */
@ -111,6 +119,10 @@ static const Key keys[] = {
{ MODKEY, XK_minus, setgaps, {.i = -1 } },
{ MODKEY, XK_equal, setgaps, {.i = +1 } },
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
// audio
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = downvol } },
{ 0, XF86XK_AudioMute, spawn, {.v = mutevol } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = upvol } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)

View file

@ -4,6 +4,7 @@ static const Block blocks[] = {
{"Mem:", "free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g", 30, 0},
{"", "date '+%b %d (%a) %I:%M%p'", 5, 0},
{"Bat:", "cat /sys/class/power_supply/BAT1/capacity", 30, 0},
{"Vol:", "pamixer --get-volume-human", 30, 0},
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.