Tag Archives: laptop

Valuable News – 2018/10/07

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here so someone else can

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

Using Dummynet for Traffic Shaping on FreeBSD.
https://www.hyperois.com/members/knowledgebase.php?action=displayarticle&id=1

HardenedBSD 1100056.6 Released.
https://hardenedbsd.org/article/op/2018-09-30/stable-release-hardenedbsd-stable-11-stable-v11000566

Cache Invalidation Bug in Linux Memory Management.
https://googleprojectzero.blogspot.com/2018/09/a-cache-invalidation-bug-in-linux.html

IBM is responsible for making \ the path separator instead of / in MS-DOS.
https://twitter.com/fahickman/status/1045809677827596288
https://github.com/Microsoft/MS-DOS/blob/master/v2.0/source/README.txt

State of Memory Safety in Linux.
https://blog.araj.me/state-of-memory-safety-in-linux/

Haiku R1/Beta1 Released.
http://www.osnews.com/story/30758/Haiku_R1_beta_1_released
https://www.haiku-os.org/get-haiku/release-notes/

FreshRSS – free self-hostable aggregator.
https://freshrss.org/

Miniflux is a minimalist and opinionated feed reader.
https://miniflux.app/

Using very old ZFS filesystem can give you kernel panic on Linux.
https://utcc.utoronto.ca/~cks/space/blog/linux/ZFSOldFilesystemPanic

OpenBSD vmd(8) now works out of the box on AMD Ryzen.
https://twitter.com/LeoUnglaub/status/1046058268555186176

The origin of the name POSIX.
https://stallman.org/articles/posix.html

PostgreSQL Per-Table Autovacuum Tuning.
https://www.keithf4.com/per-table-autovacuum-tuning/

Sequence Caching: Oracle vs. PostgreSQL.
https://seiler.us/2018-10-02-sequence-caching-oracle-vs-postgresql/

Polish BSD User Group.
https://oshogbo.vexillium.org/blog/55/

OpenSSH 2.3-7.4 Mass Username Enumeration (CVE-2018-15473).
https://github.com/trimstray/massh-enum

The POWER9 Desktop is Now Official!
https://twitter.com/PCzanik/status/1047782986660364290

If you were the Linus Torvalds of FreeBSD what would be the first thing you would change?
https://twitter.com/freebsdbytes/status/1047563491828277253

BSD Now 266 – File Type History.
https://www.jupiterbroadcasting.com/127441/file-type-history-bsd-now-266/

OpenBSD on the Desktop: some thoughts.
https://blog.gsora.xyz/openbsd-on-the-desktop-some-thoughts/

Installing Gophernicus in OpenBSD.
http://gopher.solobsd.org/gophernicus.html?utm_source=discoverbsd

FreeBSD finally updates GNOME port to 3.28 version.
https://twitter.com/wezm/status/1047990697838563329
https://svnweb.freebsd.org/ports?view=revision&revision=480951
https://help.gnome.org/misc/release-notes/3.28/

FreeBSD – FCP-0101 – Deprecating Most 10/100 Ethernet Drivers.
https://lists.freebsd.org/pipermail/freebsd-stable/2018-October/089717.html

In Other BSDs for 2018/10/06.
https://www.dragonflydigest.com/2018/10/06/21880.html

DTrace is coming to Windows. Already available on FreeBSD/macOs/Illumos. The only holdout is Linux.
https://twitter.com/TheGlasspelican/status/1048405923318943744
https://youtu.be/tG8R5SQGPck?t=732

Announcing pkgsrc-2018Q3 Release.
https://mail-index.netbsd.org/tech-pkg/2018/10/05/msg020326.html?utm_source=discoverbsd

Migrating OmniOS VM from KVM to bhyve.
https://omniosce.org/info/bhyve_migrate

FreeBSD diskinfo -wS (synchronous writes) bandwidth limits on Optane devices.
https://twitter.com/nickprincipe/status/1048251974532124673

First SmartOS snapshot with bhyve support as alternative hypervisor to QEMU/KVM.
https://bsd.network/@sehnsucht/100843128594097501
http://us-east.manta.joyent.com/Joyent_Dev/public/SmartOS/smartos.html#20180315T080815Z
https://github.com/joyent/smartos-live/commit/48cb3c49e1a9c4cf204a59bed8312b0096f6209e

FreeBSD amd64: make memset less slow with mov.
https://svnweb.freebsd.org/base?view=revision&revision=339205

Hardware

AMD 12-core (2970WX) and 24-core (2920X) Threadripper 2 CPUs on 29th October.
https://www.anandtech.com/show/13443/amd-announces-availability-of-12-and-24core-threadripper-2-cpus-coming-late-october

RISC-V Inches Toward The Center.
https://semiengineering.com/risc-v-inches-toward-the-center/

Lenovo ThinkPad X1 Extreme / 6-core / 64 GB RAM / GTX 1050 Ti / under 4 pounds.
https://arstechnica.com/gadgets/2018/08/lenovos-thinkpad-x1-extreme-hex-core-gtx-1050-ti-64gb-ram-under-4-pounds/

ARM Partners with Xilinx to Bring Cortex-M Processors to FPGAs.
https://blog.hackster.io/arm-partners-with-xilinx-to-bring-cortex-m-processors-to-fpga-be60b4c77b1a

iDRACula Vulnerability Impacts Millions of Legacy Dell EMC Servers.
https://www.servethehome.com/idracula-vulnerability-impacts-millions-of-legacy-dell-emc-servers/

Wi-Fi Alliance Introduces Wi-Fi 6 (802.11ax) Technology.
Wi-Fi 5 to identify devices that support 802.11ac technology.
Wi-Fi 4 to identify devices that support 802.11n technology
https://www.wi-fi.org/news-events/newsroom/wi-fi-alliance-introduces-wi-fi-6

MicroZed Chronicles: XDF & Versal.
https://blog.hackster.io/microzed-chronicles-xdf-versal-b5a04cd0f973

Intel Customized SoC for HP: Amber Lake-Y with On-Package LTE Modem.
https://www.anandtech.com/show/13434/intel-custom-amber-lake-y-with-lte-modem

High resolution photos of the motherboard that looks almost the same in Bloomberg.
https://twitter.com/1kevin335200/status/1047960097937346566

Life

Insufficient Sleep Associated with Risky Teen Behavior.
https://neurosciencenews.com/sleep-teen-behavior-9938/

Annoying habits of highly effective people.
https://www.economist.com/business/2018/09/29/the-annoying-habits-of-highly-effective-people

Your IQ Matters Less Than You Think.
http://nautil.us/issue/65/in-plain-sight/your-iq-matters-less-than-you-think

Other

World’s Oldest Torrent Still Alive After 15 Years.
https://torrentfreak.com/worlds-oldest-torrent-still-alive-after-15-years-180929/

After Seeing These 15 Maps You’ll Never Look At The World The Same.
http://www.physics-astronomy.org/2018/05/after-seeing-these-15-maps-youll-never.html

EOF
Advertisements

FreeBSD Desktop – Part 16 – Configuration – Pause Any Application

Many desktop oriented operating systems try to provide various usability improvements and features, like quite useful Expose or Dashboard in Mac OS X or useless Tiles concept in recent editions of Microsoft Windows systems.

pause.key.jpg

After using UNIX for so many years I knew that I could freeze (or pause) any process in the system with kill -17 (SIGSTOP) signal and then unfreeze it with with kill -19 (SIGCONT) signal as I described in the Process Management section of the Ghost in the Shell – Part 2 article. Doing it that way for the desktop applications is PITA to say the least. Can you imagine opening xterm(1) terminal and searching for all Chromium or Firefox processes and then freezing them one by one every time you need it? Me neither.

Fortunately with introduction of so called X11 helper utilities – like xdotool(1) – it is now possible to implement it in more usable manner.

Today I will show you how to freeze any X11 application with single keyboard shortcut or mouse gesture if you utilize them in any way with small simple script.

When such feature can be useful (or what for)?

Lets say you have Firefox started with many tabs open (50+) and you know that it drains battery life from your laptop. You can close it but when You will need information from any of those tabs, then You will have to start Firefox again (even more battery usage) and load all needed tabs (battery …). The alternative is to pause all Firefox processes when You do not use them. This will freeze all its processes and subprocesses and it will not use any CPU (or battery) power. When you will need it, then you will unpause it without the need to load all tabs again.

Other example may be some heavy processing. For example you started RawTherapee or Darktable processing of large amount of photos and you are not able to smoothly watch a video. Just pause it, watch the video and unpause it again to finish its work.

Its also usable in single player gaming when You can REALLY pause the game, literally πŸ™‚

You may also check earlier articles of the FreeBSD Desktop series:

First we need to install the so called X11 helpers. Do that with this pkg(8) command.

# pkg install xprop xdotool zenity xbindkeys

Now for the script that would make all this magic happen. The desktop-pause.sh script is available on GitHub as its syntax is nicely colored there. Save it in some place where its searchable through ${PATH} variable like ~/bin or ~/script directory and make it executable.

% fetch -O ~/scripts/desktop-pause.sh https://raw.githubusercontent.com/vermaden/scripts/master/desktop-pause.sh
% chmod +x ~/scripts/desktop-pause.sh
% echo $PATH | grep scripts
/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/home/vermaden/scripts

It has three ways of usage.

% desktop-pause.sh
usage: desktop-pause.sh OPTION [ARGUMENT]

OPTIONS:
  -a  -  Do pause/resume active window.
  -s  -  Do pause/resume interactively selected window.
  -p  -  Do pause/resume specified PID.
  -l  -  Do list paused processes/windows.
  -L  -  Do list paused processes/windows with PIDs.

ARGUMENT:
  PID for '-p' option.

If started with -a option, then it would pause/unpause the currently active window. This option is best used with keyboard shortcut or mouse gesture. It you start desktop-pause.sh script with -s argument, then the cursor will change and you will be able to select which window to freeze (or unfreeze). The -p option is usable in terminal directly as you may want to freeze/unfreeze a process without X11 environment or for some debugging purposes for example. The last -l option will list applications that are currently paused.

pause.key.thinkpad

Most present-day generation laptops have island type limited keyboards so you will have to choose for yourself which keyboard shortcut to use. As I still use 2011 ThinkPad T420s laptop with 7-row keyboard I have little more options. The [Pause Break] key seems to be the best candidate for such feature πŸ™‚ I will use it for the ‘active window freeze/unfreeze’ with -a option and [SHIFT]-[Pause Break] key for the more interactive -s option.

To create such new keyboard shortcut we will use handy xbindkeys(1) tool.

Lets see what code we will have to put into the ~/.xbindkeysrc configuration file.

% xbindkeys --help
xbindkeys 1.8.6 by Philippe Brochard
usage: xbindkeys [options]
  where options are:
  -V, --version           Print version and exit
  -d, --defaults          Print a default rc file
  -f, --file              Use an alternative rc file
  -p, --poll-rc           Poll the rc/guile configs for updates
  -h, --help              This help!
  -X, --display           Set X display to use
  -v, --verbose           More information on xbindkeys when it run
  -s, --show              Show the actual keybinding
  -k, --key               Identify one key pressed
 -mk, --multikey          Identify multi key pressed
  -g, --geometry          size and position of window open with -k|-mk option
  -n, --nodaemon          don't start as daemon

As its single key we will need --key option. Lets do it then.

% xbindkeys --key
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
    m:0x0 + c:110
    Pause

Now lets read the [SHIFT]-[Pause Break] sequence.

% xbindkeys --key
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.
"(Scheme function)"
    m:0x1 + c:110
    Shift + Pause

We now have all needed information for the ~/.xbindkeysrc configuration file. Here is how it looks configured.

% cat ~/.xbindkeysrc

# [Pause Break] FOR ACTIVE WINDOW
"~/scripts/desktop-pause.sh -a"
  Pause

# [Shift]-[Pause Break] FOR INTERACTIVE WINDOW
"~/scripts/desktop-pause.sh -s"
  Shift + Pause

Now lets start xbindkeys(1) and verify that it works.

% xbindkeys

Press the [Pause Break] key when you are in the terminal where you started xbindkeys(1) utility. Now hit [ENTER] several times, the terminal should be freezed. Now hit [Pause Break] key again. The etnered [ENTER] keys have been passed to it as it was unfreezed.

Lets check the Firefox example.

When processes run like usual they have on of the I*/S*/R* state like shown below.

% ps ax | grep firefox | grep -v grep
67981  -  S       3:28.66 /usr/local/lib/firefox/firefox -contentproc -childID 58 -isForBrowser -prefsLen 31209 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab
41124  0- S      68:44.94 firefox
43940  0- S      25:52.43 /usr/local/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 27620 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab

When you will now freeze Firefox with [Pause Break] key its processes will have T state.

% ps ax | grep firefox | grep -v grep
67981  -  T       3:28.66 /usr/local/lib/firefox/firefox -contentproc -childID 58 -isForBrowser -prefsLen 31209 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab
41124  0- T      68:45.17 firefox
43940  0- T      25:52.85 /usr/local/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 27620 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab

After you unfreeze them again with [Pause Break] key they will get back to normal I*/S*/R* state.

% ps ax | grep firefox | grep -v grep
67981  -  S       3:28.67 /usr/local/lib/firefox/firefox -contentproc -childID 58 -isForBrowser -prefsLen 31209 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab
41124  0- S      68:45.54 firefox
43940  0- S      25:53.01 /usr/local/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 27620 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab

You may of course specify by hand the Firefox PID which is 41124 in current state.

% desktop-pause.sh -p 41124
INFO: kill -17 41124
INFO: kill -17 67981
INFO: kill -17 43940

The Firefox browser will be paused again.

% ps ax | grep firefox | grep -v grep
67981  -  T       3:28.68 /usr/local/lib/firefox/firefox -contentproc -childID 58 -isForBrowser -prefsLen 31209 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab
41124  0- T      68:46.68 firefox
43940  0- T      25:56.22 /usr/local/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 27620 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab

Use it again to unpause it.

% desktop-pause.sh -p 41124
INFO: kill -19 41124
INFO: kill -19 67981
INFO: kill -19 43940

And viola! Firefox runs again.

% ps ax | grep firefox | grep -v grep
67981  -  S       3:28.68 /usr/local/lib/firefox/firefox -contentproc -childID 58 -isForBrowser -prefsLen 31209 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab
41124  0- S      68:46.72 firefox
43940  0- S      25:56.28 /usr/local/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 27620 -schedulerPrefs 0001,2 -appdir /usr/local/lib/firefox/browser 41124 tab

There are no downsides to this feature but one has to remember paused applications will not refresh themselves as their processes are freezed. Below you can see frozen Epiphany browser upon which the xterm(1) window was moved. Pretty Windows like effect.

epiphany.paused

After you unpause the Epiphany it gets back to normal as shown below.

epiphany.unpaused.png

Remember to add xbindkeys(1) command to your ~/.xinitrc (or ~/.xsession file) to make it permanent.

UPDATE 1

One of the Hacker News users named rhn_mk1 explained the lack of window contents refresh while application is freezed. I will just cite his comment below.

That depends on the window manager. The application state is not really affected, it just stops updating (redrawing its area). When another window moves away, the window manager asks the “underlying” application to update that area of the screen. It’s dead, so the WM keeps displaying the last thing that was there, until something else happens in that spot.

On the other hand, compositing window managers will dedicate a separate buffer to each application, where they have exclusive access. That kind of a window manager would not have to ask the application to update anything – it would just take the image from the dedicated application’s buffer and update the screen with it. Since the application’s buffer can’t be modified by anything else, it would have the last state of the application in it. That would in turn find its way to the screen. No glitches.

UPDATE 2

One of the Reddit users 89luca89 pointed me to the browser-suspender solution that ‘simply suspends the browser when not in focus using STOP/CONT’ signals.

UPDATE 3

The Lobsters user seschwar pointed out that there is Stoppable Layout functionality for XMonad which automatically pauses the processes of all windows except for the active one and it also uses SIGCONT and SIGSTOP signals.

UPDATE 4

One of the Hacker News users named imglorp suggested that my “command could also iconify/minify the app’s windows”.

This is really good idea.

I just added -A and -S options that also minimize a window.

% desktop-pause.sh 
usage: desktop-pause.sh OPTION [ARGUMENT]

OPTIONS:
  -a  -  Do pause/resume active window.
  -A  -  Do pause/resume active window and minimize it.
  -s  -  Do pause/resume interactively selected window.
  -S  -  Do pause/resume interactively selected window and minimize it.
  -p  -  Do pause/resume specified PID.
  -l  -  Do list paused processes/windows.
  -L  -  Do list paused processes/windows with PIDs.

ARGUMENT:
  PID for '-p' option.

Here is the changelog for the desktop-pause.sh script:
https://github.com/vermaden/scripts/commit/03591a138b14cededa15a05fe9c77bf1a941795d

EOF

FreeBSD Desktop – Part 15 – Configuration – Fonts & Frameworks

The title of this article kinda sounds for me like Fast & Furious title … In this part of FreeBSD Desktop series we will focus on the fonts settings andΒ GTK/QT frameworks configuration to make applications based on them look good … or at least better.

You may also check earlier articles of the FreeBSD Desktop series:

Fonts

Proper rendering of fonts in the system is not an easy task, even most popular desktop oriented operating systems like macOS (Mac OS X) and Windows have problems with it.

We will of course focus on FreeBSD fonts settings but most of that information will be reusable on other operating systems that use X11 Window System for the desktop.

To not duplicate the knowledge already available for this topic please read these two sources for handling fonts on the FreeBSD operating system.

System Settings

The font rendering on X11 Window System desktops is made by fontconfig package. The system wide configuration is kept under /usr/local/etc/fonts directory. You can even verify that it belongs to the fontconfig package with pkg-which(8) command.

% pkg which /usr/local/etc/fonts/fonts.conf.sample
/usr/local/etc/fonts/fonts.conf.sample was installed by package fontconfig-2.12.6,1

For the fonts settings there are two directories for that purpose.

  • /usr/local/etc/fonts/conf.avail
  • /usr/local/etc/fonts/conf.d

If you want to enable a feature then you create a symlink in the /usr/local/etc/fonts/conf.d directory that leads to a small config file in the /usr/local/etc/fonts/conf.avail directory.

Here are all available options.

% ls -1 /usr/local/etc/fonts/conf.avail
10-autohint.conf
10-hinting-full.conf
10-hinting-medium.conf
10-hinting-none.conf
10-hinting-slight.conf
10-no-sub-pixel.conf
10-scale-bitmap-fonts.conf
10-sub-pixel-bgr.conf
10-sub-pixel-rgb.conf
10-sub-pixel-vbgr.conf
10-sub-pixel-vrgb.conf
10-unhinted.conf
11-lcdfilter-default.conf
11-lcdfilter-legacy.conf
11-lcdfilter-light.conf
20-unhint-small-dejavu-sans-mono.conf
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-serif.conf
20-unhint-small-vera.conf
25-unhint-nonlatin.conf
30-metric-aliases.conf
31-cantarell.conf
40-nonlatin.conf
42-luxi-mono.conf
45-generic.conf
45-latin.conf
49-sansserif.conf
50-user.conf
51-local.conf
57-dejavu-sans-mono.conf
57-dejavu-sans.conf
57-dejavu-serif.conf
60-generic.conf
60-latin.conf
65-fonts-persian.conf
65-khmer.conf
65-nonlatin.conf
69-unifont.conf
70-no-bitmaps.conf
70-yes-bitmaps.conf
80-delicious.conf
90-synthetic.conf

… and here are options enabled on my system.

% ls -1 /usr/local/etc/fonts/conf.d
10-hinting-none.conf
10-hinting-slight.conf
10-scale-bitmap-fonts.conf
10-sub-pixel-rgb.conf
10-unhinted.conf
11-lcdfilter-default.conf
20-unhint-small-dejavu-sans-mono.conf
20-unhint-small-dejavu-sans.conf
20-unhint-small-dejavu-serif.conf
20-unhint-small-vera.conf
30-metric-aliases.conf
40-nonlatin.conf
42-luxi-mono.conf
45-generic.conf
45-latin.conf
49-sansserif.conf
50-user.conf
51-local.conf
57-dejavu-sans-mono.conf
57-dejavu-sans.conf
57-dejavu-serif.conf
60-generic.conf
60-latin.conf
65-fonts-persian.conf
65-nonlatin.conf
69-unifont.conf
80-delicious.conf
90-synthetic.conf
99pdftoopvp.conf
README

You may even check which of these files/features are enabled by which package.

% for FILE in /usr/local/etc/fonts/conf.d/*.conf; do pkg which ${FILE}; done
/usr/local/etc/fonts/conf.d/10-hinting-none.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-hinting-slight.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/10-sub-pixel-rgb.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-unhinted.conf was not found in the database
/usr/local/etc/fonts/conf.d/11-lcdfilter-default.conf was not found in the database
/usr/local/etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/20-unhint-small-vera.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/30-metric-aliases.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/40-nonlatin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/42-luxi-mono.conf was installed by package font-bh-ttf-1.0.3_3
/usr/local/etc/fonts/conf.d/45-generic.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/45-latin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/49-sansserif.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/50-user.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/51-local.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/57-dejavu-sans-mono.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/57-dejavu-sans.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/57-dejavu-serif.conf was installed by package dejavu-2.37
/usr/local/etc/fonts/conf.d/60-generic.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/60-latin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/65-fonts-persian.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/65-nonlatin.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/69-unifont.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/80-delicious.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/90-synthetic.conf was installed by package fontconfig-2.12.6,1
/usr/local/etc/fonts/conf.d/99pdftoopvp.conf was installed by package cups-filters-1.16.0_5

Most of the settings are of course make by the fontconfig package. As you see the 4 files are not installed by any package, they were symlinked/configured by me.

These settings seems to make fonts look best, I will ‘repeat’ these settings in various other files that we will use.

/usr/local/etc/fonts/conf.d/10-hinting-none.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-sub-pixel-rgb.conf was not found in the database
/usr/local/etc/fonts/conf.d/10-unhinted.conf was not found in the database
/usr/local/etc/fonts/conf.d/11-lcdfilter-default.conf was not found in the database

If you would like to make system wide settings then do not use the provided /usr/local/etc/fonts/fonts.conf file. Use the /usr/local/etc/fonts/local.conf instead because /usr/local/etc/fonts/fonts.conf file will be replaced with next fontconfig package update.

User Settings

I keep most of the settings/fonts in the user home dir like ~/.config and ~/.fonts directories. Its easier for me to move/backup/import these then to edit or merge the system files everytime.

The fonts are kept in the ~/.fonts directory. I will of course share the fonts of this directory, here is the list of the fonts that are available for download as fonts.tar.gz file.

  • Arvo
  • Calibri
  • Cambria
  • Cantarell
  • Clear Sans
  • Consolas
  • Constantia
  • Corbel
  • Cormorant
  • Cosmic Sans Neue Mono
  • Courier Prime Code
  • Courier Prime Sans
  • Fira Code
  • Fira Mono
  • Fira Sans
  • Francophil Sans
  • Garamond
  • Georgia
  • IBM Plex Mono
  • IBM Plex Sans
  • Inconsolata
  • Monofur
  • Monoid
  • Pro Font Windows
  • Proggy Tiny Zero
  • PT Sans
  • SV Basic Manual
  • Trebuchet MS
  • Ubuntu
  • Ubuntu Mono

I would say that Consolas, Ubuntu Mono and Inconsolata are one of the best monospaced fonts while Trebuchet MS is probably the best looking (and properly rendered) font for non-monospaced/sans serif font category. I also really like Fira, IBM Plex and also Ubuntu family. The new Cantarell font is also pretty nice.

Lots of these fonts can be installed using installing FreeBSD Ports under /usr/ports/x11-fonts category and by pkg(8) packages, but its simpler for me to keep (and move) them in the ~/.fonts directory then to install packages everytime I need them. I also only keep the ones that I need/use while port/package often provides while set of them. For long time the user configuration for fonts was kept under ~/.fonts.conf file but it is no more. The new place is the ~/.config/fontconfig/fonts.conf file.

Mine config is not that long but check its contents for yourself.

While WordPress is quite a nice platform it has it problems – it will not render properly content in HTML or XML. To not introduce eventual problems related to that I will post a screenshot of the config below along with link to the ~/.config/fontconfig/fonts.conf file.

fonts.conf.jpg

These settings were forged for more then 15 years of my time first using Slackware and Gentoo Linux and since about 2005 – FreeBSD. As You can see from the comments I swap several bad looking fonts for good looking ones.

For example if You do not like the Arial font you may want to swap it into the Trebuchet MS font with this snippet added to the ~/.config/fontconfig/fonts.conf file.

Similarly with another XML snippet – I will post a screenshot of the config below along with link to the example file.

fonts.conf.swap.jpg

To make the test we will use this simple fonts-swap-test.html HTML file.

Here is how it looks in Epiphany after the change in the ~/.config/fontconfig/fonts.conf file.

epiphany-swap-example

The Arial font has been swapped into Trebuchet MS one. For sure Epiphany, Firefox and Midori do respect this swap, I did not tried other browsers.

Remember to reload the fontconfig cache after changes to the ~/.config/fontconfig/fonts.conf file, you may do that using already posted fc-cache.sh script.

Frameworks

Some also call them toolkits. Things like GTK or QT are in this category.

GTK

My favorite framework and least PITA one at the same time for good looking desktop was GTK2. GTK1 was always ugly, fast and light, but ugly. I think we can agree on that. GTK2 from the times when GNOME 2 was considered ‘heavy’ desktop environment. Now GTK2 is mostly deprecated (some applications still use it and they still work good) in favor of GTK3 and GNOME 2 is dead. Fortunately it has been forked into project named MATE and MATE seems light now, what an irony. Fortunately because old GNOME 2 file manager – Nautilus – seems to be one of the best file managers for the UNIX systems, sure not the lightest/fastest one, but a one that suits lots/most of the needs. Under the MATE team the Nautilus has been rebranded into Caja. Caja accompanied by Thunar from the Xfce desktop environment with its mass rename tool seems to be the most universal solution for graphical file management on UNIX. They also look similar/coherent as they both use GTK3 toolkit now (before they both used GTK2 framework).

GNOME 3 and its apps use GTK3 exclusively. You may also check Cinnamon which is GNOME 3 fork with an idea to provide GNOME 2 classic experience based on modern tools and modern GTK3 framework. The MATE desktop also moved to the GTK3 so we now have two GNOME 2 successors based on GTK3. The GTK3 is not a problematic framework, but some of its applications are, probably most of the ones written on/for the GNOME 3 environment. They come with their own built-in window buttons/handlers overwriting/ignoring the ones provided by window managers. Not so long ago the default settings left you with additional border of 5 or so pixels for each side of the window if You do not use composition/shadows manager like compton, which wastes screen space. Below you will find example from just 2 months ago with this problem.

taskbar-full-desktop

Fortunately its gone now (the additional border) and Epiphany – as an example of such GNOME 3 app – works/displays properly and is shown below.

epiphany.png

Both GTK2 and GTK3 use/used these environment variables exported by export(1). I am not sure if they are still respected but I do not want to check all my apps to find out and keeping then in the ~/.xinitrc file does not hurt.

# GTK ANTIALIASING
  export GDK_USE_XFT=1

GTK2

The configuration for GTK2 framework is kept in the ~/.gtkrc-2.0 file.

Alternatively – when you use various graphical tools/managers for GTK2 settings like lxapperance you may want to use ~/.gtkrc-2.0.mine instead.

Here is mine ~/.gtkrc-2.0 file with its contents.

% cat ~/.gtkrc-2.0
  include "/home/vermaden/.gtkrc-2.0.mine"
  gtk-theme-name="Arc"
  gtk-icon-theme-name="faenza"
  gtk-font-name="Ubuntu 10"
  gtk-cursor-theme-size=0
  gtk-toolbar-style=GTK_TOOLBAR_ICONS
  gtk-toolbar-icon-size=GTK_ICON_SIZE_SMALL_TOOLBAR
  gtk-button-images=1
  gtk-menu-images=1
  gtk-enable-event-sounds=1
  gtk-xft-antialias=1
  gtk-xft-hinting=0
  gtk-xft-hintstyle="hintnone"
  gtk-xft-rgba="rgb"

The selected theme is Arc (use /usr/ports/x11-themes/gtk-arc-themes port/package) and the icon theme is Faenza (use /usr/ports/x11-themes/mate-icon-theme-faenza port/package). For the user the GTK themes are kept under the ~/.themes directory while icon sets are kept under the ~/.icons directory. I also set font to Ubuntu in the size of 10. Remember that it can also be set as ubuntu or UBUNTU. To check what font will be selected by what You type there use the fc-match(1) command from the fontconfig package.

% fc-match ubuntu
ubuntu.ttf: "Ubuntu" "Regular"

% fc-match UBUNTU
ubuntu.ttf: "Ubuntu" "Regular"

The last 4 settings – gtk-xft-* – are the ones related to fonts rendering, as I said earlier, these settings will be ‘repeated’ over various other files. Currently there is no single file to configure all fonts behavior unfortunately.

The GTK2 File Chooser keeps its configuration in the ~/.config/gtk-2.0/gtkfilechooser.ini file, its not needed to configure this file.

The GTK2 Bookmarks are stored in the ~/.gtk-bookmarks file.

Here are contents of mine.

% cat ~/.gtk-bookmarks
file:///home/vermaden/hydepark ~/hydepark
file:///home/vermaden/books ~/books
file:///home/vermaden/gfx ~/gfx
file:///home/vermaden/gfx/wallpapers ~/gfx/wallpapers
file:///home/vermaden/gfx/screenshots ~/gfx/screenshots
file:///home/vermaden/misc ~/misc
file:///home/vermaden/misc/aix ~/misc/aix
file:///home/vermaden/misc/bsd ~/misc/bsd
file:///home/vermaden/misc/hp-ux ~/misc/hp-ux
file:///home/vermaden/misc/linux ~/misc/linux
file:///home/vermaden/misc/solaris ~/misc/solaris
file:///home/vermaden/misc/hardware ~/misc/hardware
file:///home/vermaden/misc/emc ~/misc/emc
file:///home/vermaden/misc/tsm ~/misc/tsm
file:///home/vermaden/mp3 ~/mp3
file:///home/vermaden/photo.NEW ~/photo.NEW
file:///home/vermaden/vm ~/vm
file:///home/vermaden/vm/iso ~/vm/iso
file:///home/vermaden/vm/storage ~/vm/storage

GTK3

The GTK3 files are more ordered then GTK2 files. The main configuration is kept in the ~/.config/gtk-3.0/settings.ini file.

Here are my current GTK3 settings.

% cat ~/.config/gtk-3.0/settings.ini
[Settings]
  gtk-theme-name          = Arc
  gtk-icon-theme-name     = faenza
  gtk-font-name           = Ubuntu 10
  gtk-cursor-theme-size   = 0
  gtk-toolbar-style       = GTK_TOOLBAR_ICONS
  gtk-toolbar-icon-size   = GTK_ICON_SIZE_SMALL_TOOLBAR
  gtk-button-images       = 1
  gtk-menu-images         = 1
  gtk-enable-event-sounds = 1
  gtk-xft-antialias       = 1
  gtk-xft-hinting         = 0
  gtk-xft-hintstyle       = hintnone
  gtk-xft-rgba            = rgb

Besides little different syntax the settings are the same as in the GTK2 configuration, thus I will not comment them again to not repeat myself.

The GTK3 Bookmarks are kept in the ~/.config/gtk-3.0/bookmarks file and their syntax is the same as it were for the GTK2 toolkit.

% cat ~/.config/gtk-3.0/bookmarks
file:///home/vermaden/hydepark ~/hydepark
file:///home/vermaden/books ~/books
file:///home/vermaden/gfx ~/gfx
file:///home/vermaden/gfx/wallpapers ~/gfx/wallpapers
file:///home/vermaden/gfx/screenshots ~/gfx/screenshots
file:///home/vermaden/misc ~/misc
file:///home/vermaden/misc/aix ~/misc/aix
file:///home/vermaden/misc/bsd ~/misc/bsd
file:///home/vermaden/misc/hp-ux ~/misc/hp-ux
file:///home/vermaden/misc/linux ~/misc/linux
file:///home/vermaden/misc/solaris ~/misc/solaris
file:///home/vermaden/misc/hardware ~/misc/hardware
file:///home/vermaden/misc/emc ~/misc/emc
file:///home/vermaden/misc/tsm ~/misc/tsm
file:///home/vermaden/mp3 ~/mp3
file:///home/vermaden/photo.NEW ~/photo.NEW
file:///home/vermaden/vm ~/vm
file:///home/vermaden/vm/iso ~/vm/iso
file:///home/vermaden/vm/storage ~/vm/storage

As the GTK2 Bookmarks and GTK3 Bookmarks have the same format you may symlink one to another to not keep two lists of your favorite places.

As the GTK3 framework uses CSS you may tune the GTK3 to your needs in the ~/.config/gtk-3.0/gtk.css file according to the documentation provided by the GNOME team – GTK+ CSS Overview – available here.

I have tried various hacks in the past but after removing them my problems with GTK3 toolkit vanished. If you will find some interesting settings then let me know πŸ™‚

QT

The QT toolkit configuration was always a real PITA and this haven’t changed in the latest QT5 release. The default themes provided are ugly and the ones available to download are not that much better. The KDE Plasma 5 looks quite well but making QT4/QT5 look nice on a custom window manager environment is whole other story. With my settings I have minimized the ‘damage’ of the tragic QT look.

I also feel that GTK and its configuration is more UNIX oriented as you only need to edit the files while QT feels more Windows oriented as you often need the graphical config tool to set the options properly.

The QT3/QT4/QT5 use/used these environment variables exported by export(1). I am not sure if they are still respected but I do not want to check all my apps to find out and keeping then in the ~/.xinitrc file does not hurt.

# QT ANTIALIASING
  export QT_XFT=1

# QT MUST KNOW WHERE IS GTK2 CONFIG
  export GTK2_RC_FILES="${HOME}/.gtkrc-2.0"

# QT5 qt5ct
  export QT_QPA_PLATFORMTHEME=qt5ct

QT3

I am not sure if any ‘current’ application uses it, the legendary Opera 12.x used it for sure and configuration was made using the qtconfig graphical utility.

QT4

The QT4 configuration is kept in the ~/.config/Trolltech.conf file (very obvious indeed) and the graphical tool/editor is qt4-qtconfig installed from qt4-qtconfig port/package.

Here is how my current configuration looks like (yes its long and ugly).

% cat ~/.config/Trolltech.conf
[Qt%20Plugin%20Cache%204.8.false]
usr\local\lib\qt4\plugins\imageformats\libqgif.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqico.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqjpeg.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqmng.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqsvg.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqtga.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\imageformats\libqtiff.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-12-19T09:37:13
usr\local\lib\qt4\plugins\iconengines\libqsvgicon.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2015-11-21T02:41:20
usr\local\lib\qt4\plugins\inputmethods\libqimsw-multi.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang no-pkg-config, 2015-11-21T02:41:27
usr\local\lib\kde4\plugins\imageformats\kimg_dds.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_eps.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_exr.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_jp2.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_pcx.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_pic.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_psd.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_ras.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_rgb.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_tga.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_xcf.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\plugins\imageformats\kimg_xview.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:10:23
usr\local\lib\kde4\okularpart.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_epub.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\plugins\kscreen\KSC_XRandR.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:12:14
usr\local\lib\kde4\okularGenerator_mobi.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_txt.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_fb.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_ghostview.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_ooo.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\kde4\okularGenerator_poppler.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2017-11-26T09:52:40
usr\local\lib\qt4\plugins\styles\libkvantum.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2018-07-07T05:29:12
usr\local\lib\keepassx\libkeepassx-autotype-x11.so=40807, 0, x86_64 usr/local/share/qt4/mkspecs/freebsd clang full-config, 2018-08-09T05:30:15

[Qt%20Factory%20Cache%204.8]
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqgif.so=2017-12-19T09:37:13, gif
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqico.so=2017-12-19T09:37:13, ico
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqjpeg.so=2017-12-19T09:37:13, jpeg, jpg
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqmng.so=2017-12-19T09:37:13, mng
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqsvg.so=2017-12-19T09:37:13, svg, svgz
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqtga.so=2017-12-19T09:37:13, tga
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\qt4\plugins\imageformats\libqtiff.so=2017-12-19T09:37:13, tiff, tif
com.trolltech.Qt.QIconEngineFactoryInterfaceV2%3A\usr\local\lib\qt4\plugins\iconengines\libqsvgicon.so=2015-11-21T02:41:20, svg, svgz, svg.gz
com.trolltech.Qt.QIconEngineFactoryInterface%3A\usr\local\lib\qt4\plugins\iconengines\libqsvgicon.so=2015-11-21T02:41:20
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_dds.so=2017-11-26T09:10:23, dds
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_eps.so=2017-11-26T09:10:23, eps, EPS, epsi, EPSI, epsf, EPSF
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_exr.so=2017-11-26T09:10:23, exr, EXR
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_jp2.so=2017-11-26T09:10:23, jp2
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_pcx.so=2017-11-26T09:10:23, pcx, PCX
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_pic.so=2017-11-26T09:10:23, pic
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_psd.so=2017-11-26T09:10:23, psd, PSD
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_ras.so=2017-11-26T09:10:23, ras, RAS
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_rgb.so=2017-11-26T09:10:23, rgb, RGB, rgba, RGBA, bw, BW, sgi, SGI
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_tga.so=2017-11-26T09:10:23, tga, TGA
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_xcf.so=2017-11-26T09:10:23, xcf, XCF
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\lib\kde4\plugins\imageformats\kimg_xview.so=2017-11-26T09:10:23, xv
com.trolltech.Qt.QStyleFactoryInterface%3A\usr\local\lib\qt4\plugins\styles\libkvantum.so=2018-07-07T05:29:12, Kvantum

[Qt]
style=Cleanlooks
customColors\0=4287598479
customColors\1=4294967295
customColors\2=4278233855
customColors\3=4294967295
customColors\4=4294967295
customColors\5=4294967295
customColors\6=4294967295
customColors\7=4294967295
customColors\8=4294967295
customColors\9=4294967295
customColors\10=4294967295
customColors\11=4294967295
customColors\12=4294967295
customColors\13=4294967295
customColors\14=4294967295
customColors\15=4294967295
font="Ubuntu,10,-1,5,50,0,0,0,0,0"
Palette\active=#000000, #dedede, #ffffff, #eeeeee, #6f6f6f, #949494, #000000, #ffffff, #000000, #ffffff, #dedede, #000000, #8f8f8f, #ffffff, #8f8f8f, #c753ae, #eeeeee, #000000, #ffffdc, #000000
Palette\inactive=#000000, #dedede, #ffffff, #ffffff, #6f6f6f, #949494, #000000, #ffffff, #000000, #ffffff, #dedede, #000000, #8f8f8f, #ffffff, #8f8f8f, #c753ae, #eeeeee, #000000, #ffffdc, #000000
Palette\disabled=#808080, #dedede, #ffffff, #ffffff, #6f6f6f, #949494, #808080, #ffffff, #808080, #ffffff, #dedede, #000000, #8f8f8f, #808080, #8f8f8f, #c753ae, #eeeeee, #000000, #ffffdc, #000000
fontPath=@Invalid()
embedFonts=true
doubleClickInterval=400
cursorFlashTime=1000
wheelScrollLines=3
resolveSymlinks=false
globalStrut\width=0
globalStrut\height=0
useRtlExtensions=false
XIMInputStyle=On The Spot
DefaultInputMethod=xim
audiosink=Auto
videomode=Auto
GUIEffects=none
filedialog="@ByteArray(\0\0\0\xbe\0\0\0\x3\0\0\0\x1e\0\0\0\xff\0\0\0\0\0\0\0\x2\0\0\0K\0\0\xe\0\x1\0\0\0\x6\x1\0\0\0\x1\0\0\0\x2\0\0\0\x5\x66ile:\0\0\0\x15\x66ile:///home/vermaden\0\0\0\x5\0\0\0.\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0\x64\0o\0w\0n\0l\0o\0\x61\0\x64\0\0\0\x34\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0g\0\x61\0m\0\x65\0s\0.\0L\0O\0\x43\0\x41\0L\0\0\0*\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0v\0m\0/\0i\0s\0o\0\0\0\xa4\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0\x64\0o\0w\0n\0l\0o\0\x61\0\x64\0/\0W\0i\0n\0\x64\0o\0w\0s\0 \0\x37\0w\0s\0z\0y\0s\0t\0k\0i\0\x65\0 \0w\0\x65\0r\0s\0j\0\x65\0 \0x\0\x38\0\x36\0 \0x\0\x36\0\x34\0 \0[\0P\0L\0]\0/\0W\0i\0n\0\x64\0o\0w\0s\0 \0\x37\0 \0S\0P\0\x31\0 \0 \0[\0P\0L\0]\0\0\0\x32\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0v\0m\0/\0s\0t\0o\0r\0\x61\0g\0\x65\0\0\0*\0/\0h\0o\0m\0\x65\0/\0v\0\x65\0r\0m\0\x61\0\x64\0\x65\0n\0/\0v\0m\0/\0i\0s\0o\0\0\0~\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1T\0\0\0\x4\x1\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x4\0\0\0\xb5\0\0\0\x1\0\0\0\0\0\0\0)\0\0\0\x1\0\0\0\0\0\0\0,\0\0\0\x1\0\0\0\0\0\0\0J\0\0\0\x1\0\0\0\0\0\0\0\x1)"

[Qt%20Plugin%20Cache%204.6.false]
usr\local\share\google-earth\plugins\imageformats\libqgif.so=40601, 0, generic linux lsb-g++ full-config, 2011-05-17T09:42:02
usr\local\share\google-earth\plugins\imageformats\libqjpeg.so=40601, 0, generic linux lsb-g++ full-config, 2011-05-17T09:42:02

[Qt%20Factory%20Cache%204.6]
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\share\google-earth\plugins\imageformats\libqgif.so=2011-05-17T09:42:02, gif
com.trolltech.Qt.QImageIOHandlerFactoryInterface%3A\usr\local\share\google-earth\plugins\imageformats\libqjpeg.so=2011-05-17T09:42:02, jpeg, jpg

… and how it looks when loaded in the qt4-qtconfig editor.

qt4-qtconfig.jpg

QT5

The QT5 is kinda special as it requires this export(1) in the ~/.xinitrc (or ~/.xsession) file.

# QT5 qt5ct
  export QT_QPA_PLATFORMTHEME=qt5ct

Do not ask me why and I do not even want to know πŸ™‚

The QT5 configuration is kept in the ~/.config/qt5ct/qt5ct.conf file and the graphical tool/editor is qt5ct installed from qt5ct port/package.

Here is how my current QT5 configuration looks like.

% cat ~/.config/qt5ct/qt5ct.conf
[Appearance]
color_scheme_path=/usr/local/share/qt5ct/colors/dusk.conf
custom_palette=true
icon_theme=Faenza
standard_dialogs=default
style=Fusion

[Fonts]
fixed=@Variant(\0\0\0@\0\0\0\x10\0\x43\0o\0n\0s\0o\0l\0\x61\0s@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x32\x10)
general=@Variant(\0\0\0@\0\0\0\f\0U\0\x62\0u\0n\0t\0u@$\0\0\0\0\0\0\xff\xff\xff\xff\x5\x1\0\x19\x10)

[Interface]
activate_item_on_single_click=1
buttonbox_layout=3
cursor_flash_time=1000
dialog_buttons_have_icons=1
double_click_interval=400
gui_effects=@Invalid()
menus_have_icons=true
stylesheets=/usr/local/share/qt5ct/qss/fusion-fixes.qss
toolbutton_style=4
underline_shortcut=1
wheel_scroll_lines=3

[SettingsWindow]
geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\x2\x84\0\0\0j\0\0\x5\xd5\0\0\x3w\0\0\x2\x86\0\0\0\x81\0\0\x5\xd3\0\0\x3s\0\0\0\0\0\0\0\0\x6@)

… and how it looks when loaded in the qt5ct editor.

qt5ct.jpg

Back to the Xdefaults

The ~/.Xdefaults file (some use ~/.Xresources instead) also contain fonts information and setup of the cursor theme for the X11 Window System session.

Below you will find my settings, as mentined earlier, also ‘copied’ here.

! FONTS
! -----------------------------------------------------------------------------
  Xft.antialias:  true
  Xft.hinting:    false
  Xft.hintstyle:  0
  Xft.dpi:        75
  Xft.rgba:       none

! CURSOR
! -----------------------------------------------------------------------------
  Xcursor.theme: Vanilla-DMZ
  Xcursor.size:  24

The cursor theme is from the /usr/ports/x11-themes/cursor-dmz-theme port/package.

Xinitrc and Back Again

For the record, the complete GTK/QT settings in the ~/.xinitrc file are as follows.

# QT MUST KNOW WHERE IS GTK2 CONFIG
  export GTK2_RC_FILES="${HOME}/.gtkrc-2.0"

# QT5 qt5ct
  export QT_QPA_PLATFORMTHEME=qt5ct

# GTK/QT ANTIALIASING
  export QT_XFT=1
  export GDK_USE_XFT=1

# FORCE LIBREOFFICE TO USE GTK THEME
  export OOO_FORCE_DESKTOP=gnome

Hope that information provided in this article moved you one more step closer to good looking and practical FreeBSD desktop πŸ˜‰

UPDATE 1

There is one more possible way to make the FreeBSD Desktop QT4/QT5 toolkits look less ugly. The default GNOME theme is Adwaita. There also exists adwaita-qt – a QT port of that Adwaita theme. It aims to make QT to look like the GTK+ 3 Adwaita theme.

adwaita

To make use of them add the adwaita-qt4 and adwaita-qt5 packages.

# pkg install adwaita-qt4 adwaita-qt5

Then use qt4-qtconfig to set the style to Adwaita as the default QT4 theme.

qt4

After setup QT4 theme can be verified like that.

% grep -B 1 style= ~/.config/Trolltech.conf
[Qt]
style=Adwaita

Then start qt5ct to set the style to Adwaita as the default QT5 theme.

qt5

After setup QT5 theme can be verified like that.

% grep -B 1 -i adwaita ~/.config/qt5ct/qt5ct.conf
[Appearance]
style=Adwaita

Transmission rendered in GTK+ toolkit.

trans-gtk

Transmission rendered in QT4 toolkit.

trans-qt.png

Still not perfect but at least less ugly πŸ™‚

EOF

Wallpapers from Tech Pron

The Tech Pron at Twitter – @techno_pron – is a bot that posts aesthetic tech pics. Most of these computers pictures were made on a solid (or close to it) background color so I though it may be a cool idea to create wallpapers from them.

I have picked up 20 most interesting ones and made high resolution backgrounds of them. Here is their montage.

wallpapers-oldschool-machines.jpg

To download them all just follow this wallpapers-oldschool-machines.tar.gz file.

When needed use my random_wallpaper.sh handler from the https://github.com/vermaden/scripts repository to setup random wallpaper from directory.

EOF

Valuable News – 2018/07/27

UNIX

In Other BSDs for 2018/07/21.
https://www.dragonflydigest.com/2018/07/21/21525.html

NetBSD 8.0 Released.
https://www.netbsd.org/releases/formal-8/NetBSD-8.0.html

Changes to NetBSD release support policy.
https://mail-index.netbsd.org/netbsd-announce/2018/07/25/msg000290.html

ZFS Zpool Checkpoints.
http://oshogbo.vexillium.org/blog/46/

Hidden Gems of XTERM.
https://lukas.zapletalovi.com/2013/07/hidden-gems-of-xterm.html

Less Known Solaris XTerm Features.
https://twitter.com/vmisev/status/1021525740406403073
https://twitter.com/vmisev/status/1021513491532926983

Extend FreeBSD loader(8) geli support to all architectures and all disk-like devices.

https://svnweb.freebsd.org/base?view=revision&revision=336252

Scripts to create HardenedBSD ISO and KVM image for SmartOS and Triton.
https://github.com/wasted/hardenedbsd-kvm-image-builder

Antergos Linux allows root (/) on ZFS install from installer but /boot remains EXT4.
https://antergos.com/

Slackware Linux hit 25 years recently.
http://www.slackware.com/announce/1.0.php

Configure FreeBSD Jails with vnet (VIMAGE) and ZFS.
https://www.cyberciti.biz/faq/how-to-configure-a-freebsd-jail-with-vnet-and-zfs/

FreeBSD on ARM64.
https://community.online.net/t/freebsd-on-arm64/6678

ZFS for Linux.
https://www.linuxjournal.com/content/zfs-linux

Colored cal(1) output colored with grep(1).
https://twitter.com/vermaden/status/1021690491476340737

Solaris had/have 11 years old privilege escalation bug.
https://www.theregister.co.uk/2018/07/24/oracle_repatch_old_solaris_bug/

OPNsense 18.1.13 Released.
https://forum.opnsense.org/index.php?topic=9237.0

Tribblix m20.5 (ami-7cf2181b) and LX-enabled OmniTribblix m20.5 (ami-90fb11f7) available in the AWS London (eu-west-2) region.
http://www.tribblix.org/aws.html

Because Computers | BSD Now 2^8.
http://www.jupiterbroadcasting.com/126261/because-computers-bsd-now-28/

ZFS Private Beta on Citus Cloud.
https://www.citusdata.com/blog/2018/07/19/ZFS-beta-on-citus-cloud/

Oracle Solaris 11.4 beta progress from 32bit to 64bit.
https://blogs.oracle.com/solaris/oracle-solaris-114-beta-progress-on-lp64-conversion-v2

DragonFly BSD will implement new rc(8) mechanism to run scripts only once.
https://www.dragonflydigest.com/2018/07/25/21549.html

OmniOSce r151026 gets automatic boot-environment naming.
https://omniosce.org/article/auto-be-name

Expose SmartOS metadata to CFEngine.
https://github.com/bahamat/cfengine-smartos-metadata/blob/master/README.md

Sysadmin Guide to Ansible – How to Simplify Tasks.
https://opensource.com/article/18/7/sysadmin-tasks-ansible

More mitigations against speculative execution vulnerabilities from OpenBSD team.
https://undeadly.org/cgi?action=article;sid=20180724072257

FreeBSD images now available for GCE (Google Cloud Engine).
https://googlecloudplatform.uservoice.com/forums/302595-compute-engine/suggestions/18618931-freebsd
https://console.cloud.google.com/marketplace/details/freebsd-cloud/freebsd-11

DTrace on Linux Update.
https://blogs.oracle.com/linux/dtrace-on-linux%3a-an-update

NetBSD on the PineBook.
https://pbs.twimg.com/media/DjB7R23X4AIxr61.jpg:large

FreeBSD kernel module loading mechanism imported into Illumos.
http://src.illumos.org/source/xref/freebsd-head/sys/conf/kmod.mk

PBOY – small CLI tool to rename PDF files with useless names based on the suggestions found in file content and metadata.
https://github.com/2mol/pboy

Hardware

AMD 2018 Q2 Results – Best Quarter In 7 Years.
https://www.anandtech.com/show/13121/amd-announces-q2-2018-results

Why Intel will never let owners control the ME.
https://www.devever.net/~hl/intelme

Tool for partial deblobbing of Intel ME/TXE firmware images.
https://github.com/corna/me_cleaner

Intel x86 Considered Harmful by Joanna Rutkowska.
https://blog.invisiblethings.org/papers/2015/x86_harmful.pdf

Backblaze 2018 Q2 Hard Drive Stats.
https://www.backblaze.com/blog/hard-drive-stats-for-q2-2018/

Life

When We Eat or Dont Eat May Be Critical for Health.
https://www.nytimes.com/2018/07/24/well/when-we-eat-or-dont-eat-may-be-critical-for-health.html

While We Sleep Our Mind Goes on an Amazing Journey.
https://www.nationalgeographic.com/magazine/2018/08/science-of-sleep/

Other

My favorite apps on F-Droid.
https://quaap.com/D/use-fdroid

Why I will never use Windows 8 or Windows 10.
https://www.devever.net/~hl/windows8

Exposing more of ICU to PostgreSQL.
https://postgresql.verite.pro/blog/2018/07/25/icu-extension.html

EOF

.
.
.
.
.

FreeBSD Desktop – Part 14 – Configuration – Tint2

In today’s article in the FreeBSD Desktop series we will focus on the task bar configuration. I will describe how to setup the Tint2.

You may also check earlier articles of the FreeBSD Desktop series:

Features

The task bar role served by the Tint2 will be providing the following features.

  • Launcher for the most used applications.
  • Show opened/minimized windows on each of four virtual desktops.
  • Indicate current used virtual desktop.
  • Provide system tray area for applications that depend on it.
  • Maximize selected window with [Right Mouse Button].
  • Close selected window with [Middle Mouse Button].
  • Focus selected window along with switching to the virtual desktop with that window using [Left Mouse Button].
  • Pass [Left/Middle/Right Mouse Button] events to Openbox window manager when not clicked on objects.
  • Provide buttons – cpu_L cpu_M cpu_H – to set various CPU frequencies (from left Low/Medium/High).
  • Provide button – wallpaper – to set new random wallpaper.

Here is how such Tint2 task bar would look like in action, along with previously configured Dzen2 status bar.

vermaden-tint2.jpg

Tint

The Tint2 is very light solution, one of the lightest that I know while being very nice looking and effective. A rare fusion of features πŸ™‚

To achieve described earlier features we will use following Tint2 configuration ~/.tint2rc file.

% cat ~/.tint2rc
# GENERAL
# -------
  rounded          = 0
  border_width     = 0
  background_color = #222222 100
  border_color     = #000000 0

# AUTOHIDE
# --------
  autohide     = 0
  strut_policy = minimum

# TOOLTIP
# -------
  tooltip = 0

# MOUSE
# -----
  mouse_middle = close
  mouse_right  = maximize_restore

# PANEL
# -----
  wm_menu             = 1
  panel_items         = LTS
  panel_monitor       = 1
  panel_position      = top center
  panel_size          = 0 16
  panel_margin        = 0 12
  panel_padding       = 0 0 16
  panel_layer         = bottom
  panel_background_id = 1
  font_shadow         = 0

# LAUNCHER
# --------
  launcher_padding       = 0 0 1
  launcher_background_id = 1
  launcher_icon_size     = 14
  launcher_item_app      = /home/vermaden/.apps/caja.desktop
  launcher_item_app      = /home/vermaden/.apps/thunar.desktop
  launcher_item_app      = /home/vermaden/.apps/nfs.desktop
  launcher_item_app      = /home/vermaden/.apps/terminal.desktop
  launcher_item_app      = /home/vermaden/.apps/geany.desktop
  launcher_item_app      = /home/vermaden/.apps/leafpad.desktop
  launcher_item_app      = /home/vermaden/.apps/pidgin.desktop
  launcher_item_app      = /home/vermaden/.apps/thunderbird.desktop
  launcher_item_app      = /home/vermaden/.apps/firefox.desktop
  launcher_item_app      = /home/vermaden/.apps/chromium.desktop
  launcher_item_app      = /home/vermaden/.apps/gimp.desktop
  launcher_item_app      = /home/vermaden/.apps/galculator.desktop
  launcher_item_app      = /home/vermaden/.apps/deadbeef.desktop
  launcher_item_app      = /home/vermaden/.apps/transmission.desktop
  launcher_item_app      = /home/vermaden/.apps/cpu_L.desktop
  launcher_item_app      = /home/vermaden/.apps/cpu_M.desktop
  launcher_item_app      = /home/vermaden/.apps/cpu_H.desktop
  launcher_item_app      = /home/vermaden/.apps/wallpaper.desktop

# TASKBAR
# -------
  taskbar_mode                   = multi_desktop
  taskbar_padding                = 0 0 1
  taskbar_background_id          = 1
  taskbar_active_background_id   = 1
  taskbar_distribute_size        = 0
  taskbar_name                   = 1
  taskbar_name_font              = Ubuntu Mono 8
  taskbar_name_font_color        = #aaaaaa 100
  taskbar_name_active_font_color = #dd0000 100

# TASKS
# -----
  task_icon                 = 1
  task_text                 = 0
  task_width                = 14
  task_centered             = 1
  task_padding              = 0 0 1
  task_background_id        = 0
  task_active_background_id = 0
  task_iconified_icon_asb   = 40 0 0

# SYSTRAY
# -------
  systray           = 1
  systray_padding   = 0 0 1
  systray_icon_size = 14

Because the *.desktop files does not support relative directories for Icon parameter such as ‘~‘ so they need to be replaced before start at the ~/.xinitrc file (or ~/.xsession file), similarly like with the Openbox files.

We already had following Openbox ‘find/replace’ in the ~/.xinitrc file (or ~/.xsession file).

# ICONS WM
  sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" ~/.config/openbox/menu.xml
  sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" ~/.config/openbox/rc.xml

We will now add the ‘rules’ needed for Tint2 and the *.desktop files from the ~/.apps directory.

# ICONS TINT2
  sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" ~/.tint2rc

# ICONS APPS
  for I in ~/.apps/*.desktop
  do
    sed -i '' -E "s%\/home\/[a-zA-Z0-9_-]+\/%\/home\/${USER}\/%g" "${I}"
  done

Here is how the Tint2 startup is configured in the ~/.xinitrc (or ~/.xsession file).

% grep tint ~/.xinitrc                      
  ~/scripts/__openbox_restart_tint2.sh &

Remember to put ‘&‘ at the end of the line.

Doas

To make most scripts work Your user (vuk in the series) needs to be in the wheel, operator and network groups and doas(1) (sudo(8) equivalent) needs to be installed and configured in the following way.

# pkg install doas

# pw groupmod wheel    -m vuk
# pw groupmod operator -m vuk
# pw groupmod network  -m vuk

# cat /usr/local/etc/doas.conf
permit nopass :wheel as root

permit nopass :network as root cmd ifconfig
permit nopass :network as root cmd dhclient
permit nopass :network as root cmd umount
permit nopass :network as root cmd wpa_supplicant
permit nopass :network as root cmd ppp
permit nopass :network as root cmd killall args -9 dhclient
permit nopass :network as root cmd killall args -9 wpa_supplicant
permit nopass :network as root cmd killall args -9 ppp
permit nopass :network as root cmd cat args /etc/ppp/ppp.conf
permit nopass :network as root cmd /etc/rc.d/netif args onerestart
permit nopass :network as root cmd tee args /etc/resolv.conf
permit nopass :network as root cmd tee args -a /etc/resolv.conf

Scripts

There is only one new script added – ~/scripts/nfs.sh – all others are already published in previous *.tar.gz files. Its also optional because you may not have NAS resource which you would want to mount … or maybe you prefer SSHFS or CIFS share …

I also uploaded all the scripts as individual files to the GitHub page.

Make sure they remain executable.

% chmod +x ~/scripts/*

To make them work properly add ~/scripts into the ${PATH} variable at the beginning of the ~/.xinitrc file.

# PATH TO SCRIPTS
  export PATH=${PATH}:~/scripts

All of my scripts have this ‘mysterious’ line at the end. Its for statistics to check which scripts are run when (or it at all to which ones to delete).

echo '1' >> ~/scripts/stats/$( basename ${0} )

Thus it is needed to create the ‘stats’ directory.

% mkdir -p ~/scripts/stats

I have implemented that about two months ago and here are the results.

% wc -l ~/scripts/stats/* | sort -n
       1 /home/vermaden/scripts/stats/__openbox_edit_wallpaper_gimp.sh
       1 /home/vermaden/scripts/stats/__openbox_restart_lxpanel.sh
       1 /home/vermaden/scripts/stats/__openbox_show_screenshot.sh
       1 /home/vermaden/scripts/stats/__openbox_stats_top_cpu_KILL.sh
       1 /home/vermaden/scripts/stats/__openbox_stats_top_mem_RENICE.sh
       2 /home/vermaden/scripts/stats/__openbox_fullscreen.sh
       2 /home/vermaden/scripts/stats/__openbox_stats_top_cpu_RENICE.sh
       3 /home/vermaden/scripts/stats/__openbox_current_wallpaper.sh
       5 /home/vermaden/scripts/stats/__openbox_cpufreq.sh
       5 /home/vermaden/scripts/stats/__openbox_dmenu.sh
       9 /home/vermaden/scripts/stats/__openbox_virtualbox.sh
      10 /home/vermaden/scripts/stats/__openbox_delete_wallpaper.sh
      13 /home/vermaden/scripts/stats/__openbox_restart_conky.sh
      13 /home/vermaden/scripts/stats/__openbox_restart_plank.sh
      17 /home/vermaden/scripts/stats/__openbox_lock.sh
      20 /home/vermaden/scripts/stats/nfs.sh
      21 /home/vermaden/scripts/stats/__openbox_freebsd_sound.sh
      22 /home/vermaden/scripts/stats/__openbox_lock_zzz.sh
      24 /home/vermaden/scripts/stats/__openbox_edit_screenshot.sh
      24 /home/vermaden/scripts/stats/__openbox_restart_dzen2.sh
      24 /home/vermaden/scripts/stats/dzen2-fifo.sh
      28 /home/vermaden/scripts/stats/__openbox_restart_tint2.sh
      32 /home/vermaden/scripts/stats/aero-snap.sh
      48 /home/vermaden/scripts/stats/shot.sh
      56 /home/vermaden/scripts/stats/network.sh
     447 /home/vermaden/scripts/stats/xdotool.sh
     599 /home/vermaden/scripts/stats/xterm.sh
    1862 /home/vermaden/scripts/stats/random_wallpaper.sh
    5923 /home/vermaden/scripts/stats/__conky_if_ip.sh
    5942 /home/vermaden/scripts/stats/dzen2-update.sh
    5956 /home/vermaden/scripts/stats/__conky_if_dns.sh
    5956 /home/vermaden/scripts/stats/__conky_if_gw.sh
    5959 /home/vermaden/scripts/stats/__conky_battery.sh
    5966 /home/vermaden/scripts/stats/__conky_if_ping.sh
   28359 /home/vermaden/scripts/stats/desktop-kill-shit.sh
   67352 total

Of course I limited the output only to scripts that are available in this article, but be patient, more to come later πŸ™‚

Dependencies

To make these scripts work and generally to make all this setup work we will need these dependencies.

  • tint2
  • caja
  • chromium
  • deadbeef
  • firefox
  • galculator
  • geany
  • gimp
  • leafpad
  • midori
  • pidgin
  • xterm
  • thunar
  • thunderbird
  • transmission-gtk
  • feh
  • xkill

To install them all with pkg(8) just type this line below.

# pkg install \
    tint2 caja chromium deadbeef firefox galculator midori \
    geany gimp leafpad xterm thunar xkill transmission-gtk \
    thunderbird feh pidgin
   

We have finished making the ‘top’ bars. You now have all needed information in the status bar server by Dzen2 and all applications/windows covered by the Tint2 task bar.

EOF

FreeBSD Desktop – Part 13 – Configuration – Dzen2

Time for real configuration of the status bar. In today’s article of the FreeBSD Desktop series I will describe how to configure the Dzen2.

You may also check earlier articles of the FreeBSD Desktop series:

Features

The provided status bar backed by Dzen2 will be providing the following information.

  • date: Date in ISO 8601 format along with current time.
  • sys: CPU frequency, CPU temperature, system load and free RAM.
  • ip: List of current IP addresses and its interfaces.
  • gw: System default network gateway.
  • dns: System default DNS.
  • ping: Current Internet access state.
  • vol/pcm: Volume level for vol and pcm backends.
  • fs: ZFS pools free space.
  • bat: Battery and AC status.
  • top: Top 3 processes with highest CPU usage along with their RAM usage.

Here is how such Dzen2 looks like in action.

vermaden-dzen2.jpg

Dzen2

The Dzen2 offers feature that Conky or other status bar applications does not offer. I would call it refresh on demand. If you would like to implement refresh interval of 60 seconds for example (not so often) and also refresh that information everytime you ‘click’ on the status bar (or by other action) its possible to implement in Dzen2 using mkfifo(1) command.

Why anyone would want to implement such ‘strange’ refresh policy? To get more battery life mostly as You do not need this information to be refreshed every second and if You need up to date information then you will refresh it manually with a click on the status bar and have the needed information. The other reason is ‘focus’. If this status bar refreshes every second, then it ‘caches’ your attention, this may prevent you from focusing deep enough on the task you are currently doing. If you do something important that requires focus then You do not want status bar (or anything else) to distract you with useless at the moment information.

To achieve such configuration we would need three things. The dzen2-fifo.sh script that will start initial fifo on the ~/.dzen2-fifo file. The dzen2-update.sh to update the fifo and would be run from the crontab(1) every 60 seconds. A dzen2(1) action configured with left mouse button click to invoke dzen2-update.sh to update the fifo. All these scripts and scripts used directly by Dzen2 to gather needed information are available in the scripts-status-bar.tar.gz file.

To start Dzen2 at the X11 startup we will use script from the earlier ‘bulk’ already available – __openbox_restart_dzen2.sh – which kills all instances of Dzen2 and then starts the fifo backed Dzen2 with dzen2-fifo.sh script available in the scripts.tar.gz file.

Here is how its configured in the ~/.xinitrc (or ~/.xsession) file.

% grep dzen ~/.xinitrc                      
  ~/scripts/__openbox_restart_dzen2.sh &

Remember to put ‘&‘ at the end of the line.

Lets have a look how the ‘update’ is configured in the crontab(1) as shown below.

% crontab -l
# DZEN2
  0 * * * * ~/scripts/dzen2-update.sh 1> ~/.dzen2-fifo                                        2> /dev/null

The scripts that Dzen2 uses to gather information are:

~/scripts/__conky_if_ip.sh
~/scripts/__conky_if_gw.sh
~/scripts/__conky_if_dns.sh
~/scripts/__conky_if_ping.sh
~/scripts/__conky_battery.sh

… and this one to ’emulate’ clicks to implement Openbox virtual desktops switching with [Scroll Up] and [Scroll Down] mouse events.

~/scripts/xdotool.sh

The dzen2-update.sh is kinda like Conky on terminal, it just puts all that information in text format with Dzen2 colors syntax as shown below.

% dzen2-update.sh
 ^fg(#aaaaaa)date: ^fg(#eeeeee)2018/07/05/Thu/10:11 ^fg(#dd0000)| ^fg(#aaaaaa)sys: ^fg(#eeeeee)800MHz/46.1C/0.83/4.5GB ^fg(#dd0000)| ^fg(#aaaaaa)ip: ^fg(#eeeeee)wlan0/wirelesssid/192.168.0.3 ^fg(#dd0000)| ^fg(#aaaaaa)gw: ^fg(#eeeeee)192.168.0.1 ^fg(#dd0000)| ^fg(#aaaaaa)dns: ^fg(#eeeeee)192.168.0.1 ^fg(#dd0000)| ^fg(#aaaaaa)ping: ^fg(#eeeeee)^fg(#dd2200)NOPE ^fg(#dd0000)| ^fg(#aaaaaa)vol/pcm: ^fg(#eeeeee)100/100 ^fg(#dd0000)| ^fg(#aaaaaa)fs: ^fg(#eeeeee)local/69.2G sys/3.27G ^fg(#dd0000)| ^fg(#aaaaaa)bat: ^fg(#eeeeee)AC/^fg(#ffffff)90% ^fg(#dd0000)| ^fg(#aaaaaa)top: ^fg(#eeeeee)firefox/15%/0.6GB firefox/13%/0.3GB firefox/11%/0.4GB 

Doas

To make most scripts work Your user (vuk in the series) needs to be in the wheel, operator and network groups and doas(1) (sudo(8) equivalent) needs to be installed and configured in the following way.

# pkg install doas

# pw groupmod wheel    -m vuk
# pw groupmod operator -m vuk
# pw groupmod network  -m vuk

# cat /usr/local/etc/doas.conf
permit nopass :wheel as root

permit nopass :network as root cmd ifconfig
permit nopass :network as root cmd dhclient
permit nopass :network as root cmd umount
permit nopass :network as root cmd wpa_supplicant
permit nopass :network as root cmd ppp
permit nopass :network as root cmd killall args -9 dhclient
permit nopass :network as root cmd killall args -9 wpa_supplicant
permit nopass :network as root cmd killall args -9 ppp
permit nopass :network as root cmd cat args /etc/ppp/ppp.conf
permit nopass :network as root cmd /etc/rc.d/netif args onerestart
permit nopass :network as root cmd tee args /etc/resolv.conf
permit nopass :network as root cmd tee args -a /etc/resolv.conf

Scripts

In this post I attach scripts related to Dzen2. Download them all in the scripts-status-bar.tar.gz file and unpack them into the ~/scripts directory.

Here are these scripts.

% tar -tf scripts-status-bar.tar.gz
~/scripts/dzen2-fifo.sh
~/scripts/dzen2-update.sh
~/scripts/xdotool.sh
~/scripts/__conky_if_ip.sh
~/scripts/__conky_if_gw.sh
~/scripts/__conky_if_dns.sh
~/scripts/__conky_if_ping.sh
~/scripts/__conky_battery.sh

Make sure they remain executable.

% chmod +x ~/scripts/*

To make them work properly add ~/scripts into the ${PATH} variable at the beginning of the ~/.xinitrc file.

# PATH TO SCRIPTS
  export PATH=${PATH}:~/scripts

All of my scripts have this ‘mysterious’ line at the end. Its for statistics to check which scripts are run when (or it at all to which ones to delete).

echo '1' >> ~/scripts/stats/$( basename ${0} )

Thus it is needed to create the ‘stats’ directory.

% mkdir -p ~/scripts/stats

I have implemented that about two months ago and here are the results.

% wc -l ~/scripts/stats/* | sort -n
       1 /home/vermaden/scripts/stats/__openbox_show_screenshot.sh
       2 /home/vermaden/scripts/stats/__openbox_cpufreq.sh
       2 /home/vermaden/scripts/stats/__openbox_current_wallpaper.sh
       2 /home/vermaden/scripts/stats/__openbox_fullscreen.sh
       4 /home/vermaden/scripts/stats/__openbox_restart_dzen2.sh
       4 /home/vermaden/scripts/stats/dzen2-fifo.sh
       5 /home/vermaden/scripts/stats/__openbox_dmenu.sh
       5 /home/vermaden/scripts/stats/__openbox_restart_conky.sh
       5 /home/vermaden/scripts/stats/__openbox_restart_tint2.sh
       6 /home/vermaden/scripts/stats/__openbox_delete_wallpaper.sh
       7 /home/vermaden/scripts/stats/__openbox_freebsd_sound.sh
       8 /home/vermaden/scripts/stats/aero-snap.sh
      12 /home/vermaden/scripts/stats/__openbox_edit_screenshot.sh
      16 /home/vermaden/scripts/stats/__openbox_lock_zzz.sh
      16 /home/vermaden/scripts/stats/__openbox_lock.sh
      22 /home/vermaden/scripts/stats/shot.sh
      24 /home/vermaden/scripts/stats/network.sh
     214 /home/vermaden/scripts/stats/xterm.sh
     960 /home/vermaden/scripts/stats/random_wallpaper.sh
    2767 /home/vermaden/scripts/stats/desktop-battery-warning.sh
   13834 /home/vermaden/scripts/stats/desktop-kill-shit.sh
   17916 total

Of course I limited the output only to scripts that are available in this article, but be patient, more to come later πŸ™‚

Dependencies

To make these scripts work and generally to make all this setup work we will need these dependencies.

  • dzen2
  • xdotool
  • wmctrl

To install them all with pkg(8) just type this line below.

# pkg install dzen2 xdotool wmctrl
   

Crontab

After adding Dzen2 to crontab(1) and keeping the earlier entries the complete crontab(1) would look like that.

% crontab -l
# DESKTOP
  *     *     * * * ~/scripts/desktop-kill-shit.sh                                       1> /dev/null 2> /dev/null
  */5   *     * * * ~/scripts/desktop-battery-warning.sh
  */20  *     * * * ~/scripts/random_wallpaper.sh ~/gfx/wallpapers                       1> /dev/null 2> /dev/null
  12,0  *     * * * /usr/bin/find ~/.cache -mtime +10 -delete                            1> /dev/null 2> /dev/null
  0     */3   * * * /usr/bin/find ~/.local/share/Trash/files -mtime +1 -delete           1> /dev/null 2> /dev/null

# DZEN2
  0     *     * * * ~/scripts/dzen2-update.sh 1> ~/.dzen2-fifo                                        2> /dev/null

Shortcuts

This Dzen2 configuration implements five ‘mouse actions’ or shortcuts available on the status bar.

  • [Scroll Up] – switch next virtual desktop.
  • [Scroll Down] – switch previous virtual desktop.
  • [Right Click] – show Openbox root menu.
  • [Middle Click] – show Openbox window menu.
  • [Left Click] – update Dzen2 Status Bar with dzen2-update.sh invoke.

Hope I haven’t forgot anything, feel free to ask or remind me πŸ˜‰

EOF