Selaa lähdekoodia

Merge pull request #85 from KlemensMaentele/test

Added audio multimedia keys
siduck 3 vuotta sitten
vanhempi
sitoutus
7b530e23d1
3 muutettua tiedostoa jossa 32 lisäystä ja 15 poistoa
  1. 6 0
      chadwm/config.def.h
  2. 8 8
      scripts/autostart
  3. 18 7
      scripts/bar.sh

+ 6 - 0
chadwm/config.def.h

@@ -126,9 +126,15 @@ static const char *term[]  = {  "st", NULL }; // change this to your term
 static const char *rofi[] = {"rofi", "-show", "drun", NULL };
 static const char *xi[] = {"xbacklight", "-inc", "7", NULL};
 static const char *xd[] = {"xbacklight", "-dec", "7", NULL};
+static const char *rv[] = {"pamixer", "-i", "5", NULL};
+static const char *lv[] = {"pamixer", "-d", "5", NULL};
+static const char *tv[] = {"pamixer", "-t", NULL};
 
 static Key keys[] = {
     /* modifier                         key         function        argument */
+    {0,                     XF86XK_AudioMute,       spawn,          {.v = tv}},
+    {0,              XF86XK_AudioRaiseVolume,       spawn,          {.v = rv}},
+    {0,              XF86XK_AudioLowerVolume,       spawn,          {.v = lv}},
     {0,             XF86XK_MonBrightnessDown,       spawn,          {.v = xd}},
     {0,               XF86XK_MonBrightnessUp,       spawn,          {.v = xi}},
     {MODKEY|ControlMask,                XK_u,       spawn,

+ 8 - 8
scripts/autostart

@@ -1,13 +1,13 @@
-#!/bin/sh
+!/bin/sh
 
 # this is just an example!
 # add your autostart stuffs here
-xbacklight -set 5 &
-xmodmap ~/.xmodmap-sid &
-picom &
-xrdb merge ~/.Xresources &
-feh --bg-fill ~/Pictures/wall/gruvchad.png &
-
+xrandr --output DP1 --auto --right-of LVDS1 &
+xbacklight -set 100 &
+xmodmap ~/.Xmodmap
+#xrdb merge ~/.Xresources &
+feh --bg-fill ~/Pictures/wall/wall.png &
+xset r rate 200 50 &
 # run bar script and dwm ( do not remove this )
-~/.config/chadwm/scripts/./bar.sh &
+bash ~/.config/chadwm/scripts/./bar.sh &
 dwm

+ 18 - 7
scripts/bar.sh

@@ -23,18 +23,23 @@ pkg_updates() {
 	if [ -z "$updates" ]; then
 		printf "^c$green^  Fully Updated"
 	else
-		printf "^c$green^  $updates"" updates"
+		printf "^c$red^  $updates"" updates"
 	fi
 }
 
 battery() {
-	get_capacity="$(cat /sys/class/power_supply/BAT1/capacity)"
-	printf "^c$blue^   $get_capacity"
+	get_capacity="$(cat /sys/class/power_supply/BAT0/capacity)"
+	get_status="$(cat /sys/class/power_supply/BAT0/status)"
+	if [ $get_status == 'Discharging' ]; then
+		printf "^c$blue^  $get_capacity"
+	else
+		printf "^c$blue^  $get_capacity"
+	fi
 }
 
 brightness() {
-	printf "^c$red^   "
-	printf "^c$red^%.0f\n" $(cat /sys/class/backlight/*/brightness)
+	printf "^c$red^  "
+	printf "^c$red^%.0f\n" $(cat /sys/class/backlight/acpi_video0/brightness)
 }
 
 mem() {
@@ -51,7 +56,13 @@ wlan() {
 
 clock() {
 	printf "^c$black^ ^b$darkblue^ 󱑆 "
-	printf "^c$black^^b$blue^ $(date '+%I:%M %p')  "
+	printf "^c$black^^b$blue^ $(date '+%H:%M %a %d %b %Y')  "
+}
+
+volume() {
+        volume=$(pamixer --get-volume)
+        printf "^c$black^^b$darkblue^  "
+        printf "^c$black^^b$blue^ $volume"
 }
 
 while true; do
@@ -59,5 +70,5 @@ while true; do
 	[ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates)
 	interval=$((interval + 1))
 
-	sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
+	sleep 1 && xsetroot -name "$(volume) $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)"
 done