[lug] Efficiency prioritized Linux desktop

Steve Litt slitt at troubleshooters.com
Mon Apr 13 21:48:28 MDT 2020


Hi all,

I promised to articulate how to build a Linux desktop system like mine,
so here it is. My desktop greatly prioritizes speed over things like
newness, pretty, or popular. My desktop employs no fuzzy logic and is
unable to interpret "you know what I mean" type queries or commands.
I'm not saying my desktop isn't discoverable or can't be made more
discoverable, but absolutely no human ambiguity is programmed into my
desktop. My desktop greatly emphasizes the keyboard over the mouse,
because usually the keyboard is much faster. My desktop does not
contribute to drag and drop, but doesn't retard it in situations where
you drag and drop within an application, or within two different
related applications.

As a nice side effect, my desktop is very light on resources, so it
works well on anemic computers, and is sizzelingly snappy on well
endowed computers. Unless you're dealing with a web browser or other
bloatware, you'll see a result the millisecond you press a key on the
keyboard.

My desktop isn't for everybody, or even half the people or maybe even a
quarter of the people. But some people will love it if they try it.

:::

My desktop is a tripod with three legs:

1) The OpenBox window manager or a similar window manager or DE [2]

2) dmenu from Suckless Tools

3) Ability to create very short shellscripts and programs

Start with any Linux distro (It might work on BSD: I haven't tried).
Install Openbox. Install dmenu from Suckless Tools. Put the following
shellscript somewhere on your filesystem:

==============================================
#!/bin/sh
dmenu_run  -i -l 16  -fn "7x14" -nf yellow -nb black -sf black -sb white
==============================================

Inside your ~/.config/openbox/rc.xml, create a hotkey that points to
the absolute filename of that shellscript. Mine looks like the
following:

==============================================
<keybind key="S-C-semicolon">
 <action name="Execute">
 <command>/home/slitt/bin/dmenu_litt.sh</command>
 </action>
</keybind>
==============================================

What the preceding did for me is now (after restarting Openbox), when I
press Shift+Ctrl+semicolon, it pulls up a vertical list of every
executable on my executable path. As I type in characters, it narrows
the list. When the list gets to a length of one, or when I press Enter
while the highlight is on a list item, the highlighted list item is
executed. Dmenu rules out all list items except those having the string
you typed in, and it sorts items *starting* with that string on top. In
other words, I run a program using four or five keystrokes, including
the final Enter key: This is much quicker than anything I could do with
the mouse, assuming I started and ended back up in keyboard home key
position.

My choice of Shift+Ctrl+semicolon is *my* choice of a fast hotkey. You
might prefer F5, or Winkey+z, or whatever. This setup is all about DIY
and personal customization.

Here are some other hotkeys I use, and please remember, you can
substitute the hotkeys you prefer:

Shift+Ctrl+comma: Restart openbox (without closing running windows). Do
    this every time any part of Openbox' config or menus is change.

Shift+Ctrl+period: Pull up a list of all windows on all desktops,
    sorted by desktop, so you can navigate to one using first-letter
    keystrokes, then hit Enter on the one you want to go to.

Shift+Ctrl+d: Run the cal program in a terminal so I can see the date
    and time. Remember, I have no panel (taskbar) [1].

Shift+Ctrl+j: On my laptop, toggle on and off my touchpad.

Alt+0: Close currently focused window. I changed this from its default
       Ctrl+F4 because I felt Alt+0 is much easier to hit. Your mileage
       may vary.

Ctrl+9: Run my main UMENU2 menu. UMENU2 is discussed later.

There are zillions of other hotkeys given me by Openbox. They are
documented, they are obvious by viewing ~/.config/openbox/rc.xml, and
they're fairly discoverable. Many have to do with workspace navigation.

:::

So the Openbox and dmenu legs of the tripod have been discussed. Here's
an example, from my laptop, of the shellscript, called
~/bin/touchtoggle.sh, that toggles my touchpad on and off:


==============================================
#!/bin/sh

# FIRST GET DEVICE'S DEVICE ID CONTAINING CASE INSENSITIVE "TOUCHPAD"
devid=`xinput | grep -i touchpad | \
  sed -e"s/.*id=//" | sed -e"s/\s.*//"`

# WITH THAT DEVICE ID, FIND EVERYTING ABOUT PROPERTY
# CONTAINING CASE INSENSITIVE "DEVICE ENABLED"
scratchline=`xinput --list-props 11 | \
  grep -i "device enabled" | \
  sed -e"s/^\s*//" | sed -e"s/\s*$//"`
proptext=`echo $scratchline | sed -e"s/\s*(.*//"`
propid=`echo $scratchline | sed -e"s/.*(//" | sed -e"s/).*//"`
currstate=`echo $scratchline | sed -e"s/.*):\s*//"`

# DIAGNOSTICS, COMMENT OUT WHEN FULLY FUNCTIONAL
echo diagnostic devid      =$devid
echo diagnostic scratchline=$scratchline
echo diagnostic proptext   =$proptext#
echo diagnostic propid     =$propid

# TOGGLE CURRSTATE VARIABLE
echo -n "Current state of $currstate "
==============================================

If it looks a little long or complex, consider that with comments,
diagnostics and blank lines removed, this shellscript is 10 lines long,
and has no if statements or loops. In LXDE (I use LXDE instead of
Openbox on my laptop), I just linked hotkey Shift+Ctrl+j to the
preceding shellscript.

Another example: In some circles there's a huge argument about the old
way of naming network interfaces and the new way, with proponents of
the new way reminding the old way fans that you can get it to do the
old way by some special udev-foo. Well, I've made a shellscript so that
on distros using the new way, the exact network name can be deduced.
It's called ~/bin/wifi_device, as follows:

==============================================
ip link | grep ^\\S | sed -e 's/^[^:]*: //' | sed -e 's/:.*//' | grep
"^w"
==============================================

Whoaaa, tough shellscript: 1 line long. Translated to English:

* Run ip link

* Remove lines starting with space

* From string's start, remove non-colons and the first colon

* Remove the next (now first) colon and everything that follows it. You
  now have a list of all network devices.

* Remove those not starting with "w".

The preceding works whenever there's only one wifi network device. If
there are more, you need to add a numeric argument to choose which one.

I bet every person on this list could find a better way of
accomplishing this. And that's exactly my point: This is all about DIY.
Actually, DIHYKHTDI. (Do it how you know how to do it). Why search the
web for hours looking for perfection, when you can do it your way in
five minutes and move on to doing actual work.

My setup doesn't require a programmer. The barest script kitty can do
it, if he or she hasn't drunk the Gates/Jobs "people are too stupid to
config their own computer" flavored drink. Google, DuckDuckGo,
Wikipedia, Stackexchange are your friend.

Notice also, that none of what's been said so far is distro dependent.
That comes in handy when you switch distros, or when your distro
upgrade breaks things, or when you don't want to intimately learn the
bowels of your distro.

So those are the three legs of the tripod. There's an optional fourth
leg, which I'll briefly describe but not detail...

:::

THE FOURTH LEG

The fourth leg is completely optional. The productivity-loving computer
user gets what he or she needs from the first three legs. The fourth leg
is when you actually start making yourself some simple software to
accomplish simple things. Simple things that otherwise require
installing cumbersome, often distro dependent, GUI applications. Often
applications that come with dependency hell.

At the fourth leg stage, shellscripts can grow to 50 lines. AWK, grep
and sort combine to efficiently batch-process text files into answers
you need, or input to a batch file that does what you need. 

And if you really want to feel the power, you can use UMENU2 (GPLv3) to
bolt a very nice menu interface onto one or more shellscripts, or AWK
scripts, or even (most non-programmers won't do this) a Domain Specific
Language made from such scripts.

http://troubleshooters.com/projects/umenu2/

With grep, awk, sed, cut, sort, head, tail, tee, cat, less, dmenu, and
maybe UMENU2 and python, you can get your computer to do almost
anything you need, and get it working quickly. It won't be pretty. The
user interface might be funky. Your friends will laugh at you. You
might later replace part or all of it with a "real app", or maybe even
a "killer app". But a reasonable facility with these programs can get
you moving, without evaluating alternatives or tearing your hair out due
to dependencies.

:::

Like I said, this isn't for everyone, but for some people it's a
productivity energy shot.


[1]: Having a panel doesn't violate the spirit of my setup. LXDE is
     approximately Openbox plus a panel, as is lxQt. I can also
     recommend the standalone panel tint2. Other panels are probably
     excellent.

[2]: Openbox is one of several interfaces that can be used. Anything
     light enough to eliminate noticeable keyboard latency and stable
     enough to repeatedly do the same thing. Other acceptable interfaces
     include, but are not limited to, LXDE, lxQt, Windowmaker, IceWM,
     ctwm. If absolutely necessary, you could even do it with Gnome,
     KDE or Unity, although the result might be a little sluggish.
     Also, ultra lightweight interfaces such as ratpoison, jwm, twm,
     awesome, j3, fvwm and the like can work well if you put in the
     time to configure them to achieve your goals.

     I find Openbox easiest to use for this purpose.


SteveT

Steve Litt
March 2020 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb


More information about the LUG mailing list