Specific configuration for a testing laptop

Some specific things to tweak on our example Debian testing laptop

Author: Francesco Poli
Contact: invernomuto@paranoici.org
Version: 0.28
Copyright: Expat license
Notice:

Copyright (c) 2011-2026 Francesco Poli

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About this document
Web form HyperText Markup Language
Source form reStructuredText
Web stylesheet Cascading StyleSheets
Build directives Makefile

Contents

Summary of previous episodes

In another document (HTML, reST) you saw how to install a Debian testing base system on a laptop. You also found references to other general workstation documents to follow in order to tune the system. Now it's time to perform some laptop-specific configuration tweaking.

Network management

Network management on a laptop is slightly trickier than on a workstation/desktop or server machine: on a laptop different network interfaces are commonly used in different situations, and you cannot count on having the same network link always available.

Wired and wireless network

Mark the following packages as manually installed:

# aptitude unmarkauto iw wireless-regdb

and the following one as automatically installed:

# aptitude markauto wpasupplicant

Install the following network management daemon:

# aptitude --without-recommends install connman-gtk

Temporarily shut the ConnMan daemon down:

# systemctl stop connman.service

Then, bring the Ethernet network interface down:

# ifdown enx144fd7cea686

and edit the configuration file for network interfaces, until it looks like:

# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

Now, start the ConnMan daemon:

# systemctl start connman.service

The Ethernet network should be brought up and configured automatically (via DHCP), if available. If this fails to happen, and/or in order to manage other less trivial connections (such as wireless networks), a user may start a ConnMan UI:

$ connman-gtk

or:

$ connmanctl

You may use the UI to configure connections (for instance wireless ones) and enable/disable them.

By default, ConnMan will wait for at most 120 s on boot for a network link to be established. This will slow down the boot process, whenever no (Ethernet) network is available. If you want to avoid this delay and accept booting with the network down, you may disable the service:

# systemctl disable connman-wait-online.service

If you want to have the graphical ConnMan UI started on each Fluxbox session you open, so that it runs in the systray, configure it by clicking on the Settings button: uncheck "Use fsid with openconnect", check "Use status icon", and check "Launch to tray by default". Then insert the following two lines into your regular user's ~/.xsession file (between MANAGER and HANG POINT):

$ grep -A 1 'network management client' ~/.xsession
# start network management client
connman-gtk &

Power management

Install a power management daemon:

# aptitude install xfce4-power-manager

If you want to have this daemon started on each Fluxbox session you open, insert the following two lines into your regular user's ~/.xsession file (between MANAGER and HANG POINT):

$ grep power ~/.xsession
# start power management daemon
xfce4-power-manager --daemon

You can configure the daemon's settings, by selecting Power manager settings from the menu that pops up when you right-click on its systray icon, or, alternatively, by issueing the following command:

$ xfce4-power-manager-settings

In the "General" tab, choose "Ask" "When power button is pressed", "Do nothing" "When sleep button is pressed", "Do nothing" "When hibernate button is pressed", "Do nothing" "When battery button is pressed", enable "Handle display brightness keys", set "Brightness step count" 10, uncheck "Exponential", enable "Status notifications", enable "System tray icon". In the "System" tab, choose "System sleep mode" "Suspend" on battery and "Suspend" plugged in, set "When inactive for" Never on battery and Never plugged in, choose "Lock screen" on battery and "Lock screen" plugged in "When laptop lid is closed", set "Critical battery power level" 10 %, choose "On critical battery power" "Notify", and check "Lock screen when system is going to sleep". In the "Display" tab, enable "Display power management", set "Put to sleep after" 5 minutes on battery and 35 minutes plugged in, "Switch off after" 7 minutes on battery and 45 minutes plugged in, "On inactivity reduce to" 20 % on battery and 80 % plugged in, and "Reduce after" 2 minutes on battery and Never plugged in.

System monitor

In order to address laptop-specific needs, the configuration file for Conky should be adapted. You may use the following configuration file:

$ cat ~/.config/conky/conky.conf
-- vim: syntax=lua

conky.config = {
    background = false, -- do not fork in the background
    use_xft = true, -- use Xft
    font = 'Hack:size=8.0', -- Xft font
    update_interval = 2.0, -- update interval (in seconds)
    total_run_times = 0, -- run forever
    own_window = true, -- do not use root window, create own window instead
    own_window_type = 'override', -- desktop own window
    own_window_transparent = true, -- use pseudo transparency
    double_buffer = true, -- use double buffering
    minimum_width = 400, -- minimum width of text area
    draw_shades = true, -- draw shades
    draw_outline = false, -- do not draw outlines
    draw_borders = false, -- do not draw borders around text
    draw_graph_borders = true, -- draw borders around graphs
    stippled_borders = 8, -- stippled borders?
    border_inner_margin = 3, -- border margins and width
    border_outer_margin = 0,
    border_width = 1,
    default_color = 'white', -- default colors
    default_shade_color = 'black',
    default_outline_color = 'black',
    alignment = 'top_right', -- placement
    gap_x = 8, -- gap between borders of screen and text
    gap_y = 8,
    no_buffers = true, -- subtract file system buffers from used memory
    cpu_avg_samples = 2, -- number of cpu samples to average
    net_avg_samples = 2, -- number of net samples to average
    override_utf8_locale = true, -- need to force UTF8
    use_spacer = 'left', -- add spaces to keep things from moving about
    text_buffer_size = 640, -- set buffer size (in bytes) for exec outputs
    if_up_strictness = 'address', -- set if_up check strictness
};

-- stuff to be formatted on screen
conky.text = [[
${color green}Host:$color $nodename - $sysname $kernel on $machine
$hr
${color green}Time:$color ${time %a, %d %b %Y %T %z}${color green} - Unix time:$color ${time %s} s
${color green}Uptime:$color $uptime
${color green}Load Average:$color $loadavg${color green} - Processes:$color $processes${color green} - Running:$color $running_processes
${color green}CPU usage         %CPU   %MEM   RAM usage         %CPU   %MEM
${color} ${top name 1} ${top cpu 1} ${top mem 1}  ${top_mem name 1} ${top_mem cpu 1} ${top_mem mem 1}
${color} ${top name 2} ${top cpu 2} ${top mem 2}  ${top_mem name 2} ${top_mem cpu 2} ${top_mem mem 2}
${color} ${top name 3} ${top cpu 3} ${top mem 3}  ${top_mem name 3} ${top_mem cpu 3} ${top_mem mem 3}
${color green}CPU Clock Frequencies [MHz]:
$color ${freq 1} ${freq 2} ${freq 3} ${freq 4} ${freq 5} ${freq 6} ${freq 7} ${freq 8}
${color green}CPU Usage:$color $cpu % ${cpubar 6,100}${color green} - Disk I/O:$color $diskio/s
${color lightgrey}${cpugraph 30,200 0000ff ff0000} ${diskiograph 30,200 0000ff ff0000}
${color green}RAM Usage: $color $mem/$memmax - $memperc % ${membar}
${color green}Swap Usage:$color $swap/$swapmax - $swapperc % ${swapbar}
$hr
${color green}CPU Core Temperatures [K]:
$color ${hwmon coretemp temp 2 1 273} ${hwmon coretemp temp 3 1 273} ${hwmon coretemp temp 4 1 273} ${hwmon coretemp temp 5 1 273} ${hwmon coretemp temp 6 1 273} ${hwmon coretemp temp 7 1 273} ${hwmon coretemp temp 8 1 273} ${hwmon coretemp temp 9 1 273}
$hr
${color green}Network Ports:$color ${tcp_portmon 1 65535 count}
${if_up enx144fd7cea686}${color green} enx144fd7cea686 - Up:$color ${upspeedf  enx144fd7cea686} KiB/s${color green} - Down:$color ${downspeedf  enx144fd7cea686} KiB/s
${color lightgrey}${upspeedgraph  enx144fd7cea686 30,200 0000ff ff0000} ${downspeedgraph  enx144fd7cea686 30,200 0000ff ff0000}
$endif${if_up wlp0s20f3}${color green} wlp0s20f3 - Up:$color ${upspeedf wlp0s20f3} KiB/s${color green} - Down:$color ${downspeedf wlp0s20f3} KiB/s
${color lightgrey}${upspeedgraph wlp0s20f3 30,200 0000ff ff0000} ${downspeedgraph wlp0s20f3 30,200 0000ff ff0000}
$endif$hr
${color green}Filesystems:
${color green} /     $color${fs_used     /}/${fs_size     /} ${fs_bar     /}
${color green} /boot $color${fs_used /boot}/${fs_size /boot} ${fs_bar /boot}
${color green} /var  $color${fs_used  /var}/${fs_size  /var} ${fs_bar  /var}
${color green} /home $color${fs_used /home}/${fs_size /home} ${fs_bar /home}
$hr
${color green}${execi 50 ddate}
${color green}${execi 65000 fortune -s | tr -d '\b' | cowsay}
]];

Hardware event management

In order to handle some hardware events, install the following package:

# aptitude install acpi-support

On-the-fly video output reconfiguration

In order to be able to temporarily reconfigure video outputs (screen, external monitors, external video projectors, ...) on the fly, install the following GUI program:

# aptitude install arandr

However, it's easy enough to do the same with some trivial scripts for your regular user:

$ cat ~/.screenlayout/default.sh
#!/bin/sh
xrandr \
 --output eDP-1  --primary --preferred --pos 0x0 --rotate normal \
 --output HDMI-1 --off \
 --output DP-1   --off \
 --output HDMI-2 --off \
 --output DP-2   --off \
 --output HDMI-3 --off

xfce4-panel -q
sleep 1
xfce4-panel --disable-wm-check --sm-client-disable &

$ cat .screenlayout/hdmi_only.sh
#!/bin/sh
xrandr \
 --output eDP-1  --off \
 --output HDMI-1 --primary --preferred --pos 0x0 --rotate normal \
 --output DP-1   --off \
 --output HDMI-2 --off \
 --output DP-2   --off \
 --output HDMI-3 --off

xfce4-panel -q
sleep 1
xfce4-panel --disable-wm-check --sm-client-disable &

$ cat ~/.screenlayout/hdmi_dual.sh
#!/bin/sh
xrandr \
 --output eDP-1  --primary --preferred --pos 0x0 --rotate normal \
 --output HDMI-1 --preferred --right-of eDP-1 --rotate normal \
 --output DP-1   --off \
 --output HDMI-2 --off \
 --output DP-2   --off \
 --output HDMI-3 --off

Please note that issueing the command xrandr with no arguments shows the available outputs with their state (connected or disconnected) and possible modes.