aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2018-07-14 16:07:01 +0200
committerAdrian Kummerlaender2018-07-14 16:07:01 +0200
commit7776e329779cf7f1ad4d9528302d8914a37c7dd9 (patch)
tree9070178f1e3c664cc2ee6e0061623ffda3f00295
parent9abc8a72d2c44e482af4cac2d3bcd9cae0e5503e (diff)
downloadnixos_home-7776e329779cf7f1ad4d9528302d8914a37c7dd9.tar
nixos_home-7776e329779cf7f1ad4d9528302d8914a37c7dd9.tar.gz
nixos_home-7776e329779cf7f1ad4d9528302d8914a37c7dd9.tar.bz2
nixos_home-7776e329779cf7f1ad4d9528302d8914a37c7dd9.tar.lz
nixos_home-7776e329779cf7f1ad4d9528302d8914a37c7dd9.tar.xz
nixos_home-7776e329779cf7f1ad4d9528302d8914a37c7dd9.tar.zst
nixos_home-7776e329779cf7f1ad4d9528302d8914a37c7dd9.zip
Wrap notify-send calls in XMonad
-rw-r--r--gui/conf/xmonad.hs15
1 files changed, 10 insertions, 5 deletions
diff --git a/gui/conf/xmonad.hs b/gui/conf/xmonad.hs
index 8f0cae4..490f22b 100644
--- a/gui/conf/xmonad.hs
+++ b/gui/conf/xmonad.hs
@@ -76,9 +76,12 @@ scratchpads = [ NS "terminal" "kitty --class=scratchterm" (className =? "scratch
(customFloating sideBarRight) ]
hostSpecificKeybindings host = case host of
- "asterix" -> [ ("M-i b" , spawn "notify-send Battery \"`acpi | cut -c 10-`\"")
- , ("M-i c" , spawn "notify-send \"`acpi --thermal | awk '{print $4}'`°C\" \"`cat /proc/acpi/ibm/fan | awk '/speed/{print $2}'` RPM\"") ]
- "obelix" -> [ ("M-i g" , spawn "notify-send GPU \"`nvidia-smi --query-gpu=name,temperature.gpu,utilization.gpu,utilization.memory --format=csv,noheader | awk -F',' '{print $1 \" running at\" $2 \"°C due to\" $3 \" load and\" $4 \" memory usage\"}'`\"") ]
+ "asterix" -> [ ("M-i b" , showNotification "Battery"
+ "`acpi | cut -c 10-`")
+ , ("M-i c" , showNotification "`acpi --thermal | awk '{print $4}'`°C"
+ "`cat /proc/acpi/ibm/fan | awk '/speed/{print $2}'` RPM") ]
+ "obelix" -> [ ("M-i g" , showNotification "GPU"
+ "`nvidia-smi --query-gpu=name,temperature.gpu,utilization.gpu,utilization.memory --format=csv,noheader | awk -F',' '{print $1 \" running at\" $2 \"°C due to\" $3 \" load and\" $4 \" memory usage\"}'`") ]
_ -> [ ]
commonKeybindings =
@@ -131,8 +134,8 @@ commonKeybindings =
, ("M-w h" , withFocused $ placeFloating sideBarLeft)
, ("M-w l" , withFocused $ placeFloating sideBarRight)
-- system information
- , ("M-i t" , spawn "notify-send \"`date +%T`\" \"`date +\"%Y-%m-%d\"`\"")
- , ("M-i l" , spawn "notify-send Load \"`cut -c -14 /proc/loadavg`\"")
+ , ("M-i t" , showNotification "`date +%T`" "`date +\"%Y-%m-%d\"`")
+ , ("M-i l" , showNotification "Load" "`cut -c -14 /proc/loadavg`")
-- system control
, ("M-c <Up>" , spawn "amixer sset Master 10%+")
, ("M-c <Down>" , spawn "amixer sset Master 10%-")
@@ -218,3 +221,5 @@ hideScreenBorder (RationalRect x0 y0 w h) = RationalRect (x0-(bw/sw)) (y0-(bw/sh
where bw = 6
sw = 1280
sh = 768
+
+showNotification title text = spawn ("notify-send \"" ++ title ++ "\" \"" ++ text ++ "\"")