Author Archives: Todd Partridge (Gently)

Catalyst Driver, a Journey Taken… Better than I’d Known

I previously read about (a good number of times) people not having the best experiences with AMD’s proprietary driver. However, with my new laptop I decided that no matter how much I love the open-source driver (bought it because AMD opened the specs to it), that realistically it would take a few years before I’d be able to play games with it. The AMD/ATI website says 7xxxM series is supported so I decided to try it.

Prepare for Installing Catalyst

Removed open-source Radeon driver options, commented /etc/X11/xorg.conf.d/20-radeon.conf.

Installing Catalyst Driver

Using Vi0l0’s excellent catalyst repository, I added it to /etc/pacman.conf:

[catalyst] Server = http://catalyst.apocalypsus.net/repo/catalyst/$arch

Add Vi0l0 key:

sudo pacman-key -r          NUM
sudo pacman-key --lsign-key NUM

Installed (using pacman shortcuts script (pm):

pm y
pm i linux-headers catalyst-hook catalyst-utils lib32-catalyst-utils

Using catalyst-hook here to have the module put into initramfs when kernel versions areupgraded (provides catalyst driver).

X.org Server-Configuration

sudo aticonfig --initial 

Added module to load at boot:

echo '# Load AMD Catalyst driver
fglrx' | sudo tee /etc/modules-load.d/fglrx.conf

Disabled Mode Setting: Added GRUB_CMDLINE_LINUX="nomodeset" (for GRUB2) to /etc/default/grub), then:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Testing

Reboot, and driver loaded properly (lsmod | grep fglrx), and direct rendering is enabled (glxinfo | grep direct).

Configuring Display

Created root .desktop for ATI Catylyst Control Center:

cp /usr/share/applications/amdcccle.desktop ~/.local/share/applications/
sed -i 's/Exec=amdcccle/Exec=gksudo amdcccle/' ~/.local/share/applications/amdcccle.desktop
chmod +x ~/.local/share/applications/amdcccle.desktop

Color

  • Color Temperature: Use display’s settings

Display Manager

  • Selected down arrow for both monitors to change to correct settings.

Logout/Login: Gnome 3 crash, extensions disabled
Login: Monitor settings lost, both on lower resolution (open-source radeon driver and catalyst define monitors differently so Gnome using xrandr flubs the first time after.

DTV

  • Pixel Format: RGB 4:4:4 (Full RGB)
  • Adjustments: Overscan 0%

Switchable Graphics

Catalyst driver does not recognize discrete GPU properly, thinks integrated GPU is discrete GPU:

Show GPUs:

aticonfig --list-adapters
* 0. 00:01.0 AMD Radeon HD 6520G          # * Default
  1. 01:00.0 AMD Radeon HD 7600M Series

But…:

aticonfig --px-list
PowerXpress: Discrete GPU is active (High-Performance mode).

I tried using sudo aticonfig --px-igpu to switch to integrated to see if it would switch but got an X.org server hang. Also tried sudo aticonfig --px-dgpu to see if aticonfig --px-list was in error but no luck. Tried using discrete GPU BusID (BusID "PCI:1:0:0") in xorg.conf but that didn’t work either. The catalyst driver doesn’t properly recognize the 7670M GPU as discrete GPU. Entered bug.

GNOME bug

When I first started with GNOME mouse clicks would miss at times and sometimes keypresses did too, I added export CLUTTER_VBLANK=none to ~/.bash_profile and it fixed this. Oddly, I commented it later because I thought it might be related to another bug (it was not) and forgot to enable it again, but I haven’t seen the problem since.

Conclusion

Hard to believe there is not official AMD Catalyst bugzilla (odd how their website points to the unofficial one) so I’m a bit worried about the near future but think all will be fine.

The driver works good. I’m getting a consistent 50fps on Urban Terror and tried Doom and it looks pretty good. Disappointed about not being able to use the discrete GPU, would have been nice. Gonna keep using catalyst, its working good.

Here’s a script i built called gpuswitch I plan to use when gaming later. Night.

Resources

The Beauty of rsync and Backup Script

rsync is a command-line tool used to copy/clone files (“fast incremental file transfer“). It is a great, simple backup tool. The basic rsync command is this:

rsync -a src dest_dir

Where src is the original directory or file and dest_dir is the destination directory. Because rsync does incremental backups it only adds the file to the dest if it has been updated from the original backup.

rsync -axS src dest_dir

This is the command I use. This command can be used to backup just about anything! The options:

  • -a means archive mode which basically means to preserve the file “as is” (same permissions…)
  • -x means not to cross file systems boundaries
  • -S means to handle sparse files efficiently
  • -v option (verbose) can be used to print what rsync is doing

An important note about rsync: when src is a directory a trailing slash (/) tells rsync to copy the “contents” of the directory:

rsync -axS src_dir/ dest_dir
ls -1 dest_dir/
 file1
 file2

Without a trailing slash:

rsync -axS src_dir dest_dir
ls -1 dest_dir
 src_dir

rsync can also use file-lists containing paths of directories and files, to both include and exclude them for backup:

sudo rsync -axS --files-from="incl_file.txt" --exclude-from="excl_file.txt" src_dir dst_dir

src_dir will have to be specified and will have to be relative to paths in the file list:

cat incl_file.txt
Desktop/
rsync -axS --files-from="incl_file.txt" --exclude-from="excl_file.txt" /home/user/ dst_dir

rsync can also remove files from the dest_dir with the --delete option, so files that get added to the exclude file or taken out of the include file will removed from dest_dir.

rsync -axS --delete-excluded --files-from="incl_file.txt" --exclude-from="excl_file.txt" /home/user/ dst_dir

Backup Script

I use rsync to backup my system configurations and /home/ to make reinstalling easy. I created the script to remember the command to use, but to also easily add to the include and exclude files:

bcksysc i /etc/hostname 
 Added "/etc/hostname" to bcksysc-inc.txt include file.

Syntax:

bcksysc 
 bcksysc  - backup configurations
 i - add to the include list a file or folder
 e - add to the exclude list a file or folder
 c - create backup

Here’s the script all that needs to be done is to change the Parent Destination Directory (for backing up /home/ I copied the script to bckhome, changed the type to home and added /home/ to the include file):

So my destination directory looks like this:

ls -1 /run/media/todd/Backup/rsync/
 ...
 aspire_2012-08-31_sysc
 aspire_2012-08-31_home

Screencasting Done Easy (Desktop Recording)

I got to test out a good number of screencasting applications and I found a good one, and as usual the easiest was the best. I started with recordMyDesktop.

recordMyDesktop

recordMyDesktop is a basic program that works good. The GTK version has a simple UI that sets a border around the area to be recorded. I has sound recording too.

A minor thing but of note is that the window detection area is off when selecting a windows, but the reason I didn’t use recordMyDesktop was because I found the quality wasn’t that good. It could be because it uses .ogv format, or perhaps it had something to do with my system.

This is and example I did with recordMyDesktop and though it’s enlarged (OpenShot doesn’t have the ability to use the original size) the quality I wanted to be better.

Others

I tried Istanbul and a couple others all with about the same recording results. Istanbul hasn’t been developed in several years and though I got excited about xvidcap it hasn’t been developed in years either. xvidcap grabs screenshots and then concatenates them into a video. I got excited because xvidcap’s preview uses Imagemagick’s animate tool to preview the video and it was real nice. Unfortunately very little works in xvidcap anymore but taking the screenshots. To put them together I used:

fmpeg -i out%04d.xwd -r 15 -vcodec huffyuv test.avi

unfortunately the quality was no better than that of the others.

FFmpeg

The great command line tool to encode and decode video ffmpeg can also do screencasts and I read a lot of how people liked it (and I do too). To use it it’s real basic:

ffmpeg -f x11grab -s wxga -i :0.0 -sameq screencast.mpg

The quality isn’t quite what I want it to be, but I’ve seen other people have nice looking screencasts so I think it must be either my video card or my video driver.

This line can be amended some for better quality, performance, and add sound recording. Using the raw, lossless codecs for video and audio improves processor usage for better FPS recording:

ffmpeg -f x11grab -s wxga -i :0.0 -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 screencast.avi
  • -s and -i are for size and input. -s will give the dimensions and -i will define the co-ordinates. wxga is a definition of a video resolution standard (available ones are listed in man ffmpeg)
  • -r can be added to define the frame rate. Default is 25 and is good. Only reason really to change it is if frames are dropped during recording (marked with red).
  • -follow_mouse 100 can be added to follow mouse movements. 100 is the border in pixels that must be reached before the area is moved.

ffcast and FFmpeg

ffcast is a program that grabs and passes X.org server dimensions and co-rodinates to other programs. It has built-in support to pass these parameters for some programs including ffmpeg. So the command will now look like this:

ffcast -s ffmpeg -- -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 screencast.avi

ffcast’s -s option will prompt for the screen area and then pass the dimensions and co-orodinates to ffmpeg using --.

Now to make this easy, I put this in a bash script, it runs as such:

 screencast <a|f|m|w> - create screencasts (a)rea (f)ull-screen (m)ouse (w)indow

Here’s the bash script:

An example:

cVLC as Default Video Player



I love MPlayer. I’ve been using it for years. Whenever I needed to watch a video from my camera or downloaded something from YouTube it always did great. However, I revisited recently trying to play a DVD with MPlayer after having gone through a lengthy setup process a ways back and discovered MPlayer still cannot play DVD’s reliably. From the examples I tried it seemed as error-prone as before.

MPlayer always ran dependably and with almost no resources, videos would pop rightup. Learning to use the keyboard to navigate Mplayer was likely having one big remote control. However, I came to the decision that I cannot deal with the quirks of MPlayer anymore (there is good work on the mplayer2 project that is trying to fix a lot of the internal plumbing problems of MPlayer) but I needed something more-reliable. So when I decided just to use VLC, I accidentally learned about clvc.

I don’t normally use VLC because I use GNOME. Having MPlayer open up immediately was a big plus, but with clvc (which is part of the VLC package) videos open just like they did with MPlayer. And the playback quality is good. To play a DVD:

cvlc dvd://

The big thing is I’m going to have to learn all the key mappings again for cvlc, so a made a reference sheet:

Key Mappings

Desktop Recognition

To have clvc be recognized by the desktop a .desktop needs to be created:

and put in ~/.local/share/applications.

sudo update-desktop-database -q

Warning: I had to put it in /usr/share/applications/ for GNOME 3.6 to be able to recognize it in Default Applications and Removable media. This is likely a bug.

To have all known video types that VLC knows and define them to cVLC as the default application do:

xdg-mime default cvlc.desktop $(grep -oP 'video.*?;' /usr/share/applications/vlc.desktop | tr ';\n' ' ')

Load on DVD Insertion

I have yet to find out how to do this. This probably isn’t the correct way to do it, but it should work (note: my install is busted a bit right now so unable to test). Put in /usr/share/applications/clvc-dvd.desktop:)

[Desktop Entry]
Type=Application
Name=cVLC
GenericName=Media Player
GenericName[ca]=Reproductor multimèdia
GenericName[de]=Medienwiedergabe
GenericName[fr]=Lecteur multimédia
GenericName[it]=Lettore multimediale
GenericName[ja]=メディアプレーヤー
X-GNOME-FullName=Command Line VLC
Comment=Play movies and songs
Icon=vlc
TryExec=cvlc dvd://
Exec=cvlc dvd:// %U
Terminal=false
Type=Application
Categories=AudioVideo;Player;Recorder;
MimeType=video/dv;video/mpeg;video/x-mpeg;video/msvideo;video/quicktime;video/x-anim;video/x-avi;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-flc;video/x-fli;video/x-flv;video/vnd.rn-realvideo;video/mp4;video/mp4v-es;video/mp2t;application/ogg;application/x-ogg;video/x-ogm+ogg;audio/x-vorbis+ogg;application/x-matroska;audio/x-matroska;video/x-matroska;video/webm;audio/webm;audio/x-mp3;audio/x-mpeg;audio/mpeg;audio/x-wav;audio/x-mpegurl;audio/x-scpls;audio/x-m4a;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;application/vnd.rn-realmedia;audio/x-real-audio;audio/x-pn-realaudio;application/x-flac;audio/x-flac;application/x-shockwave-flash;misc/ultravox;audio/vnd.rn-realaudio;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-wav;audio/x-pn-windows-acm;image/vnd.rn-realpix;audio/x-pn-realaudio-plugin;application/x-extension-mp4;audio/mp4;audio/amr;audio/amr-wb;x-content/video-vcd;x-content/video-svcd;x-content/video-dvd;x-content/audio-cdda;x-content/audio-player;application/xspf+xml;x-scheme-handler/mms;x-scheme-handler/rtmp;x-scheme-handler/rtsp;
X-KDE-Protocols=ftp,http,https,mms,rtmp,rtsp,sftp,smb
Keywords=Player;Capture;DVD;Audio;Video;Server;Broadcast;
NoDisplay=True

and then point to it in Removable Media > DVD.

YouTube videos

VLC has it’s own parser to be able to extract URL’s from YouTube so running is all that is needed to get the job done:

cvlc "http://www.youtube.com/..."

Architectural Intent – a Wallpaper Tile



I tend to use my desktop as my workspace so I like wallpapers that act as more of a background decoration rather than elaborate artwork. So I created this. This is based on a wallpaper I found on the net (sorry, can’t remember where) and I re-did it. The original was in jpeg format and it had a bit of dithering to it.

It’s real basic, just 140×140, but I tile it and it comes out real nice:

It’s a vector image so it’s able to be resized real easy if need be.



systemd transfer… Done!



Well, after being throughly put off, I dived into systemd and have done a complete (pure) systemd installation; and I can tell you, I think its pretty nice.

I had no plans to change Arch’s initialization system, but I needed to switch to systemd because parts of GNOME 3 require it. Its been a long time a coming but systemd is a good thing for Linux, a real good thing. Arch’s init system was legendary. It’s what I believed what attracted a lot of people about Arch. Being so pulled to for me was it’s basic, straight-forward setup, so I wasn’t exactly excited about having to switch to systemd. systemd setup isn’t quite as easy as Arch’s rc system but I like it and found it has good logic. The best thing about systemd though will be its unification between other distros. This means that setting up a good number of programs will be similar no matter what distribution documentation is read. Also systemd will save a good amount of developers time as many of the distribution-based init scripts will no longer have to be specifically written (and will rather be included in the application). Plus it inclusion of D-BUS makes it a good deal more powerful.

Here’s what it looks like. It’s not quite as nice looking as Arch’s, but oh well:

systemd is the future… yeeeaaahh! A more unified Linux front.

A basic detail of my systemd install can be found on my GNOME 3 Setup page. Even better to read the whole page on the wiki which is really well done.

Disk and Memory Usage Scripts

At times I like to check my levels of disk and memory usage and it’s more convenient for me to do it from the command line. So, I created a couple scripts for them:

devtop 
 Filesystem      Size  Used Avail Use% Mounted on
 /dev/sda5       9.8G  6.4G  2.9G  69% /
 /dev/sda6       166G   38G  121G  24% /home
memtop 
 PROGRAM                   %MEM    #MEM
 firefox                   10.2    352.98 MB
 gnome-shell               4.1     141.76 MB
 Xorg                      1.5     53.60 MB
 nautilus                  1.2     41.52 MB
 gedit                     1.1     40.59 MB
 gnome-settings-           0.7     26.23 MB
 gnome-terminal            0.6     22.31 MB
 nm-applet                 0.6     21.30 MB
 python2                   0.6     20.89 MB

Saves me a lot of time over having to open a program :).

Convert Videos to PSP



I’m a TED video junkie. I always have videos on my PSP ready to watch. I also like to put YouTube videos on there. I did this enough that I created a script for it that makes putting videos on my PSP real easy:

 pspvidconv <d*> <video(s)> - Convert videos to PSP (d to use directory)

The PSP allows use of a single-depth directory. The directory option (when using d flag) will ask if the user wants to create a new directory, if the answer is no, it will present the existing ones.

Warning: Currently h264 encoding isn’t working. The PSP will report that it is an unknown codec, so mp3g4-xvid is the only option with ffmpeg.

h264enc

Because I’ve found that options and settings change frequently with encoding tools, it is better to have an expert be able to handle them (otherwise, I will spend more time looking options up again). A good program to use is h264enc. It’s a shell script (perl, I believe) and well done; not good for many files as all settings will have to be re-entered but does a good job.

Handbrake

For Handbrake GUI I found this post. I have yet to find any handbrake-cli lines that work.

GNOME 3 Setup



I’d been fortunate lately to have time to work on my GNOME 3 setup and I got it working and looking pretty good; so… I thought I’d share it from beginning to end. GNOME 3 is shaping up real nice and with the extension support provides great customibility. There’s still a little work that needs to be done, but I am nearly 100% happy with it. Any thoughts, additions, comments, would be appreciated.

A couple notes to explain some of my design reasoning: I have a laptop so a few things apply just to that; I use my pacman/aurhelper script to install so here it will be viewed as ‘pm i‘ instead of say ‘pacman -S‘ (for example); finally to install all programs at once and then configure them, the all-as-one command is at the bottom.

Clean

Dirty

Table of Contents

Security General
General
Bootloader (GRUB2)
Initialization System
Hardware
Desktop Environment
Security Firefox
Preferences
Under the hood
Program Setups
Other Programs
Install all as one
ToDo

Security General

Install firewall, edit config, add to startup daemons:

pm i arno-iptables
sudo rc.d start arno-iptables-firewall

Create dummies for insecure webkit (libwebkit and libwebkit3).

Block problem packages:

sudo sed -i "/^IgnorePkg/ a libwebkit3 libwebkit qtwebkit flashplugin" /etc/pacman.conf

General

Update pacman mirrors to best available with script.

Update System (initilize pacman first):

pm y && pm i pacman
sudo pacman-key --init; pacman-key --populate archlinux
pm u

Bootloader (GRUB2)

mv /boot/grub /boot/grub-legacy
dd if=/dev/sda of=/boot/grub-legacy/grub-mbr bs=512 count=63
pm i grub2-bios
sudo grub-install --directory=/usr/lib/grub/i386-pc --target=i386-pc --boot-directory=/boot --no-floppy --recheck --debug /dev/sda
sudo grub-mkconfig -o /boot/grub/grub.cfg

Add Windows menu entry:

pm i ntfs-3g  # Then mount partition
sudo grub-probe --target=fs_uuid /run/media/todd/Windows/bootmgr
echo '
menuentry "Windows" --class windows {
insmod part_msdos
insmod ntfs
insmod search_fs_uuid
insmod ntldr
search --fs-uuid --no-floppy --set=root C8BC2300BC22E8A0
ntldr /bootmgr
}' | sudo tee -a /etc/grub.d/40_custom

Hibernation define partition, add resume hook to /etc/mkinitcpio.conf:

sudo sed -i 's|^GRUB_CMDLINE_LINUX=""|GRUB_CMDLINE_LINUX="resume=/dev/sda7"|' /etc/default/grub
sudo sed -i '/^HOOKS/ s/ filesystems / resume filesystems /' /etc/mkinitcpio.conf

GRUB2 Arch Linux Theme:

pm i grub2-theme-archxion
sudo cp -r /usr/share/grub/themes/Archxion /boot/grub/themes/
GRUB_THEME="/boot/grub/themes/Archxion/theme.txt" to /etc/default/grub
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo mkinitcpio -p linux

Initialization System

Replace Arch’s init system with systemd (required by GNOME).

Pure systemd install:

pm i systemd systemd-arch-units systemd-ui-git
sudo gpasswd -a todd adm #For admin work with systemd

Define to bootloader (in /etc/default/grub):

GRUB_CMDLINE_LINUX_DEFAULT=" and remove quiet. GRUB_CMDLINE_LINUX="resume=/dev/sda7"

sudo grub-mkconfig -o /boot/grub/grub.cfg

Necessary settings:

echo "aspire" | sudo tee /etc/hostname
echo 'America/New_York' | sudo tee /etc/timezone
echo 'KEYMAP=us
FONT=lat9w-16
FONT_MAP=8859-1_to_uni' | sudo tee /etc/vconsole.conf
echo 'LANG=en_US.UTF-8
LC_COLLATE=C' | sudo tee /etc/locale.conf
echo '# Load card reader module
sdhci' | sudo tee /etc/modules-load.d/sdhci.conf
echo '# Set Radeon graphic card to dynamic power method
w /sys/class/drm/card0/device/power_method - - - - dynpm
w /sys/class/drm/card1/device/power_method - - - - dynpm' | sudo tee /etc/tmpfiles.d/radeon_power-method.conf

Enable units (i.e. daemons, services…; Arno’s iptables firewall service):

sudo systemctl enable arno-iptables-firewall.service avahi-daemon.service cups.service dbus.service dcron.service dnsmasq.service gdm.service gpm.service NetworkManager.service syslog-ng.service

Remove Arch init system:

pm r systemd-arch-units initscripts sysvinit
pm i systemd systemd-sysvcompat
sudo reboot

Hardware

Hardware-specific settings.

CPU

AMD processor firmware update:

pm i amd-ucode

Graphic Card

Set Radeon video card to dynamic power save method on resume:

echo '#!/bin/sh
# Set Radeon graphic card to dynamic power method

case "$1" in
  resume | thaw )
echo dynpm > /sys/class/drm/card0/device/power_method
echo dynpm > /sys/class/drm/card1/device/power_method
;;
esac' | sudo tee /etc/pm/sleep.d/97_radeon_dyn_power_method
sudo chmod +x /etc/pm/sleep.d/97_radeon_dyn_power_method

Printer

Canon Linux Info (Select Product > Linux)

pm i cnijfilter-mg5200 scangearmp-mg5200 cups-bjnp

Had to add manually to CUPS:

Address: bjnp://192.168.1.80
Name: Canon_Pixma_MG5220
Network: Home Network

Add static IP to router and direct to printer MAC address.

Sound

Install ALSA tools, set sound level:

pm i alsa-utils
alsamixer
alsactl store

Set default sound card.

Wireless

Only proprietay driver available at this time for Broadcom chip BCM43227. Reported that open source brcmsmac/brcmfmac will supported in the future.

pm i broadcom-wl
sudo modprobe wl
sudo depmod -a
sudo sed -i '/^MODULES/ s/)/ wl)/' /etc/rc.conf

Desktop Environment

Install desktop (Xorg server, ATI/AMD Radeon driver, and GNOME):

pm i xorg-server xorg-xinit xorg-server-utils
pm i xf86-video-ati
pm i gnome          # Choose apps
pm i gnome-extra

Ubuntu fonts:

pm i cairo-ubuntu

Security Firefox

Put Firefox in a sandbox:

pm i sandfox firefox gksu
sudo chmod ugo-wx ~/.adobe ~/.macromedia
sudo sed -i 's_^hide=/home/\\$user/.adobe.*$_bindro=/home/\\$user/.adobe      # bind folder read-only_g' /usr/bin/sandfox
sudo sed -i 's_^hide=/home/\\$user/.macromedia.*$_bindro=/home/\\$user/.macromedia # bind folder read-only_g' /usr/bin/sandfox
IgnnorePkg sandfox in pacman.conf
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox-sandfox.desktop ~/.local/share/applications/firefox-sandfox.desktop
chmod +x ~/.local/share/applications/firefox-sandfox.desktop

Change Exec line in firefox-sandfox.desktop to:

gksudo –disable-grab “sandfox –profile firefox firefox”

Remove previous sandboxes on boot:

echo '[Unit]
Description=Remove Sandfox previous sandboxes

[Service]
Type=oneshot
ExecStart=/bin/sh -c "sandfox --user todd --closeall && /bin/rm -rf /mnt/sandfox/*"

[Install]
WantedBy=multi-user.target' | sudo tee /etc/systemd/system/sandfox-rm.service
sudo systemctl enable sandfox-rm.service

Preferences

Display

Add ICC profile to ~/.local/share/icc so recognized by GNOME’s System Settings > Color (done through QuickGamma through Windows 7, Windows 7 calibrated ICC proviles are not recognized. Windows 7 profiles are stored in 32).

Fix for improper display size detection and to set brightness.

Laptop Specific

Touchpad (System Settings > Mouse and Touchpad):

  • Uncheck: Enable mouse clicks with touchpad (uncheck)
  • Check: Two-finger scrolling
  • Change scroll speed

Desktop Settings

Install advanced settings editor ():

pm i gnome-tweak-tool
  • In Advanced Settings in menu: Enable desktop icons and right-click menu, hide Home folder, Computer, and Trash icons; or, from command line:
    gsettings set org.gnome.desktop.background show-desktop-icons true
    gsettings set org.gnome.nautilus.desktop   home-icon-visible false
    gsettings set org.gnome.nautilus.desktop   computer-icon-visible false
    gsettings set org.gnome.nautilus.desktop   trash-icon-visible false
  • Add maximize and minimize buttons
    gsettings set org.gnome.shell.overrides button-layout close,minimize,maximize:

Date and Time (GNOME to handle NTP), enable in System Settings > Date and Time > Network Time > On; set clock to AM/PM.

Nautilus single click: Nautilus > Edit > Preferences > Behavior >

Save Desktop Session: (Options tab > Automatically remember…)

gnome-session-properties

Suspend preferences (via command line):

  • Power button press suspend type
  • Battery suspend type
  • Battery lid-close suspend type
  • Battery duration until suspend
  • AC lid-close suspend type
  • AC duration until suspend
  • Dim Screen for AC
  • Dim Screen time
  • Disable lock when resuming from sleep
gsettings set org.gnome.settings-daemon.plugins.power button-power hibernate
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type hibernate
gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action hibernate
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout 1740
gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action suspend
gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 10800
gsettings set org.gnome.settings-daemon.plugins.power idle-dim-ac true
gsettings set org.gnome.settings-daemon.plugins.power sleep-display-ac 1200
gsettings set org.gnome.desktop.lockdown disable-lock-screen true

Shortcuts: (System settings > Keyboard > Shortcuts)

  • Suspend (Add in Custom Shortcuts > + then assign key Ctrl+Alt+S), uses pwr script):
    /home/todd/.scripts/pwr s
  • Blank Screen (Add in Custom Shortcuts > + then assign key Ctrl+Alt+B), uses pwr script):
    /home/todd/.scripts/pwr b
  • Show Desktop (Navigation > Hide all… > Ctrl+Alt+D)

Defualt Screenshot directory as Desktop:

gsettings set org.gnome.gnome-screenshot auto-save-directory file:///home/todd/Desktop

Numlock on when GDM starts:

pm i numlockx
sudo sed -i 's|^exit 0.*$|# Enable numlock\nif [ -x /usr/bin/numlockx ]; then /usr/bin/numlockx on; fi\n\nexit 0|' /etc/gdm/Init/Default

Graceful Shutdown of non-session supported Gnome window applications (doesn’t work for all applications):

sudo sed -i 's|^exit 0.*$|# Exit these GNOME non-session-supported windows gracefully on logout\necho " Closing selected windows programs gracefully"\nexport DISPLAY=:0\nsu todd -c "wmctrl -c "Mozilla Firefox""\nsu todd -c "wmctrl -c "Geany""\n\nexit 0|' /etc/gdm/PostSession/Default

Login Noise:

~/.local/share/sounds/desktop-login.wav

Gnome Shell Extensions:

Extensions in the AUR:

pm i \
gnome-shell-extension-alternate-tab-git
gnome-shell-extension-alternative-status-menu-git \
gnome-shell-extension-axe-menu \
gnome-shell-extension-common-git \
gnome-shell-extension-drive-menu-git \
gnome-shell-extension-extended-volume-indicator-git \
gnome-shell-extension-inhibit-suspend-git \
gnome-shell-extension-move-clock \
gnome-shell-extension-noa11y \
gnome-shell-extension-user-theme-git \
gnome-shell-extension-weather-git \
gnome-shell-extension-windowoverlay-icons-git \
gnome-shell-google-calendar-xat59-git

From website:

Extension Settings

weather:

gsettings set org.gnome.shell.extensions.weather woeid USTN0454
gsettings set org.gnome.shell.extensions.weather unit fahrenheit
gsettings set org.gnome.shell.extensions.weather wind-speed-unit mph
gsettings set org.gnome.shell.extensions.weather show-sunrise-sunset true
gsettings set org.gnome.shell.extensions.weather use-symbolic-icons true

GNOME shell google calendar:

su -c "/usr/share/gnome-shell-google-calendar/gnome-shell-google-calendar.py toddrpartridge@gmail.com $(cat /home/todd/.sitepass-com.txt)" todd
cp /usr/share/gnome-shell-google-calendar/gnome-shell-google-calendar.desktop ~/.config/autostart/
gsettings set org.gnome.desktop.default-applications.office.calendar exec "firefox 'https://www.google.com/calendar'"

Axe Menu Custom Applications Menu icon:

sudo cp ~/Designs/arch-legacy-blue1-toon-symbolic-01.svg /usr/share/icons/Faience/places/scalable/start-here-archlinux-toon-symbolic.svg

CPUFreq Control (none exist, gnome-shell-cpufreq is per processor) using jupiter instead:

pm i jupiter rfkill
sudo gpasswd -a todd jupiter

Under the hood

Cron (dcron because I know it).

Root settings:

sudo mv /root/.bashrc{,.bck}
sudo ln -s ~/.{bashrc,bash_profile,vimrc,vim} /root
sudo mkdir /root/.config/
sudo cp -r ~/.config/geany/ /root/.config/
sudo rm -rf /root/.config/geany/geany_socket*

Match filesystem check times multiple partitions:

sudo tune2fs -c 33 -C 0 -i 6m -T now /dev/sda5
sudo tune2fs -c 33 -C 0 -i 6m -T now /dev/sda6

SMART

pm i gsmartcontrol
sudo sed -i 's/^DEVICESCAN.*$/DEVICESCAN -a -n standby,q -m toddrpartridge@gmail.com -M test/' /etc/smartd.conf
pm i msmtp-mta msmtp
sudo ln -s ~/.msmtprc /root/
sed -i "s|^password.*$|password $(cat ~/.sitepass-com.txt)|" ~/.msmtprc
sudo systemctl enable smartd.service
sudo systemctl start  smartd.service

Escalate privileges for certain programs (link).

Filter Advertisements (Ad-blocker script).

Discover the package a command belongs to on the command line (bash-completion broke):

pm i pkgfile-git
  • Add to .bashrc:
    source /usr/share/doc/pkgfile/command-not-found.bash

Program Setups

Gedit

Open (Edit > Preferences > Tab):

View: Display right margin at column 80: Check
Highlight current line
Editor: Tab width: 2
Insert space instead of tabs Check
Create a backup copy of files before saving Uncheck
Autosave file every 10 minutes Check
Font&C: Theme Oblivion
Plugin: Save Session

Gnome Terminal:

General: Terminal Bell > uncheck
Use custom default terminal size: 80 x 24
Colors: Use colors from system theme > uncheck
Text color: #D4CFD3
Background color: #2E3436
Built-in schemes: Tango
Scrolling: Scrollback > 1024

Other Programs

General:

pm i abiword acpi ario aspell-en bc cd-discid curl dnsmasq dos2unix dosfstools gcolor2 geany-git geany-plugins-git gedit-plugins gimp gnumeric gpart gparted grilo-plugins gstreamer0.10-bad-plugins gstreamer0.10-ffmpeg gstreamer0.10-ugly-plugins hardinfo hwinfo id3v2 imagemagick inkscape iotop irssi lame libdvdcss libdvdnav libdvdread librsvg links lsof meld mesa-demos minidlna mlocate mp3gain mpd mplayer2 msmtp mtools nautilus-open-terminal networkmanager-dispatcher-ntpd ntp ntfsprogs openjdk6 openssh oneshot p7zip pacman-color perl-html-parser perl-rename pwgen python-libxml rsync ruby sdcv shotwell tidyhtml transmission-gtk ttf-google-webfonts ttf-microsoft-consolas tree unrar vlc xclip xorg-xdpyinfo

CVS systems keep around:

pm e bzr cmake git intltool mercurial subversion

General, AUR programs:

pm i arachnophilia aurup g9led geany-themes-git gist-git gnome-gmail mailnot-git mp3diags pacaur pastebinit perl-mp3-tag ripit

Themes:

pm i atolm-gtk3 cheser-icon-theme elementary-gtk-theme elementary-icons-bzr elements-theme faenza-icon-theme faience-icon-theme gnome-shell-theme-atolm gnome-shell-theme-default-mod gnome-shell-theme-london-smoke gtk-theme-grayday gtk-theme-hope mediterraneannight-theme orion-gtk-theme sammy-themes youtube-viewer zukitwo-themes

dnsmasq

dnsmasq for faster DNS queries:

sudo sed -i 's:^#listen-address=:listen-address=127.0.0.1:' /etc/dnsmasq.conf
sudo sed -i 's:^#bind-interfaces:#bind-interfaces:' /etc/dnsmasq.conf
echo '#!/bin/bash
# Prepend localhost to resolv.conf for dnsmasq
if [[ ! $(grep 127.0.0.1 /etc/resolv.conf) ]]; then
  sed -i "0,/^nameserver/inameserver 127.0.0.1" /etc/resolv.conf
fi' | sudo tee /etc/NetworkManager/dispatcher.d/localhost-prepend
sudo chmod +x /etc/NetworkManager/dispatcher.d/localhost-prepend

Mouse (G9)

Setup

Geany (use nightly repository)

  echo -e '\n[geany]
Server = http://geany.nightlybuilds.org/archlinux/x86_64' | sudo tee -a /etc/pacman.conf
  pm y
  pm i geany-git geany-plugins-git geany-themes

Configure

Gnome Gmail (Gmail as default mail app)

Enable: Applications > Internet > Gnome Gmail System Settings > Details > Default Applications, Mail

MiniDLNA

Setup

MPD

Setup

Vim

cp /etc/vimrc /etc/vimrc.bak
cp /usr/share/vim/vim73/vimrc_example.vim /etc/vimrc

VLC

Set as default:

System Settings > Details > Removable Media > DVD Video : VLC media player

System Settings > Details > Default Applications > Video: VLC media player

Use /dev/sr0 instead of /dev/dvd in ~/.config/vlc/vlcrc.

Set mimetypes:

cp /usr/share/applications/vlc.desktop ~/.local/share/applications/
sed -i 's|^Mimetype.*$|MimeType=video/dv;video/mpeg;video/x-mpeg;video/msvideo;video/quicktime;video/x-anim;video/x-avi;video/x-ms-asf;video/x-ms-wmv;video/x-msvideo;video/x-nsv;video/x-flc;video/x-fli;application/ogg;application/x-ogg;application/x-matroska;audio/x-mp3;audio/x-mpeg;audio/mpeg;audio/x-wav;audio/x-mpegurl;audio/x-scpls;audio/x-m4a;audio/x-ms-asf;audio/x-ms-asx;audio/x-ms-wax;application/vnd.rn-realmedia;audio/x-real-audio;audio/x-pn-realaudio;application/x-flac;audio/x-flac;application/x-shockwave-flash;misc/ultravox;audio/vnd.rn-realaudio;audio/x-pn-aiff;audio/x-pn-au;audio/x-pn-wav;audio/x-pn-windows-acm;image/vnd.rn-realpix;video/vnd.rn-realvideo;audio/x-pn-realaudio-plugin;application/x-extension-mp4;audio/mp4;video/mp4;video/mp4v-es;x-content/video-vcd;x-content/video-svcd;x-content/video-dvd;x-content/audio-cdda;x-content/audio-player;|' ~/.local/share/applications/vlc.desktop
chmod +x ~/.local/share/applications/vlc.desktop

Install all as one:

Install Java independently as not recognized as a dependency:

pm i jre7-openjdk # Needed as not recognized as dependency

Keep Version Control Systems (VCS) around:

pm e bzr cmake git intltool mercurial subversion
pm i alsa-utils gksu grub2-bios grub2-theme-archxion ntfs-3g systemd systemd-sysvcompat sandfox firefox cnijfilter-mg5200 scangearmp-mg5200 cups-bjnp gnome-tweak-tool numlockx pkgtools wmctrl \
arachnophilia aurup g9led gist-git gnome-gmail mailnot-git mp3diags pastebinit perl-mp3-tag ripit  \
abiword acpi ario aspell-en bc cd-discid curl dnsmasq dos2unix dosfstools gcolor2 geany-git geany-plugins-git geany-themes-git gedit-plugins gimp gnumeric gpart gparted grilo-plugins gstreamer0.10-bad-plugins gstreamer0.10-ffmpeg gstreamer0.10-ugly-plugins hardinfo hwinfo id3v2 imagemagick inkscape iotop irssi lame libdvdcss libdvdnav libdvdread librsvg links lsof meld mesa-demos minidlna mlocate mp3gain mpd msmtp mtools nautilus-open-terminal networkmanager-dispatcher-ntpd ntp ntfsprogs openssh oneshot p7zip pacaur pacman-color perl-html-parser perl-rename pwgen python-libxml rsync ruby sdcv shotwell tidyhtml transmission-gtk ttf-microsoft-consolas tree unrar vlc xclip xorg-xdpyinfo \
atolm-gtk3 cheser-icon-theme elementary-gtk-theme elementary-icons-bzr elements-theme faenza-icon-theme faience-icon-theme gnome-shell-theme-atolm gnome-shell-theme-default-mod gnome-shell-theme-london-smoke gtk-theme-grayday gtk-theme-hope mediterraneannight-theme orion-gtk-theme sammy-themes youtube-viewer zukitwo-themes \
gnome-shell-extension-alternate-tab-git gnome-shell-extension-alternative-status-menu-git gnome-shell-extension-axe-menu gnome-shell-extension-common-git gnome-shell-extension-drive-menu-git gnome-shell-extension-extended-volume-indicator-git gnome-shell-extension-inhibit-suspend-git gnome-shell-extension-move-clock gnome-shell-extension-noa11y gnome-shell-extension-user-theme-git gnome-shell-extension-weather-git gnome-shell-extension-windowoverlay-icons-git gnome-shell-google-calendar-xat59-git

ToDo

  • No GNOME extension for: gmail; printer; cpufreq control, color picker
  • Try Extensions: Shell OSD, Remove bottom panel, Notification button top bar
  • cronie
  • CPUFreq Control, laptop mode tools
  • Expand sda5?
  • Does ripit work?, abcde
  • XDGDIRS
  • for i in *.svg; do ln -s pwd / i $pwd/{16,22,24,32,48,64}/; done
  • Resize svg
  • gtkpod
  • gnome-globalmenu-git globalmenu-extension
  • gnash lightspark
  • libreoffice
  • mplayer 1.1?
  • Spyder3pro and dispcalgui
  • How to add dynamic address for printer? Printer does have listed: Printer Name and Bonjour service.

Markdown to WordPress Format

When I discovered MarkDown I was in love, it was very nice to discover an easy, clean, well-thought-out markup language. I wanted a way to be able take my detailed notes, have them easy to read, and then to be able post them here on the blog that would be in a nice WordPress format. Yesterday, I wrote about discovering pandoc which enables a person to write in markdown and have it converted to HTML. To be able to use the HTML code created by pandoc in WordPress it needed to be slightly edited and cleaned up. Therefore,… I created a bash script for it.

Example conversion from MarkDown format to WordPress format

It works pretty good. Basically it removes tags for paragraphs (<p>), cleans up code blocks, improves formating, as well as doing a few other things. I haven’t gone through all permutations that pandoc conversion can do so a few thing swill be left out, but otherwise it should work for most things. If anything needs to be added please let me know.

Pandoc-flavored markdown: Perfect!

I’d been looking for a way to convert my notes to webpages. Typically I wrote my notes in .txt form and then went through them and added links, formatting… when I was ready to blog them. Recently, I had asked StackOverflow if I could convert MediaWiki format to HTML. I’m an Administrator for the Arch Wiki so I’m very familiar writing this format. This is when I learned about pandoc. Pandoc’s author describes pandoc as, “If you need to convert files from one markup format into another, pandoc is your swiss-army knife…“.

Plain Text Example

I planned to write my notes in mediawiki format and then convert to HTML, however I’d been using StackOverflow lately and started to learn Markdown Prose and really like it. Markdown’s is designed to be easy to write and read: “Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)“. Markdown is so easy to write that it makes sense that sites like StackOverflow and GitHub are using it.

Markdown, Markup Languange

Pandoc has extended markdown to use code blocks ```, tables, and a few other things and converting is very basic:

pandoc file.md -o file.htm

I’m in love, I’m in love, I’m in love :), as it will save me a good bit of time in editing/creating Documentation. Tomorrow, I’ll post a bash script to clean up the HTML to be able to put it in a WordPress Blog.

Follow

Get every new post delivered to your Inbox.

Join 52 other followers