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’.

Chocolatey: Package Manager for Windows

While preparing Cikgu JN’s new laptop (refurbish Thinkpad T400), I have amazed that there is opensource package manager and some automation for Windows. The laptop come with Windows 7 Professional.

“Chocolatey is a package manager for Windows (like apt-get or yum but for Windows).”https://chocolatey.org

Main application interface is command line, but also Chocolatey provide option to install nice graphical tool.

Below is some summary command:

choco install -y vlc
choco install -y firefox libreoffice gimp mame telegram sumatra-pdf chocolateygui
choco upgrade -y firefox
choco upgrade -y all

 

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

 

 

Reka-bentuk Banglo Kecil v2

Masih belum berpuas hati dengan reka-bentuk banglo kecil yang sebelum ini, Cikgu cuba mereka-bentuk rumah banglo untuk mendapatkan yang lebih sesuai dengan citarasa.

Berikut antara ciri-ciri rumah yang Cikgu ambil perhatian:

  • Ruang tamu yang dapat melihat kawasan luar depan dan belakang rumah.
  • Saiz rumah yang kecil tetapi selesa.
  • Dapur bersaiz penuh.
  • Dua bilik mandi; dengan tandas duduk dan tandas cangkung.
  • Ruang untuk mesin basuh pakaian.
  • Ruang untuk simpan kasut.
  • Ruang untuk pejabat/komputer.
  • Ruang tamu boleh digunakan untuk solat jemaah, dan juga untuk majlis keramaian.
  • Dapur dan meja makan yang agak tersorok dari ruang tamu.
  • Pili air di luar pintu masuk depan dan belakang rumah.
  • Semua bilik tidur mempunyai tingkap yang sesuai.
  • 4 bilik tidur (1 bilik parent, 2 untuk anak lelaki dan anak perempuan, 1 untuk tetamu atau stor).
  • Kedudukan bilik-bilik dengan ruang keluarga berkumpul tidak terlalu jauh/terpencil, supaya mudah berinteraksi/bertemu muka dan dapat merapatkan hubungan kekeluargaan.

Ciri-ciri yang terpaksa diketepikan dalam reka-bentuk ini antaranya ialah seperti yang berikut:

  • Ruang khas untuk pentry.
  • Ruang stor. Untuk ruang stor ini, mungkin boleh diadakan sekalikan dengan garaj kereta. Kontena terpakai juga mungkin boleh diguna sebagai ruang stor.
  • Ruang jemuran pakaian selepas basuh untuk dikeringkan, kerana boleh diadakan di luar rumah.
  • Attached-garrage for two cars.

rumahpegoh-livingdiningtengah_dapurtepiblkg_4bedrooms_0garage_v1-6-photo009-edited

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’.

Cheap Stereo Sound Amplifier for Audiophile

This are the tip for cheap audio system. I am using this system for my computer.

I bought cheap China made mini stereo amplifier to power-up my cheap used 4″ speaker.

By using this stereo amplifier, the sound is amplified. But there is a problem that really disturb me, I lost the stereo quality. I did test with one channel only, for example play audio source left channel only, I have the sound output to my left speaker, but plus I also hear the sound in my right speaker. This is very bad to me 😦

Then here I come with solution. The key of this tip are ‘two’ cheap mini stereo amplifier. Yes, I am using two mini stereo amplifier. One amplifier will be use to amplify left channel for output to left speaker, and another one amplifier will be use for output to right speaker.

two_cheap_mini_stereo_amplifier

Connection from audio input, to two separate amplifier, and then to speakers.

The output sound now really separate left and right channel. Stereo output very nice, like using ear/headphone.

Below are some pictures of my setup… very messy.

The two cheap stereo mini amplifier

The two cheap stereo mini amplifier

Cheap used 2.0 speaker

Cheap used stereo speaker