xmobar - audio

This commit is contained in:
2024-03-07 20:45:47 +01:00
parent c90ff7fa3e
commit e890e496bd
5 changed files with 37 additions and 21 deletions

View File

@@ -12,5 +12,5 @@
};
};
home.packages = [ pkgs.xmobar ];
home.packages = with pkgs; [ xmobar maim ];
}

View File

@@ -0,0 +1,22 @@
Status=$(pulseaudio-ctl full-status)
Volume=$(cut -d ' ' -f 1 <<<$Status)
Mute=$(cut -d ' ' -f 2 <<<$Status)
Microphone=$(cut -d ' ' -f 3 <<<$Status)
if [[ $Mute == "yes" ]]; then
Symbol="\xe04f"
else
if [[ $Volume -le 50 ]]; then
Symbol="\xe04d"
else
Symbol="\xe050"
fi
fi
if [[ $Microphone == *"yes"* ]]; then
MicOut="\xe02b"
else
MicOut="\xe029"
fi
echo "<fc=#db4d65><fn=1>$Symbol</fn></fc> $Volume% <fc=#db4d65><fn=1>$MicOut</fn></fc>"

View File

@@ -3,7 +3,7 @@ import Xmobar
config :: Config
config =
defaultConfig
{ font = "Fira Code"
{ font = "Fira Code 9"
, position = TopH 30
, borderColor = "#402339"
, border = FullB
@@ -13,6 +13,7 @@ config =
, commands =
[
Run $ Com "./scripts/backlight.sh" [] "backlight" 10
Run $ Com "./scripts/audio.sh" [] "audio" 10
Run $ Cpu
[
"--template", "<fc=#a9a1e1><fn=1>\xf085</fn></fc> <total>%"
@@ -38,7 +39,7 @@ config =
, "--"
, "--on", "<fc=#5c0714><fn=1>\xe050</fn>>/fc> <volumestatus>"
]
, Run $ Date "<fc=#ECBE7B><fn=1>\xf017</fn></fc> %d.%m.%y %H:%M" "date" 300
, Run $ Date "<fc=#ECBE7B><fn=1>\xf017</fn></fc> %a %d.%m.%y %H:%M" "date" 300
, Run $ DynNetwork
[
"-t","<fc=#4db5bd><fn=1>\xf063</fn></fc> <rx> <fc=#c678dd><fn=1>\xf062</fn></fc> <tx>"
@@ -68,7 +69,7 @@ config =
]
, sepChar = "%"
, alignSep = "}{"
, template = "%XMonadLog% }{ %backlight% | %cpu% | %memory% | %battery% | %dynnetwork% | %date% "
, template = "%XMonadLog% }{ %audio% | %backlight% | %cpu% | %memory% | %battery% | %dynnetwork% | %date% "
}
main :: IO ()

View File

@@ -11,6 +11,7 @@ import XMonad.Util.ClickableWorkspaces
import XMonad.Util.Loggers
import Data.ByteString (maximum)
import Text.XHtml (gray)
import Distribution.Compat.Prelude (print)
main = xmonad . ewmhFullscreen . ewmh . withEasySB (statusBarProp "xmobar" (pure myXmobarPP)) defToggleStrutsKey $ myconfig
@@ -24,14 +25,19 @@ myconfig = def
}
`additionalKeysP`
[
-- System
("M-p", spawn "rofi -show \"drun\"")
, ("<print>", spawn "maim --format=png \"/home/elias/Pictures/screenshot-$(date -u +'%Y-%m-%d-%H:%M:%S.png')\"")
--Program
, ("M-c", spawn "firefox")
-- Brightness
, ("<XF86MonBrightnessUp>", spawn "xbacklight -inc 10")
, ("<XF86MonBrightnessDown>", spawn "xbacklight -dec 10")
--, ("<XF86AudioMute>", spawn "wpctl set-mute 58 toggle")
--, ("<XF86AudioRaiseVolume>", spawn "wpctl set-volume 58 0.05+")
--, ("<XF86AudioLowerVolume>", spawn "wpctl set-volume 58 0.05-")
--, ("<XF86AudioMicMute>", spawn "wpctl set-mute 52 toggle")
-- Audio
, ("<XF86AudioMute>", spawn "pulseaudio-ctl mute")
, ("<XF86AudioRaiseVolume>", spawn "pulseaudio-ctl up 5")
, ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down 5")
, ("<XF86AudioMicMute>", spawn "pulseaudio-ctl mute-input")
]
`removeKeysP` []