Skip to content

Instantly share code, notes, and snippets.

@cmsj
Created February 1, 2013 21:23
Embed
What would you like to do?
My current lcd4linux configuration. For more details of some of the python stuff here, and some preview videos, see: http://www.tenshu.net/2013/01/funky-lcd4linux-python-module.html
# lcd4linux config
## Local config
Variables {
# This are useful substitutions for later
tick 500
tack 100
seconds 2000
net_if 'br0' # Set this to the network interface to monitor
disk_match 'sd.' # Set this to something that matches disks (sdX, hdX, mdX, etc)
alldisks '/=/,srv=/srv,New=/srv/media/New'
}
## Displays
Display LCD2USB {
# My actual hardware LCD
Driver 'LCD2USB'
Size '20x4'
Icons 2
Contrast 220
Brightness 50
Bus '005'
Device '003'
}
Display Curses {
# Show in a terminal for very quick testing
Driver 'Curses'
Size '20x4'
}
Display XWindow {
# Show in an X11 window for testing.
# Note that this is configured to replicate the 20x4 red-on-black LCD I own
Driver 'X11'
Size '100x32'
Font '5x8'
Pixel '4+1'
Gap '-1x-1'
Border 20
Buttons 0
Foreground 'ff0000ff'
Background '000000ff'
Basecolor '000000'
Bordercolor '000000'
}
## Labels
Widget LabelAllDisks {
# Rotating label for the disks I want to monitor space usage on
class 'Text'
update seconds
width 3
expression python::exec('lcd4linux_rotator', 'main', 'AllDisks key ' . alldisks)
}
Widget LabelDiskRW {
# Two arrows moving in opposite directions.
# This is intended to be placed between an icon/word and a bar
# widget to indicate which half of the widget is which direction
class 'Icon'
speed 400
Bitmap {
Row1 '.....|.....|*....|.*...|..*..|...*.|....*|.....|.....'
Row2 '.....|*....|**...|***..|****.|.****|..***|...**|....*'
Row3 '.....|.....|*....|.*...|..*..|...*.|....*|.....|.....'
Row4 '.....|.....|.....|.....|.....|.....|.....|.....|.....'
Row5 '.....|.....|.....|.....|.....|.....|.....|.....|.....'
Row6 '.....|.....|....*|...*.|..*..|.*...|*....|.....|.....'
Row7 '.....|....*|...**|..***|.****|****.|***..|**...|*....'
Row8 '.....|.....|....*|...*.|..*..|.*...|*....|.....|.....'
}
}
Widget LabelRxTx {
# Animated Rx/Tx label showing which relates to which half of a bar
class 'Icon'
speed 250
Bitmap {
Row1 '****.|***..|**...|*....|.....|.....|....*|...**|..***|.****'
Row2 '*...*|...*.|..*.*|.*.*.|*.*.*|.*.*.|*.*.*|.*.*.|*.*..|.*...'
Row3 '****.|***..|**...|*...*|...*.|..*..|.*..*|*..**|..***|.****'
Row4 '*...*|...*.|..*.*|.*.*.|*.*.*|.*.*.|*.*.*|.*.*.|*.*..|.*...'
Row5 '.....|.....|.....|.....|.....|.....|.....|.....|.....|.....'
Row6 '*****|****.|***.*|**.*.|*.*.*|.*.*.|*.*.*|.*.**|*.***|.****'
Row7 '..*..|.*...|*....|....*|...*.|..*..|.*...|*....|....*|...*.'
Row8 '..*..|.*...|*...*|...*.|..*.*|.*.*.|*.*..|.*...|*...*|...*.'
}
}
## Widgets
Widget DiskBar {
# Split bar widget that shows all the read/write activity on a given
# set of disks (as defined earlier by 'disk_match')
class 'Bar'
expression diskstats(disk_match, 'read_sectors', 500)
expression2 diskstats(disk_match, 'write_sectors', 500)
length 19
direction 'E'
#style 'H'
update tack
}
Widget NetBar {
# Split bar widget that shows all the receive/transmit activity on a
# given network interface (as defined earlier by 'net_if')
class 'Bar'
expression netdev(net_if, 'Rx_bytes', 500)
expression2 netdev(net_if, 'Tx_bytes', 500)
length 19
direction 'E'
update tack
#style 'H'
}
Widget BarAllDisks {
# Bar widget that rotates through the percentage usage of several
# disks (as defined earlier by LabelAllDisks)
class 'Bar'
update seconds
length 17
#style 'H'
direction 'E'
min 0
max 100
expression path=python::exec('lcd4linux_rotator', 'main', 'AllDisks value') ; ((statfs(path, 'blocks') - statfs(path, 'bavail')) / statfs(path, 'blocks'))*100
}
Widget TextScroll {
class 'Text'
width 20
align 'M'
update 20000
speed 130
expression python::exec('dailymail', 'main')
}
## Layouts
Layout tenshu {
# The Layout I use for my fileserver
Row1 {
Col1 'LabelDiskRW'
Col2 'DiskBar'
}
Row2 {
Col1 'LabelRxTx'
Col2 'NetBar'
}
Row3 {
Col1 'LabelAllDisks'
Col4 'BarAllDisks'
}
Row4 {
Col1 'TextScroll'
}
}
## Config selection
## Choose which output display to use
## and which layout
#Display 'Curses'
Display 'XWindow'
#Display 'LCD2USB'
Layout 'tenshu'
@bestimmaa
Copy link

Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment