incomplete.io

cloudshell xorg display

We've configured the LCD display and configured the Xorg X server to be able to display on the LCD. Next we'll create an X session to start the X display and display some stuff on the screen when the backlight is on.

Add yet another include statement to the top-level Ansible playbook (ansible-playbook.yml) file and to pull in the xsession.yml file, which we will create and add the following content:

    - name: Install Xorg X Server
      apt:
            name: xserver-xorg
            state: latest

    - name: Install conky
      apt:
            name: conky
            state: latest

    - name: Configure Conky display
      template:
          src: ./templates/xu4-cloudshell/conkyrc.j2
          dest: /etc/conkyrc
          owner: root
          group: root
          mode: 0644

    - name: Service to start Conky and X on LCD
      template:
          src: ./templates/xu4-cloudshell/xinit.service
          dest: /etc/systemd/system/xinit.service
          owner: root
          group: root
          mode: 0644

    # Enable X/Conky service
    - name: Reload systemd
      command: /bin/systemctl daemon-reload

    - name: Enable xinit service
      command: /bin/systemctl enable xinit


Again, this isn't specific to the XU-4, but we find useful for ours. Here's what the Ansible tasks give us:

  1. Install the Xorg X server if not already installed
  2. Install the Conky system monitor application
  3. Write a configuration for Conky based on a template
  4. Create a systemd service to start X and Conky on the LCD

/etc/systemd/system/xinit.service

This service simply starts xinit to start both an X server and the Conky X client.

[Unit]
Description=Conky and Xorg
After=systemd-user-sessions.service

[Service]
ExecStart=/usr/bin/xinit /usr/bin/conky -c /etc/conky/conky.conf -- vt01

[Install]
WantedBy=multi-user.target

/etc/conky/conky.conf

Our conky configuration file is the default config with a few small changes:

-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo

Any original torsmo code is licensed under the BSD license

All code written since the fork of torsmo is licensed under the GPL

Please see COPYING for details

Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
All rights reserved.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
]]

conky.config = {
    alignment = 'top_left',
    background = false,
    border_width = 1,
    cpu_avg_samples = 2,
    default_color = 'white',
    default_outline_color = 'white',
    default_shade_color = 'white',
    double_buffer = true,
    draw_borders = false,
    draw_graph_borders = true,
    draw_outline = false,
    draw_shades = false,
    use_xft = true,
    font = 'DejaVu Sans Mono:size=10',
    gap_x = 5,
    gap_y = 5,
    minimum_height = 5,
	minimum_width = 5,
    net_avg_samples = 2,
    no_buffers = true,
    out_to_console = false,
    out_to_stderr = false,
    extra_newline = false,
    own_window = true,
    own_window_class = 'Conky',
    own_window_type = 'desktop',
    stippled_borders = 0,
    update_interval = 2.0,
    uppercase = false,
    use_spacer = 'none',
    show_graph_scale = false,
    show_graph_range = false
}

conky.text = [[
$nodename
${color grey}RAM:$color $mem/$memmax - $memperc% ${membar 4}
${color grey}CPU 1:$color ${cpubar cpu1 4}
${color grey}CPU 2:$color ${cpubar cpu2 4}
${color grey}CPU 3:$color ${cpubar cpu3 4}
${color grey}CPU 4:$color ${cpubar cpu4 4}
${color grey}CPU 5:$color ${cpubar cpu5 4}
${color grey}CPU 6:$color ${cpubar cpu6 4}
${color grey}CPU 7:$color ${cpubar cpu7 4}
${color grey}CPU 8:$color ${cpubar cpu8 4}
/        $color${fs_used /}/${fs_size /}
/datavol $color${fs_used /datavol}/${fs_size /datavol}
Tx:$color ${upspeedgraph eth0 10}
Rx:$color ${downspeedgraph eth0 10}
]]
Twitter: @IncompleteIO