Skip to content

Instantly share code, notes, and snippets.

@cmsj
Created February 1, 2013 21:23
Show Gist options
  • Select an option

  • Save cmsj/4694242 to your computer and use it in GitHub Desktop.

Select an option

Save cmsj/4694242 to your computer and use it in GitHub Desktop.

Revisions

  1. cmsj revised this gist Mar 1, 2013. No changes.
  2. cmsj renamed this gist Mar 1, 2013. 1 changed file with 21 additions and 35 deletions.
    56 changes: 21 additions & 35 deletions gistfile1.txt → gistfile1
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,11 @@ Display LCD2USB {
    # My actual hardware LCD
    Driver 'LCD2USB'
    Size '20x4'
    Backlight 1
    Icons 5 # XXX: Set this based on how many Icons we actually use
    Icons 2
    Contrast 220
    Brightness 50
    Bus '005'
    Device '003'
    }

    Display Curses {
    @@ -52,22 +55,6 @@ Widget LabelAllDisks {
    update seconds
    width 3
    expression python::exec('lcd4linux_rotator', 'main', 'AllDisks key ' . alldisks)
    width 3
    }

    Widget LabelDisk {
    # Attempt at an icon vaguely like a hard disk
    class 'Icon'
    Bitmap {
    Row1 '*****'
    Row2 '*.*.*'
    Row3 '**.**'
    Row4 '*.*.*'
    Row5 '*.*.*'
    Row6 '**.**'
    Row7 '*.*.*'
    Row8 '*****'
    }
    }

    Widget LabelDiskRW {
    @@ -77,15 +64,15 @@ Widget LabelDiskRW {
    class 'Icon'
    speed 400
    Bitmap {
    Row1 '.....|.....|*....|.*...|..*..|...*.|....*|.....|.....'
    Row2 '.....|*....|**...|***..|****.|.****|..***|...**|....*'
    Row3 '.....|.....|*....|.*...|..*..|...*.|....*|.....|.....'
    Row4 '.....|.....|.....|.....|.....|.....|.....|.....|.....'
    Row5 '.....|.....|.....|.....|.....|.....|.....|.....|.....'
    Row6 '.....|.....|....*|...*.|..*..|.*...|*....|.....|.....'
    Row7 '.....|....*|...**|..***|.****|****.|***..|**...|*....'
    Row8 '.....|.....|....*|...*.|..*..|.*...|*....|.....|.....'
    }
    Row1 '.....|.....|*....|.*...|..*..|...*.|....*|.....|.....'
    Row2 '.....|*....|**...|***..|****.|.****|..***|...**|....*'
    Row3 '.....|.....|*....|.*...|..*..|...*.|....*|.....|.....'
    Row4 '.....|.....|.....|.....|.....|.....|.....|.....|.....'
    Row5 '.....|.....|.....|.....|.....|.....|.....|.....|.....'
    Row6 '.....|.....|....*|...*.|..*..|.*...|*....|.....|.....'
    Row7 '.....|....*|...**|..***|.****|****.|***..|**...|*....'
    Row8 '.....|.....|....*|...*.|..*..|.*...|*....|.....|.....'
    }
    }

    Widget LabelRxTx {
    @@ -112,9 +99,9 @@ Widget DiskBar {
    class 'Bar'
    expression diskstats(disk_match, 'read_sectors', 500)
    expression2 diskstats(disk_match, 'write_sectors', 500)
    length 18
    length 19
    direction 'E'
    style 'H'
    #style 'H'
    update tack
    }

    @@ -127,7 +114,7 @@ Widget NetBar {
    length 19
    direction 'E'
    update tack
    style 'H'
    #style 'H'
    }

    Widget BarAllDisks {
    @@ -136,7 +123,7 @@ Widget BarAllDisks {
    class 'Bar'
    update seconds
    length 17
    style 'H'
    #style 'H'
    direction 'E'
    min 0
    max 100
    @@ -148,7 +135,7 @@ Widget TextScroll {
    width 20
    align 'M'
    update 20000
    speed 150
    speed 130
    expression python::exec('dailymail', 'main')
    }

    @@ -157,9 +144,8 @@ Widget TextScroll {
    Layout tenshu {
    # The Layout I use for my fileserver
    Row1 {
    Col1 'LabelDisk'
    Col2 'LabelDiskRW'
    Col3 'DiskBar'
    Col1 'LabelDiskRW'
    Col2 'DiskBar'
    }
    Row2 {
    Col1 'LabelRxTx'
  3. cmsj created this gist Feb 1, 2013.
    185 changes: 185 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,185 @@
    # 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'
    Backlight 1
    Icons 5 # XXX: Set this based on how many Icons we actually use
    }

    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)
    width 3
    }

    Widget LabelDisk {
    # Attempt at an icon vaguely like a hard disk
    class 'Icon'
    Bitmap {
    Row1 '*****'
    Row2 '*.*.*'
    Row3 '**.**'
    Row4 '*.*.*'
    Row5 '*.*.*'
    Row6 '**.**'
    Row7 '*.*.*'
    Row8 '*****'
    }
    }

    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 18
    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 150
    expression python::exec('dailymail', 'main')
    }

    ## Layouts

    Layout tenshu {
    # The Layout I use for my fileserver
    Row1 {
    Col1 'LabelDisk'
    Col2 'LabelDiskRW'
    Col3 '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'