Archive

Archive for the ‘Linux’ Category

Rhythmbox is silent: reset pulseaudio configuration

Rhythmbox is silent?

After playing around with different Linux Shells/UIs/window managers (including i3, Gnome Shell, etc) and some frequent restarts, I noticed that for some reason my music player Rhythmbox had stopped playing any sounds. Though it was still “playing” songs, no sounds were actually made by speakers, headphones, etc. In contrast, all other sounds were OK, including OS sounds like info/error messages, or other players like VLC. Changing sound setting, volumes, as well as changing audio devices did not have any effect on this.

Resetting pulseaudio configuration

Turns out that the pulseaudio configuration was messed up. The solution to this problem is to move/delete the old configuration, then let it be recreated (the original problem description and solution to this is here):

mv ~/.config/pulse/ ~/.config/pulse_old/ # move/delete the old config
pulseaudio -k # restart pulseaudio

After doing this and restarting Rhythmbox its sound should be back to normal, – though you might need to restart the OS if you run into problems with external speakers/headphones.

i3 window manager: quick setup and configuration

February 5, 2017 Leave a comment

i3_window_manager_screenshot

i3 example [Wikipedia]

The i3 window manager is a tiling window manager: it enables power users to operate/arrange/manage application windows in a very fast way in tiles, without any requirements to use a mouse. Alex Booker provides an excellent introduction and overview to the i3 window manager, which is divided into 3 videos: general introduction, configuration, and (visual) fine tuning. In this post we summarize the i3 configuration we use atm for a quick lookup (which is partially based on Alex Booker’s videos).

Installation


sudo apt-get install i3

Logout, then login to i3. The i3 configuration wizard starts automatically if there is no i3 configuration file yet (we recommend using Super as the mod key at this point, because Alt is used by a huge amount of applications for other tasks). You can always remove the i3 config file at ~/.config/i3/config and start the wizard again using i3-config-wizard.

Basic usage

We strongly recommend to go through all the shortcuts in the official i3 reference card (it just takes a moment and is the core of how you will operate i3 afterwards). Be aware that if you are using an alternative keyboard layout, i3 automatically detects which keys are located at the positions that i3 would normally use – so you will be able to use the same physical keys, even if you are using a completely different layout.

After being aware of the basic usage of i3, skimming through the official i3 user’s guide will make sense. This should highlight the possibilities with i3 (in both how to operate i3 and how to configure it), which will make later configuration tasks easier by far.

i3 config file

The main i3 config is located in ~/.config/i3/conf. This file is created by i3-config-wizard at first and can be modified as wished afterwards.

Be aware that changing any i3 config at least requires i3 to be reloaded (“restarted in place”) with Mod+Shift+R. Some configuration also require the underlying application that is started/controlled by i3 (e.g. compton) to be restarted. If i3 restarts those applications on each reload depends on its configuration (that’s the difference between exec and exec_always in the config file). If the underlying application was started with exec, restarting the application by hand or logging out/loging back in is required.

(Re)starting i3 from command line

To start i3 from a native tty command line:

DISPLAY=:0 # or :1 etc...
export DISPLAY
# killall i3 # required in case i3 is running
i3 -c .config/i3/config

To instead restart a running i3 from a native tty command line:

i3-msg reload
i3-msg restart

Media buttons etc.

Most likely i3 does not recognize your media buttons correctly from the beginning. You at first need playerctl to enable control over (parts) of the media buttons, of which you can get different packages (including .deb) here. The i3 FAQ then provides a config snippet that can be copied (appended) to your i3 config file to map keys to the media buttons. Be aware that the number of the pulse audio device may be different (in the script it’s 0, but for others it might e.g. be 1). If e.g. the buttons cause the currently focused window to flicker, but the volume does not change, this might be an indication for using the wrong device.

Set wallpaper

You need e.g. feh to set a wallpaper in i3:


sudo apt-get install feh

By adding the following to your i3 config file you always set the wallpaper when i3 is started/reloaded:


exec_always feh --bg-scale /path/to/your/wallpaper.jpg

For different wallpaper scaling options, check out the man page of feh (it provides e.g. –bg-center, –bg-fill, –bg-max, –bg-scale, –bg-tile, …)

Launch applications on specified workspaces

At first, you need to find out the xprop window class of your target application. For this, start xprop and click on the application window. The 2nd string under WM_CLASS(STRING) is the string you need to know in the next step: add the following line to your i3 config file (and replace CLASS with the just determined string):


assign [class="CLASS"] 10

10 in this case indicates the nr. of the workspace the application window should be positioned.

Autostart applications

To automatically start applications, add one of the following lines to your i3 config file:


exec APPLICATION_COMMAND


exec_always APPLICATION_COMMAND

exec only executes the command when i3 is started, and exec_always executes the command each time i3 is reloaded. For example, starting your web browser is only useful for each fresh i3 start, but setting the wallpaper is useful to be done each time i3 is reloaded.

Monitor configuration

An easy way to configure the monitor setup using an UI is with arandr (UI for randr):


sudo apt-get install arandr

If you want to make a certain monitor configuration permanent you can a) configure monitors as wished in arandr, then b) save the configuration to a file, and c) add “exec_always CONFIG_FILE” to your i3 config file.

Wifi controls

i3 does not come with a built in UI for to control your wifi. To avoid configuring it via config files (which is still pretty cumbersome in Linux after all those years) you can use e.g. the graphical frontend wicd-gtk:


sudo apt-get install wicd-gtk
wicd-gtk

Change system fonts

One possible cosmetic improvement is to use different system fonts in i3. Alex recommends the Yosemite San Francisco Font: you can download it from its github page (under “manual install”), then change the font entry in the i3 config file to:


font pango:System San Francisco Display 10

Further, changing the font for the used gtk is recommended. You can do this is the gtk configuration file (in ~/gtkrc-2.0 and/or .config/gtk-3.0/…) by changing the font line to e.g.:


gtk-font-name="System San Franzisco 10"

Another option is to use the lxappearance config UI (but it currently seems buggy as not detecting all installed fonts correctly, as long they are not already in use with the system):


sudo apt-get install lxappearance
lxappearance

Replace dmenu with rofi


sudo apt-get install rofi

In the i3 config file, replace the dmenu-shortcut with e.g.


bindsym $mod+a exec rofi -show run -lines 20 -eh 1.3 -opacity "85" -bw 0 -font "System San Francisco Display 10"

or, to have different colors:


set $bg-color   #2f343f
set $text-color #f3f4f5
bindsym $mod+a exec rofi -show run -lines 20 -eh 1.3 -opacity "90" -bw 0 -bc "$bg-color" -bg "$bg-color" -fg "$text-color" -hlbg "$text-color" -hlfg "$bg-color" -font "System San Francisco Display 10"

Transparency and fading effects

i3 does not provide for transparency or fading effects itself (it has less purpose in doing so, as e.g. windows don’t overlap in a tiling arrangement). To add those, use e.g. compton:


sudo apt-get install compton

and add “exec compton” to your i3 config file. The configuration is for compton is done via ~/.config/compton.conf, which you first have to copy from the example file location. With Ubuntu, this is:


cp /usr/share/doc/compton/examples/compton.sample.conf ~/.config/compton.conf

Afterwards, you can change settings there to your needs. We usually do the following:

  • Increase window fading speed, which is specified in milliseconds between fading steps: “”fade-delta = 5;”
  • Remove transparency from unfocused windows and menues (increases their readability). To do so, comment out “inactive-opacity” and “menu-opacity”.

Replace the i3status bar (bottom/top bar) with i3blocks


sudo apt-get install i3blocks

Copy the example i3blocks config file:


cp /etc/i3blocks.conf ~/.config/i3/i3blocks.conf

And change the value of the “status_command” from “i3status” with “i3blocks -c ~/.config/i3/i3blocks.conf” in your i3 config file.

Then you can customize i3blocks in your ~/.config/i3/i3blocks.conf file. For example:

  • Set the interval of date/time to 1 to have a 1s time update interval.
  • For volume add “command=/usr/share/i3blocks/volume 5 pulse” and set the interval 1 to use the pulse audio volume level with 1s interval.
  • Replace the text of labels with character/utf-8 icons as you like – this saves space in the bar. Alex has some nice examples for this in his own config file on github.

Workspaces on predefined screens

For users using a multi-monitor setup configuring to which screen specific workspace automatically go might be interesting:


# put workspaces on specific screens
workspace 1 output HDMI-1
workspace 2 output DVI-I-1
...

More i3 shortcuts

  • Auto back-and-forth: after switching from workspace A to workspace B, pressing the shortcut for workspace B again to switch back to workspace A. Add “workspace_auto_back_and_forth yes” to enable this feature.

Application configuration

Usability of some applications benefits from some more configuration:

  • The new mail attention add-on for Thunderbird makes i3 raise the urgent notification flag for new mails, so that the corresponding workspace is highlighted.
  • Enabling the “Message Notification” add-on in Pidgin makes i3 raise the urgent notification flag for new messages, so that the corresponding workspace is highlighted.

More hints

As i3 does not come with a built in network configuration UI: to configure networks like VPNs you can use the following (parts of the network-manager and network-manager-gnome packages):

  • nm-connection-editor allows editing network settings
  • nmtui allows for activating/deactivating networks over the command line

i3 does also not come with a built in UI for configuring computer mice. The mouse pointer speed can be adapted with xinput:

  • use “xinput –list –short” to determine the name of your mouse device, then
  • “xinput –set-prop “MOUSE DEVICE NAME” “Device Accel Constant Deceleration” 1.8″ to change the mouse pointer speed. The latter can be added to the i3 config file to automatically keep the speed after a restart of i3.

Backup your i3 configuration

Most (if not all) i3 configuration is located in those 3 files, which consequently are the only ones that need to be backed up:


~/.config/i3/config
~/.config/i3/i3blocks.conf
~/.config/compton.conf

Categories: Linux, Misc

Ubuntu Gnome 16.04: Some Useful Configuration

August 12, 2016 Leave a comment

Ubuntu Logo      Ubuntu Gnome Logo

A lot has changed in Ubuntu Gnome in the past 2 years. With the release of Ubuntu Gnome 16.04 a few months ago we take the chance to do a follow-up of our 2014 post and summarize the configuration we usually apply to a fresh installation of Ubuntu Gnome 16.04.

To consider for backup before installation

Just for completeness: you might want to backup some things beside private documents, music, videos etc, e.g.:

  • ~/.bashrc contains path variables, changes to bash behaviour etc.
  • ~/.bash_aliases contains aliases, other additions to bashrc.
  • ~/.conkyrc contains configuration for conky (if you use conky).
  • ~/.bash_profile “The personal initialization file, executed for login shells ” (see bash man page).
  • ~/bin/ may contain scripts and links to executables (as ~/bin is usually added to PATH).
  • ~/.config: contains configurations for different applications (e.g ~/config/compton.conf or ~/.config/i3/ if compton or i3 they are used).
  • ~/.gnupg/: contains PGP keys (used e.g. via Thunderbird enigmail).
  • ~/.local/share/rhythmbox if you use Rhythmbox, this folder contains your local playlists.
  • ~/.mozilla/: contains Firefox configuration, history etc.
  • ~/.purple/: contains purple based messaging configuration (e.g. pidgin), including possibly used OTR keys.
  • ~/.ssh/ contains ssh private and public keys, authorized keys for ssh login and ssh fingerprints seen in the past.
  • ~/.thunderbird/ contains Thunderbird configuration and mails.
  • GTK bookmarks: contains GTK based bookmarks (used e.g. by Nautilus, Nemo, Thunar, PCManFM etc). With Ubuntu 14.04 an newer they are located at ~/.config/gtk-3.0/bookmarks.
  • /etc/fstab contains automatic mounted partitions and folders.
  • cron jobs can be found on multiple locations (root-level /etc/crontab, root-level anacron and periodics /etc/cron*, user-level /var/spool/cron/crontabs)

Gnome Shell

In case you are new to Gnome Shell we strongly recommend reading a short intro, as this will probably save you lots of time later: Gnome shell cheat sheet one and two (they are not always updated to the newest…). Some examples for of useful features of Gnome Shell that might not be intuitive if you were using other UIs before:

  • The main menu of Gnome Shell style windows is hidden in the black area right next to the “Activities” button (top left) and gets shown only on click.
  • The message tray (lists messages from apps like Skype, Pidgin, Thunderbird etc.) is hidden as well and accessible via the shortcut Super+M.
  • The suspend button is hidden in the top right user menu under the power button and becomes visible on pressing Alt.
  • You can restart Gnome Shell with executing “r” in the Alt+F2 box without closing your applications etc. Useful to developers as well as to “soft reset” stuff in case of window freezes or other bugs. This is btw. equivalent to calling gnome-shell –replace directly (in case you do that from a tty without X server you need to specify the display – which will usually be 0 as you will typically only have one X server running: gnome-shell –replace -d :0).
  • Executing “lg” in Alt+F2 brings up the Gnome Shell log, which is useful in case of problems with Gnome Shell and its extensions.

Gnome Shell search providers

  • Type “search” in the activities view to bring up the search configuration. You might want to disable and/or reorder some choices here.
  • Type “privacy” in the activities view to bring up the privacy settings, which might be worthwhile to review as well.

Gnome Shell tweak tool

The tweak tool provides access to a number of tuning options. It should come preinstalled already, but in case it is not there yet:

sudo apt-get install gnome-tweak-tool

For example:

  • Changing the system font size (we usually change it from 11 to 10).
  • Changing the cursor theme (we usually change it to the dmz cursor theme:
     sudo apt-get install dmz-cursor-theme
  • Change workspace behavior, so that workspaces don’t only affect the primary screen but all screens.
  • Change how modal dialogs are attached to their parent windows.
  • Window selection model, if you’re used to mouse-over window selection (as I’m personally). Here’s the difference between mouseover and sloppy in case you wonder. I personally don’t like windows to be raised to the front automatically after the mouse pointer standing still for a certain time in it. This can be changed by turning off “automatically raise windows” in tweak tool or “auto-raise” in org–>gnome–>desktop–>wm–>preferences, or by adapting “auto-raise-delay” next to it. And in case you want windows to immediately get focus as you hover the mouse over them deselect “focus-change-on-pointer-rest” in org–>gnome–>shell–>overrides.

Gnome Shell extensions

We typically install some Gnome Shell Extensions, including the following ones:

  • AlternateTab: don’t group windows of same application in Alt+Tab, can be configured to show only the application icon instead of the window preview.
  • Dash to Dock: easy way to set maximum dock icon size + disabling “require pressure to show dock” to achieve nearly-normal dock behaviour.
  • gTile: a window tiling utility – supports aligning windows to tiles spanning your screen (e.g. 2×2, 3×2, 4×4).
  • Native windows placement: more intuitive placing of windows in the activities window.
  • Notification Alerts: makes the user’s menu blink on new messages in the message tray.
  • Recent Items: adds list of recently used items to the top bar.
  • Search recently used files: integrated into the Gnome Shell activities view – this seems to work no longer as it’s not compatible with Gnome Shell >= 3.14. We’re still investigating how to best include recently used files in the activities search (frankly neither the Gnome Shell search providers “files” and “documents” nor other extensions seem to do this trick).
  • TopIcons Plus: one successor of TopIcons that nicely integrates into Gnome Shell and shows legacy application “tray” icons on the right side of the shell top bar.
  • User themes: enables loading of themes from ~/.themes/, which can then be selected in the gnome tweak tool to customize Gnome Shell.
  • WindowOverlay Icons: shows application symbol above windows in the activities overview. With centred and enlarged icons (~150px) helps pinpointing windows fast in our opinion.

Window button layout: put buttons left

We usually change the button layout so that the buttons are arranged on the left side (like with MAC systems) – as this saves you mouse distance. For Gnome Shell the needed tool is dconf-editor:

sudo apt-get install dconf-editor

In dconf-editor changes have to be applied to “button-layout” in  to org.gnome.desktop.wm.preferences in Ubuntu 16.04. Our usual button layout is “close,minimize,maximize”, all on the left side.

More look and feel: themes, icons, …

If you feel the need for changing the look and feel of your Gnome Shell even more, you can add different themes, icons sets, etc to Gnome Shell (all in the tweak tool). We sometimes use these:

  • Super Flat Remix Gnome Shell theme – “super lightweight”. If you use conky you might want to adapt the opacity to fit this theme (its at about 15%).
  • Elementary Icon set – the old one from 2013, “super clean”.
  • Depending on your needs you might also consider installing a dock shell extension (e.g. Dash to Dock, which features a bit more options for configuration than e.g. SimpleDock).
  • If you are instead up for a good looking and nicely working MAC oriented theme, consider the Gnome Shell/GTK+ theme OS X 10.11 El Capitan.

Some further configurations

Custom window shortcuts

Window specific shortcuts are mostly in dconf-editor in org–>gnome–>desktop–>wm–>keybindings. Additionally to adding assignments you might need to remove some to get your configuration working. An example of what we often use:

  • maximize: []
  • maximize-horizontally: [‘<Super>Page_Up’]
  • minimize: [‘<Super>Down’]
  • switch-to-workspace-up: [‘<Control><Alt>Up’]
  • toggle-maximized: [<Super>’Up’]
  • unmaximize: []

Custom command shortcuts

User specific commands can be defined in “Keyboard–>Shortcuts”. We typically create a shortcut to open a file manager at the data partition, such as Ctrl+Alt+E for nemo /media/data or nautilus /data/media, depending on your file manager.

Show all startup applications

Since Ubuntu 12.04 some startup applications are hidden, therefore not shown in gnome-session-properties. To show those applications use:

sudo sed -i "s/NoDisplay=true/NoDisplay=false/g"; /etc/xdg/autostart/*.desktop

Special Keyboard Buttons with MS Ergonomic Keyboard

If you happen to use a MS Ergonomic Keyboard (e.g. the Natural Ergonomic Keyboard 4000) some buttons might not work for you by default. It might be helpful to change the following:

  • For multimedia forward/backward: in Keyboard->Shortcuts->Sound and Multimedia: assign “Forward” and “Backward” to the previous/next track actions.
  • To use the zoom slider for scrolling add the following in etc/udev/hwdb.d/61-keyboard-local.hwdb
    keyboard:usb:v045Ep00DB*
     KEYBOARD_KEY_0c022d=pageup
     KEYBOARD_KEY_0c022e=pagedown

    Then recreate the hwdb:

    sudo udevadm hwdb --update

    Those might require to replug the keyboard or reboot.

Tooltip background color

The default tooltip background color is black – which is horrible for programs using dark fonts (like Eclipse). To change the tooltip background color install gnome-color-chooser and in Specific–>Tooltips change Foreground to black and Background to pale yellow, as Nick Andrik suggested here.

Application Configuration

File browser

  • Though Nautilus file browser has become better with the latest releases some might still not be convinced by it. One of the disadvantages it brings for power users is the missing tree view feature in the main area (the right one, not the left tree or places view). Options for replacing Nautilus include: Nemo, Thunar, PCManFM, Dolphin, and many more.
  • In case you stick with Nautilus:
    • If you dislike the recursive-search-as-you-type feature: you can disable it (and enable the old interactive search) by enabling org.gnome.nautilus.preferences.enable-interactive-search with the dconf-editor.
    • Most file browsers support the creation of files from templates in the context menu (right click -> “new document” -> select one of your templates). The location you need to put template files that should show up in this menu is ~/Templates/. If you notice that with Nautilus the “new documents” entry in the context menu is missing entirely, try creating an empty file in ~/Templates/, which should make it visible again.
    • Add custom actions with nautilus-actions-config-tool, such as running Terminator from the current location as stated in detail here.

Bash

We usually adapt Bash behavior to immediately log commands of all opened terminals.

Terminal emulation

Usually we also replace the default terminal emulation if it’s not very powerful (split screens, all hotkeys configurable etc.). Our current choice for Ubuntu is terminator, which features split screens and a detailed hotkey configuration – but of course there are many others out there with similar features.

Firefox

Besides enabling the “do not track me” flags in browsers other measures might also help reducing the traceability. In Firefox–>Properties–>Privacy (actual names might differ slightly, but the meaning is clear):

  • Enable “Firefox will record custom history”: discard third party cookies when Firefox closes
  • Enable “Clear history on Firefox close”: check “empty cache”, “discard cookies” and “discard active logins”

Firefox addons

Some Firefox addons we find useful, therefore tend to install straight away as well:

Thunderbird

We usually install some Thunderbird addons directly via Thunderbird->Tools->Addons. Addons we find useful are:

Disabling unnecessary notifications

With Gnome Shell, notifications tend to get persisted in the message tray. This is a good thing, as we won’t miss e.g. that we’ve been pinged in a chat, even if we were not at the PC when the ping happened. But we also don’t want unnecessary messages to show up there, as those tend to be distracting. Usually, we disable the following notifications (and alike in other programs):

  • Notifications from contacts coming online/offline in Pidgin, Skype, etc.
  • Notifications of music players playing the next track (e.g. Rhythmbox: disabling the “Notifications” plugin).
  • Notifications from any all-time-running terminal, like Yakuake or Guake.

Finally: root partition backup

Discussions about backups are omnipresent, so we won’t discuss the problem again here. In case there is no automatic backup having a “clean” – but properly configured system right after installation might be a good time to do a backup. That might save you lots of time in case users mess up the system. An option for quick backups is using fsarchiver from a live media (the installation media might come in handy). For a quick start with fsarchiver we’d recommend their quick start page. We assume that your installation was not split across multiple partitions in our example. The fsarchiver-command for backing up a partition on /dev/sda1 to /media/data/backups/datetime.fsa using 2 cores (-j2), splitting archives to multiple files of 4000MB (-s4000), standard compression (-z3) and verbose output (-v) from a live media would be:

sudo fsarchiver savefs -j2 -s4000 -z3 -v /media/data/backups/datetime.fsa /dev/sda1

The fsarchiver-command for restoring partition /dev/sda1 from /media/data/backups/datetime.fsa from a live media would be:

sudo fsarchiver restfs -j2 -v /media/data/backups/datetime.fsa id=0,dest=/dev/sda1

 

Categories: Linux

Git security: enabe fsckobjects in ~/.gitconfig:

February 3, 2016 Leave a comment

In order to prevent possible tampering with code in git repositories you work with (e.g. malicious manipulation of objects during clone, fetch, push…), check if these lines exist in your ~/.gitconfig and add them, if they don’t:

[transfer]
fsckobjects = true
[fetch]
fsckobjects = true
[receive]
fsckObjects = true

These enable git checking transferred objects for their integrity using their computed hashes.

Original idea from here: https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0
(and the corresponding bug on Debian here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813157)

Data backups: diff, rdiff-backup etc.

February 28, 2015 Leave a comment

diff: differences between source and destination folder

Imagine you already some 1:1 backup, e.g. your data partition copied to a backup disk. You did that without using rdiff-backup or similar, just a plain copy. If you now want to see differences between the source and destination directory the following diff command might come in handy. It lists the differences in content between dir1 and dir2 – recursively and with modified output (we assume you just want to know which files changed, and not how files changed). This could be useful to see which files “disappeared” since doing the backup (accidentally deleted etc.)

diff -ur dir1 dir2 > diff.txt

rdiff-backup: easy to use incremental backups

When backing up bigger portions of data, incremental backups can greatly speed up the process. rdiff-backup provides such incremental backups and is fairly easy to use. Further, rdiff-backup always represents the latest version of your content in the backup, alongside reverse diffs to go back to older versions.

The rdiff-backup syntax works the “include all content in the specified source directory to the backup, exclude only additionally specified files/folders”-way. For my personal data backup I do it the other way round, as I only have a hand full folders to include in the backup, which are distributed all over the file system. I first include all locations I want backupped, then exclude everything else (“/**”) and specify the file system root as source directory. The following command is adapted to my personal needs (and really only backups data, no system configuration or else), so you will need to adapt it to fit your needs:

rdiff-backup --include /media/data/documents --include /media/data/pictures --include /media/data/music --include /media/data/new --include /media/data/tools --include /media/data/virtualOS --include /home/xxx/.thunderbird --include /home/xxx/git_repos --exclude /** / /path/to/backup

You can include your data partitions here, as well as do a data backup of essential parts of your system by including /etc, /home, /root etc.

Ubuntu Gnome 14.04: our usually applied configurations

May 11, 2014 1 comment

As we (darksider15 and myself) regularly set up PCs for private use with Ubuntu and Gnome Shell we’d like to share our usual considerations before doing the installation as well as our  list of usually applied configurations after the installation. For our example we use Ubuntu 14.04 and Gnome Shell 3.10. In order to not install Ubuntu’s default desktop Unity we use the Ubuntu GNOME flavour, but regular Ubuntu including Unity could be used as well (Gnome Shell can be installed from the repositories then). In case you are new to Gnome Shell we strongly recommend a short reading – as this will probably save you lots of time and make your life a lot easier: Gnome shell cheat sheet one and two (they are not always updated to the newest…). Some examples for usable – but not very intuitive features of Gnome Shell for people coming from other desktop environments:

  • The primary window menu of Gnome Shell Style Windows (in Ubuntu 14.04 e.g. Nautilus and gnome tweak tool) is hidden in the black area right next to the “Activities” button (top left) and gets shown on a click.
  • The message tray (lists messages from apps like skype, pidgin, thunderbird etc.) is accessible via the shortcut Super+M.
  • The suspend button is hidden in the top right user menu under the power button and becomes visible on pressing Alt.
  • You can restart Gnome Shell with executing “r” in the Alt+F2 box without closing your applications etc. Useful to developers as well as to “soft reset” stuff in case of window freezes or other bugs. This is btw. equivalent to calling gnome-shell --replace directly (in case you do that from a tty without X server you need to specify the display – which will usually be 0 as you will typically only have one X server running: gnome-shell --replace -d :0).

To consider for backup before installation

Depending on who’s PC you are installing the OS on (and if the installed OS already is Ubuntu or another Linux distribution installed) you might want to backup some things beside private documents, music, videos etc. Assuming that the old OS is Ubuntu with Gnome Shell, we usually check the following things for backup:

  • ~/.bashrc contains path variables, changes to bash behaviour etc.
  • ~/.bash_aliases contains aliases, other additions to bashrc
  • ~/.bash_profile “The personal initialization file, executed for login shells ” (see bash man page)
  • ~/bin/ may contain scripts and links to executables (as ~/bin is usually added to PATH).
  • ~/.gnupg/: contains PGP keys (used e.g. via Thunderbird enigmail).
  • ~/.mozilla/: contains Firefox configuration, history etc.
  • ~/.purple/: contains purple based messaging configuration (e.g. pidgin), including possibly used OTR keys.
  • ~/.ssh/ contains ssh private and public keys, authorized keys for ssh login and ssh fingerprints seen in the past.
  • ~/.thunderbird/ contains Thunderbird configuration and mails.
  • GTK bookmarks: contains GTK based bookmarks (used e.g. by Nautilus, Nemo, Thunar, PCManFM etc). For example on Ubuntu 12.04 gtk bookmarks are located at ~/.gtk-bookmarks, on Ubuntu 14.04 they are located at ~/.config/gtk-3.0/bookmarks.
  • /etc/fstab contains automatic mounted partitions and folders.

After installing Ubuntu 14.04 Gnome flavour: configuration

Graphics

At first we usually install graphics drivers as they might cause problems (depending on the specific graphics). In our example we have a Nvidia GeForce 5400 (GF108 Fermi chip) in the Optimus graphics of a ThinkPad T430 notebook. For compatibility reasons the integrated graphics have been disabled completely in the BIOS, only the dedicated Nvidia graphics are used. To obtain drivers we include the ubuntu-x-swat PPA and install the current drivers from there:

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current

After installing the driver you can check with

sudo lspci -k

if the driver is loaded (look for VGA in the list, check if the kernel driver in use is nvidia). To ensure that the current setup supports 3D hardware acceleration (essential for most 3D games) use

glxinfo | grep direct

Gnome shell extensions

We typically install some Gnome Shell Extensions, including the following ones:

  • AlternateTab: don’t group windows of same application in Alt+Tab.
  • Dash to Dock: easy way to set maximum dock icon size + disabling “require pressure to show dock” to achieve nearly-normal dock behaviour.
  • gTile: a window tiling utility – supports aligning windows to tiles spanning your screen (e.g. 2×2, 3×2, 4×4).
  • ignore_request_hide_titlebar: makes (some) Gnome Shell Style applications show their titlebar again (currently more of a bugfix than feature with the way we use Gnome Shell).
  • Native windows placement: more intuitive placing of windows in the activities window.
  • Notification Alerts: makes the user’s menu blink on new messages in the message tray.
  • Recent Items: adds list of recently used items to the top bar.
  • Removable Drives Menu: status icon for ejecting removable drives.
  • Search recently used files: integrated into the Gnome Shell Dash
  • TopIcons: although there exist more sophisticated versions this one shows Skype/Pidgin icon in top bar.
  • WindowOverlay Icons: shows application symbol above windows in the activities overview. With centred and enlarged icons (~150px) hepls pinpointing windows fast in our opinion.

Mount additional partition

In case there is such one (which was not stated for automatic mounting right during installing Ubuntu) you can add an corresponding entry to /etc/fstab. For compatibility reasons we are using /media/data as mount point here (nowadays Ubuntu would use /media/username/data instead). A typical entry for an ext3 partition would be

UUID=23f8a3fb-3f0d-4960-8c88-80e0db3cc471 /media/data     ext3    defaults        0       2

and for ntfs it would be

UUID=581F7F14085DF65D    /media/data    ntfs    defaults    0    0

You can either use the device in /dev or the UUID to specify the device to be mounted. Both can be found out using blkid:

sudo blkid

In case you have troubles with write access to the disk ensure that the folder it is mounted to (/media/data) exists and has write access for your user.

Window button layout: put buttons left

We usually change the button layout so that the buttons are arranged on the left side (like with MAC systems) – as this saves you mouse distance. For Gnome Shell the needed tool is dconf-editor:

sudo apt-get install dconf-editor
dconf-editor

In dconf-editor changes have to be applied to org–>gnome–>shell–>overrides–>button-layout (there is also a button-layout in org–>gnome–>desktop–>wm–>preferences–>button-layout – that’s probably be the same entry visible multiple times in dconfg, but try changing this one if the first didn’t work for you). Our usual button layout is

close,minimize,maximize:

System font and font size

In our opinion Ubuntu system font is rather big. It can be decrease in the fonts tab of gnome tweak tool:

sudo apt-get install gnome-tweak-tool
gnome-tweak-tool

We usually reduce the default (11pt) to 10pt for all but monospace fonts. If you feel comfortable with the standard fonts at all: we usually change interface and documents font to “Ubuntu” (slightly easier to read in our opinion).

Cursor theme

We like to change the Gnome Shell default cursor theme (Adwaita, white border, black filling) to DMZ-White (black border, white filling). Therefore you first need the dmz cursor theme:

sudo apt-get install dmz-cursor-theme

Then the cursor theme can be changed in Appearance->Cursor of gnome-tweak-tool.

Window selection behaviour

If you’re used to mouse-over window selection (as I’m personally): this can be changed using gnome-tweak-tool again. Select “mouse over” or “sloppy” in Windows–>Focus Mode. (difference between mouseover and sloppy). I personally don’t like windows to be raised to the front automatically after the mouse pointer standing still for a certain time in it. This can be changed by deselecting “auto-raise” in org–>gnome–>desktop–>wm–>preferences. or by adapting “auto-raise-delay” next to it. And in case you want windows to immediately get focus as you hover the mouse over them deselect “focus-change-on-pointer-rest” in org–>gnome–>shell–>overrides.

Tooltip background color

The default tooltip background color is black – which is horrible for programs using dark fonts (like Eclipse). To change the tooltip background color install gnome-color-chooser and in Specific–>Tooltips change Foreground to black and Background to pale yellow as Nick Andrik suggested here.

Show all startup applications

Since Ubuntu 12.04 some startup applications are hidden, therefore not shown in gnome-session-properties. To show those applications use:

sudo sed -i &quot;s/NoDisplay=true/NoDisplay=false/g&quot; /etc/xdg/autostart/*.desktop

Custom shortcuts

Sadly, at the moment changing shortcuts via UI in gnome shell is split between multiple applications. Some applications show options to change settings that are not used at all. For window specific shortcuts use dconf-editor in org–>gnome–>desktop–>wm–>keybindings as you can manipulate most stuff there. Our typical shortcuts include:

  • toggle-maximized: [‘Up’]
  • Maximize vertically: [‘Page_Up’]
  • Minimize: [‘Down’]

User specific commands can be defined using “Shortcuts–>Custom Shortcuts” in the “Keyboard” app. We typically create a shortcut to open a file manager at the data partition, such as Ctrl+Alt+E for nemo /data/media or nautilus /data/media, depending on your file manager.

Multi monitors: get Ubuntu to remember their setup

Currently Ubuntu 14.04 seems to not remember multi monitor configurations for the reason of not loading ~/.config/monitors.xml (where the setup is stored correctly after configuring it). The update-monitor-position script provides a nice workaround to this problem by enforcing loading of monitors.xml as a custom startup application.

Restricted formats

By installing codecs for restricted formats we ensure to be able to play (most) formats straight away (although these formats suck for obvious reasons and should be avoided in favour of non-restricted ones).

Application configurations

File Browser

We’re not very convinced of Nautilus as file browser atm with the way we want to use Gnome Shell. The main problem is that it can’t be configured to the point anymore (e.g. bugs in the window button placement for gnome shell style windows). Another problem for power users may be the dropped tree view features in the main area (the right one, not the left tree or places view). We hope that’s coming back soon. Currently we use Nemo as file browser, but there are of course multiple options for people feeling like replacing Nautilus in Ubuntu 14.04, with us only listing some options:

  • Nemo: Nautilus fork, default for Linux mint (Cinnamon desktop), features a tree view.
  • Thunar: Nautilus fork, default for Xubuntu (Xfce desktop), no tree view either.
  • PCManFM: default for Lubuntu (Lxde desktop), no tree view either.
  • Dolphin: Kubuntu default (KDE desktop), different look and feel, but very powerful and customizable, features a tree view.

Bash

We usually adapt Bash behaviour to immediately log commands of all opened terminals.

Terminal emulation

Usually we also replace the default terminal emulation if it’s not very powerful (split screens, all hotkeys configurable etc.). Our current choice for Ubuntu is terminator, which features split screens and a detailed hotkey configuration – but of course there are many others out there with similar features.

Firefox

Besides enabling the “do not track me” flags in browsers other measures might also help reducing the traceability. In Firefox–>Properties–>Privacy (actual names might differ slightly, but the meaning is clear):

  • Enable “Firefox will record custom history”: discard third party cookies when Firefox closes
  • Enable “Clear history on Firefox close”: check “empty cache”, “discard cookies” and “discard active logins”

Firefox addons

Some Firefox addons we find useful, therefore tend to install straight away as well:

Yakuake

If Yakuake is started along with the system we usually disable the notification popups – they might cause problems in case Yakuake displays them too soon.

Notifications from Pidgin, Skype etc.

We usually turn off notification popups on buddies going online or offline, as this causes additional notifications in the message tray (and the user’s menu to blink, caused by the corresponding gnome shell extension). With Pidgin, notifications can be configured in Tool–>Plugins–>Libnotify Popups. With Skype, notifications can be configured in Skype–>Options–>Notifications (look for “Contact Came Online/Offline”).

Amarok

There seems to be an issue with the global media button “play/pause” in Ubuntu 14.04 with the command not being delivered correctly to applications. Specifically for Amarok (our music player of choice) the button works hardly anytime as long as the system (not Amarok itself) has it assigned to the system-wide play/pause shortcut. Therefore one solution is to unbind the “Play (or play/pause)” shortcut in Keyboard->Shortcuts->Sound and Media – Amark should receive the command correctly afterwards (ensure there is a correct binding in Amarok in Settings->Configure Shortcuts…->Play/Pause->Global)

Thunderbird

We usually install Thunderbird lightning from the repositories and it’s addons directly via Thunderbird->Tools->Addons. Addons we find useful are:

Finally: root partition backup

Discussions about backups are omnipresent, so we won’t discuss the problem again here. In case there is no automatic backup having a “clean” – but properly configured system right after installation might be a good time to do a backup. That might save you lots of time in case users mess up the system. An option for quick backups is using fsarchiver from a live media (the installation media might come in handy). For a quick start with fsarchiver we’d recommend their quick start page. We assume that your installation was not split across multiple partitions in our example. The fsarchiver-command for backing up a partition on /dev/sda1 to /media/data/backups/datetime.fsa using 2 cores (-j2), splitting archives to multiple files of 4000MB (-s4000), standard compression (-z3) and verbose output (-v) from a live media would be:

sudo fsarchiver savefs -j2 -s4000 -z3 -v /media/data/backups/datetime.fsa /dev/sda1

The fsarchiver-command for restoring partition /dev/sda1 from /media/data/backups/datetime.fsa from a live media would be:

sudo fsarchiver restfs -j2 -v /media/data/backups/datetime.fsa id=0,dest=/dev/sda1

Batch sort jpg images to folders named after dates images were taken

May 11, 2014 1 comment

Once in a while I need to transfer pictures taken with my mobile phone for private use (jpg format) from my phone to my PC – and to sort them there. I want my pictures sorted in folder named by the date taken (e.g. “2014_05_11_description”) – which is pretty time consuming if done by hand. The script snippet below takes all jpg files in the current folder, creates subfolders named by the dates pictures have been taken and sorts the files in there accordingly. In case you don’t want to add a description to the folders afterwards you might want to remove the last “_” in foldername.

for f in `ls *jpg`
do
        foldername=`exif -t 0x9003 -m $f | sed s/:/_/g | awk '{print $1}'`_
        if ! test -e "$foldername"; then
                mkdir -pv "$foldername"
        fi
        mv -v $f $foldername
done

Insights to extracting date from jpg files in short:

  • exif is used to extract the date and time the image was taken,
  • sed replaces “:” with “_” and
  • awk removes the time information as I only want date.

Credits: according to my notes I originally built my script upon this script.