Tag Archives: laptop

The Power to Serve – FreeBSD Power Management

This is the motto of the FreeBSD operating system – The Power to Serve – which also greatly fits for the topic of this article. Decade ago (yes time flies) I even made a wallpaper with this motto – still available on the DeviatArt page.

freebsd_the_power_to_serve_small.jpg

Time for FreeBSD article covering its power management features. It also applies to FreeBSD Desktop series but its not limited to it. Popular opinion seems to be that FreeBSD is so server oriented that it lacks any power management mechanisms. Nothing more far from the truth. While less important on the desktop (but will still lower your electricity bill) or servers it is desirable to properly configure power management on laptops to so they will have longer battery life and will run more quiet.

I write this as the FreeBSD Handbook does not cover all that information in the 11.13. Power and Resource Management chapter. The FreeBSD on Laptops article part 4. Power Management is from the ancient times of FreeBSD 10.1-RELEASE. There is some information on the FreeBSD Wiki page but parts of it are outdated.

FreeBSD offers many mechanisms in the power management department:

  • power off devices without attached driver
  • scale CPU frequency and power
  • supports CPU sleep states (C1/C1E/C2/C3/…)
  • enabling/disabling Turbo Mode available in most CPUs
  • per USB device power management options
  • SATA/AHCI channels/controllers power management
  • limit of wakeups/interrupts to increase idle time
  • suspend/resume support (along with using laptop lid for it)
  • support for vendor specific tools that help to measure power management
  • tools and ACPI support for fan speed control
  • tools and ACPI support for setting screen brightness
  • battery capacity status and running time estimation
  • network interfaces power saving options

One word about different files for the settings in the FreeBSD system:

  • /etc/rc.conf – does not require reboot just daemons reloading
  • /etc/sysctl.conf – does not require reboot – you can set them at runtime
  • /boot/loader.conf – these settings REQUIRE reboot

Information

Let’s start by describing where to get needed information about current CPU speed, used C-states, current power management modes for USB devices, battery capacity and remaining time, etc.

Battery

To get battery information you can use the acpiconf(8) tool. This is the acpiconf(8) output for my main battery (in the ThinkPad T420s laptop) with AC power attached.

% acpiconf -i 0
Design capacity:        44000 mWh
Last full capacity:     37930 mWh
Technology:             secondary (rechargeable)
Design voltage:         11100 mV
Capacity (warn):        1896 mWh
Capacity (low):         200 mWh
Low/warn granularity:   1 mWh
Warn/full granularity:  1 mWh
Model number:           45N1037
Serial number:          28608
Type:                   LION
OEM info:               SANYO
State:                  high
Remaining capacity:     100%
Remaining time:         unknown
Present rate:           0 mW
Present voltage:        12495 mV

… and with AC power detached.

% acpiconf -i 0
Design capacity:        44000 mWh
Last full capacity:     37930 mWh
Technology:             secondary (rechargeable)
Design voltage:         11100 mV
Capacity (warn):        1896 mWh
Capacity (low):         200 mWh
Low/warn granularity:   1 mWh
Warn/full granularity:  1 mWh
Model number:           45N1037
Serial number:          28608
Type:                   LION
OEM info:               SANYO
State:                  high
Remaining capacity:     100%
Remaining time:         2:31
Present rate:           0 mW
Present voltage:        12492 mV

Now as AC power is detached from the laptop the Remaining time: field will show you remaining time estimation for this single battery shows as 2:31 here (two hours and thirty one minutes).

Below is acpiconf(8) output for my secondary battery (in ThinkPad T420s ultrabay instead of DVD drive).

% acpiconf -i 1
Design capacity:        31320 mWh
Last full capacity:     24510 mWh
Technology:             secondary (rechargeable)
Design voltage:         10800 mV
Capacity (warn):        1225 mWh
Capacity (low):         200 mWh
Low/warn granularity:   1 mWh
Warn/full granularity:  1 mWh
Model number:           45N1041
Serial number:            260
Type:                   LiP
OEM info:               SONY
State:                  high
Remaining capacity:     100%
Remaining time:         unknown
Present rate:           0 mW
Present voltage:        12082 mV

… and with AC power detached.

% acpiconf -i 1
Design capacity:        31320 mWh
Last full capacity:     24510 mWh
Technology:             secondary (rechargeable)
Design voltage:         10800 mV
Capacity (warn):        1225 mWh
Capacity (low):         200 mWh
Low/warn granularity:   1 mWh
Warn/full granularity:  1 mWh
Model number:           45N1041
Serial number:            260
Type:                   LiP
OEM info:               SONY
State:                  discharging
Remaining capacity:     98%
Remaining time:         1:36
Present rate:           14986 mW
Present voltage:        11810 mV

With AC power detached it shows the Remaining time: as 1:36 for the secondary battery.

So its total 4:07 time on battery estimated. The same time in minutes (247) will be shown in the sysctl(8) value named hw.acpi.battery.time as shown below.

% sysctl hw.acpi.battery.time
hw.acpi.battery.time: 247

You can also get more ‘complete’ battery information with below sysctl(8) values under hw.acpi.battery MIB.

% sysctl hw.acpi.battery
hw.acpi.battery.info_expire: 5
hw.acpi.battery.units: 2
hw.acpi.battery.state: 1
hw.acpi.battery.time: 247
hw.acpi.battery.life: 99

The hw.acpi.battery.time will show you ‘-1‘ value if you have AC power attached.

% sysctl hw.acpi.battery
hw.acpi.battery.info_expire: 5
hw.acpi.battery.units: 2
hw.acpi.battery.state: 0
hw.acpi.battery.time: -1
hw.acpi.battery.life: 100

Battery Wear

As time passes by batteries lose their ‘design’ capacity. After 1-2 years such battery can have only 70% or less of its original efficiency.

All the information needed to check that is provided by the acpiconf(8) command with Design capacity: and Last full capacity: values. I have made a battery-capacity.sh script that will tell you what the current battery efficiency is. Here is how it looks in action.

% battery-capacity.sh 0
Battery '0' model '45N1037' has efficiency: 86%

% battery-capacity.sh 1
Battery '1' model '45N1041' has efficiency: 78%

Here is the battery-capacity.sh script itself.

#! /bin/sh

if [ ${#} -ne 1 ]
then
  echo "usage: ${0##*/} BATTERY"
  exit
fi

if acpiconf -i ${1} 1> /dev/null 2> /dev/null
then
  DATA=$( acpiconf -i ${1} )
  MAX=$( echo "${DATA}" | grep '^Design\ capacity:'     | awk -F ':' '{print $2}' | tr -c -d '0-9' )
  NOW=$( echo "${DATA}" | grep '^Last\ full\ capacity:' | awk -F ':' '{print $2}' | tr -c -d '0-9' )
  MOD=$( echo "${DATA}" | grep '^Model\ number:'        | awk -F ':' '{print $2}' | awk '{print $1}' )
  echo -n "Battery '${1}' model '${MOD}' has efficiency: "
  printf '%1.0f%%\n' $( bc -l -e "scale = 2; ${NOW} / ${MAX} * 100" -e quit )
else
  echo "NOPE: Battery '${1}' does not exists on this system."
  echo "INFO: Most systems has only '0' or '1' batteries."
  exit 1
fi

CPU

To get information about current CPU’s you will have to use dev.cpu MIB or dev.cpu.0 for the first physical CPU core.

% sysctl dev.cpu.0
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 412905 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 290us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/3/104
dev.cpu.0.freq_levels: 2501/35000 2500/35000 2200/29755 2000/26426 1800/23233 1600/20164 1400/17226 1200/14408 1000/11713 800/9140
dev.cpu.0.freq: 800
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

If you load the coretemp(4) kernel module with kldload(8) command you will get additional temperature information.

Below is same sysctl(8) dev.cpu.0 MIB with coretemp(4) kernel module loaded.

% sysctl dev.cpu.0
dev.cpu.0.temperature: 49.0C
dev.cpu.0.coretemp.throttle_log: 0
dev.cpu.0.coretemp.tjmax: 100.0C
dev.cpu.0.coretemp.resolution: 1
dev.cpu.0.coretemp.delta: 51
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 16549 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 1489us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/3/104
dev.cpu.0.freq_levels: 2501/35000 2500/35000 2200/29755 2000/26426 1800/23233 1600/20164 1400/17226 1200/14408 1000/11713 800/9140
dev.cpu.0.freq: 800
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

Let me describe some most useful ones.

CPU core temperature.
dev.cpu.0.temperature: 49.0C

CPU supported C-states (C1 and C2 for this CPU).
dev.cpu.0.cx_supported: C1/1/1 C2/3/104

CPU statistics for C-states usage (only C1 state been used).
dev.cpu.0.cx_usage_counters: 16549 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 1489us

CPU maximum (most deep) C state enabled.
dev.cpu.0.cx_lowest: C1

CPU supported frequency levels with power usage after the ‘/‘ character. The 2500/35000 can be read as 2.5 Ghz frequency with 35 W power usage and 2501 is the Turbo Mode. The lowest is 800 MHz with about 9 W usage.
dev.cpu.0.freq_levels: 2501/35000 2500/35000 2200/29755 2000/26426 1800/23233 1600/20164 1400/17226 1200/14408 1000/11713 800/9140

CPU current frequency (will vary when You use powerd(8) or powerdxx(8) daemon).
dev.cpu.0.freq: 800

The hw.acpi.thermal.tz0.temperature MIB will also show you current thermal zone temperature.

% sysctl hw.acpi.thermal.tz0.temperature
hw.acpi.thermal.tz0.temperature: 49.1C

To check how many cores you have use these commands.

% grep FreeBSD/SMP /var/run/dmesg.boot
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s)

% sysctl kern.smp.cpus
kern.smp.cpus: 2

If my description does not feel useful then you should also check the -d flag for sysctl(8) command as shown below.

% sysctl -d dev.cpu.0.freq
dev.cpu.0.freq: Current CPU frequency

lscpu(1)

There is also third party tool called lscpu(8) that will describe your CPU features and model. You will have to add it from packages.

# pkg install lscpu

To make lscpu(8) work the cpuctl(4) kernel module is needed.

Here is how it looks for my dual core CPU.

# kldload cpuctl
# lscpu
Architecture:            amd64
Byte Order:              Little Endian
Total CPU(s):            2
Thread(s) per core:      2
Core(s) per socket:      2
Socket(s):               0
Vendor:                  GenuineIntel
CPU family:              6
Model:                   42
Model name:              Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
Stepping:                7
L1d cache:               32K
L1i cache:               32K
L2 cache:                256K
L3 cache:                3M
Flags:                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 cflsh ds acpi mmx fxsr sse sse2 ss htt tm pbe sse3 pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline aes xsave osxsave avx syscall nx rdtscp lm lahf_lm

dmesg(8)

Also dmesg(8) command (or /var/run/dmesg.boot file after longer uptime) covers your CPU model and features information.

% grep CPU /var/run/dmesg.boot
CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (2491.97-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0:  on acpi0
coretemp0:  on cpu0

CPU Frequency Scalling

For CPU scaling feature you may use the powerd(8) daemon available in the FreeBSD base system or powerdxx(8) from the FreeBSD Ports or packages. The powerdxx(8) daemon aims to better scale multicore systems and not turning all cores to high state when there is moderate load on the system but some people may prefer that approach to have full power available when they do anything and to save power when they do nothing. Thus powerd(8) is not better then powerdxx(8) or vice versa. They are just different so that gives you more options for your needs.

No matter which one you will choose it has to be configured in the /etc/rc.conf file.

powerd(8)

Here are the options for powerd(8) daemon.

powerd_enable=YES
powerd_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 1600"

The -n option of for the unknown state – if for some reason the powerd(8) will not be able to determine if you are running on the AC power or battery. The -a is for AC power and -b for running on the battery. The adaptive setting is less ‘agressive’ so its more battery time friendly. The hiadaptive is more aggressive this its preferred when you are running on AC power. The -m option sets minimum CPU frequency to be used and -M the maximum. Both in MHz units. Check powerd(8) man page for more details.

powerdxx(8)

First you will need to install it.

# pkg install powerdxx

Then its options are identical as those of powerd(8) daemon.

powerdxx_enable=YES
powerdxx_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 1600"

Check the powerdxx(8) section above for the flags/parameters description.

Decade ago CPU frequency scalling on FreeBSD was not that ‘easy’ as it is now, you may check my old HOWTO: FreeBSD CPU Scaling and Power Saving in that topic from 2008.

C-States

The C-states can be configured in the /etc/rc.conf file with these options.

  • performance_cx_lowest
  • economy_cx_lowest

The economy_cx_lowest parameter is for running on battery and performance_cx_lowest parameter is for running on AC power. Both are set using the /etc/rc.d/power_profile script used by rc(8) subsystem. It sets the hw.acpi.cpu.cx_lowest parameter which sets/controls all dev.cpu.*.cx_lowest values. You can also track the changes in the /var/log/messages file when you attach/detach the AC power.

% tail -f /var/log/messages
Nov 28 13:14:42 t420s power_profile[48231]: changed to 'economy'
Nov 28 13:14:46 t420s power_profile[56835]: changed to 'performance'

Usually I jest use these values.

performance_cx_lowest=C1
economy_cx_lowest=Cmax

These settings above are generally sufficient for most systems. To check which C-states your CPU supports get the value of dev.cpu.0.cx_supported MIB.

% sysctl dev.cpu.0.cx_supported
dev.cpu.0.cx_supported: C1/1/1 C2/3/104

My CPU supports only C1 and C2 but yours may support more. I remember once when using some old Core 2 Duo laptop that the C2 state had quite ‘noticable’ delay when getting back from C1 (running) state to C2 (sleep) state so following setting is needed. You do not use the performance_cx_lowest and economy_cx_lowest parameters. You set the first core to C1 and all other cores to C2. This way even on mattery you have fully resonsive system and all other cores may sleep and save enegry.

For example if You would have 4 cores and your maximum (deepest) supported C-state would be C3, then you would put these into the /etc/sysctl.conf file.

% grep cx_lowest /etc/sysctl.conf
dev.cpu.0.cx_lowest=C1
dev.cpu.1.cx_lowest=C3
dev.cpu.2.cx_lowest=C3
dev.cpu.3.cx_lowest=C3

CPU Turbo Mode

There are two ways to enable Turbo mode. One way is to set powerd(8) or powerdxx(8) daemon with maximum frequency set above nominal CPU speed. For example if you have CPU described as dual-core 2.3 Ghz then set the maximum speed with -M flag to 4000 for example (which would mean 4GHz). If you do not use CPU frequency scaling daemon then you will use dev.cpu.0.freq parameter with highest (first) value from the dev.cpu.0.freq_levels MIB.

Supported CPU frequency levels on my system.

% sysctl dev.cpu.0.freq_levels 
dev.cpu.0.freq_levels: 2501/35000 2500/35000 2200/29755 2000/26426 1800/23233 1600/20164 1400/17226 1200/14408 1000/11713 800/9140

The hightest value (left) is 2501/35000 so I need to set dev.cpu.0.freq parameter with this value to use Turbo Mode. You need to only use the ‘frequency’ value part because if you paste it with power requirements description it will fail.

# sysctl dev.cpu.0.freq=2501/35000
sysctl: invalid integer '2501/35000'

This is how it should be used.

# sysctl dev.cpu.0.freq=2501
dev.cpu.0.freq: 800 -> 2501

USB Devices

To list attached USB devices use the usbconfig(8) tool.

% usbconfig
ugen1.1:  at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen2.1:  at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1:  at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen2.2:  at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2:  at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.3:  at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen2.3:  at usbus2, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)

You will see that pwr parameter (short for power) will show you current power setting which can be:

  • ON
  • OFF
  • SAVE

To set new USB power option for the ugen1.1 device also use the usbconfig(8) tool with the power_save parameter in the following way.

# usbconfig -u 1 -a 1 power_save

The USB power management does not have dedicated config file on FreeBSD so we will put them into universal /etc/rc.local file which is being run at the end of the start-up process managed by the rc(8) subsystem. Here is the added content with exception for the ‘Lenovo USB Receiver‘ which is my wireless mouse.

% grep -A 10 POWER /etc/rc.local
# POWER SAVE USB DEVICES
usbconfig \
  | grep -v 'Lenovo USB Receiver' \
  | awk '{print $1}' \
  | sed 's|ugen||'g \
  | tr -d : \
  | awk -F '.' '{print $1 " " $2 }' \
  | while read U A
    do
      usbconfig -u ${U} -a ${A} power_save 2> /dev/null
    done

It’s good idea to NOT save power for mouse or tracked devices because you will probably find it annoying to have to wait about a second each time you would like to use it. I use a for loop to set power saving for all USB devices except wireless USB mouse (identified as ‘Lenovo USB Receiver‘ device).

SATA/AHCI Power Management

FreeBSD offerts AHCI channels power management via acpich(4) driver. These power management settings cen be set at boot using the hint.ahcich.*.pm_level parameter in the /boot/loader.conf file. I use configuration up to 8 channels while I only have three.

% grep ahcich /var/run/dmesg.boot
ahcich0:  at channel 0 on ahci0
ahcich1:  at channel 1 on ahci0
ahcich4:  at channel 4 on ahci0
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0

That is because settings for non-existent devices are harmless and will not display any error messages but you will not have to use different settings for various systems which saves time. This is the hint.ahcich.*.pm_level description from the ahci(4) man page.

  hint.ahcich.X.pm_level

    controls SATA interface Power Management for the specified channel,
    allowing some power to be saved at the cost of additional command latency.

    Some controllers, such as ICH8, do not implement modes 2 and 3 with NCQ
    used. Because of artificial entering latency, performance degradation in
    modes 4 and 5 is much smaller then in modes 2 and 3.

Possible power management options are:

  • 0 – interface Power Management is disabled (default)
  • 1 – device is allowed to initiate PM state change, host is passive
  • 2 – host initiates PARTIAL PM state transition every time port becomes idle
  • 3 – host initiates SLUMBER PM state transition every time port becomes idle
  • 4 – driver initiates PARTIAL PM state transition 1ms after port becomes idle
  • 5 – driver initiates SLUMBER PM state transition 125ms after port becomes idle

Here are my setting from the /boot/loader.conf file.

# AHCI POWER MANAGEMENT FOR EVERY USED CHANNEL (ahcich 0-7)
  hint.ahcich.0.pm_level=5
  hint.ahcich.1.pm_level=5
  hint.ahcich.2.pm_level=5
  hint.ahcich.3.pm_level=5
  hint.ahcich.4.pm_level=5
  hint.ahcich.5.pm_level=5
  hint.ahcich.6.pm_level=5
  hint.ahcich.7.pm_level=5

Devices without Driver

FreeBSD has power saving option to not power devices that does not have attached driver. Its called hw.pci.do_power_nodriver and you can set it in the /boot/loader.conf file. Here is its description from then pci(4) man page.

  hw.pci.do_power_nodriver (Defaults to 0)

    Place devices into a low power state (D3) when
    a suitable device driver is not found.

It can be set to one of the following values:

  • 0 – All devices are left fully powered (defaults).
  • 1 – Like ‘2‘ except that storage controllers are also not powered down.
  • 2 – Powers down most devices (display/memory/peripherals not powered down).
  • 3 – Powers down all PCI devices without a device driver.

Here is my setting from the /boot/loader.conf file.

# POWER OFF DEVICES WITHOUT ATTACHED DRIVER
  hw.pci.do_power_nodriver=3

The pciconf(8) utility will show you what devices are in your system and which driver is attached to it. If no driver is attached you will see none*@ for such devices, as none0@ below. You can also check man page for most drivers like em(4) man page for em0 device or xhci(4) page for xhci0 device.

% pciconf -l
hostb0@pci0:0:0:0:      class=0x060000 card=0x21d217aa chip=0x01048086 rev=0x09 hdr=0x00
vgapci0@pci0:0:2:0:     class=0x030000 card=0x21d217aa chip=0x01268086 rev=0x09 hdr=0x00
none0@pci0:0:22:0:      class=0x078000 card=0x21d217aa chip=0x1c3a8086 rev=0x04 hdr=0x00
em0@pci0:0:25:0:        class=0x020000 card=0x21ce17aa chip=0x15028086 rev=0x04 hdr=0x00
ehci0@pci0:0:26:0:      class=0x0c0320 card=0x21d217aa chip=0x1c2d8086 rev=0x04 hdr=0x00
hdac0@pci0:0:27:0:      class=0x040300 card=0x21d217aa chip=0x1c208086 rev=0x04 hdr=0x00
pcib1@pci0:0:28:0:      class=0x060400 card=0x21d217aa chip=0x1c108086 rev=0xb4 hdr=0x01
pcib2@pci0:0:28:1:      class=0x060400 card=0x21d217aa chip=0x1c128086 rev=0xb4 hdr=0x01
pcib3@pci0:0:28:3:      class=0x060400 card=0x21d217aa chip=0x1c168086 rev=0xb4 hdr=0x01
pcib4@pci0:0:28:4:      class=0x060400 card=0x21d217aa chip=0x1c188086 rev=0xb4 hdr=0x01
ehci1@pci0:0:29:0:      class=0x0c0320 card=0x21d217aa chip=0x1c268086 rev=0x04 hdr=0x00
isab0@pci0:0:31:0:      class=0x060100 card=0x21d217aa chip=0x1c4f8086 rev=0x04 hdr=0x00
ahci0@pci0:0:31:2:      class=0x010601 card=0x21d217aa chip=0x1c038086 rev=0x04 hdr=0x00
ichsmb0@pci0:0:31:3:    class=0x0c0500 card=0x21d217aa chip=0x1c228086 rev=0x04 hdr=0x00
iwn0@pci0:3:0:0:        class=0x028000 card=0x11118086 chip=0x42388086 rev=0x3e hdr=0x00
sdhci_pci0@pci0:5:0:0:  class=0x088000 card=0x21d217aa chip=0xe8221180 rev=0x07 hdr=0x00
xhci0@pci0:13:0:0:      class=0x0c0330 card=0x01941033 chip=0x01941033 rev=0x04 hdr=0x00

You can also use -v flag to get more detailed information.

% pciconf -l -v
(...)
xhci0@pci0:13:0:0:      class=0x0c0330 card=0x01941033 chip=0x01941033 rev=0x04 hdr=0x00
    vendor     = 'NEC Corporation'
    device     = 'uPD720200 USB 3.0 Host Controller'
    class      = serial bus
    subclass   = USB

Nvidia Optimus

If for some reason your BIOS/UEFI firmware does not allow you to disable Nvidia discrete graphics card you may use this script to disable it so it will not drain power from your system. It requires the acpi_call(4) kernel module which is provided by the acpi_call package.

# mkdir /root/bin
# cd /root/bin
# fetch https://people.freebsd.org/~xmj/turn_off_gpu.sh
# pkg install acpi_call
# kldload acpi_call
# chmod +x /root/bin/turn_off_gpu.sh
# /root/bin/turn_off_gpu.sh

You may add it to the /etc/rc.local file after the USB power saving options with this entry.

# DISABLE NVIDIA CARD
  /root/bin/turn_off_gpu.sh

It successd it will store the working ACPI call in the /root/.gpu_method file and execute it each next time.

Suspend and Resume

The biggest enemies of supend/resume mechanism are bugs in your BIOS/UEFI firmware for your hardware. Sometimes disabling Bluetooth helps – that is the option for ThinkPad T420s for example. To check which suspend modes are supported on your system check the hw.acpi.supported_sleep_state MIB from sysctl(8) subsystem.

% sysctl hw.acpi.supported_sleep_state
hw.acpi.supported_sleep_state: S3 S4 S5

To enter ACPI S3 sleep state (suspend) you can use acpiconf(8) tool or zzz(8) tool.

# zzz

… or with acpiconf(8) tool.

# acpiconf -s 3

Its exactly the same as stated in the zzz(8) man page.

You can also set sysctl(8) value that everytime you close your laptop lid your system will go to sleep. To achieve that put hw.acpi.lid_switch_state=S3 into the /etc/sysctl.conf file. No matter if you put you hardware to sleep by command or by closing the lid your laptop will resume after opening the lid. Of course if you haven’t closed the lid after the zzz(8) command you will either have to close and open the lid or push the power button to resume. Of course you may also suspend/resume desktops or even your backup server if it has its purpose. It’s not limited to laptops only.

There are also dedicated kernel modules for various vendor ACPI subsystems. Here they are:

  • /boot/kernel/acpi_asus_wmi.ko
  • /boot/kernel/acpi_asus.ko
  • /boot/kernel/acpi_dock.ko
  • /boot/kernel/acpi_fujitsu.ko
  • /boot/kernel/acpi_hp.ko
  • /boot/kernel/acpi_ibm.ko
  • /boot/kernel/acpi_panasonic.ko
  • /boot/kernel/acpi_sony.ko
  • /boot/kernel/acpi_toshiba.ko
  • /boot/kernel/acpi_video.ko
  • /boot/kernel/acpi_wmi.ko

For example if you have IBM/Lenovo ThinkPad the you will use the acpi_ibm.ko kernel module.

# kldload acpi_ibm

After loading each module you will get new sysctl(8) values for your use. For example related to fan speed, keyboard backlit or screen brightness. Below is new dev.acpi_ibm section in sysctl(8) after loading the acpi_ibm(4) kernel module.

% sysctl dev.acpi_ibm
dev.acpi_ibm.0.handlerevents: NONE
dev.acpi_ibm.0.mic_led: 0
dev.acpi_ibm.0.fan: 0
dev.acpi_ibm.0.fan_level: 0
dev.acpi_ibm.0.fan_speed: 0
dev.acpi_ibm.0.wlan: 1
dev.acpi_ibm.0.bluetooth: 0
dev.acpi_ibm.0.thinklight: 0
dev.acpi_ibm.0.mute: 0
dev.acpi_ibm.0.volume: 0
dev.acpi_ibm.0.lcd_brightness: 0
dev.acpi_ibm.0.hotkey: 1425
dev.acpi_ibm.0.eventmask: 134217727
dev.acpi_ibm.0.events: 1
dev.acpi_ibm.0.availmask: 134217727
dev.acpi_ibm.0.initialmask: 2060
dev.acpi_ibm.0.%parent: acpi0
dev.acpi_ibm.0.%pnpinfo: _HID=LEN0068 _UID=0
dev.acpi_ibm.0.%location: handle=\_SB_.PCI0.LPC_.EC__.HKEY
dev.acpi_ibm.0.%driver: acpi_ibm
dev.acpi_ibm.0.%desc: IBM ThinkPad ACPI Extras
dev.acpi_ibm.%parent: 

Here are descriptions of more interesting ones.

This one will turn the LED light on the Microphone mute button.
dev.acpi_ibm.0.mic_led

Select if you want to manage CPU fan (0) or leave it to the manufacturer defaults (1).
dev.acpi_ibm.0.fan

If CPU fan is enabled, set its speed.
dev.acpi_ibm.0.fan_level

This one will tell you how fast the CPU fan is spinning (in RPMs).
dev.acpi_ibm.0.fan_speed

Enable/disable WiFi (if its enabled in BIOS).
dev.acpi_ibm.0.wlan

Enable/disable Bluetooth (if its enabled in BIOS).
dev.acpi_ibm.0.bluetooth

Enable/disable ThinkLight.
dev.acpi_ibm.0.thinklight

Mute/unmute speakers.
dev.acpi_ibm.0.mute

Speakers volume.
dev.acpi_ibm.0.volume

Screen brightness.
dev.acpi_ibm.0.lcd_brightness

For most of the cases its not needed to use them as you will probably just use the vendor defined keyboard shortcuts (probably with Fn key) or vendor specific dedicated buttons. Sometimes you want to create/use your own setup or need custom keyboard shortcuts, or you want to control the fan speed depending on the CPU temperature other way then your vendor predefined it. This is when these dedicated ACPI kernel modules are most useful.

For example I recently thought that my CPU fan seems to be little louder then it should be so I created custom cron(8) based acpi-thinkpad-fan.sh script to use lower fan speeds or even lower quieter speeds when CPU temperature is low enough.

I will post it here. Maybe you will find it useful for your purposes. To describe it shortly it disables the fan when CPU temperature is below 50 (C) degrees, it sets it to level ‘1’ if its between 50 (C) and 60 (C) degrees and sets it to level ‘3’ when temperature reaches more then 60 (C) degrees.

#! /bin/sh

if ! kldstat | grep -q acpi_ibm.ko
then
  doas kldload acpi_ibm
fi

doas sysctl dev.acpi_ibm.0.fan=0 1> /dev/null 

TEMP=$( sysctl -n hw.acpi.thermal.tz0.temperature | awk -F'.' '{print $1}' )

if [ ${TEMP} -lt 50 ]
then
  doas sysctl dev.acpi_ibm.0.fan_level=0 1> /dev/null
  exit 0
fi

if [ ${TEMP} -lt 60 ]
then
  doas sysctl dev.acpi_ibm.0.fan_level=1 1> /dev/null
  exit 0
fi

if [ ${TEMP} -ge 60 ]
then
  doas sysctl dev.acpi_ibm.0.fan_level=3 1> /dev/null
  exit 0
fi

… and here is its crontab(5) entry:

% crontab -l
# ACPI/IBM/FAN
* * * * * ~/scripts/acpi-thinkpad-fan.sh

Network Interfaces

There is also ifconfig(8) option to save power if a driver supports such feature, its called powersave and its used like that.

# ifconfig wlan0 powersave

I use it in my network.sh network management script described broadly in the FreeBSD Network Management with network.sh article.

Vendor Tools

There are also vendor tools available on FreeBSD like powermon(8) for example. Remember that it requires cpuctl(4) kernel module to work.

# pkg install powermon
# kldload cpuctl
# powermon
                  Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
                      (Arch: Sandy Bridge, Limit: 44W)



   5.11W [=======>                                                           ]



 Package:           Uncore:             x86 Cores:          GPU:
 Current: 5.11W     Current: 3.17W      Current: 1.73W      Current: 0.21W
 Total: 98.33J      Total: 60.86J       Total: 33.49J       Total: 3.98J

DTrace

The dynamic tracing framework that like ZFS found its way from Solaris/Illumos to FreeBSD may be also useful weapon in the battle for more time on your battery.

First add the dtrace-toolkit package.

# pkg install dtrace-toolkit

Your system stops saving energy or wakes CPU up because something needs to be run/done. To check what is run on your system you mostly run ps(1) or top(1) utilities but that will not show you what exactly is being started or how often something is being run. This is where DTrace comes with help.

We will use the /usr/share/dtrace/toolkit/execsnoop script from the dtrace-toolkit package. It will print EVERY COMMAND that is being run with all its arguments.It will remain silent when no commands are run, be advised.

Here is example output for my dzen2 toolbar update.

# /usr/local/share/dtrace-toolkit/execsnoop 
  UID    PID   PPID ARGS
 1000  97748  97509 /usr/local/bin/zsh -c ~/scripts/dzen2-update.sh > ~/.dzen2-fifo
 1000  97748      1 /bin/sh /home/vermaden/scripts/dzen2-update.sh
 1000  99157  97748 sysctl -n kern.smp.cpus
 1000    311  97748 ps ax -o %cpu,rss,command -c
 1000   3118   1521 awk -v SMP=200 /\ idle$/ {printf("%.1f%%",SMP-$1)}
 1000   4462  97748 date +%Y/%m/%d/%a/%H:%M
 1000   4801  97748 sysctl -n dev.cpu.0.freq
 1000   6009  97748 sysctl -n hw.acpi.thermal.tz0.temperature
 1000   6728  97748 sysctl -n vm.stats.vm.v_inactive_count
 1000   7043  97748 sysctl -n vm.stats.vm.v_free_count
 1000   7482  97748 sysctl -n vm.stats.vm.v_cache_count
 1000  10363   8568 bc -l
 1000  10863  10363 dc -x
 1000  13143   7773 grep --color -q ^\.
 1000  13798  97748 /bin/sh /home/vermaden/scripts/__conky_if_ip.sh
 1000  15089  14235 ifconfig -u
 1000  16439  14235 grep -v 127.0.0.1
 1000  17738  14235 grep -c inet 
 1000  19069  18612 ifconfig -l -u
 1000  19927  18612 sed s/lo0//g
 1000  20772  13798 ifconfig wlan0
 1000  23388  21410 grep ssid
 1000  24588  13798 grep -q "
 1000  25965  25282 awk /ssid/ {print $2}
 1000  27917  27217 awk /inet / {print $2}
 1000  29941  97748 /bin/sh /home/vermaden/scripts/__conky_if_gw.sh
 1000  32808  31412 route -n -4 -v get default
 1000  34012  31412 awk END{print $2}
 1000  34895  97748 /bin/sh /home/vermaden/scripts/__conky_if_dns.sh
 1000  36118  34895 awk /^nameserver/ {print $2; exit} /etc/resolv.conf
 1000  37628  97748 /bin/sh /home/vermaden/scripts/__conky_if_ping.sh dzen2
 1000  38829  37628 ping -c 1 -s 0 -t 1 -q 9.9.9.9
 1000  42079  41566 mixer -s vol
 1000  42177  41566 awk -F : {printf("%s",$2)}
 1000  44434  43254 zfs list -H -d 0 -o name,avail
 1000  45866  43254 awk {printf("%s/%s ",$1,$2)}
 1000  47004  97748 /bin/sh /home/vermaden/scripts/__conky_battery_separate.sh dzen2
 1000  48282  47004 sysctl -n hw.acpi.battery.units
 1000  49494  47004 sysctl -n hw.acpi.battery.life
 1000  49948  47004 sysctl -n hw.acpi.acline
 1000  52073  51441 acpiconf -i 0
 1000  53055  51441 awk /^State:/ {print $2}
 1000  53981  53186 acpiconf -i 0
 1000  55354  53186 awk /^Remaining capacity:/ {print $3}
 1000  55968  55631 acpiconf -i 1
 1000  57187  55631 awk /^State:/ {print $2}
 1000  58405  57471 acpiconf -i 1
 1000  59201  57471 awk /^Remaining capacity:/ {print $3}
 1000  60961  59252 bsdgrep -v -E (COMMAND|idle)$
 1000  63534  59252 head -3
 1000  62194  59252 sort -r -n
 1000  64629  59252 awk {printf("%s/%d%%/%.1fGB ",$3,$1,$2/1024/1024)}
 1000  64634  93198 tail -1 /home/vermaden/.dzen2-fifo

Lots of processes just to update the information on the top of the screen. That is why I refresh dzen2 information only every 5 minutes and if I want exact information and system status for current moment I just ‘click’ on then dzen2 bar to run all these commands and refresh itself.

This way using DTrace you will know if something unwanted does not steal you precious battery time. You may find such dzen2 config in my FreeBSD Desktop – Part 13 – Configuration – Dzen2 article.

Other

ZFS

By default ZFS will commit transaction group every 5 seconds and that is good default setting for the vfs.zfs.txg.timeout parameter. You may want to increase it a little if needed. To 10 for example. I say about that parameter mostly because lots of guides advice to set it to 1 for various performance reasons but keep in mind that setting it to 1 will prevent your disk (and CPU) from going to sleep thus draining more battery life.

If you want to mess with vfs.zfs.txg.timeout value set it in the /boot/loader.conf file.

Applications

To get more time on battery used applications are also crucial. For example Thunar uses less CPU time then Caja or Nautilus. The Geany text editor uses less CPU resources and memory then Scite or Gedit editors, even GVim takes more resouces. Not to mention that custom Openbox/Fluxbox/${YOUR_FAVORITE_WM} window manager based setup will consume a lot less CPU time then entire Gnome or Mate environment.

Sound

You may also gain little battery time if you reduce the number of sound generated interrupts with hw.snd.latency option.

Here is the option from my /boot/loader.conf file.

# REDUCE NUMBER OF SOUND GENERATED INTERRUPTS
  hw.snd.latency=7

Hardware

It’s sometimes possible to literally buy more battery time. For example when you want to buy new SSD for you laptop then pick not the fastest one but the most power efficient one. You will probably not feel the performance difference anyway but you will appreciate more battery time.

Most RAM modules come with 1.5V current voltage but there is chance that your laptop may support low power DDR modules with 1.35V current thus increasing your battery time. Also keep in mind that each RAM stick uses about 0.5-1.0W of power so using single 8 GB RAM stick will provide you more battery time the the same 8 GB of memory using two 4 GB RAM modules. This also have performance drawback because with single RAM module you will not be able to use dual channel technology so you will limit you RAM speed. Some laptops have even 4 RAM slots (like ThinkPad W520 for example) so without losing anything you should use two 8 GB RAM sticks instead of four 4 GB RAM sticks for longer battery life.

It is sometimes possible to swap your DVD drive to internal secondary battery. Examples of such laptops are Dell Latitude D630, ThinkPad T420s or ThinkPad T500/W500. Sometimes vendors offer entire slice battery that will stick to the bottom of your laptop like slice battery for ThinkPad X220 or T420/T520/W520 laptops or for the 1st generation of ThinkPad X1 laptop.

Hope that this information will help you squeeze some battery time (or at least save some power) on FreeBSD πŸ™‚

EOF
Advertisements

FreeBSD Desktop – Part 2.1 – Install FreeBSD 12

This article is an update/rewrite to the already published FreeBSD Desktop – Part 2 – Install. With the upcoming introduction of the FreeBSD 12.0-RELESE version new possibilities arise when it comes to installation. I already talked/showed that method in my ZFS Boot Environments Reloaded at NLUUG presentation but to make it more available and obvious part of my FreeBSD Desktop series I write about it again in dedicated article entry.

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

Now (in FreeBSD 12.x) it is possible to install FreeBSD on GELI encrypted root on ZFS pool without any additional partitions or filesystems. No longer separate UFS or ZFS boot pool /boot filesystem is needed. And what is even more appealing such setup is supported both on UEFI and BIOS (also refereed as Legacy or CSM) systems. Such setup is also compatible with both new bectl(8) utility and the old proven beadm(8) tool. It is also nice that to make such setup you only need to choose the Auto ZFS option from the bsdinstall(8) so you will not have to do it by hand. I advice using GPT (BIOS+UEFI) as it will support both system types so when you are running BIOS system now and will move the disk to other system that boots with UEFI it will also just work out of the box.

The FreeBSD 12.0 is currently at the RC1 stage so we will use that one for below examples of such setup. The 12.0-RELEASE is expected to arise before Christmas if no significant problems or bugs will be found on the road to RC2 and RC3 editions.

For the record here is the FreeBSD 12.0-RC1 Availability information page and aggregated FreeBSD 12.0-RELEASE Release Notes for the upcoming new major FreeBSD version, but it is not yet complete/ready.

I will only show one install process that will work for both UEFI and BIOS systems – the crucial option here is GPT (BIOS+UEFI) to select (which is also the default one). The other option that You need to select is Yes for the Encryption part and also select the SWAP size. You may as well do not use swap and enter ‘0‘ here which means that SWAP partition will not be created. You may as well create ZFS ZVOL partition for SWAP on ZFS pool later or just create a file like /SWAP and enable it as SWAP. No matter which SWAP option you will choose if your system swaps then you are too low on memory and neither of these methods are better or worse then.

freebsd-install-01.png

freebsd-install-02.png

freebsd-install-03.png

One last thing about the default FreeBSD (no matter if 11.x or 12.x) ZFS dataset/filesystem layout. I showed it on my ZFS Boot Environments/ZFS Boot Environments Reloaded presentations but without any text comment as I talked it live.

By default both /var and /usr filesystems are part of the Boot Environment. They are protected and snapshoted during the beadm create newbe process (or by bectl(8) also). Its appears that /var and /usr are separate processes when you type zfs list commend as shown on the slide below.

zroot-layout-01.png

… but when you check the canmount parameter for all ZFS datasets, then it become obvious that /usr and /var are ’empty’ datasets (not mounted).

zroot-layout-02.png

… and also confirmation from theΒ df(1) tool.

zroot-layout-03.png

I asked FreeBSD Developers what is the reason for such construct and its for the mountpoint inheritance purposes. For example when zroot/usr has mountpoint set to /usr then when you create zroot/usr/local dataset, then it will automatically get the /usr/local for the mountpoint parameter by inheritance. At the first sight it may be misleading (I also got caught) but it makes sense when you think about it.

The only filesystems that are NOT included for the Boot Environment protection are these:

  • /usr/home
  • /usr/ports
  • /usr/src
  • /var/audit
  • /var/crash
  • /var/log
  • /var/mail
  • /var/tmp

While in most cases it is not needed to protect these in the Boot Environment protection if you want to also protect these type these two comments to move all the /usr/* and /var/* datasets/filesystems into the Boot Environment pool/ROOT/dataset. It will work on a running system without need for reboot, just make sure you use -u flag.

# zfs rename -u zroot/usr zroot/ROOT/default/usr
# zfs rename -u zroot/var zroot/ROOT/default/var

Now grab that FreeBSD ISO and install it the best possible way up to date πŸ™‚

You will probably want to get amd64 version which is suitable for both 64-bit AMD and Intel systems.

EOF

Β 

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

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

.
.
.
.
.