From 9316f42d7d92a276b188166af85f78b3565b84d4 Mon Sep 17 00:00:00 2001 From: Solomon Laing Date: Mon, 24 May 2021 11:02:20 +0930 Subject: [PATCH] updated xmobar somewhat and trying to get conditional configs working --- .../xmobar/{xmobarrc.hs => xmobarrc-main.hs} | 7 +- .config/xmobar/xmobarrc-sub.hs | 46 +++++++ .config/xmobar/xmobarrc.save | 110 ---------------- .config/xmobar/xmobarrc.save.1 | 124 ------------------ .xmonad/xmonad.hs | 18 ++- 5 files changed, 65 insertions(+), 240 deletions(-) rename .config/xmobar/{xmobarrc.hs => xmobarrc-main.hs} (95%) create mode 100644 .config/xmobar/xmobarrc-sub.hs delete mode 100644 .config/xmobar/xmobarrc.save delete mode 100644 .config/xmobar/xmobarrc.save.1 diff --git a/.config/xmobar/xmobarrc.hs b/.config/xmobar/xmobarrc-main.hs similarity index 95% rename from .config/xmobar/xmobarrc.hs rename to .config/xmobar/xmobarrc-main.hs index 0f0dd2d..b35ebe5 100644 --- a/.config/xmobar/xmobarrc.hs +++ b/.config/xmobar/xmobarrc-main.hs @@ -12,8 +12,7 @@ Config { -- layout , sepChar = "%" -- delineator between plugin names and straight text , alignSep = "}{" -- separator between left-right alignment - , template = " %UnsafeStdinReader% | %cpu% %memory% %dynnetwork% } \ - \{ %date% | %YPAD% | %battery% | %updates% %trayerpad%" + , template = " %cpu% %memory% %dynnetwork% } %UnsafeStdinReader% { %date% | %YPAD% | %battery% | %updates% %trayerpad%" } -- general behavior @@ -109,6 +108,8 @@ Config { , "-L", "10", "-H", "80" , "-l", "#882410", "-h", "#95C05D" , "--", "-O", "Charging", "-o", "Battery" + -- , "-a", "notify-send -u critical 'Battery running out!!'" + -- , "-A", "10" ] 10 -- Runs a standard shell command 'uname -r' to get kernel version @@ -125,5 +126,3 @@ Config { ] } - - diff --git a/.config/xmobar/xmobarrc-sub.hs b/.config/xmobar/xmobarrc-sub.hs new file mode 100644 index 0000000..da9145d --- /dev/null +++ b/.config/xmobar/xmobarrc-sub.hs @@ -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 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 + + ] + } diff --git a/.config/xmobar/xmobarrc.save b/.config/xmobar/xmobarrc.save deleted file mode 100644 index b72ecdc..0000000 --- a/.config/xmobar/xmobarrc.save +++ /dev/null @@ -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 = " %cpu% | %memory% | %dynnetwork% }\ - \{ %date% | %YPAD% | %kbd% | %uname% %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 tags. For more details - -- see http://projects.haskell.org/xmobar/#system-monitor-plugins. - , commands = - -- weather monitor - [ Run Weather "YPAD" ["--template" , ": °C" - , "--Low" , "10" - , "--High" , "25" - , "--normal" , "#95C05D" - , "--high" , "red" - , "--low" , "lightblue" - ] 36000 - - -- -- network activity monitor - -- , Run Network "enp33s0" [ "--template" , "eth: kB/s kB/s" - -- , "--Low" , "100000" -- units: B/s - -- , "--High" , "500000" -- units: B/s - -- , "--low" , "#95C05D" - -- , "--normal" , "#ee9a00" - -- , "--high" , "#882410" - -- ] 10 - -- , Run Network "wlp36s0" [ "--template" , "wlan: kB/s 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" , ": kB/s 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: %" - , "--Low" , "30" -- units: % - , "--High" , "60" -- units: % - , "--low" , "#95C05D" - , "--normal" , "#ee9a00" - , "--high" , "#882410" - ] 10 - - -- memory usage monitor - , Run Memory [ "--template" ,"mem: % (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 - - ] - } diff --git a/.config/xmobar/xmobarrc.save.1 b/.config/xmobar/xmobarrc.save.1 deleted file mode 100644 index 2c2d330..0000000 --- a/.config/xmobar/xmobarrc.save.1 +++ /dev/null @@ -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 = " %cpu% | %memory% | %dynnetwork% | %UnsafeStdinReader% }\ - \{ %date% | %YPAD% | %kbd% | %uname% %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 tags. For more details - -- see http://projects.haskell.org/xmobar/#system-monitor-plugins. - , commands = - -- weather monitor - [ Run Weather "YPAD" ["--template" , ": °C" - , "--Low" , "10" - , "--High" , "25" - , "--normal" , "#95C05D" - , "--high" , "red" - , "--low" , "lightblue" - ] 36000 - - -- -- network activity monitor - -- , Run Network "enp33s0" [ "--template" , "eth: kB/s kB/s" - -- , "--Low" , "100000" -- units: B/s - -- , "--High" , "500000" -- units: B/s - -- , "--low" , "#95C05D" - -- , "--normal" , "#ee9a00" - -- , "--high" , "#882410" - -- ] 10 - -- , Run Network "wlp36s0" [ "--template" , "wlan: kB/s kB/s" - -- , "--Low" , "100000" -- units: B/s - -- , "--High" , "500000" -- units: B/s - -- , "--low" , "#95C05D" - -- , "--normal" , "#ee9a00" - -- , "--high" , "#882410" - -- ] 10 - -Run BatteryP ["BAT0"] - ["-t", " (%)", - "-L", "10", "-H", "80", "-p", "3", - "--", "-O", "On - ", "-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" , ": kB/s 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: %" - , "--Low" , "30" -- units: % - , "--High" , "60" -- units: % - , "--low" , "#95C05D" - , "--normal" , "#ee9a00" - , "--high" , "#882410" - ] 10 - - -- memory usage monitor - , Run Memory [ "--template" ,"mem: % (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 - - ] - } diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs index 80c3df5..e30cd1e 100644 --- a/.xmonad/xmonad.hs +++ b/.xmonad/xmonad.hs @@ -511,7 +511,19 @@ myStartupHook = do -- Run xmonad with the settings you specify. No need to modify this. main :: IO () 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 1 /home/solomon/.config/xmobar/xmobarrc1" -- xmproc <- spawnPipe "xmobar -x 2 /home/solomon/.config/xmobar/xmobarrc2" @@ -539,7 +551,9 @@ main = do handleEventHook = myEventHook <+> fullscreenEventHook, -- logHook = myLogHook, 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 , ppVisible = xmobarColor "#88ae55" "" . clickable -- Visible but not current workspace , ppHidden = xmobarColor "#82AAFF" "" . wrap "*" "" . clickable -- Hidden workspaces in xmobar