diff options
author | jao <jao@gnu.org> | 2019-10-05 23:33:36 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2019-10-05 23:33:36 +0100 |
commit | f1973d263ebc7059989091f2026622ff2766dc66 (patch) | |
tree | f0c8992c26c2c1bd2f9305b1f981d072b410a144 | |
parent | 05d143ee56ca6785b12ccde43a8d278ebbc93bdf (diff) | |
download | xmobar-config-f1973d263ebc7059989091f2026622ff2766dc66.tar.gz xmobar-config-f1973d263ebc7059989091f2026622ff2766dc66.tar.bz2 |
load icons
-rwxr-xr-x | icons/gen-load-icons.sh | 36 | ||||
-rw-r--r-- | icons/load_0.xpm | 24 | ||||
-rw-r--r-- | icons/load_1.xpm | 24 | ||||
-rw-r--r-- | icons/load_2.xpm | 24 | ||||
-rw-r--r-- | icons/load_3.xpm | 24 | ||||
-rw-r--r-- | icons/load_4.xpm | 24 | ||||
-rw-r--r-- | icons/load_5.xpm | 24 | ||||
-rw-r--r-- | icons/load_6.xpm | 24 | ||||
-rw-r--r-- | icons/load_7.xpm | 24 | ||||
-rw-r--r-- | icons/load_8.xpm | 24 | ||||
-rw-r--r-- | src/lib/Config.hs | 7 | ||||
-rw-r--r-- | src/lib/Monitors.hs | 7 |
12 files changed, 265 insertions, 1 deletions
diff --git a/icons/gen-load-icons.sh b/icons/gen-load-icons.sh new file mode 100755 index 0000000..2ff765e --- /dev/null +++ b/icons/gen-load-icons.sh @@ -0,0 +1,36 @@ +#! /usr/bin/env perl + +use warnings; +use strict; + +use local::lib; +use Image::Xpm; +use POSIX; + +my $iwidth = 8; +my $iheight = 16; +my $pixels_per = $iheight / 8; +my $color_bg = "white"; +my $color_fg = "darkseagreen"; + +for ( my $file_num = 0; $file_num <= 8; $file_num++ ) { + my $i = Image::Xpm->new(-file => "load_$file_num.xpm", + -width => $iwidth, + -height => $iheight, + -background => $color_bg); + + my $h = $file_num * $pixels_per; + + for ( my $x = 0; $x < $iwidth; $x++ ) { + for ( my $y = 0; $y < $iheight; $y++ ) { + $i->xy($x, $y, $color_bg); + } + } + for ( my $x = 0; $x < $iwidth; $x++ ) { + for ( my $y = $iheight; $y >= ($iheight - $h); $y-- ) { + $i->xy($x, $y, $color_fg); + } + } + + $i->save; +} diff --git a/icons/load_0.xpm b/icons/load_0.xpm new file mode 100644 index 0000000..5c43f2c --- /dev/null +++ b/icons/load_0.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_0[] = { +"5 16 4 1", +"# c darkseagreen", +"! c grey90", +"$ c grey96", +" c white", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" " +}; diff --git a/icons/load_1.xpm b/icons/load_1.xpm new file mode 100644 index 0000000..d21d509 --- /dev/null +++ b/icons/load_1.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_1[] = { +"5 16 4 1", +" c white", +"$ c grey96", +"! c grey90", +"# c darkseagreen", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +"#####", +"#####" +}; diff --git a/icons/load_2.xpm b/icons/load_2.xpm new file mode 100644 index 0000000..afceb6f --- /dev/null +++ b/icons/load_2.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_2[] = { +"5 16 4 1", +"! c grey90", +"# c darkseagreen", +" c white", +"$ c grey96", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +"#####", +"#####", +"#####", +"#####" +}; diff --git a/icons/load_3.xpm b/icons/load_3.xpm new file mode 100644 index 0000000..f88ef26 --- /dev/null +++ b/icons/load_3.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_3[] = { +"5 16 4 1", +" c white", +"$ c grey96", +"! c grey90", +"# c darkseagreen", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####" +}; diff --git a/icons/load_4.xpm b/icons/load_4.xpm new file mode 100644 index 0000000..6182dcf --- /dev/null +++ b/icons/load_4.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_4[] = { +"5 16 4 1", +"! c grey90", +"# c darkseagreen", +"$ c grey96", +" c white", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +" ", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####" +}; diff --git a/icons/load_5.xpm b/icons/load_5.xpm new file mode 100644 index 0000000..05b7f4a --- /dev/null +++ b/icons/load_5.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_5[] = { +"5 16 4 1", +" c white", +"$ c grey96", +"! c grey90", +"# c darkseagreen", +" ", +" ", +" ", +" ", +" ", +" ", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####" +}; diff --git a/icons/load_6.xpm b/icons/load_6.xpm new file mode 100644 index 0000000..971a973 --- /dev/null +++ b/icons/load_6.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_6[] = { +"5 16 4 1", +" c white", +"$ c grey96", +"! c grey90", +"# c darkseagreen", +" ", +" ", +" ", +" ", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####" +}; diff --git a/icons/load_7.xpm b/icons/load_7.xpm new file mode 100644 index 0000000..dac0754 --- /dev/null +++ b/icons/load_7.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_7[] = { +"5 16 4 1", +"! c grey90", +"# c darkseagreen", +" c white", +"$ c grey96", +" ", +" ", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####" +}; diff --git a/icons/load_8.xpm b/icons/load_8.xpm new file mode 100644 index 0000000..94843d4 --- /dev/null +++ b/icons/load_8.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char *load_8[] = { +"5 16 4 1", +"! c grey90", +"# c darkseagreen", +"$ c grey96", +" c white", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####", +"#####" +}; diff --git a/src/lib/Config.hs b/src/lib/Config.hs index 6493bd7..58108f1 100644 --- a/src/lib/Config.hs +++ b/src/lib/Config.hs @@ -1,4 +1,5 @@ -module Config (Palette(..), baseConfig, palette, (<~>), defaultHeight) where +module Config (Palette(..), baseConfig, palette, (<~>), mkArgs, defaultHeight) + where import System.Environment (lookupEnv) @@ -68,6 +69,7 @@ baseConfig p = defaultConfig { , persistent = True , sepChar = "|" , alignSep = "{}" + , iconRoot = "/home/jao/.xmobar/icons" } (<~>) :: Palette -> [String] -> [String] @@ -77,3 +79,6 @@ baseConfig p = defaultConfig { , "--high", (pHigh p) ] ] + +mkArgs :: Palette -> [String] -> [String] -> [String] +mkArgs p args extra = concat [(p <~> args), ["--"], extra] diff --git a/src/lib/Monitors.hs b/src/lib/Monitors.hs index 3c35488..1d47c5f 100644 --- a/src/lib/Monitors.hs +++ b/src/lib/Monitors.hs @@ -53,6 +53,13 @@ multiCPU p = MultiCpu (p <~> ["-t", "<autototal>" , "-c", " " , "-L", "30", "-H", "70" , "-p", "3", "-a", "l"]) 10 +cpuBars p = MultiCpu (mkArgs p + ["--template" , " <autoipat> <total>%" + , "-L", "50", "--H", "85"] + ["--fallback-icon-pattern", "<icon=load_%%.xpm/>" + , "--contiguous-icons"]) + 10 + cpuFreq p = CpuFreq (p <~> ["-t" , "<cpu0> <cpu1> <cpu2> <cpu3>" , "-L", "1", "-H", "2", "-S", "Off" , "-d", "2"]) 50 |