From 41c35f8101811fe5f53afce597961c7eaf1649f8 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 16 Jul 2021 05:10:11 +0200 Subject: [PATCH] Rewrite xmobar config --- home/.config/xmobar/multi_mon.sh | 2 +- home/.config/xmobar/xmobarrc.hs | 147 +++++++++++++++++++++---------- home/.config/xmobar/xmobarrc0 | 147 +++++++++++++++++++++---------- home/.config/xmobar/xmobarrc1 | 143 +++++++++++++++++++++--------- 4 files changed, 302 insertions(+), 137 deletions(-) diff --git a/home/.config/xmobar/multi_mon.sh b/home/.config/xmobar/multi_mon.sh index 7fa76bf..b14aae7 100755 --- a/home/.config/xmobar/multi_mon.sh +++ b/home/.config/xmobar/multi_mon.sh @@ -12,7 +12,7 @@ WORK_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/xmobar" make_position_line(){ xpos=$(($1 * $WIDTH)) - line=", position = Static { xpos = $xpos, ypos = 0, width = $WIDTH, height = 24 }" + line="position = Static { xpos = $xpos, ypos = 0, width = $WIDTH, height = 24 }," echo "$line" } diff --git a/home/.config/xmobar/xmobarrc.hs b/home/.config/xmobar/xmobarrc.hs index 280d6a1..e0e6435 100644 --- a/home/.config/xmobar/xmobarrc.hs +++ b/home/.config/xmobar/xmobarrc.hs @@ -1,50 +1,105 @@ +-- xmobar main configuration file +-- +-- This file serves as a shared template for the specific xmonad +-- configuration files that are generated from this file to accomodate +-- for multiple monitors. +-- +-- For more details, run 'man xmobar', or visit the project website -- http://projects.haskell.org/xmobar/ -Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=true" - , additionalFonts = [ "xft:Mononoki Nerd Font:pixelsize=11:antialias=true:hinting=true" - , "xft:Font Awesome 5 Free Solid:pixelsize=12" - , "xft:Font Awesome 5 Brands:pixelsize=12" - ] - , bgColor = "#282c34" - , fgColor = "#ff6c6b" - , position = Static { xpos = 0, ypos = 0, width = 1920, height = 24 } - , lowerOnStart = True - , hideOnStart = False - , allDesktops = True - , persistent = True - -- apparently there's no way to use env var or relpaths here - , iconRoot = "/home/itsdrike/.config/xmobar/xpm" - , commands = [ - -- Time and date - Run Date "\xf017 %b %d %Y - (%H:%M) " "date" 50 - -- Network up and down - , Run Network "wlp2s0" ["-t", "\xf0ab kb \xf0aa kb"] 20 - -- Cpu usage in percent - , Run Cpu ["-t", "\xf108 cpu: (%)","-H","50","--high","red"] 20 - -- Ram used number and percent - , Run Memory ["-t", "\xf233 mem: M (%)"] 20 - -- Disk space free - , Run DiskU [("/", "\xf0c7 hdd: free")] [] 60 - -- Runs a standard shell command 'uname -r' to get kernel version - , Run Com "uname" ["-r"] "" 3600 - -- Add dynamic invisible XPM icon that resizes to accomodate trayer - -- this needs to be an absolute string path, env vars or relpaths aren't accepted - -- this should only be on 1 monitor (single file), so ignore this comment on others - , Run Com "/home/itsdrike/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 10 - -- Allow mouse clicking by using unsafe stdin reader - , Run UnsafeStdinReader - ] - , sepChar = "%" - , alignSep = "}{" - , template = " | %UnsafeStdinReader% }{ \ - \| %uname% \ - \| %cpu% \ - \| %memory% \ - \| %disku% \ - \| %wlp2s0% \ - \| %date% \ - \|%trayerpad%\ - \ " - } +Config { +-- Set font for default dg/bg colors. xmobar height will +-- be controlled by this font (it'll adjust itself to accomodate it) +-- Additional fonts can be defined for emoji support +font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=true", +additionalFonts = [ + "xft:Font Awesome 5 Free Solid:pixelsize=12", + "xft:Font Awesome 5 Brands:pixelsize=12", + "xft:Mononoki Nerd Font:pixelsize=11:antialias=true:hinting=true" +], +bgColor = "#282c34", +fgColor = "#ff6c6b", + +-- Define static position that will be adjusted by the deploy script +-- which will tweak the starting positions for multiple monitors, this +-- configuration will work fine for single monitor systems out of the box. +position = Static { xpos = 0, ypos = 0, width = 1920, height = 24 }, +-- Define the place where all used XPM images will be stored in +-- Apparently there's is no way to use env var or relpaths here. +iconRoot = "/home/itsdrike/.config/xmobar/xpm", +-- list of commands which gather information about the system +-- which can then be referrenced in the final template string +commands = [ + -- Gather and format CPU usage information + -- if it's above 50%, we consider it high and make it red + Run Cpu [ + "-t", "\xf108 cpu: %", + "-H","50", + "--high","red" + ] 20, + + -- Ram used number and percent + Run Memory ["-t", "\xf233 mem: M (%)"] 20, + + -- Battery information. This is likely to require some customization + -- based upon your specific hardware. Or, for a desktop you may want + -- to just remove this section entirely. + Run Battery [ + "-t", "\xf240 % - ", + "--", + "-i", "AC", + "-O", "AC", + "-o", "AUX", + "-L", "12", + "-h", "green", + "-l", "red" + ] 10, + + -- Time and date + Run Date "\xf017 %H:%M %b %d %Y" "date" 50, + + -- Network up and down + Run Network "wlp2s0" ["-t", "\xf0ab kb \xf0aa kb"] 20, + --Run Network "enp3s0" ["-t", "\xf0ab kb \xf0aa kb"] 20, + + -- Show free disk space on / + Run DiskU [("/", "\xf0c7 hdd: ")] [] 60, + + -- Get kernel version from uname -r + Run Com "uname" ["-r"] "" 3600, + + -- Add dynamic invisible XPM icon that resizes to accomodate trayer + -- this needs to be an absolute string path, env vars or relpaths aren't accepted + -- this should only be on 1 monitor (single file), so ignore this comment on others + Run Com "/home/itsdrike/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 10, + + -- This line tells xmobar to read input from stdin. + -- That's how it gets information that xmonad is sending + -- (such as workspaces) for displaying. + -- By using UnsafeStdinReader, it also allows mouse clicking events + Run UnsafeStdinReader +], + +-- Separator character used to wrap variables in the xmobar template string +sepChar = "%", +-- Alignment eparator character used in the xmobar template string. +-- Everything before this will be aligned left, everything after right. +alignSep = "}{", + +-- Template string defining the xmobar contents and overall layout. +template = "\ + \ \ + \| %UnsafeStdinReader% }{ \ + \|  %uname% \ + \| %battery% \ + \| %cpu% \ + \| %memory% \ + \| %disku% \ + \| %wlp2s0% \ + --\| %eth3s0% \ + \| %date% \ + \| %trayerpad%\ + \ " +} diff --git a/home/.config/xmobar/xmobarrc0 b/home/.config/xmobar/xmobarrc0 index a664fa1..5846d7b 100644 --- a/home/.config/xmobar/xmobarrc0 +++ b/home/.config/xmobar/xmobarrc0 @@ -1,48 +1,103 @@ +-- xmobar main configuration file +-- +-- This file serves as a shared template for the specific xmonad +-- configuration files that are generated from this file to accomodate +-- for multiple monitors. +-- +-- For more details, run 'man xmobar', or visit the project website -- http://projects.haskell.org/xmobar/ -Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=true" - , additionalFonts = [ "xft:Mononoki Nerd Font:pixelsize=11:antialias=true:hinting=true" - , "xft:Font Awesome 5 Free Solid:pixelsize=12" - , "xft:Font Awesome 5 Brands:pixelsize=12" - ] - , bgColor = "#282c34" - , fgColor = "#ff6c6b" - , position = Static { xpos = 0, ypos = 0, width = 1920, height = 24 } - , lowerOnStart = True - , hideOnStart = False - , allDesktops = True - , persistent = True - -- apparently there's no way to use env var or relpaths here - , iconRoot = "/home/itsdrike/.config/xmobar/xpm" - , commands = [ - -- Time and date - Run Date "\xf017 %b %d %Y - (%H:%M) " "date" 50 - -- Network up and down - , Run Network "wlp2s0" ["-t", "\xf0ab kb \xf0aa kb"] 20 - -- Cpu usage in percent - , Run Cpu ["-t", "\xf108 cpu: (%)","-H","50","--high","red"] 20 - -- Ram used number and percent - , Run Memory ["-t", "\xf233 mem: M (%)"] 20 - -- Disk space free - , Run DiskU [("/", "\xf0c7 hdd: free")] [] 60 - -- Runs a standard shell command 'uname -r' to get kernel version - , Run Com "uname" ["-r"] "" 3600 - -- Add dynamic invisible XPM icon that resizes to accomodate trayer - -- this needs to be an absolute string path, env vars or relpaths aren't accepted - -- this should only be on 1 monitor (single file), so ignore this comment on others - , Run Com "/home/itsdrike/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 10 - -- Allow mouse clicking by using unsafe stdin reader - , Run UnsafeStdinReader - ] - , sepChar = "%" - , alignSep = "}{" - , template = " | %UnsafeStdinReader% }{ \ - \| %uname% \ - \| %cpu% \ - \| %memory% \ - \| %disku% \ - \| %wlp2s0% \ - \| %date% \ - \|%trayerpad%\ - \ " - } +Config { +-- Set font for default dg/bg colors. xmobar height will +-- be controlled by this font (it'll adjust itself to accomodate it) +-- Additional fonts can be defined for emoji support +font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=true", +additionalFonts = [ + "xft:Font Awesome 5 Free Solid:pixelsize=12", + "xft:Font Awesome 5 Brands:pixelsize=12", + "xft:Mononoki Nerd Font:pixelsize=11:antialias=true:hinting=true" +], +bgColor = "#282c34", +fgColor = "#ff6c6b", + +-- Define static position that will be adjusted by the deploy script +-- which will tweak the starting positions for multiple monitors, this +-- configuration will work fine for single monitor systems out of the box. +position = Static { xpos = 0, ypos = 0, width = 1920, height = 24 }, +-- Define the place where all used XPM images will be stored in +-- Apparently there's is no way to use env var or relpaths here. +iconRoot = "/home/itsdrike/.config/xmobar/xpm", +-- list of commands which gather information about the system +-- which can then be referrenced in the final template string +commands = [ + -- Gather and format CPU usage information + -- if it's above 50%, we consider it high and make it red + Run Cpu [ + "-t", "\xf108 cpu: %", + "-H","50", + "--high","red" + ] 20, + + -- Ram used number and percent + Run Memory ["-t", "\xf233 mem: M (%)"] 20, + + -- Battery information. This is likely to require some customization + -- based upon your specific hardware. Or, for a desktop you may want + -- to just remove this section entirely. + Run Battery [ + "-t", "\xf240 % - ", + "--", + "-i", "AC", + "-O", "AC", + "-o", "AUX", + "-L", "12", + "-h", "green", + "-l", "red" + ] 10, + + -- Time and date + Run Date "\xf017 %H:%M %b %d %Y" "date" 50, + + -- Network up and down + Run Network "wlp2s0" ["-t", "\xf0ab kb \xf0aa kb"] 20, + --Run Network "enp3s0" ["-t", "\xf0ab kb \xf0aa kb"] 20, + + -- Show free disk space on / + Run DiskU [("/", "\xf0c7 hdd: ")] [] 60, + + -- Get kernel version from uname -r + Run Com "uname" ["-r"] "" 3600, + + -- Add dynamic invisible XPM icon that resizes to accomodate trayer + -- this needs to be an absolute string path, env vars or relpaths aren't accepted + -- this should only be on 1 monitor (single file), so ignore this comment on others + Run Com "/home/itsdrike/.config/xmobar/trayer-padding-icon.sh" [] "trayerpad" 10, + + -- This line tells xmobar to read input from stdin. + -- That's how it gets information that xmonad is sending + -- (such as workspaces) for displaying. + -- By using UnsafeStdinReader, it also allows mouse clicking events + Run UnsafeStdinReader +], + +-- Separator character used to wrap variables in the xmobar template string +sepChar = "%", +-- Alignment eparator character used in the xmobar template string. +-- Everything before this will be aligned left, everything after right. +alignSep = "}{", + +-- Template string defining the xmobar contents and overall layout. +template = "\ + \ \ + \| %UnsafeStdinReader% }{ \ + \|  %uname% \ + \| %battery% \ + \| %cpu% \ + \| %memory% \ + \| %disku% \ + \| %wlp2s0% \ + --\| %eth3s0% \ + \| %date% \ + \| %trayerpad%\ + \ " +} diff --git a/home/.config/xmobar/xmobarrc1 b/home/.config/xmobar/xmobarrc1 index 66cd15e..abb62e4 100644 --- a/home/.config/xmobar/xmobarrc1 +++ b/home/.config/xmobar/xmobarrc1 @@ -1,46 +1,101 @@ +-- xmobar main configuration file +-- +-- This file serves as a shared template for the specific xmonad +-- configuration files that are generated from this file to accomodate +-- for multiple monitors. +-- +-- For more details, run 'man xmobar', or visit the project website -- http://projects.haskell.org/xmobar/ -Config { font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=true" - , additionalFonts = [ "xft:Mononoki Nerd Font:pixelsize=11:antialias=true:hinting=true" - , "xft:Font Awesome 5 Free Solid:pixelsize=12" - , "xft:Font Awesome 5 Brands:pixelsize=12" - ] - , bgColor = "#282c34" - , fgColor = "#ff6c6b" - , position = Static { xpos = 1920, ypos = 0, width = 1920, height = 24 } - , lowerOnStart = True - , hideOnStart = False - , allDesktops = True - , persistent = True - -- apparently there's no way to use env var or relpaths here - , iconRoot = "/home/itsdrike/.config/xmobar/xpm" - , commands = [ - -- Time and date - Run Date "\xf017 %b %d %Y - (%H:%M) " "date" 50 - -- Network up and down - , Run Network "wlp2s0" ["-t", "\xf0ab kb \xf0aa kb"] 20 - -- Cpu usage in percent - , Run Cpu ["-t", "\xf108 cpu: (%)","-H","50","--high","red"] 20 - -- Ram used number and percent - , Run Memory ["-t", "\xf233 mem: M (%)"] 20 - -- Disk space free - , Run DiskU [("/", "\xf0c7 hdd: free")] [] 60 - -- Runs a standard shell command 'uname -r' to get kernel version - , Run Com "uname" ["-r"] "" 3600 - -- Add dynamic invisible XPM icon that resizes to accomodate trayer - -- this needs to be an absolute string path, env vars or relpaths aren't accepted - -- this should only be on 1 monitor (single file), so ignore this comment on others - -- Allow mouse clicking by using unsafe stdin reader - , Run UnsafeStdinReader - ] - , sepChar = "%" - , alignSep = "}{" - , template = " | %UnsafeStdinReader% }{ \ - \| %uname% \ - \| %cpu% \ - \| %memory% \ - \| %disku% \ - \| %wlp2s0% \ - \| %date% \ - \ " - } +Config { +-- Set font for default dg/bg colors. xmobar height will +-- be controlled by this font (it'll adjust itself to accomodate it) +-- Additional fonts can be defined for emoji support +font = "xft:Ubuntu:weight=bold:pixelsize=11:antialias=true:hinting=true", +additionalFonts = [ + "xft:Font Awesome 5 Free Solid:pixelsize=12", + "xft:Font Awesome 5 Brands:pixelsize=12", + "xft:Mononoki Nerd Font:pixelsize=11:antialias=true:hinting=true" +], +bgColor = "#282c34", +fgColor = "#ff6c6b", + +-- Define static position that will be adjusted by the deploy script +-- which will tweak the starting positions for multiple monitors, this +-- configuration will work fine for single monitor systems out of the box. +position = Static { xpos = 1920, ypos = 0, width = 1920, height = 24 }, +-- Define the place where all used XPM images will be stored in +-- Apparently there's is no way to use env var or relpaths here. +iconRoot = "/home/itsdrike/.config/xmobar/xpm", +-- list of commands which gather information about the system +-- which can then be referrenced in the final template string +commands = [ + -- Gather and format CPU usage information + -- if it's above 50%, we consider it high and make it red + Run Cpu [ + "-t", "\xf108 cpu: %", + "-H","50", + "--high","red" + ] 20, + + -- Ram used number and percent + Run Memory ["-t", "\xf233 mem: M (%)"] 20, + + -- Battery information. This is likely to require some customization + -- based upon your specific hardware. Or, for a desktop you may want + -- to just remove this section entirely. + Run Battery [ + "-t", "\xf240 % - ", + "--", + "-i", "AC", + "-O", "AC", + "-o", "AUX", + "-L", "12", + "-h", "green", + "-l", "red" + ] 10, + + -- Time and date + Run Date "\xf017 %H:%M %b %d %Y" "date" 50, + + -- Network up and down + Run Network "wlp2s0" ["-t", "\xf0ab kb \xf0aa kb"] 20, + --Run Network "enp3s0" ["-t", "\xf0ab kb \xf0aa kb"] 20, + + -- Show free disk space on / + Run DiskU [("/", "\xf0c7 hdd: ")] [] 60, + + -- Get kernel version from uname -r + Run Com "uname" ["-r"] "" 3600, + + -- Add dynamic invisible XPM icon that resizes to accomodate trayer + -- this needs to be an absolute string path, env vars or relpaths aren't accepted + -- this should only be on 1 monitor (single file), so ignore this comment on others + + -- This line tells xmobar to read input from stdin. + -- That's how it gets information that xmonad is sending + -- (such as workspaces) for displaying. + -- By using UnsafeStdinReader, it also allows mouse clicking events + Run UnsafeStdinReader +], + +-- Separator character used to wrap variables in the xmobar template string +sepChar = "%", +-- Alignment eparator character used in the xmobar template string. +-- Everything before this will be aligned left, everything after right. +alignSep = "}{", + +-- Template string defining the xmobar contents and overall layout. +template = "\ + \ \ + \| %UnsafeStdinReader% }{ \ + \|  %uname% \ + \| %battery% \ + \| %cpu% \ + \| %memory% \ + \| %disku% \ + \| %wlp2s0% \ + --\| %eth3s0% \ + \| %date% \ + \ " +}