суббота, 7 марта 2009 г.

How to make screenshots silently.

  1. Install imagemagick package: sudo aptitude install imagemagick
  2. Save this script somewhere:
    #!/bin/sh

    file=~/Desktop/Screenshot.png
    if [ -f "$file" ]; then
    i=1
    file=~/Desktop/Screenshot-${i}.png
    while [ -f "$file" ]; do
    i=$(($i+1))
    file=~/Desktop/Screenshot-${i}.png
    done
    fi

    import -window root -display :0 +repage "$file"
  3. Now make this script executable: chmod +x
  4. Use Super+Print to launch this script - launch gconf-editor, go /apps/metacity. In global_keybindings choose free run_command_X (should be disabled), and set it to <Super>Print. Then go to keybinding_commands and set command_X (X should be the same as X in global_keybindings) to full path to the saved script

четверг, 22 января 2009 г.

Translate from my russian blog: http://emacs23.blogspot.com/2008/10/gnome-places.html
The fact Gnome Panel only can contain 5 items really annoy me, and this behaviour cannot be changed through GUI, but directly from code.
These are steps to improve the issue in Debian derivatives, such as Ubuntu:
  1. Install apt-build package:
    sudo aptitude install apt-build
  2. After the configuration file like *apt-build* or something would be in directory /etc/apt/sources.list.d/, I don't know exactly. One of them would contain line like deb file:/var/cache/apt-build....... You need to place this line at the top of the file /etc/apt/sources.list in order aptitude to know where to get rebuilded packages. If you don't change repository settings while apt-build installation, this line would be:
    deb file:/var/cache/apt-build/repository apt-build main
    Place it at the top of /etc/apt/sources.list
  3. Now get Gnome Panel sources from repos:
    sudo apt-build source gnome-panel
  4. Need to change capacity value. It's in the file /var/cache/apt-build/build/gnome-panel-...../gnome-panel/panel-menu-items.c. These dots ..... in the file path are Gnome Panel version numbers, but they are depends on the Gnome version you use, so, you need to manually complete a path - just use Tab key ;). Use your favourite text editor (I know, this is Emacs :D:D:D):
    sudo emacs /var/cache/apt-build/build/gnome-panel-....../gnome-panel/panel-menu-items.c
    , then find a line:
    #define MAX_ITEMS_OR_SUBMENU 5
    this is a key - current Places menu capacity: 5. Change it with another value, I use 50. Then save the file.
  5. Build the package:
    sudo apt-build install gnome-panel
  6. It's all, you must see updates notification now - it's time to install.
Here is the command line to perform this automatically:
sudo aptitude apt-build; echo 'deb file:/var/cache/apt-build/repository apt-build main' | cat /etc/apt/sources.list > ~/lol.list; sudo mv ~/lol.list /etc/apt/sources.list; sudo apt-build source gnome-panel; file=`find /var/cache/apt-build/build -name *gnome-panel -type d | sort | tail -1`'/panel-menu-items.c'; sed -e 's/^#define MAX_ITEMS_OR_SUBMENU.*/#define MAX_ITEMS_OR_SUBMENU 50/g' $file > ~/lol.tmp; sudo mv ~/lol.tmp $file; sudo apt-build install -f gnome-panel; killall gnome-panel