Skip to main content


Showing posts from December, 2017

How to start R or Byobu by default in Xfce terminal or Gnome terminal

Fine-tuning your terminal
Maybe you only use your terminal emulator for R.

You type R followed by Enter after you open your terminal.

It could be easier still!

Right click and choose Preferences on Xfce terminal or Profiles -> Profile preferences on gnome terminal. Under the General tab of Xfce terminal or the Command tab of gnome terminal, check Run a custom command instead of my shell. In the field for the custom command, type /usr/bin/R.

That's it! R now starts up automatically when you open a terminal.

Of course, when you close R you also close the terminal.

Don't do this if you want your shell!

I run /usr/bin/byobu as a custom command in Xfce terminal.

I keep gnome terminal as a generic bash terminal.

How to move windows without the title bar

The problem Usually you left click and hold the title bar to move a window.

You have a poorly placed window with the title bar out of sight.

How do you move the darn thing?

This tip is so tiny I almost hesitate to publish it.

Then I remember how stuck I used to get before I learned it.

This tip saved my life!
The solution Hold down the Alt key.

Now you can left click, hold, and move a window from anywhere inside the window.

Works like magic on every window manager I've ever used in Linux!

Getting rid of empty lines in Linux

The problem Some files have a lot of empty lines.

You may want to condense multiple empty lines to a single empty line.

You may want to get rid of all empty lines.

The solutioncat -s filename condenses multiple empty lines to a single empty line.
Inside vim, call the command as :%!cat -s
cat -s filename | sed '/^$/d' gets rid of all empty lines.
Inside vim, call the command as :%!cat -s | sed '/^$/d'
Note Empty lines are not the same as blank lines.
Empty lines have nothing in them.
Blank lines may have spaces and tabs that you can't see.
These commands won't work with tabs or spaces on an "empty" line.

Xfce as a tiling window manager

Tiling window managers
I flirted with tiling window managers on Linux.

I liked them. I still like them. I may go back to them.

But I like a standard desktop more, at least for now.

Here's the thing.

Xfce can tile windows just fine!

So with Xfce, I have the best of both worlds.

Setting up tiling on Xfce
Xfce does not tile by default, at least on Debian stretch.

The potential is there, but no keystrokes are associated with tiling commands.

To fix this, go to Settings -> Window Manager. Click the Keyboard tab.

Scroll down to to the tiling commands.

There are eight of them. I use four:

Tile window to the top
Tile window to the bottom
Tile window to the left 
Tile window to the right

Use all eight if you so desire!

Double-click each command and give the keystrokes you want to use.

This was a little weird, at least for me.

I thought I would describe the keys I wanted to use in a field.

But no. I had to type the actual keys.

For example, double click on Tile window to the top.

Then type

Tricks with dict! Find similarly spelled words! Find phrases!

Tricks with dict
I use dict a lot from the command line.

Usually I type something like dict tricky to get back a definition and synonyms.

That's about as simple and user friendly as you can get.

But dict has a few more advanced tricks up its sleep.

dict can find similarly spelled words.

I wrote a short story with an alligator. I wanted words with "gator" to use as puns.

This command did the trick: dict -s re gator -m

Here's what I got back:
gcide:  Abnegator  Abrogator  Aggregator  alligator  Alligator   alligator  "Alligator apple"  "Alligator fish"  "Alligator gar"   "Alligator pear"  "alligator pear"  "alligator press"   "Alligator snapper"  "Alligator terrapin"  "Alligator tortoise"   "Alligator turtle"  "Alligator wood"  "Alligator wrench"   alligatored  alligatorfish  Alligatoridae  Castigator  castigatory   Castigatory  Circumnavigator  Comp…

Turn off that annoying touchpad and turn it on again from the command line in Linux

The problem
Touchpads on laptops drive me nuts.

Overly sensitive touchpads move me around in a document when I write.

Worse, they bounce me to other applications!

If I could turn my touchpad off permanently, that would be great.

But I need my touchpad for my desktop.

The solution
I wrote two short shell scripts to turn my touchpad off and on.

I named them td and te, for touchpad disable and touchpad enable.

Touchpad disable:
NUMBER=`xinput | grep Synaptics | sed 's/.*id=\([0-9]\+\).*/\1/'` xinput set-prop $NUMBER "Device Enabled" 0 Touchpad enable:
NUMBER=`xinput | grep Synaptics | sed 's/.*id=\([0-9]\+\).*/\1/'` xinput set-prop $NUMBER "Device Enabled" 1 I dropped them in my home directory, and made them executable: chmod 755 td te To call them I press <Alt>-F2 for a command line.

I type ./td <Enter> to disable the touchpad and ./te <Enter> to enable it.

That's all there is to it. Bliss!
Notes These little scripts have improve…

Xfce4 Dictionary Spanish English

The problem My wife uses the Xfce4 Dictionary ver. 0.7.2 which is a gui frontend to dict.

She needed an English <- -> Spanish dictionary for work.

The online server did not return English <--> Spanish results by default, even though the server has those dictionaries installed. I didn't want to take the time to figure out why. I know how to ask for those dictionaries from the command line, but that wasn't the issue. I needed a quick hack so my wife could look up words.
The solution In File -> Preferences in Xfce Dictionary, there is a Web Service tab.

At the bottom of the Web Service tab is a URL: field.

Drop this code into the field:{word}

Close the preferences dialog.

Select the Web Service button from Search with: on the main panel.

Now a search makes a page pop up on the default web browser with the definition of the word in Spanish and English. The direction of the search doesn't matter. Apple returns manzana, and m…

Support blog with a $5 contribution