Some Computer Hints


Ubuntu GNOME

Desktop Files

To localize a desktop file for a specific user:

$ cp /usr/share/applications/application.desktop ~/.local/share/applications/

and edit the file ~/.local/share/applications/application.desktop as needed.

Similarly, you can customize application desktop directories and menus after doing:

$ cp /usr/share/desktop-directories/app_group.directory ~/.local/share/desktop-directories/
$ cp /etc/xdg/menus/gnome-applications.menu ~/.config/menus

To check a desktop file syntax and activate:

$ desktop-file-validate ~/.local/share/applications/application.desktop
$ update-mime-database ~/.local/share/mime
$ update-desktop-database ~/.local/share/applications

For an example, see the Linux Installation of Personal Notes File topic and also How to extend a .desktop file for adding new Actions?.

Getting Screen Shot of a Window From Command Line

First, find the window identity (a hexadecimal integer) of the window you are interested, using the command:

$ wmctrl -l

This number is displayed in the first column of the above command output and the window title is in the last column. Then, use the following sample command sequence to save the screen shot into your ~/Pictures directory:

$ wmctrl -i -a 0x05200951 && gnome-screenshot -w

Mounting Disks

Normally you can mount disk images using the gnome-disks utility. However, to mount a disk image as writable you may have to use the command line:

$ gnome-disk-image-mounter --writable floppy_disk.img

To gvfs-mount a remote filesystem over SSH to a local system, use the GIO commandline tool like this:

$ gio mount sftp://user_name@server_name

After that, you can use other gio commands or just switch to a virtual directory named like this:

$ cd /run/user/user_id/gvfs/sftp:host=server_name,user=user_name

and you can access the remote server’s root filesystem locally.

Utilities

To create GUI-style interactions from your Bash script or command line, you can use the zenity command. For an example, you can look at Add password option to default compress menu.

Windows

To get (geometry) information about a window you can use the command:

$ xwininfo