Transparent background in console-based web browser

It’s cool to have a transparent background in your console-based web browser, such as Elinks or Lynx. Depending on your desktop image and text colours, the result may become illegible, unusable and detrimental to the eyes, but visually stunning awesomeness is guaranteed in any case.

There are several spins and versions of Elinks, so the simple tweaks I list here may not work for everyone. When I was researching how to achieve background transparency, the tutorials on the web suggested recompiling with certain options. However, for me, with version 0.13.GIT (obtained from Arch User Repository), all I needed was these entries in elinks.conf:

	set document.colors.use_document_colors = 0 	# set document.colors.background = black

This means that attempts to use webpage CSS has to be switched off and the black background (most usable option normally) has to be commented out, if it’s in use.

Then make Elinks acknowledge the transparency of the terminal under Options / Terminals / *terminal name* / transparency. Set transparency to “1”. This will result in something like this in elinks.conf:

	set terminal.xterm-color.transparency = 1

Now try it out 🙂

HOW TO TRANSPARENT BACKGROUND IN LYNX

Lynx’s functionality is also severely dependent on the precise version. Mine is 2.8.9dev.1, which is the most uptodate at the moment of writing. In some distros the latest version goes under the name lynx-cur or lynx-current.

    1. Look for the file /etc/lynx.lss
    2. Either copy the file to your user directory under some workable name to modify it as user or modify the original file as root.
    3. In the file, find these rows:
      normal:        normal:                 lightgray:black default:       normal:                 white:black
    4. And comment them out:
      #normal:        normal:                 lightgray:black #default:       normal:                 white:black
    5. Start Lynx with lynx -lss path-to-the-modified-lynx.lss

Note: If you chose to modify the original /etc/lynx.lss, it will be overwritten when the next Lynx update arrives.

Lynx instructions derived from https://bbs.archlinux.org/viewtopic.php?pid=1071270#p1071270

Mount /tmp to RAM and systemd

/tmp is a system section that is rather active. Temporary downloads get directed there. Package manager (system updater) works through it. Building packages, if not specifically directed elsewhere, also works through the same section.

Why mount /tmp to RAM?

If your hardware uses SSD instead of HDD, you may want to reduce disk activity as SSD is sensitive to it and supposedly gets worn out easily. Reduced number of disk writes can be achieved by mounting /tmp to RAM. There are instructions on the net how to do it.

However, systems built around systemd may already direct /tmp to RAM out of the box. I don’t know if all systemd distros do this, but Manjaro does. More specifically, systemd treats /tmp as tmpfs, which means /tmp is directed both to RAM and swap.

Why not mount /tmp to RAM?

Allowing /tmp to operate in RAM is desirable, if the system disk is an SSD instead of HDD. But when you use HDD, which is more likely, and you compile source into packages every once in a while with relatively limited RAM, then it’s more desirable to have /tmp operate on the disk rather than in RAM. When you compile code into packages and RAM runs out of space, you will get an error.

Find out if /tmp is treated as tmpfs

In terminal, type:

df -h

The result may be like this:

/dev/sda6           15G    6,3G  8,3G  44% / dev                3,9G       0  3,9G   0% /dev run                3,9G    9,0M  3,9G   1% /run tmpfs              3,9G    272K  3,9G   1% /dev/shm tmpfs              3,9G       0  3,9G   0% /sys/fs/cgroup tmpfs              3,9G     20K  3,9G   1% /tmp

Find /tmp in the last column and see if it says tmpfs in front of it in the first column. If yes, and you use HDD and have limited RAM, consider changing the situation.

Pointing /tmp to HDD

In distros with systemd, the solution is:

systemctl mask tmp.mount

After this, df -h should result in something like this:

/dev/sda6           15G    6,3G  8,3G  44% / dev                3,9G       0  3,9G   0% /dev run                3,9G    9,0M  3,9G   1% /run tmpfs              3,9G    272K  3,9G   1% /dev/shm tmpfs              3,9G       0  3,9G   0% /sys/fs/cgroup

Plainly, /tmp section should vanish. May take a reboot for full completion of the change.

Non-systemd

In other distros it’s more likely that /tmp was not pointed to RAM in the first place. If it was, it should be possible to change this by editing and reloading /etc/fstab.

Thunderbird: Disable Remote Images Warning

There are plenty of tutorials on the internet to get Thunderbird mailer to display images in emails, even though this is obvious: Press Show Remote Content. This post is about how to never see the warning again.

remote images warning

Seamonkey is a sane mailer. It displays the same kind of warning, but with two options, either to allow remote content or never warn about it again (and never show the content either). Thunderbird, however, has been sanitised towards insanity, so it only displays Show Remote Content button, but doesn’t seem to offer a way to get rid of the ugly button altogether.

Here’s how: Open Preferences –> Advanced –> General and find about:config. There, find the setting mailnews.message_display.disable_remote_image. Set this to false. Done.

Review: Manjaro Netbook Edition

(Here’s the official intro to Manjaro Netbook Edition https://forum.manjaro.org/index.php?topic=7319.0)

My screen of Manjaro Netbook Edition after a weekend of tweaking:

Netbook Edition screenshot after personalisation

Comparison with Manjaro Openbox Edition a.k.a. Manjarobox

LOGIN MANAGER

The login manager is MDM, known from Linux Mint. In my opinion it’s too heavy for netbooks. In Manjarobox you get Slim, which is much more appropriate. This was the first thing I changed to reflect Manjarobox after I installed the Netbook Edition.

DESKTOP

Manjarobox features Openbox, which is a light desktop. Light basically means that there are no desktop icons and the apps menu opens with right-click on the desktop, instead of having a dedicated taskbar button. Still, for example the invaluable systray is there.

In comparison, Netbook Edition features Xfce, a full-featured desktop environment, but with some important alterations specific to Netbook Edition. In normal Xfce you expect desktop icons. These are not available in Netbook Edition. The rest is pretty much there, even the new feature of window snapping-and-tiling-by dragging. (In Manjarobox this last functionality is available with keyboard shortcuts after some hacking.)

The most visible departure from the usual Xfce is the central taskbar in Netbook Edition. The central taskbar is replaced with DockbarX. The taskbar in normal Xfce behaves like in XP, whereas DockbarX always iconifies the open apps. When hovering the mouse pointer above the icon in DockbarX, you see the list of open windows with an opportunity to switch to them or close them with precision. Right-click on the icon provides you with some actions, such as pin, (un)maximise, and close the application – Win 7 style.

There’s a unique default behaviour configured into Netbook Edition’s desktop environment: Apps start up with maximised window. I was wary of this behaviour at first. This was one of the reasons why I didn’t try Netbook Edition on my netbook sooner. However, now I have seen it in action and it seems that this behaviour makes kind of sense in netbooks.

Some oddities occur due to this maximisation behaviour, for example when you copy files in Thunar, a full-screen progress window pops up instead of a small progress bar. Still, by default you have the well-considered unmaximise button on the taskbar. It’s also possible to easily configure a keyboard shortcut to toggle window maximisation in Xfce, so in the end this is not a problem. It’s a feature.

CHOICE OF APPLICATIONS

Compared to Manjarobox 0.8.8 which was very minimalistic, Netbook Edition comes with more apps, such as Midori browser (versus no browser in Manjarobox 0.8.8), Xfburn (I don’t know why this is here; how many netbooks have a DVDRW drive?), Audacious, VLC.

I liked the lack of apps in Manjarobox better. Manjarobox 0.8.8 even lacked the graphical applications manager (Pamac in Manjaro), so that you had to know the command-line way of adding apps at first. To compensate, Manjarobox comes with some important installation scripts in the apps menu – menu items to install the graphical applications manager, office software, printers’ drivers, multimedia codecs, and more.

Manjarobox’s installation scripts is something that is in turn missing in Netbook Edition and this is a serious miss in my opinion, because, for example, even though some multimedia apps are there in Netbook Edition out of the box, not all codecs are there.

SOME PERSONAL STUFF

In my screenshot above there are some visible additions to the default selection of apps in Netbook Edition:

  • Artha (the Wordnet dictionary with some added features)
  • Seamonkey
  • Skype
  • Otter browser (the pointer icon in the centre of the taskbar; Otter browser does not really have an icon, but this is how I made it to look like for now)
  • Xfce goodies, such as the CPU graph and Clipman; this is another miss in the default selection of apps in Netbook Edition in my opinion. To me, these goodies are inseparable from Xfce.

THE BEST IN NETBOOK EDITION

In comparison with Manjarobox, the screen lock and suspend at lid-close is configured properly out of the box. This how it should be in any OS version specifically catering to laptops and similar.

For this edition, the developers have optimised the kernel (for the i686 architecture version; Netbook Edition with x86_64 architecture doesn’t have this). I am too dumb to understand the benefits of the optimised kernel, but there’s more: Also Flash plugin, which I thought inappropriate for my netbook and I didn’t even try in Manjarobox, is specifically optimised and works like a snap in all browsers!

Now, disappointingly again, these optimised packages – linux312-netbook and flashplugin-netbook – don’t seem to be readily available in the repositories. Manjarobox users would really appreciate them.

I am a Skype user, so a remark on this too. In Manjarobox, Skype tended to crash in the middle of some kinda hot webcam sessions. Without much research I thought it can be blamed on hardware weakness. Now on Manjaro Netbook Edition these crashes do not occur. Either I got lucky or something’s truly optimised here 🙂

CONCLUSION

All-in-all, there are some important things in this edition that make it worth trying, such as the optimised Flash plugin and considerately pre-configured lid-close. The misses are minor and easily remedied. If you have a netbook and some experience with Manjaro, give it a try.

My netbook has 1 GB RAM and Intel Atom CPU N450 (-HT-) clocked at Min:1000.000Mhz Max:1666.000Mhz. Netbook Edition’s Xfce desktop works here almost as snappy as Openbox that I tried earlier. I was perfectly satisfied with Openbox, but I like some of the added functionality in Netbook Edition, such as the window tiling by dragging, and I have learned to like the auto-maximised windows. With less RAM and weaker CPU however, Openbox would still be a smarter choice considering the resources.

Reformat USB stick in Linux

Here’s a follow-up to the blog post Create a bootable USB stick in Linux.

The first time I reformatted my USB stick from bootable to a normal file-storage device, I followed some other instructions, but now Webupd8.org instructions worked.

THE PROCEDURE

1. Insert the USB stick.

2. In terminal, issue:

dmesg | tail

3.There will be the description of the activities of the last active device. The device name will be between brackets as [sdd], [sdc] or [sdb]. See what you got and remember it.

4. Unmount the device. It should work by issuing in terminal:

sudo umount /dev/sdb

The sdb bit should be your own device of course. However, sometimes the command doesn’t work. I had to use the graphical file manager to unmount the device.

5. Reformat by issuing in terminal:

sudo mkdosfs -F 32 -n 'Label' -I /dev/sdb

The -F 32 can be omitted, but it ensures the most Windows-friendly format.

The ‘Label’ gives the device a name. You can have ‘MyUSB’ or such, if you like.

6. After the last command has done its thing (may take time), remove and reinsert the stick to test the result.

NTFS File System

When the aim is to format the stick as ntfs instead of msdos file system, step #5 is different:

sudo mkntfs -L Label -I /dev/sdb -F

Note the little differences from step #5 compared to msdos file system:

  • Label is without quotes
  • With ntfs, -F means “force” (to override an error message) rather than “format” (try mkntfs without -F and see what you’ll get)

All the other steps are the same.

Mplayer error

After a system update, Mplayer failed to launch. It gave this error:

mplayer: error while loading shared libraries: liblirc_client.so.0: cannot open shared object file: No such file or directory

Looking around the web for solution, I found that the fault is in the dependency called lirc-utils.

Solution #1: Reinstall lirc-utils

Solution #2: Recompile Mplayer without dependency on lirc-utils

In PKGBUILD under ./configure –prefix=/usr \ add –disable-lirc

Solution #2 found here https://bugs.archlinux.org/task/18526

Create a bootable USB stick in Linux

Note: These instructions erase the whole stick. The result will be just one bootable OS on the stick. In the next post I will tell how to get the stick back to normal, somewhat.

  1. Stick the USB stick in the computer
  2. In the terminal, determine the device:
    sudo ls -l /dev/disk/by-id/*usb*

    The device listed multiple times, with a number in the end and without, is the one to use. E.g. /dev/sdb

  3. If you have automount enabled, unmount the device.
  4. cd to the folder where the iso file is.
  5. Create bootable device:
    sudo dd if=filename.iso of=/dev/sdb bs=4M; sync

    The device path is an example. However, it must be without number in the end.

Learned from here http://crunchbang.org/forums/viewtopic.php?id=23267

Copy with mouse in Xterm

Xterm is a terminal emulator for Linux that I like a lot. For some reason it’s not the default emulator in any distro that I know of. This post is about how to make Xterm select-and-copy-to-clipboard with mouse.

One of the features I like in Xterm is the way copy and paste work there. Namely, it’s not emulating modern word processors in this, where you Ctrl+C (or, more often, Ctrl+Shift+C) to copy and Ctrl+V (Ctrl+Shift+V) to paste. Instead, the mouse works there in peculiar ways that may seem cumbersome at first, but make sense later, after some infotechnological enlightenment.

The move to copy

Xterm allows copying with mouse this way:

  • Select a letter (Left-click+Drag)
  • Release the mouse button and move the mouse where you want to end the selection
  • When the mouse pointer is where you want to end the selection, Right-click

This selects everything from the first selected letter (which was really only to mark the beginning of the selection) to the right-click. In truth, this move both selects and copies, but it’s not obvious that it copies.

Multiple buffers

Terminal emulators distinguish three buffers, two of which are important – at least for my purposes. The two important buffers are Primary and Clipboard.

The described move to select text in Xterm also copies it at the same time to the primary buffer. This means it’s possible to paste it (with Ins or Shift+Ins or a keyboard shortcut specific for the program open in the emulator) in Xterm only, not paste it elsewhere in the desktop. To be able to copy from Xterm and paste elsewhere, a tweak is necessary.

The tweak to copy to the clipboard in Xterm

Note: The tweak will copy to the clipboard buffer, not only to primary. This will make the distinction of primary and clipboard buffers disappear. If you need the distinction, don’t use this tweak.

In your home folder, a text file named .Xresources or .Xdefaults probably already exists. If not, create it. Create just one of these, not both.

In the file, paste this line:

XTerm*VT100.translations: #override : select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)

Save the file. To make the function take effect immediately, issue this command in the terminal:

xrdb -merge .Xresources

If you created the file by the name .Xdefaults, use that name instead of .Xresources. All this done, the described move to select text with mouse in Xterm should do select-and-copy-to-clipboard so that it can be pasted to any other program on the desktop.

Copy with mouse in Elinks

Elinks is a console-based webbrowser that allows some interaction with mouse. At first glance it’s impossible to grab text, but this works by point-click-and-drag when holding down Shift key. This post is about a specific mismatch of default settings between Manjaro Openbox desktop and Elinks web browser.

For a while I was puzzled why Shift+Left-Click+Drag doesn’t select text in Elinks in Manjaro Openbox desktop, but the answer is stated openly in the default conky script on the desktop: Left-Click+Drag is reserved for moving windows around on the desktop and this conflicts with the function in Elinks despite the distinction of Shift being pressed or not.

I decided to change the desktop default. The solution is to find, in Openbox RC (.config/openbox/rc.xml), the guilty section that causes the mouse behaviour and to remove it or comment it out. Since I removed it already months ago, I don’t even remember what the actual section was – and I am happy about this.

The result is that Shift+Left-Click+Drag will select text in Elinks again. Also, dragging windows around remains working, only not in the entire window area any more. Now you have to select precisely the upper window bar to Left-Click+Drag windows on the desktop.

Elinks.conf

In summer 2013 I set up Elinks text browser. To me it makes sense as a replacement for Opera browser component, because I use Opera primarily to read and type, not watch images or videos. So, this post is for those who don’t care so much about images and videos on the internet, but care a lot about text and urls.

Here are snippets from my elinks.conf file with comments. I mostly show the changes that emulate Opera plus some inevitable differences from Opera.

A. Startup

When you open up Elinks the first time, you can open up configuration options by pressing o and keyboard settings by pressing k. After some time and effort in those two dialogs, elinks.conf file becomes understandable and then it’s possible to edit the file directly.

## ELinks 0.12pre5 configuration file  ## ui  #  User interface options.    ## ui.startup_goto_dialog [0|1]   #  Pop up goto dialog in newly created tabs when there's no homepage set. This   #  means also showing goto dialog on startup.   set ui.startup_goto_dialog = 0

At first startup, Elinks opens up the address field, called “go-to dialog”. It’s similar to Opera’s F2 address field. Since I don’t want this dialog at every startup and at every new tab (yep, Elinks does tabs), I have this setting at 0. Otherwise you’d have to press Esc to get rid of it at every startup and every new tab.

With go-to dialog at 0 and no homepage set, I have a blank page at Elinks startup. From here, I can:

– type g to open the go-to dialog (there’s no other address field but the go-to dialog; the blank page is really completely blank)
– h to browse history of visited pages
– s for bookmarks.

Those g, h, and s are default shortcuts which can also be changed.

Concerning the address field (go-to dialog), these keyboard bindings are handy:

bind "edit" "Shift-Insert" = "paste-clipboard" bind "edit" "Tab" = "auto-complete" 

Paste-clipboard, obviously, pastes to the address field from clipboard. Rather than Ctrl+v it’s better to have it Shift+Ins because this is the regular shortcut in consoles.

Tab completes some typed text on the address field from history and bookmarks.

B. Display

To make the webpage display sanely as per console logic and to remove unnecessary formatting, use these settings:

## document  #  Document options.    ## document.colors    #  Default document color settings.      ## document.colors.background <color|#rrggbb>     #  Default background color.     set document.colors.background = "black"      ## document.colors.use_document_colors <num>     #  Use colors specified in document:     #  0 is use always the default settings     #  1 is use document colors if available, except background     #  2 is use document colors, including background. This can     #    mostly look very impressive, but some sites will appear     #    really ugly. Note, that obviously if the background is     #    not black, it will break the behaviour of transparency.     set document.colors.use_document_colors = 0    ## document.css    #  Options concerning how to use CSS for styling documents.      ## document.css.enable [0|1]     #  Enable adding of CSS style info to documents.     set document.css.enable = 0  bind "main" "B" = "toggle-display-tables" 

The toggle to render/ignore tables is the uppercase B. In the keybindings, lowercase and uppercase keys are different bindings. Again, change it to what you like. When you are in the keyboard bindings dialog in elinks, and you try to set a binding that already exists, you get a warning along with the opportunity to overwrite.

C. Images

## document.browse    #  Document browsing options (mainly interactivity).      ## document.browse.images      #  Options for handling of images.        ## document.browse.images.show_as_links [0|1]       #  Display links to images without an alt attribute. If this option is       #  off, these images are completely invisible.       set document.browse.images.show_as_links = 1

This makes images show up as [img] if they have no alt text. The [img] is a link that identifies the url when you select it. I have the setting this way just in case the text implies the image may be useful after all, so I can download it when really needed to see.

D. Moving around in a document

By default, Space moves the page down by a screen. PgUp goes up a screen in the document. To move up and down a row or line, use the default bindings Ins and Del. I saw no reason to change these. If the mouse is enabled, the scroll wheel can also scroll the document by rows, but sorry, no smooth scrolling.

By default, arrow keys have some conflicting functions that must be changed to emulate Opera’s spatial navigation jumping from link to link:

bind "main" "Down" = "move-link-down" bind "main" "Right" = "move-link-right-line" bind "main" "Up" = "move-link-up" bind "main" "Left" = "move-link-left-line"  bind "main" "j" = "history-move-forward" bind "main" "u" = "history-move-back" 

E. Links

## document.browse.links      #  Options for handling of links to other documents.        ## document.browse.links.numbering [0|1]       #  Display numbers next to the links.       set document.browse.links.numbering = 0  bind "main" "/" = "toggle-numbered-links" bind "main" "l" = "link-menu" bind "main" "L" = "goto-url-current-link"

/ will give numbers to all links, so you can type the number to go to the link.

When a link is selected, l key (lowercase l) will open up a menu that contains options like Open, Open in new tab, new window, download, and more.

Uppercase L will extract the url in the link to the address field (goto-dialog) for full examination and editing. Of course, Elinks has a sensible status bar so that the url of any selected link can be examined immediately, but the screen width is not always enough.

More bindings:

bind "main" "Ctrl-D" = "add-bookmark" bind "main" "a" = "add-bookmark-link" bind "main" "Ctrl-S" = "save-url-as"

F. Tabs

By default, lowercase t key opens up a new tab, but in a non-obvious way: It duplicates the current page. This is okay so you don’t have to have another keybinding for Duplicate page. You can see that a new tab has been opened because a tab bar appears above the status bar.

In the new tab situation, refer to instructions given under A. Startup. Just two Operatic keybindings from v.12:

bind "main" "Ctrl-W" = "tab-close" bind "main" "Shift-Ctrl-Alt-W" = "tab-close-all-but-current" 

Some keybindings simply won’t work, I don’t know why. Ctrl+Tab to cycle tabs doesn’t work. The default keybindings to move between tabs are < and >.

G. Searching in the document

To search within a document , I have these bindings:

bind "main" "." = "search-typeahead-text" bind "main" "Ctrl-F" = "search" bind "main" "F3" = "find-next" bind "main" "Shift-F3" = "find-next-back"

With bindings like this, a simple . key will allow search-as-you-type like in Opera. Ctrl+F will open up a search dialog as in most graphical editors. The next item will be highlighted by F3 and the previous by Shift+F3.

Links don’t need specific search. Above there was a keybinding “/” to identify all links by number, so you can go to any of them by typing the number. Moving between links is as simple as pressing the arrow keys.

H. Search engines

There’s something called “dumb rewrite prefixes” and “smart rewrite prefixes” in Elinks. You are welcome to figure out the smart ones if you are smart. Here’s how to use the dumb ones to add search engines:

## protocol  #  Protocol specific options.    ## protocol.rewrite       ## protocol.rewrite.default_template <str>     #  Default URI template used when the string entered in the goto dialog does     #  not appear to be a URI or a filename (i.e. contains no '.', ':' or '/'     #  characters), and does not match any defined prefixes. Set the value to ""     #  to disable use of the default template rewrite rule.     #       #  %c in the template means the current URL,     #  %s in the template means the whole string from the goto     #     dialog,     #  %0,%1,...,%9 mean the 1st,2nd,...,10th space-delimited part     #     of %s,     #  %% in the template means '%'.     set protocol.rewrite.default_template = "https://duckduckgo.com/?t=ouk&q=%s"      ## protocol.rewrite.dumb      #  Dumb prefixes, see enable-dumb description for details.        ## protocol.rewrite.dumb.g <str>       #  Replacement URI for this dumbprefix:       #  %c in the string means the current URL       #  %% in the string means '%'       set protocol.rewrite.dumb.g = "!g"        ## protocol.rewrite.dumb.d <str>       set protocol.rewrite.dumb.d = "http://dictionary.reference.com/dic?q=%s&search=search"        ## protocol.rewrite.dumb.imdb <str>       set protocol.rewrite.dumb.imdb = "http://www.imdb.com/find?s=all&q=%s"

Hopefully you see the pattern.

I have Duckduckgo set to conduct a search when I type something on the address field (go-to dialog) that isn’t an address.

When the typed string on the address field begins with “g ” (g plus space), then it will go to Google results via Duckduckgo.

When the typed string on the address field begins with “d “, it will conduct the Dictionary.com search, “imdb ” will search Imdb.com, for just a few examples. You can add and change as you like.