updated xmobar somewhat and trying to get conditional configs working

This commit is contained in:
Solomon Laing 2021-05-24 11:02:20 +09:30
parent 0e73c247e1
commit 9316f42d7d
5 changed files with 65 additions and 240 deletions

View File

@ -12,8 +12,7 @@ Config {
-- layout -- layout
, sepChar = "%" -- delineator between plugin names and straight text , sepChar = "%" -- delineator between plugin names and straight text
, alignSep = "}{" -- separator between left-right alignment , alignSep = "}{" -- separator between left-right alignment
, template = " <action=`xdotool key super+a`><icon=haskell_20.xpm/></action> %UnsafeStdinReader% <fc=#9da5ae>|</fc> %cpu% %memory% %dynnetwork% } \ , template = " <action=`xdotool key super+a`><icon=haskell_20.xpm/></action> %cpu% %memory% %dynnetwork% } %UnsafeStdinReader% { %date% <fc=#9da5ae>|</fc> %YPAD% <fc=#9da5ae>|</fc> %battery% <fc=#9da5ae>|</fc> %updates% %trayerpad%"
\{ %date% <fc=#9da5ae>|</fc> %YPAD% <fc=#9da5ae>|</fc> %battery% <fc=#9da5ae>|</fc> %updates% %trayerpad%"
} }
-- general behavior -- general behavior
@ -109,6 +108,8 @@ Config {
, "-L", "10", "-H", "80" , "-L", "10", "-H", "80"
, "-l", "#882410", "-h", "#95C05D" , "-l", "#882410", "-h", "#95C05D"
, "--", "-O", "Charging", "-o", "Battery" , "--", "-O", "Charging", "-o", "Battery"
-- , "-a", "notify-send -u critical 'Battery running out!!'"
-- , "-A", "10"
] 10 ] 10
-- Runs a standard shell command 'uname -r' to get kernel version -- Runs a standard shell command 'uname -r' to get kernel version
@ -125,5 +126,3 @@ Config {
] ]
} }

View File

@ -0,0 +1,46 @@
Config {
-- appearance
font = "xft:Fira Code:size=9:antialias=true:hinting=true"
, bgColor = "#121e32"
, fgColor = "#dfdfef"
, position = Top
, border = BottomB
, borderColor = "#121e32"
-- layout
, sepChar = "%" -- delineator between plugin names and straight text
, alignSep = "}{" -- separator between left-right alignment
, template = "} %UnsafeStdinReader% {"
}
-- general behavior
, lowerOnStart = True -- send to bottom of window stack on start
, hideOnStart = False -- start with window unmapped (hidden)
, allDesktops = True -- show on all desktops
, overrideRedirect = True -- set the Override Redirect flag (Xlib)
, pickBroadest = False -- choose widest display (multi-monitor)
, persistent = True -- enable/disable hiding (True = disabled)
-- plugins
-- Numbers can be automaticallJy colored according to their value. xmobar
-- decides color based on a three-tier/two-cutoff system, controlled by
-- command options:
-- --Low sets the low cutoff
-- --High sets the high cutoff
--
-- --low sets the color below --Low cutoff
-- --normal sets the color between --Low and --High cutoffs
-- --High sets the color above --High cutoff
--
-- The --template option controls how the plugin is displayed. Text
-- color can be set by enclosing in <fc></fc> tags. For more details
-- see http://projects.haskell.org/xmobar/#system-monitor-plugins.
, commands =
[
-- Prints out the left side items such as workspaces, layout, etc.
Run UnsafeStdinReader
]
}

View File

@ -1,110 +0,0 @@
loConfig {
-- appearance
font = "xft:Fira Code:size=14:bold:antialias=true:hinting=true"
, bgColor = "#14071F"
, fgColor = "#646464"
, position = Top
, border = BottomB
, borderColor = "#646464"
, iconRoot = "/home/solomon/.xmonad/xpm/" -- default: "."
-- layout
, sepChar = "%" -- delineator between plugin names and straight text
, alignSep = "}{" -- separator between left-right alignment
, template = " <action=`xdotool key super+p`><icon=haskell_20.xpm/></action> <fc=#f3617a>%cpu%</fc> <fc=#805a9b>|</fc> <fc=#b262cd>%memory%</fc> <fc=#805a9b>|</fc> <fc=#706bc2>%dynnetwork%</fc> }\
\{ <fc=#ee9a00>%date%</fc> <fc=#805a9b>|</fc> <fc=#b55322>%YPAD%</fc> <fc=#805a9b>|</fc> <fc=#882410>%kbd%</fc> <fc=#805a9b>|</fc> <fc=#6e1a11>%uname%</fc> %trayerpad%"
}
-- general behavior
, lowerOnStart = True -- send to bottom of window stack on start
, hideOnStart = False -- start with window unmapped (hidden)
, allDesktops = True -- show on all desktops
, overrideRedirect = True -- set the Override Redirect flag (Xlib)
, pickBroadest = False -- choose widest display (multi-monitor)
, persistent = True -- enable/disable hiding (True = disabled)
-- plugins
-- Numbers can be automatically colored according to their value. xmobar
-- decides color based on a three-tier/two-cutoff system, controlled by
-- command options:
-- --Low sets the low cutoff
-- --High sets the high cutoff
--
-- --low sets the color below --Low cutoff
-- --normal sets the color between --Low and --High cutoffs
-- --High sets the color above --High cutoff
--
-- The --template option controls how the plugin is displayed. Text
-- color can be set by enclosing in <fc></fc> tags. For more details
-- see http://projects.haskell.org/xmobar/#system-monitor-plugins.
, commands =
-- weather monitor
[ Run Weather "YPAD" ["--template" , "<station>: <tempC>°C"
, "--Low" , "10"
, "--High" , "25"
, "--normal" , "#95C05D"
, "--high" , "red"
, "--low" , "lightblue"
] 36000
-- -- network activity monitor
-- , Run Network "enp33s0" [ "--template" , "eth: <icon=net_up_20.xpm/><tx>kB/s <icon=net_down_20.xpm/><rx>kB/s"
-- , "--Low" , "100000" -- units: B/s
-- , "--High" , "500000" -- units: B/s
-- , "--low" , "#95C05D"
-- , "--normal" , "#ee9a00"
-- , "--high" , "#882410"
-- ] 10
-- , Run Network "wlp36s0" [ "--template" , "wlan: <icon=net_up_20.xpm/><tx>kB/s <icon=net_down_20.xpm/><rx>kB/s"
-- , "--Low" , "100000" -- units: B/s
-- , "--High" , "500000" -- units: B/s
-- , "--low" , "#95C05D"
-- , "--normal" , "#ee9a00"
-- , "--high" , "#882410"
-- ] 10
-- network activity monitor (dynamic interface resolution)
, Run DynNetwork [ "--template" , "<dev>: <icon=net_up_20.xpm/><tx>kB/s <icon=net_down_20.xpm/><rx>kB/s"
, "--Low" , "100000" -- units: B/s
, "--High" , "500000" -- units: B/s
, "--low" , "#95C05D"
, "--normal" , "#ee9a00"
, "--high" , "#882410"
] 10
-- cpu activity monitor
, Run Cpu [ "--template" , "cpu: <total>%"
, "--Low" , "30" -- units: %
, "--High" , "60" -- units: %
, "--low" , "#95C05D"
, "--normal" , "#ee9a00"
, "--high" , "#882410"
] 10
-- memory usage monitor
, Run Memory [ "--template" ,"mem: <usedratio>% (<used>Mb)"
, "--Low" , "20" -- units: %
, "--High" , "90" -- units: %
, "--low" , "#95C05D"
, "--normal" , "#ee9a00"
, "--high" , "#882410"
] 10
-- time and date indicator
-- (%F = y-m-d date, %a = day of week, %T = h:m:s time)
, Run Date "%a %d %b %Y %H:%M:%S" "date" 10
-- keyboard layout indicator
, Run Kbd [ ("us(dvorak)" , "DV")
, ("us" , "US")
]
-- Runs a standard shell command 'uname -r' to get kernel version
, Run Com "uname" ["-r"] "" 3600
-- Script that dynamically adjusts xmobar padding depending on number of trayer icons.
, Run Com "/home/solomon/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 20
]
}

View File

@ -1,124 +0,0 @@
Config {
-- appearance
font = "xft:Fira Code:size=14:bold:antialias=true:hinting=true"
, bgColor = "#14071F"
, fgColor = "#646464"
, position = Top
, border = BottomB
, borderColor = "#646464"
, iconRoot = "/home/solomon/.xmonad/xpm/" -- default: "."
-- layout
, sepChar = "%" -- delineator between plugin names and straight text
, alignSep = "}{" -- separator between left-right alignment
, template = " <action=`xdotool key super+p`><icon=haskell_20.xpm/></action> <fc=#f3617a>%cpu%</fc> <fc=#805a9b>|</fc> <fc=#b262cd>%memory%</fc> <fc=#805a9b>|</fc> <fc=#706bc2>%dynnetwork%</fc> <fc=#805a9b>|</fc> %UnsafeStdinReader% }\
\{ <fc=#ee9a00>%date%</fc> <fc=#805a9b>|</fc> <fc=#b55322>%YPAD%</fc> <fc=#805a9b>|</fc> <fc=#882410>%kbd%</fc> <fc=#805a9b>|</fc> <fc=#6e1a11>%uname%</fc> %trayerpad%"
}
-- general behavior
, lowerOnStart = True -- send to bottom of window stack on start
, hideOnStart = False -- start with window unmapped (hidden)
, allDesktops = True -- show on all desktops
, overrideRedirect = True -- set the Override Redirect flag (Xlib)
, pickBroadest = False -- choose widest display (multi-monitor)
, persistent = True -- enable/disable hiding (True = disabled)
-- plugins
-- Numbers can be automatically colored according to their value. xmobar
-- decides color based on a three-tier/two-cutoff system, controlled by
-- command options:
-- --Low sets the low cutoff
-- --High sets the high cutoff
--
-- --low sets the color below --Low cutoff
-- --normal sets the color between --Low and --High cutoffs
-- --High sets the color above --High cutoff
--
-- The --template option controls how the plugin is displayed. Text
-- color can be set by enclosing in <fc></fc> tags. For more details
-- see http://projects.haskell.org/xmobar/#system-monitor-plugins.
, commands =
-- weather monitor
[ Run Weather "YPAD" ["--template" , "<station>: <tempC>°C"
, "--Low" , "10"
, "--High" , "25"
, "--normal" , "#95C05D"
, "--high" , "red"
, "--low" , "lightblue"
] 36000
-- -- network activity monitor
-- , Run Network "enp33s0" [ "--template" , "eth: <icon=net_up_20.xpm/><tx>kB/s <icon=net_down_20.xpm/><rx>kB/s"
-- , "--Low" , "100000" -- units: B/s
-- , "--High" , "500000" -- units: B/s
-- , "--low" , "#95C05D"
-- , "--normal" , "#ee9a00"
-- , "--high" , "#882410"
-- ] 10
-- , Run Network "wlp36s0" [ "--template" , "wlan: <icon=net_up_20.xpm/><tx>kB/s <icon=net_down_20.xpm/><rx>kB/s"
-- , "--Low" , "100000" -- units: B/s
-- , "--High" , "500000" -- units: B/s
-- , "--low" , "#95C05D"
-- , "--normal" , "#ee9a00"
-- , "--high" , "#882410"
-- ] 10
Run BatteryP ["BAT0"]
["-t", "<acstatus><watts> (<left>%)",
"-L", "10", "-H", "80", "-p", "3",
"--", "-O", "<fc=green>On</fc> - ", "-i", "",
"-L", "-15", "-H", "-5",
"-l", "red", "-m", "blue", "-h", "green"
"-a", "notify-send -u critical 'Battery running out!!'",
"-A", "3"]
600
-- network activity monitor (dynamic interface resolution)
, Run DynNetwork [ "--template" , "<dev>: <icon=net_up_20.xpm/><tx>kB/s <icon=net_down_20.xpm/><rx>kB/s"
, "--Low" , "100000" -- units: B/s
, "--High" , "500000" -- units: B/s
, "--low" , "#95C05D"
, "--normal" , "#ee9a00"
, "--high" , "#882410"
] 10
-- cpu activity monitor
, Run Cpu [ "--template" , "cpu: <total>%"
, "--Low" , "30" -- units: %
, "--High" , "60" -- units: %
, "--low" , "#95C05D"
, "--normal" , "#ee9a00"
, "--high" , "#882410"
] 10
-- memory usage monitor
, Run Memory [ "--template" ,"mem: <usedratio>% (<used>Mb)"
, "--Low" , "20" -- units: %
, "--High" , "90" -- units: %
, "--low" , "#95C05D"
, "--normal" , "#ee9a00"
, "--high" , "#882410"
] 10
-- time and date indicator
-- (%F = y-m-d date, %a = day of week, %T = h:m:s time)
, Run Date "%a %d %b %Y %H:%M:%S" "date" 10
-- keyboard layout indicator
, Run Kbd [ ("us(dvorak)" , "DV")
, ("us" , "US")
]
-- Runs a standard shell command 'uname -r' to get kernel version
, Run Com "uname" ["-r"] "" 3600
-- Script that dynamically adjusts xmobar padding depending on number of trayer icons.
, Run Com "/home/solomon/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 20
-- Prints out the left side items such as workspaces, layout, etc.
-- The workspaces are 'clickable' in my configs.
--, Run UnsafeStdinReader
]
}

View File

@ -511,7 +511,19 @@ myStartupHook = do
-- Run xmonad with the settings you specify. No need to modify this. -- Run xmonad with the settings you specify. No need to modify this.
main :: IO () main :: IO ()
main = do main = do
xmproc <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc.hs"
-- need to learn more haskell but I want to do something like the following
-- need this because I share configs over computers
-- let toProc = ""
-- let host = spawnOnce "cat /etc/hostname"
-- if host isSubsequenceOf "archdesktop"
-- then let toProc = "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-desktop.hs"
-- else let toProc = "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-laptop.hs"
-- xmproc0 <- spawnPipe toProc
xmproc0 <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc-main.hs"
xmproc1 <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc-sub.hs"
xmproc2 <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc-sub.hs"
-- xmproc <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc0" -- xmproc <- spawnPipe "xmobar -x 0 /home/solomon/.config/xmobar/xmobarrc0"
-- xmproc <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc1" -- xmproc <- spawnPipe "xmobar -x 1 /home/solomon/.config/xmobar/xmobarrc1"
-- xmproc <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc2" -- xmproc <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc2"
@ -539,7 +551,9 @@ main = do
handleEventHook = myEventHook <+> fullscreenEventHook, handleEventHook = myEventHook <+> fullscreenEventHook,
-- logHook = myLogHook, -- logHook = myLogHook,
logHook = myLogHook <+> dynamicLogWithPP xmobarPP logHook = myLogHook <+> dynamicLogWithPP xmobarPP
{ ppOutput = hPutStrLn xmproc { ppOutput = \x -> hPutStrLn xmproc0 x
>> hPutStrLn xmproc1 x
>> hPutStrLn xmproc2 x
, ppCurrent = xmobarColor "#a8de45" "" . wrap "[" "]" -- Current workspace in xmobar , ppCurrent = xmobarColor "#a8de45" "" . wrap "[" "]" -- Current workspace in xmobar
, ppVisible = xmobarColor "#88ae55" "" . clickable -- Visible but not current workspace , ppVisible = xmobarColor "#88ae55" "" . clickable -- Visible but not current workspace
, ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar