Optimizing Debian on Laptop

ai-tee, linux

TLP (advanced power management for Linux)

# echo "deb http://ftp.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
# apt-get update
# apt-get install tlp tlp-rdw
# tlp start
# tlp-stat -s

Source:


Brightness Adjusment

Create a script:

# vim brightness.sh
# chmod +x brightness.sh

Content of “brightness.sh” script

function main_menu
{
    sudo clear
    cursetting=$(cat /sys/class/backlight/intel_backlight/brightness)
    maxsetting=$(cat /sys/class/backlight/intel_backlight/max_brightness)
    powersave=$((maxsetting/5))
    conservative=$((powersave*2))
    medium=$((powersave*3))
    performance=$((powersave*4))
    echo ""
    echo "----------------------- Brightness -----------------------"
    echo " 1. Set Display to Minimum (Powersave) brightness setting."
    echo " 2. Set Display to Low (Conservative) brightness setting."
    echo " 3. Set Display to Medium brightness setting."
    echo " 4. Set Display to High (Performance) brightness setting."
    echo " 5. Set Display to Maximum brightness setting."
    echo " 6. Exit."
    echo "----------------------------------------------------------"
    if [ $cursetting -eq $powersave ]; then
     cursetting='Minimum'
    else
     if [ $cursetting -eq $conservative ]; then
      cursetting='Conservative'
     else
      if [ $cursetting -eq $medium ]; then
       cursetting='Medium'
      else
       if [ $cursetting -eq $performance ]; then
        cursetting='Performance'
       else
        if [ $cursetting -eq $maxsetting ]; then
         cursetting='Maximum'
        fi
       fi
      fi
     fi
    fi
    echo "        Current Display Setting - "$cursetting;
    choice=7
    echo ""
    echo -e "Please enter your choice: \c"
}

function press_enter
{
    echo ""
    echo -n "Press Enter to continue."
    read
    main_menu
}

main_menu
while [ $choice -eq 7 ]; do
read choice

if [ $choice -eq 1 ]; then
 echo $powersave | sudo tee /sys/class/backlight/intel_backlight/brightness
 main_menu
else
 if [ $choice -eq 2 ]; then
  echo $conservative | sudo tee /sys/class/backlight/intel_backlight/brightness
  main_menu
 else
  if [ $choice -eq 3 ]; then
   echo $medium | sudo tee /sys/class/backlight/intel_backlight/brightness
   main_menu
  else
   if [ $choice -eq 4 ]; then
    echo $performance | sudo tee /sys/class/backlight/intel_backlight/brightness
    main_menu
   else
    if [ $choice -eq 5 ]; then
     echo $maxsetting | sudo tee /sys/class/backlight/intel_backlight/brightness
     main_menu
    else
     if [ $choice -eq 6 ]; then
      exit;
     else
      echo -e "Please enter the NUMBER of your choice: \c"
      choice = 7
     fi
    fi
   fi
  fi
 fi
fi
done

Source


Add Sudo user

# apt-get install sudo
# adduser [new-user]
# adduser [new-user] sudo

If it is still failed, add the [new-user] directly with visudo

# visudo
Add the [new-user] on this section # User privilege specification
root ALL=(ALL:ALL) ALL
[new-user] ALL=(ALL:ALL) ALL

Source:


UTC or Local Time Management

Synchronizing UTC or local time between two OS (Windows and Linux) in dual boot Laptop.

$ sudo timedatectl
      Local time: Thu 2017-05-11 21:42:06 WIB
  Universal time: Thu 2017-05-11 14:42:06 UTC
        RTC time: Thu 2017-05-11 14:42:06
       Time zone: Asia/Jakarta (WIB, +0700)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
$ sudo timedatectl set-local-rtc 1
$ sudo timedatectl
      Local time: Thu 2017-05-11 21:45:00 WIB
  Universal time: Thu 2017-05-11 14:45:00 UTC
        RTC time: Thu 2017-05-11 21:45:00
       Time zone: Asia/Jakarta (WIB, +0700)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: yes
      DST active: n/a

Source:


Remote Desktop Protocol

$ sudo apt-get install rdesktop

Source:


TeamViewer

$ wget https://downloadus1.teamviewer.com/download/version_12x/teamviewer_12.0.76279_i386.deb
$ sudo dpkg -i teamviewer_12.0.76279_i386.deb
$ sudo apt-get install -f

Source:


Improve Font Rendering

Subpixel-hinting and Font-smoothing
Create a file “.fonts.conf” in the home folder

$ more ~/.fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
  <match target="font">
    <edit mode="assign" name="lcdfilter">
      <const>lcddefault</const>
    </edit>
  </match>
</fontconfig>

Install Infinality

$ more /etc/apt/sources.list
...
deb http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main
deb-src http://ppa.launchpad.net/no1wantdthisname/ppa/ubuntu trusty main
...
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E985B27B
$ sudo apt-get update
$ sudo apt-get install fontconfig-infinality
$ sudo bash /etc/fonts/infinality/infctl.sh setstyle
Select a style:
1) debug       3) linux          5) osx2         7) win98
2) infinality  4) osx          6) win7         8) winxp
#? 3
conf.d -> styles.conf.avail/linux
$ more /etc/profile.d/infinality-settings.sh
...
# USE_STYLE="DEFAULT"
USE_STYLE="UBUNTU"
...

Install Ubuntu Font

$ wget http://mirrors.kernel.org/ubuntu/pool/main/u/ubuntu-font-family-sources/ttf-ubuntu-font-family_0.80-0ubuntu6_all.deb
$ sudo dpkg -i ttf-ubuntu-font-family*.deb
$ sudo apt-get install gnome-tweak-tool
$ gnome-tweak-tool

Configure Fonts on gnome-tweak-tool:

  • Window Titles [ Ubuntu Regular – 11 ]
  • Interface [ Ubuntu Regular – 11 ]
  • Documents [ Ubuntu Regular – 11 ]
  • Monospace [ Ubuntu Mono Regular – 13 ]
  • Hinting [ Slight ]
  • Antialiasing [ Rgba ]
  • Scaling Factor [ 1.00 ]

Install Microsoft Font

$ sudo apt-get install ttf-mscorefonts-installer
$ wget http://download.microsoft.com/download/E/6/7/E675FFFC-2A6D-4AB0-B3EB-27C9F8C8F696/PowerPointViewer.exe
$ unar PowerPointViewer.exe
$ cd PowerPointViewer/
$ unar ppviewer.cab
$ cd ppviewer/
$ mkdir ~/.fonts
$ cp *.TTF *.TTC ~/.fonts

Logout and login again to see the change.

Source:


Browser

Chrome install

$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo dpkg -i google-chrome-stable_current_amd64.deb

Source:


Show Desktop

Settings => Keyboard => Shortcut => Navigation => Hide all normal windows (Super + D)

Source:


Printer Management

$ sudo apt install cups

Open http://localhost:631/admin

Source:


Change Python Version 2 to 3

$ ls /usr/bin/python*
/usr/bin/python3.4 /usr/bin/python2.7
$ python --version
Python 2.7.9
$ sudo update-alternatives --list python
update-alternatives: error: no alternatives for python
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
update-alternatives: using /usr/bin/python2.7 to provide /usr/bin/python (python) in auto mode
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.4 2
update-alternatives: using /usr/bin/python3.4 to provide /usr/bin/python (python) in auto mode
$ python --version
Python 3.4.2

Back again to version 2 or vice versa:

$ sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.4 2 auto mode
 1 /usr/bin/python2.7 1 manual mode
 2 /usr/bin/python3.4 2 manual mode
Press enter to keep the current choice[*], or type selection number: 

Sources:

Comments Off on Optimizing Debian on Laptop