Today's phlog entry is about how to 
set up a ThinkPad L440 running Debian 
LXDE. The tutorial deals with the 
following issues:

* screen brightness keys 
* touchpad setup 
* window snapping
* sharp fonts 

The information here should be 
relevant to all *40 ThinkPads.

I'm posting this here for my own 
future reference, but I know that 
there are other ThinkPad users around 
gopherspace, so I might as well share 
the details.


NETINSTALL / WIFI SETUP
=======================

The net install iso is great for 
installing LXDE. It presents you with 
a choice of desktops at some 
point in the installation 
procedure. 

During installation, the wifi works 
and the wifi hardware is identified 
for you. Write down the name of the 
hardware. Mine was:

rtlwifi/rtl8192eefw.bin 

After reboot, the wifi will no longer 
work properly, because it depends on 
non-free firmware. You'll need to plug 
in your ethernet, add the contrib and 
non-free repos to the 
/etc/apt/sources.list lines, and 
install the wifi firmware.

I found the correct driver by typing:

apt-get update
apt-cache search rtlwifi

Then just install the firmware. For 
me, this involved the following 
installation:

apt-get install firmware-realtek

Use synaptic to do this part if you 
prefer the GUI.


SCREEN BRIGHTNESS KEY SETUP 
===========================

The sound buttons on the L440 work 
with LXDE out of the box. The screen 
brightness buttons do not. In order to 
get them working, install the 
xbacklight and xbindkeys packages.

Then follow these instructions[1]:

Check your /sys/class/backlight 
folder. If you can see an 
intel_backlight folder there ... then 
creating a /etc/X11/xorg.conf file 
with the below configuration should 
work for you.

 
Section "Device"
        Identifier  "Intel Graphics" 
        Driver      "intel"
        Option      "Backlight"  "intel_backlight"
EndSection


You might need to log out and back in 
before you conduct the next test.

Open a terminal and type "xbacklight 
-10" without the quotation marks. The 
screen should dim a little. You can 
bump up the brightness by typing 
"xbacklight +10". 

Now that you've verified that 
xbacklight works, create a file in 
your home directory called 
.xbindkeysrc with the leading period.

Enter the following in the file:


#BrightnessUp
"xbacklight +10"
    XF86MonBrightnessUp

#BrightnessDown
"xbacklight -10"
    XF86MonBrightnessDown


Save the file. Now the brightness keys 
(F5 and F6) should work to raise and 
lower your screen brightness. If they 
don't, try logging out and logging 
back in.


TOUCHPAD SETUP
==============

This one drove me crazy. I must have 
spent three or four hours on it. It 
turns out that it's really easy. I 
have the original clunkpad in my L440. 
Since no ThinkPad in the *40 series 
has proper bottom buttons, regardless 
of whether you switch to the *50 
series trackpad or not, I wanted to 
set up the clickpad sensibly, like a 
mac, where a one-finger click anywhere 
is a 'left click' and a two-finger 
click is a 'right click'.

All that's required to make the change 
is to add one line to the file
/usr/share/X11/xorg.conf.d/40-libinput.conf 

Find the section that looks like this:

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

Add this line after Driver "libinput":

        Option "ClickMethod" "clickfinger"

So in the end, the section will look 
like this:

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "ClickMethod" "clickfinger"
EndSection

That's it. 

See the following link for more 
libinput configuration details:

https://wiki.archlinux.org/index.php/Libinput#Button_re-mapping


WINDOW SNAPPING
===============

I like to be able to "snap" my windows 
to half-screen (left or right), 
full-screen, or minimized state by 
holding down the Windows Key and 
pressing the arrow keys.

You can achieve this behaviour by 
editing ~/.config/openbox/lxde-rc.xml

Add the following text[2] just prior 
to the line that says "<!-- 
Keybindings for window switching -->"


    <!-- Aero Snap for Openbox Begin Code-->
    <keybind key="W-Left">        # HalfLeftScreen
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>0</x><y>0</y><height>100%</height><width>50%</width></action>
    </keybind>
    <keybind key="W-Right">        # HalfRightScreen
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo"><x>-0</x><y>0</y><height>100%</height><width>50%</width></action>
    </keybind>
    <keybind key="W-Up">
      <action name="MaximizeFull"/>
    </keybind>
    <keybind key="W-Down">
      <action name="Iconify"/>
    </keybind>
    <!-- Aero Snap for Openbox End Code-->


Once you set up window snapping like 
this, you'll wonder how you got along 
without it.


SHARPFONTS
==========

Linux fonts are a lot better than they 
used to be, but they're still not 
great, and they're not hard to fix. A 
long time ago, there was a website 
dedicated to installing sharper 
fonts[3] on Linux. It's gone, but you 
can still get fonts and the scripts.

If you like the old, very crisp fonts 
from the Windows XP era, you'll want 
to make these mods.

First login as root and install the 
microsoft true type fonts, as follows:

apt-get install ttf-mscorefonts-installer

Then get the following file: 

https://web.archive.org/web/20130501222012/http://www.osresources.com/files/centos-windows-fonts/fontconfig.tbz

Navigate into the directory with the 
fontsconfig.tbz file, and execute the 
following command:

tar xvjpf fontconfig.tbz -C /etc/fonts/

Log out and log back in. You can fine 
tune the fonts by going to the LXDE 
Menu > Preferences > Customize Look 
and Feel > Fonts Tab.

If you don't like the change, just 
navigate into fontconfig.tbz, note the 
names of the four files within the 
folder, and then remove them from 
/etc/fonts.

But I think you're going to like it.


COMPTON
========

To install compton (for terminal transparency)

apt-get install compton compton-conf
nano ~/.config/lxsession/LXDE/autostart

Add to the end of the file:

@/usr/bin/compton


BLUETOOTH
==========

apt-get install blueman

Then log out / log in


FILE MANAGER ACCESS TO SERVERS
==============================

To allow PCmanFM and Nautilus ("Files") to mount FTP, SMB, etc.

apt-get install gvfs-backends


 
[1] https://superuser.com/questions/1279727/xfce-change-brightness-steps-and-or-change-brightness-key-behavior

[2] I believe this is the source for the original scripting: https://ubuntuforums.org/showthread.php?t=2076433

[3] www.sharpfonts.com