aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-10 04:53:57 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-10 04:53:57 +0200
commit5f97842b01d98c586d3b6bc0834ec6704a2b1d3a (patch)
tree3e08d8a58de90ca6f1879a1c08d631105e313171
parentc9a38b22e7b5ea507352a170fd4cf3ea73acc2cd (diff)
downloaddotfiles-5f97842b01d98c586d3b6bc0834ec6704a2b1d3a.tar.gz
dotfiles-5f97842b01d98c586d3b6bc0834ec6704a2b1d3a.tar.bz2
dotfiles-5f97842b01d98c586d3b6bc0834ec6704a2b1d3a.zip
Added notification on volume and backlight change
-rwxr-xr-xbin/backlight-ctl11
-rwxr-xr-xbin/volume-ctl12
-rwxr-xr-xinstall1
-rw-r--r--xmonad.hs16
4 files changed, 32 insertions, 8 deletions
diff --git a/bin/backlight-ctl b/bin/backlight-ctl
new file mode 100755
index 0000000..7153276
--- /dev/null
+++ b/bin/backlight-ctl
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[ "$#" -ne 1 ] && exit 1;
+
+case "$1" in
+ "up") xbacklight -inc 5 ;;
+ "down") xbacklight -dec 5 ;;
+ *) exit 1 ;;
+esac
+
+notify-send "backlight $(xbacklight | cut -d '.' -f 1)"
diff --git a/bin/volume-ctl b/bin/volume-ctl
new file mode 100755
index 0000000..7e3ec83
--- /dev/null
+++ b/bin/volume-ctl
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+[ "$#" -ne 1 ] && exit 1;
+
+case "$1" in
+ "up") pulseaudio-ctl up ;;
+ "down") pulseaudio-ctl down ;;
+ "mute") pulseaudio-ctl mute ;;
+ *) exit 1 ;;
+esac
+
+notify-send "volume $(pulseaudio-ctl full-status | cut -d ' ' -f 1)"
diff --git a/install b/install
index 93ea77a..9106ed2 100755
--- a/install
+++ b/install
@@ -47,6 +47,7 @@ create_dotfile_link_same .newsboat/config
# create_dotfile_link_same slock/config.def.h
+ln -sv "$DOTDIR/bin" "$HOME/bin"
###############################################################################
# dependencies
diff --git a/xmonad.hs b/xmonad.hs
index 1730b3c..566c332 100644
--- a/xmonad.hs
+++ b/xmonad.hs
@@ -33,14 +33,14 @@ myLayouts = tiledBigMaster -- bigger master for code and smaller slave fo
myManageHook = insertPosition End Newer -- insert new window at the end of the current layout
-myKeys = [ ("<XF86AudioRaiseVolume>", spawn "pulseaudio-ctl up") -- volume up
- , ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down") -- volume down
- , ("<XF86AudioMute>", spawn "pulseaudio-ctl mute") -- volume mute
- , ("<XF86MonBrightnessUp>", spawn "light -A 5") -- backlight up
- , ("<XF86MonBrightnessDown>", spawn "light -U 5") -- backlight down
- , ("<XF86ScreenSaver>", spawn "slock") -- lock screen
-
- , ("M-o", spawn "~/git/dotfiles/bin/project-open") -- TODO could could be generalized
+myKeys = [ ("<XF86AudioRaiseVolume>", spawn "~/bin/volume-ctl up")
+ , ("<XF86AudioLowerVolume>", spawn "~/bin/volume-ctl down")
+ , ("<XF86AudioMute>", spawn "~/bin/volume-ctl mute")
+ , ("<XF86MonBrightnessUp>", spawn "~/bin/backlight-ctl up")
+ , ("<XF86MonBrightnessDown>", spawn "~/bin/backlight-ctl down")
+ , ("<XF86ScreenSaver>", spawn "slock")
+
+ , ("M-o", spawn "~/bin/project-open")
, ("M-S-o", spawn "cd ~/test && st")
, ("M-d", spawn "cd ~/Downloads && st")
, ("M-m", spawn "st -e mocp")