Toggle Touchpad Enable & Disable

Here is my simple script to help me toggle touchpad enable & disable in NixOS running on Thinkpad R61.

~/bin/toggleTouchpadEnableDisable

# Try disabling the libinput device.

d=`xinput list | grep -i touchpad | awk '{for(i=1;i<=NF;i++){ tmp=match($i, /id=[0-9]/); if(tmp){print $i} } }' | awk --field-separator== '{ print $2 }'`
echo 'xinput list'
echo " SynPS/2 Synaptics TouchPad device ID: $d"

# Find the touchpad, in my case it's called "SynPS/2 Synaptics TouchPad", with ID 11.
echo "xinput list-props $d"
de=`xinput list-props $d | grep 'Device Enabled' | awk '{ print $3}' | awk --field-separator=\( '{print $2}' | awk --field-separator=\) '{print $1}'`
ds=`xinput list-props $d | grep 'Device Enabled' | awk '{ print $4}'`
echo " Device Enabled setting ID: $de, Device Enabled status: $ds"

newStatus=0
if [ $ds == 0 ]; then
 #echo "Set new status to: $newStatus"
 newStatus=1
elif [ $ds == 1 ]; then
 #echo "Set new status to: $newStatus"
 newStatus=0
fi

# There should be one called 'Device Enabled'; at least mine has.
echo "xinput set-prop $d $de $newStatus"
xinput set-prop $d $de $newStatus

ds2=`xinput list-props $d | grep 'Device Enabled' | awk '{ print $4}'`
echo " Device Enabled setting ID: $de, Device Enabled status: $ds2"

 

Advertisements

dvorak keyboard

Today is the first day I learn to touch-type with ‘dvorak’ keyboard layout.

Training Requirement

For training, just use current ‘qwerty’ keyboard, and proceed to https://learn.dvorak.nl/.

Ignore what’s printed on physical ‘qwerty’ keyboard keys would help 😛

Training

I do training touch type dvorak at https://learn.dvorak.nl/.

How to change keyboard Layout on Windows

For Windows (I am using Windows7), to configure for switch keyboard layout between ‘qwerty’ and ‘dvorak’, please look at look in Regional and Language Options > Keyboards and Languages > Change keyboards…

2017-12-24 20_24_24-Greenshot-changeKeyboardLayoutQwertyDvorak

Then, to switch between those keyboard layout, we can select the keyboard layout from ‘Language Bar’ icon at bottom-left screen corner. The setting for keyboard layout are by application basis. That’s mean each application have it’s own keyboard layout.

2017-12-24 20_24_24-Greenshot-changeKeyboardLayoutLanguageBar

How to change keyboard Layout on Linux

For Linux (I am using NixOS),  we can use two commands to switch keyboard layout in X and another two commands to switch keyboard layout in console.

When in X, run below command. The setting will effect all application in X.

  • setxkbmap dvorak
  • setxkbmap us

To display current keymap, use command ‘setxkbmap -query’.

When in console, run below command. The setting will effect all application in console.

  • loadkeys dvorak
  • loadkeys us

A tip to easily and quickly switch keyboard layout mapping in Linux

Windows quite good IMHO as it provide ‘language bar’ for easily switch keyboard layout mapping.

For Linux, we can do a little trick to make the switching keyboard layout in X a little bit easier. For example, just need to add two lines aliases to ~/.bashrc file as below:

  • alias asdf=’setxkbmap dvorak’ # to switch to dvorak in X
  • alias aoeu=’setxkbmap us’ # to switch to qwerty in X

The we just need to enter same four left-fingers home keys (‘asdf‘ when currently using qwerty; and ‘aoeu‘ when using dvorak) to switch between those two layout mapping.

Do the same little trick to make the switching keyboard layout in console a little bit easier. For example, just need to add two lines aliases to ~/.bashrc file as below:

  • alias lkj=’loadkeys dvorak’ # to switch to dvorak in console
  • alias nth=’loadkeys us’ # to switch to qwerty in console

The we just need to enter same four right-fingers home keys (‘lkj‘ when currently using qwerty; and ‘nth‘ when using dvorak) to switch between those two layout mapping.

To set default keyboard layout to dvorak in NixOS

Add those line in ‘/etc/nixos/configuration.nix’:

  • i18n.consoleKeyMap = “dvorak”; # for terminals
  • services.xserver.xkbVariant = “dvorak”; # for graphical

And then run rebuild with command ‘nixos-rebuild switch’.

GoboLinux 016

This is my note while trying with new release GoboLinux 016 inside VirtualBox.

GoboLinux VM VirtualBox configured as below:

  • KVM
sudo su -

Xorg -configure
 cp xorg.conf.new /etc/xorg.conf

vim /etc/xorg.conf
 Section "Device"
 # Driver "fbdev"
 Driver "vesa"

reboot

ip addr ls
 dhcpd enp0s1
updateRecipes
 cd /Data/Compile/Recipes
 find . | grep -i tmux

tmux
https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz

NewVersion Tmux 2.3 https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
 Compile Tmux 2.3
vim /System/Settings/Compile/Compile.conf
 compileRecipeAuthor="Muhammad Najib Bin Ibrahim <mnajib@gmail.com>"

ContributeRecipe Tmux 2.3

#scp najib@tomato:~/.tmux.conf

If have broken links from previous installation attempt, try run this prior to Compile:

$ find /System/Index | RemoveBroken

To install package:

SuggestUpdates
InstallPackage -b -C Qt

 

 

My OS Watch List

Berikut adalah senarai opensource OS yang menarik perhatian Cikgu.

  • NixOS
  • GoboLinux
  • ReactOS
  • FreeBSD
  • Android-x86

 

nixos-logo-only-hires

NixOS (http://nixos.org) ialah distro Linux dengan pendekatan unik untuk pengurusan pakej dan konfigurasi. Dibina di atas pengurus pakej nixpkg, ia benar-benar perisytiharan, menjadikan sistem penaiktarafan boleh dipercayai, dan mempunyai banyak kelebihan lain.

 

gobo-logo

GoboLinux (http://www.gobolinux.org/) dan NixOS (http://www.nixos.org/) adalah antara OS yang paling Cikgu teruja. Ini adalah kerana Cikgu sangat tertarik dengan idea kaedah filesystem dan package manager.

NixOS dan GoboLinux pada umumnya bertujuan menyelesaikan masalah kebergantungan antara perisian dengan pelbagai versi, tapi dengan pendekatan atau kaedah berlainan. NixOS membezakan setiap versi perisian dengan gabungan ‘hash dan nama perisian sebagai nama direktori’, manakala Gobolinux membezakan setiap versi perisian dengan ‘nombor versi sebagai nama direktori’.

 

reactos_0

Opensource OS yang seterusnya ialah ReactOS (http://www.reactos.org/). ReactOS merupakan operating system yang serupa cara kerja Windows. Secara umumnya, pengguna boleh secara terus menggantikan Windows dengan ReactOS. Buat masa sekarang ReactOS masih lagi dalam proses permulaan pembikinan dan berstatus ‘beta’.

gobolinux: New Major Release

GoboLinux 015, the new major release of GoboLinux.

gobolinux-screenshot-ARM_003_Lucas

GoboLinux, the Linux distribution featuring a rethought file system structure. This is the first full-system image release in a number of years, after a long period in which we kept only updating compilation recipes. Packages were built using both ALFS (Automated Linux from Scratch) and our custom dynamically-generated sandboxed environment which insulates the source code and its dependencies during compilation. Major upgrades include the Enlightenment 18 desktop and kernel version 3.14.2, as well as new versions of the GoboLinux management tools. Please check the Release Notes for details and download instructions.

Refer: http://gobolinux.org/