Commit 3570097e authored by epsi sayidina's avatar epsi sayidina

conky: multiple statusbar

parent fcd14101
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
-- for use with bright dzen2 panel
deco = helper.decoDoubleArrowLeft
--[[
disabled = ''
.. parts.mpd()
.. parts.uptime()
.. parts.memory()
.. parts.battery()
.. parts.date()
.. parts.time()
.. parts.cputemp()
.. parts.machine()
.. helper.separator()
]]
enabled = ''
.. parts.transition(deco, colWhite, colGreen400)
.. parts.host(colGreen400)
.. parts.transition(deco, colGreen400, colGreen500)
.. parts.volume(colGreen500)
.. parts.transition(deco, colGreen500, colGreen600)
.. parts.cpu0(colGreen600)
.. parts.transition(deco, colGreen600, colBlue500)
.. parts.ssid(colBlue500)
.. parts.transition(deco, colBlue500, colBlue600)
.. parts.network(colBlue600)
.. parts.transition(deco, colBlue600, colWhite)
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
disabled = ''
.. parts.mpd()
.. parts.uptime()
.. parts.memory()
.. parts.battery()
.. parts.date()
.. parts.time()
.. parts.cputemp()
.. parts.machine()
]]
enabled = ''
.. parts.host()
.. parts.volume()
.. parts.cpu0()
.. parts.ssid()
.. parts.network()
.. helper.separator()
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
]]
conky.config = {
out_to_x = false,
out_to_console = true,
short_units = true,
update_interval = 1
}
presetName = 'bright-background'
home = os.getenv("HOME")
path = '/Documents/standalone/dzen2/multi/'
dofile(home .. path .. 'gmc.lua')
dofile(home .. path .. 'presets/' .. presetName .. '.lua')
dofile(home .. path .. 'helper.lua')
dofile(home .. path .. 'parts.lua')
decoleft = helper.decoDoubleArrowLeft
decoright = helper.decoDoubleArrowRight
conky.text = ''
.. parts.transition(decoleft, colWhite, colBlue500)
.. parts.mpd(colBlue500)
.. parts.transition(decoright, colWhite, colBlue500)
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
]]
conky.config = {
out_to_x = false,
out_to_console = true,
short_units = true,
update_interval = 1
}
presetName = 'bright-background'
home = os.getenv("HOME")
path = '/Documents/standalone/dzen2/multi/'
dofile(home .. path .. 'gmc.lua')
dofile(home .. path .. 'presets/' .. presetName .. '.lua')
dofile(home .. path .. 'helper.lua')
dofile(home .. path .. 'parts.lua')
deco = helper.decoDoubleArrowRight
conky.text = ''
.. parts.cpu0(colGreen300)
.. parts.transition(deco, colGreen500, colGreen300)
.. parts.cputemp(colGreen500)
.. parts.transition(deco, colGreen700, colGreen500)
.. parts.memory(colGreen700)
.. parts.transition(deco, colWhite, colGreen700)
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
]]
conky.config = {
out_to_x = false,
out_to_console = true,
short_units = true,
update_interval = 1
}
presetName = 'bright-background'
home = os.getenv("HOME")
path = '/Documents/standalone/dzen2/multi/'
dofile(home .. path .. 'gmc.lua')
dofile(home .. path .. 'presets/' .. presetName .. '.lua')
dofile(home .. path .. 'helper.lua')
dofile(home .. path .. 'parts.lua')
deco = helper.decoDoubleArrowLeft
conky.text = ''
.. parts.transition(deco, colWhite, colRed400)
.. parts.ssid(colRed400)
.. parts.transition(deco, colRed400, colRed600)
.. parts.network(colRed600)
-- .. parts.transition(deco, colRed600, colWhite)
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
]]
conky.config = {
out_to_x = false,
out_to_console = true,
short_units = true,
update_interval = 1
}
presetName = 'bright-background'
home = os.getenv("HOME")
path = '/Documents/standalone/dzen2/multi/'
dofile(home .. path .. 'gmc.lua')
dofile(home .. path .. 'presets/' .. presetName .. '.lua')
dofile(home .. path .. 'helper.lua')
dofile(home .. path .. 'parts.lua')
decoleft = helper.decoCornerBottomLeft
decoright = helper.decoCornerBottomRight
conky.text = ''
.. parts.transition(decoright, colWhite, colGreen400)
.. parts.transition(decoright, colGreen400, colGreen600)
.. parts.uptime(colGreen600)
.. parts.transition(decoleft, colGreen400, colGreen600)
.. parts.transition(decoleft, colWhite, colGreen400)
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
]]
conky.config = {
out_to_x = false,
out_to_console = true,
short_units = true,
update_interval = 1
}
presetName = 'bright-background'
home = os.getenv("HOME")
path = '/Documents/standalone/dzen2/multi/'
dofile(home .. path .. 'gmc.lua')
dofile(home .. path .. 'presets/' .. presetName .. '.lua')
dofile(home .. path .. 'helper.lua')
dofile(home .. path .. 'parts.lua')
decoleft = helper.decoCornerTopLeft
decoright = helper.decoCornerTopRight
conky.text = ' '
.. parts.transition(decoright, colWhite, colBlue400)
.. parts.transition(decoright, colBlue400, colBlue600)
.. parts.host(colBlue600)
.. parts.machine(colBlue600)
.. parts.transition(decoleft, colBlue400, colBlue600)
.. parts.transition(decoleft, colWhite, colBlue400)
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
]]
conky.config = {
out_to_x = false,
out_to_console = true,
short_units = true,
update_interval = 1
}
presetName = 'bright-background'
home = os.getenv("HOME")
path = '/Documents/standalone/dzen2/multi/'
dofile(home .. path .. 'gmc.lua')
dofile(home .. path .. 'presets/' .. presetName .. '.lua')
dofile(home .. path .. 'helper.lua')
dofile(home .. path .. 'parts.lua')
decoleft = helper.decoCornerTopLeft
decoright = helper.decoCornerTopRight
conky.text = ''
.. parts.transition(decoright, colWhite, colBlue400)
.. parts.transition(decoright, colBlue400, colBlue600)
.. parts.date(colBlue600)
.. parts.time(colBlue600)
.. parts.transition(decoleft, colBlue400, colBlue600)
.. parts.transition(decoleft, colWhite, colBlue400)
.. ' '
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- google material colors
-- https://material.io/guidelines/style/color.html
colWhite = '\\#ffffff'
colBlack = '\\#000000'
colGrey50 = '\\#fafafa'
colGrey100 = '\\#f5f5f5'
colGrey200 = '\\#eeeeee'
colGrey300 = '\\#e0e0e0'
colGrey400 = '\\#bdbdbd'
colGrey500 = '\\#9e9e9e'
colGrey600 = '\\#757575'
colGrey700 = '\\#616161'
colGrey800 = '\\#424242'
colGrey900 = '\\#212121'
colRed50 = '\\#ffebee'
colRed100 = '\\#ffcdd2'
colRed200 = '\\#ef9a9a'
colRed300 = '\\#e57373'
colRed400 = '\\#ef5350'
colRed500 = '\\#f44336'
colRed600 = '\\#e53935'
colRed700 = '\\#d32f2f'
colRed800 = '\\#c62828'
colRed900 = '\\#b71c1c'
colRedA100 = '\\#ff8a80'
colRedA200 = '\\#ff5252'
colRedA400 = '\\#ff1744'
colRedA700 = '\\#d50000'
colPink50 = '\\#fce4ec'
colPink100 = '\\#f8bbd0'
colPink200 = '\\#f48fb1'
colPink300 = '\\#f06292'
colPink400 = '\\#ec407a'
colPink500 = '\\#e91e63'
colPink600 = '\\#d81b60'
colPink700 = '\\#c2185b'
colPink800 = '\\#ad1457'
colPink900 = '\\#880e4f'
colPinkA100 = '\\#ff80ab'
colPinkA200 = '\\#ff4081'
colPinkA400 = '\\#f50057'
colPinkA700 = '\\#c51162'
colIndigo50 = '\\#e8eaf6'
colIndigo100 = '\\#c5cae9'
colIndigo200 = '\\#9fa8da'
colIndigo300 = '\\#7986cb'
colIndigo400 = '\\#5c6bc0'
colIndigo500 = '\\#3f51b5'
colIndigo600 = '\\#3949ab'
colIndigo700 = '\\#303f9f'
colIndigo800 = '\\#283593'
colIndigo900 = '\\#1a237e'
colIndigoA100 = '\\#8c9eff'
colIndigoA200 = '\\#536dfe'
colIndigoA400 = '\\#3d5afe'
colIndigoA700 = '\\#304ffe'
colBlue50 = '\\#e3f2fd'
colBlue100 = '\\#bbdefb'
colBlue200 = '\\#90caf9'
colBlue300 = '\\#64b5f6'
colBlue400 = '\\#42a5f5'
colBlue500 = '\\#2196f3'
colBlue600 = '\\#1e88e5'
colBlue700 = '\\#1976d2'
colBlue800 = '\\#1565c0'
colBlue900 = '\\#0d47a1'
colBlueA100 = '\\#82b1ff'
colBlueA200 = '\\#448aff'
colBlueA400 = '\\#2979ff'
colBlueA700 = '\\#2962ff'
colYellow50 = '\\#fffde7'
colYellow100 = '\\#fff9c4'
colYellow200 = '\\#fff59d'
colYellow300 = '\\#fff176'
colYellow400 = '\\#ffee58'
colYellow500 = '\\#ffeb3b'
colYellow600 = '\\#fdd835'
colYellow700 = '\\#fbc02d'
colYellow800 = '\\#f9a825'
colYellow900 = '\\#f57f17'
colYellowA100 = '\\#ffff8d'
colYellowA200 = '\\#ffff00'
colYellowA400 = '\\#ffea00'
colYellowA700 = '\\#ffd600'
colTeal50 = '\\#e0f2f1'
colTeal100 = '\\#b2dfdb'
colTeal200 = '\\#80cbc4'
colTeal300 = '\\#4db6ac'
colTeal400 = '\\#26a69a'
colTeal500 = '\\#009688'
colTeal600 = '\\#00897b'
colTeal700 = '\\#00796b'
colTeal800 = '\\#00695c'
colTeal900 = '\\#004d40'
colTealA100 = '\\#a7ffeb'
colTealA200 = '\\#64ffda'
colTealA400 = '\\#1de9b6'
colTealA700 = '\\#00bfa5'
colGreen50 = '\\#e8f5e9'
colGreen100 = '\\#c8e6c9'
colGreen200 = '\\#a5d6a7'
colGreen300 = '\\#81c784'
colGreen400 = '\\#66bb6a'
colGreen500 = '\\#4caf50'
colGreen600 = '\\#43a047'
colGreen700 = '\\#388e3c'
colGreen800 = '\\#2e7d32'
colGreen900 = '\\#1b5e20'
colGreenA100 = '\\#b9f6ca'
colGreenA200 = '\\#69f0ae'
colGreenA400 = '\\#00e676'
colGreenA700 = '\\#00c853'
colOrange50 = '\\#fff3e0'
colOrange100 = '\\#ffe0b2'
colOrange200 = '\\#ffcc80'
colOrange300 = '\\#ffb74d'
colOrange400 = '\\#ffa726'
colOrange500 = '\\#ff9800'
colOrange600 = '\\#fb8c00'
colOrange700 = '\\#f57c00'
colOrange800 = '\\#ef6c00'
colOrange900 = '\\#e65100'
colOrangeA100 = '\\#ffd180'
colOrangeA200 = '\\#ffab40'
colOrangeA400 = '\\#ff9100'
colOrangeA700 = '\\#ff6d00'
colDeepOrange50 = '\\#fbe9e7'
colDeepOrange100 = '\\#ffccbc'
colDeepOrange200 = '\\#ffab91'
colDeepOrange300 = '\\#ff8a65'
colDeepOrange400 = '\\#ff7043'
colDeepOrange500 = '\\#ff5722'
colDeepOrange600 = '\\#f4511e'
colDeepOrange700 = '\\#e64a19'
colDeepOrange800 = '\\#d84315'
colDeepOrange900 = '\\#bf360c'
colDeepOrangeA100 = '\\#ff9e80'
colDeepOrangeA200 = '\\#ff6e40'
colDeepOrangeA400 = '\\#ff3d00'
colDeepOrangeA700 = '\\#dd2c00'
-- vim: ts=4 sw=4 noet ai cindent syntax=lua-- global
helper = {}
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- constant
-- glyph icon decoration
local decoPath = 'Documents/standalone/dzen2/assets/xbm'
-- diagonal corner
helper.decoCornerTopLeft = '^i(' .. decoPath .. '/dc-024-tl.xbm)'
helper.decoCornerTopRight = '^i(' .. decoPath .. '/dc-024-tr.xbm)'
helper.decoCornerBottomLeft = '^i(' .. decoPath .. '/dc-024-bl.xbm)'
helper.decoCornerBottomRight = '^i(' .. decoPath .. '/dc-024-br.xbm)'
-- single arrow and double arrow
helper.decoSingleArrowLeft = '^i(' .. decoPath .. '/sa-024-l.xbm)'
helper.decoSingleArrowRight = '^i(' .. decoPath .. '/sa-024-r.xbm)'
helper.decoDoubleArrowLeft = '^i(' .. decoPath .. '/da-024-l.xbm)'
helper.decoDoubleArrowRight = '^i(' .. decoPath .. '/da-024-r.xbm)'
-- http://fontawesome.io/
local fontAwesome = '^fn(FontAwesome-9)'
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- initialization
--local colorPreset = nil
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
function helper.icon(text, color)
color = color or colorPreset.icon
local preIcon = '^fg(' .. color .. ')' .. fontAwesome
local postIcon = '^fn()^fg()'
return ' ' .. preIcon .. text .. postIcon .. ' '
end
function helper.label(text, color)
color = color or colorPreset.label
return '^fg(' .. color .. ')' .. text
end
function helper.separator(color)
color = color or colorPreset.separator
return '^fg(' .. color .. ')' .. '|'
end
function helper.value(text, color)
color = color or colorPreset.value
return '^fg(' .. color .. ')' .. text
end
function helper.common(icon, label, value, colorBg)
colorBg = colorBg or colorPreset.background
text=''
if colorBg then text = text .. '^bg(' .. colorBg .. ')' end
if not colorBg then text = helper.separator() end
if icon then text = text .. ' ' .. helper.icon(icon) end
if label then text = text .. ' ' .. helper.label(label) end
if value then text = text .. ' ' .. helper.value(value) .. ' ' end
return text
end
#!/usr/bin/env bash
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# parameters for 1280 width screen
width_side=400
width_center=480
height=24
xpos_topleft=0
ypos_topleft=0
xpos_topcenter=400
ypos_topcenter=0
xpos_topright=880
ypos_topright=0
xpos_bottomleft=0
ypos_bottomleft=(800-24)
xpos_bottomcenter=400
ypos_bottomcenter=(800-24)
xpos_bottomright=880
ypos_bottomright=(800-24)
bgcolor="#ffffff"
fgcolor="#000000"
font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
parameters_topleft=" -x $xpos_topleft -y $ypos_topleft"
parameters_topleft+=" -w $width_side -h $height"
parameters_topleft+=" -fn $font"
parameters_topleft+=" -ta l -bg $bgcolor -fg $fgcolor"
parameters_topleft+=" -title-name dzentopleft"
parameters_topcenter=" -x $xpos_topcenter -y $ypos_topcenter"
parameters_topcenter+=" -w $width_center -h $height"
parameters_topcenter+=" -fn $font"
parameters_topcenter+=" -ta c -bg $bgcolor -fg $fgcolor"
parameters_topcenter+=" -title-name dzentopcenter"
parameters_topright=" -x $xpos_topright -y $ypos_topright"
parameters_topright+=" -w $width_side -h $height"
parameters_topright+=" -fn $font"
parameters_topright+=" -ta r -bg $bgcolor -fg $fgcolor"
parameters_topright+=" -title-name dzentopright"
parameters_bottomleft=" -x $xpos_bottomleft -y $ypos_bottomleft"
parameters_bottomleft+=" -w $width_side -h $height"
parameters_bottomleft+=" -fn $font"
parameters_bottomleft+=" -ta l -bg $bgcolor -fg $fgcolor"
parameters_bottomleft+=" -title-name dzenbottomleft"
parameters_bottomcenter=" -x $xpos_bottomcenter -y $ypos_bottomcenter"
parameters_bottomcenter+=" -w $width_center -h $height"
parameters_bottomcenter+=" -fn $font"
parameters_bottomcenter+=" -ta c -bg $bgcolor -fg $fgcolor"
parameters_bottomcenter+=" -title-name dzenbottomcenter"
parameters_bottomright=" -x $xpos_bottomright -y $ypos_bottomright"
parameters_bottomright+=" -w $width_side -h $height"
parameters_bottomright+=" -fn $font"
parameters_bottomright+=" -ta r -bg $bgcolor -fg $fgcolor"
parameters_bottomright+=" -title-name dzenbottomright"
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# main
# remove all dzen2 instance
pkill dzen2
# This is just a sample.
# more dzen-conky means more CPU.
path=~/Documents/standalone/dzen2/multi
# execute dzen
conky -c $path/conky-topleft.lua | dzen2 $parameters_topleft &
conky -c $path/conky-topcenter.lua | dzen2 $parameters_topcenter &
conky -c $path/conky-topright.lua | dzen2 $parameters_topright &
conky -c $path/conky-bottomleft.lua | dzen2 $parameters_bottomleft &
conky -c $path/conky-bottomcenter.lua | dzen2 $parameters_bottomcenter &
conky -c $path/conky-bottomright.lua | dzen2 $parameters_bottomright &
# optional transparency
sleep 1 && exec `(transset .8 -n dzentopleft >/dev/null 2>&1 &)` &
sleep 1 && exec `(transset .8 -n dzentopcenter >/dev/null 2>&1 &)` &
sleep 1 && exec `(transset .8 -n dzentopright >/dev/null 2>&1 &)` &
sleep 1 && exec `(transset .8 -n dzenbottomleft >/dev/null 2>&1 &)` &
sleep 1 && exec `(transset .8 -n dzenbottomcenter >/dev/null 2>&1 &)` &
sleep 1 && exec `(transset .8 -n dzenbottomright >/dev/null 2>&1 &)` &
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
You may consider change glyph using FontAwesome icon
http://fontawesome.io/cheatsheet/
* Sample: Battery Icon: 
]]
parts = {}
-- user variables
local wlandev = 'wlp0s3f3u2'
-- shortcut
local _h = helper
-- template variables: Color Indicator
local color_indicator_dark = {
good = '',
degraded = colRed900,
bad = colRed500
}
local color_indicator_bright = {
good = '',
degraded = colWhite,
bad = colYellow500
}
local ci = color_indicator_bright
-- transition image
function parts.transition(decoIcon, decoBg, decoFg)
text = '^bg(' .. decoBg .. ')'
.. '^fg(' .. decoFg .. ')' .. decoIcon
return text
end
-- Time
function parts.time(colorBg)
return _h.common('', nil, '${time %H:%M:%S }', colorBg)
end
-- Date
function parts.date(colorBg)
return _h.common('', nil, '${time %D}', colorBg)
end
-- Volume
function parts.volume(colorBg)
local volume_command = [[amixer get Master | tail -1 | sed 's/.*\[\([0-9]*%\)\].*/\1/']]
return _h.common('', 'Vol', "${execi 1 " .. volume_command .. "}", colorBg)
end
-- Host
function parts.host(colorBg)
return _h.common('', 'Host', '$nodename', colorBg)
end
-- Uptime
function parts.uptime(colorBg)
return _h.common('', 'Uptime', '$uptime', colorBg)
end
-- Memory
function parts.mem(colorBg)
return _h.common('', 'RAM', '$mem/$memmax', colorBg)
end
-- SSID
-- might have core dumped when no device
function parts.ssid(colorBg)
return _h.common(' ', '', '$wireless_essid', colorBg)
end
-- Lua Function Demo
-- https://github.com/brndnmtthws/conky/issues/62
function _h.exec(command)
local file = assert(io.popen(command, 'r'))
local s = file:read('*all')
file:close()
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
-- read once
local machine = _h.exec('uname -r')
function parts.machine(colorBg)
return _h.common('', nil, machine, colorBg)
end
-- Media Player Daemon
function parts.mpd(colorBg)
local mpd = [[\
${if_mpd_playing}\
]] .. _h.icon('')
.. _h.value(' ${mpd_artist 20} ')
.. _h.icon('')
.. _h.value(' ${mpd_title 30}') ..[[
${else}]] .. _h.icon('') .. [[${endif}\
]]
return _h.common(nil, nil, mpd, colorBg)
end
-- CPU temperature:
function parts.cputemp(colorBg)
local cputemp = [[\
${if_match ${acpitemp}<45}\
]] .. _h.value('${acpitemp}°C', ci.good) .. [[
${else}${if_match ${acpitemp}<55}\
]] .. _h.value('${acpitemp}°C', ci.degraded) .. [[
${else}${if_match ${acpitemp}>=55}\
]] .. _h.value('${acpitemp}°C', ci.bad) .. [[
${endif}${endif}${endif}\
]]
return _h.common('', 'CPU', cputemp, colorBg)
end
-- Network