Chapter 4
In This Chapter
Starting and navigating the desktop environment
Using external storage devices in the desktop environment
Using File Manager and Image Viewer
Browsing the web
Customizing your desktop
Logging out from LXDE
The quickest way to start playing with your Raspberry Pi is to use the more visual desktop environment, which is called LXDE (short for Lightweight X11 Desktop Environment). LXDE is part of the recommended Raspbian Linux distribution for the Raspberry Pi (see Chapter 3). LXDE is designed to be as efficient as possible in its use of memory and the processor. That makes it perfect for the Raspberry Pi, which is limited in both respects compared to many modern computers.
The desktop environment works in a similar way to the Windows or Mac OS operating systems, which let you use icons and the mouse to find and manage files and operate programs. That makes it relatively intuitive to navigate, and means you can easily find and try out some of the software that comes with your Linux distribution.
In this chapter, we talk you through using the desktop environment and introduce you to some of its programs.
When you switch on your Raspberry Pi, it usually takes you into the command line interface (see Chapter 5), which enables you to control your computer by typing in instructions for it. You might be asked to enter a password first (see Chapter 3), but when you get to the prompt (pi@raspberrypi ~ $), you should type in startx to enter the desktop environment. It takes a moment or two to start and the screen might go blank for a short time.
Figure 4-1 shows the LXDE desktop environment. The giant raspberry logo in the middle of the screen is just a wallpaper (a decorative background image on the screen), so don’t worry if you see a different image there.
The strip along the bottom of the screen is called the taskbar, and this is usually visible whatever program you’re using.
Down the left of the screen you can find icons that provide rapid access to essential programs, including your web browser, programming tools, and some reference guides and tutorials. These programs are
To start a program using one of the icons on the desktop, just double-click it as you would in Microsoft Windows or Mac OS.
For all the other programs you might want to run, you use the Programs menu. At the bottom left of the screen is an icon that looks like a bird in flight. Click it and you’ll see the menu appear, similar to Figure 4-2.
The menu works in the same way as the Windows Start menu. As you move your mouse over the categories of programs, a submenu appears on the right, showing you the programs in that category. Click one of these once to start it.
LXDE enables you to use two desktops on your monitor, which is particularly helpful if you’re using a small screen. It means you can double the amount of space you have for using and arranging your programs. You can use two buttons at the bottom left of the screen to switch between the desktops (see Figure 4-2).
The two desktops work independently of each other, so if you start a program on one desktop, you can’t see it when you switch to the other, but the program is still there. You can switch desktops to go back to it again.
You can move a program from one desktop to the other by clicking the icon in the top-left corner of its window, hovering over Send to Desktop in the menu that opens, and then choosing which desktop you would like it to go to. You can also send a program to all desktops this way, so you can see the program no matter which desktop you’re using. Another way to move a program to another desktop is to click the title bar at the top of its window, drag the window to the side of the screen, and hold it there (with the mouse button still held down) until the desktop switches.
You can run different programs in each desktop, but in practice, you shouldn’t run too many programs at the same time.
You’ll probably want to use more than one program in an LXDE session, so you need to know how to close programs when you’ve finished with them, and how to rearrange programs on the screen.
The program windows in LXDE have similar controls to Microsoft Windows that enable you to resize and close them. Figure 4-3 shows the Task Manager application, with these controls indicated:
It’s easy to change the size of windows so you can see more than one at a time, for example. Move your mouse cursor to one of the edges until the mouse icon changes, and you can click and drag it inward or outward to reshape the window. You can also click and drag a corner to change the window’s height and width at the same time. To arrange the windows side by side, you can move them around by clicking and dragging the title bars at the top of them.
If your Raspberry Pi doesn’t seem to be responding, it might just be very busy. At the bottom right of the taskbar is the CPU Usage Monitor, which tells you how heavily the Raspberry Pi’s processor is being used. It’s a bar chart that scrolls from right to left, so the right-most edge shows the latest information. A green bar that fills the height of the graph indicates that your Raspberry Pi is working flat out, so it might take a moment or two to respond to you, especially when starting programs. In our experience, the Raspberry Pi doesn’t crash often, but it can sometimes be overwhelmed to the extent that it looks like it has. It’s usually worth being patient.
You can see which programs are running on your Raspberry Pi by running the Task Manager (see Figure 4-3). You can find it in the Programs menu among your system tools, but you can also go straight to it by holding down the Ctrl and Alt keys and pressing Delete.
If you have a program that is not responding, you can stop it using the Task Manager. Right-click it in the task list and choose Term to terminate it. This sends a request to the program and gives it a chance to shut down safely, closing any files or other programs it uses. Alternatively, you can choose Kill. That terminates the program immediately, with the possible loss of data.
When you’re using the desktop environment, you can plug in external USB storage devices, such as external hard drives or USB keys (also known as flash drives), and the Raspberry Pi automatically recognizes them. Figure 4-4 shows you the window that appears when you connect a device. You can then view the device in File Manager to access its files.
Flipping ahead to Figure 4-5, the USB key is shown in the list of places on the left as 66 MB Filesystem. Click its name to see its files.
You can manage your files using the command line (see Chapter 5), but it’s often easier to do it in LXDE. File Manager (see Figure 4-5) is used to browse, copy, delete, rename, and otherwise manage the files on your Raspberry Pi or connected storage devices.
You start File Manager by clicking its button at the bottom left of the screen (indicated on Figure 4-2), or by using the Programs menu, where it is among the System Tools.
In Linux, people usually talk of storing files in directories, but LXDE uses the term folders instead, which is probably familiar to you from other computers you’ve used. A folder is just a way of grouping a collection of files or programs and giving that collection a name. You can put folders inside other folders too.
On the right of File Manager, you can see the files (and any folders) that are inside the folder you’re currently looking at. Each file has an icon indicating what type of file it is, except for image files, which have a small representation of the picture itself. In Figure 4-5, you can see the different files that make up the Python games that come with your Raspberry Pi in your pi folder, including pictures of game characters and backgrounds, and sound effects that are shown with a musical note on the icon.
You can double-click a folder in this area to open it, and you can double-click a file to open it with the default program for that file type. An image file opens using the Image Viewer, for example, and a Scratch file opens in Scratch. If you want to choose which program to open a file in instead, you can right-click the file’s icon to bring up an option called Open With. Select it to bring up a menu of all the programs available on your Raspberry Pi, and then make your choice.
On the left is a list of your places, which are special types of folders. There are four main folders here:
You might also see other places here, depending on how your Raspberry Pi is set up. Figure 4-5 shows an entry beneath Applications for a 64MB USB key Sean plugged in.
Across the top of File Manager is a menu bar, including File, Edit, Go, Bookmarks, View, Tools, and Help menus. Most of the options here you can also do in other ways with File Manager, as we show you, but if you get stuck, this menu is a good way to quickly get back on track.
Underneath the menu bar is an icon bar that includes a number of useful shortcuts. They’re indicated in Figure 4-5:
File Manager makes it easy to copy and move your files and folders, without the need for any text commands.
When you right-click on a file or folder in File Manager, a menu opens that enables you to rename the file, delete the file or folder (which sends it to the Rubbish Bin), and to cut or copy it.
If you cut a file, it is moved to wherever you choose to paste it. If you copy the file, a duplicate copy of it is placed where you paste it. You paste by going to the folder where you would like the file to be stored and then right-clicking on an empty space inside a folder and choosing Paste from the menu that appears. (If you copy or cut a file without pasting it, nothing happens to it.)
There are several ways to select more than one file at a time, so you can delete, copy, or move them all at the same time:
After you’ve selected a group of files, you can drag them all into a different folder by clicking one of the selected files and dragging it into the folder. You can also right-click on one of your selected files and choose to cut or copy the whole group, as shown in Figure 4-6. If you delete one of the selected files, they will all be moved to the Rubbish Bin.
LXDE supports some keyboard shortcuts that might be familiar to you from Microsoft Windows. You can use Ctrl+A to select all files and folders, Ctrl+C to copy, Ctrl+V to paste, and Ctrl+X to cut selected files and folders in LXDE. It’s worth remembering, however, that Ctrl+C is used to cancel an operation in the Linux command line (see Chapter 5), so the Copy shortcut isn’t universal on your Raspberry Pi the way it is in Windows.
Organizing your files in folders makes it easier to manage them. You can more easily see what files you have where, go straight to a file when you need it, and back up a group of files by copying the folder to an external storage device.
It’s easy to make a new folder. First go to the location where you would like your new folder to be stored. Typically, this will be in your pi folder, or one of its subfolders, such as your Desktop. Right-click a blank space in the right pane of File Manager and hover the mouse over Create New. Click Folder in the fly-out menu that appears and you’ll be prompted to enter a name and click OK to confirm. If you change your mind, click Cancel instead.
You can also click the File menu at the top left of File Manager, find Create New, and then click Folder.
When you right-click on an empty space in the right pane in File Manager, a menu opens with an option to change how the files there are sorted. You can sort files by name, modification time, size, or file type, in either ascending or reverse order.
You can change how files and folders are shown in File Manager, so you can strike a balance between how many you can see at once, and how easy they are to see. The View menu in the menu bar at the top of File Manager gives you the choice of four different ways to display the files and folders. By default, File Manager uses the icon view, which strikes a good balance between the number of files you can see at a time and how large each icon is. The thumbnail view is particularly useful in a folder of images because it enlarges the preview that takes the place of a generic icon for picture files. To see as many files as possible at once, use the Compact view, which lists the files and folders in columns with a small icon and the filename.
The detailed list view (see Figure 4-7) reveals more information about each file, showing a short description, its size, and when it was last modified. You can click the column headings to sort the view by the filename, description (which groups similar files), size, or modification date. If you click the column heading again, the sort order is reversed.
Sometimes you might need to refresh the view of File Manager to reflect your latest changes. To do that, tap the F5 key on the keyboard or choose Reload Folder from the View menu.
The View menu also enables you to change the side pane in File Manager so it shows you the directory tree instead of the places. You’ll learn more about the directory tree in Chapter 5, but it’s worth knowing there’s an option to navigate using it in File Manager too.
Linux has a rigorous permissions structure that governs who can access all its files, and whether they have permission to modify them or run them. It’s a good thing because it means it’s relatively difficult for you to do any real harm to your Raspberry Pi’s operating system accidentally. You’re free to use File Manager to explore all the files your operating system uses, but if you try to delete an essential file, you’ll be told you don’t have permission (see Figure 4-8).
If you want to explore your system, go to your pi folder, click the Up a Level button twice (see Figure 4-5), and then take a look in the folders there. Chapter 5 covers some of these in more depth.
If you find you need to do something you don’t have permission to do, you can brush away all the restrictions by opening the current folder as the root user, one of the options in the Tools menu. As a root user, you can do anything on the computer, including deleting things you shouldn’t, so it’s good practice to only use this option if you really need to. When you’ve finished working as the root user (also called the Super User in File Manager), close File Manager window to protect yourself against accidentally making further changes you shouldn’t.
The Tools menu also has an option to open the current folder in the terminal. This enables you to use Linux commands (see Chapter 5) to make changes to the folder. Often this is the quickest way to accomplish something, especially after you’ve mastered the finer points of Linux. While you’re using File Manager, you can also use the keyboard shortcut F4 to access the terminal.
When it comes to browsing the web on your Raspberry Pi, you really are spoiled for choice, with three browsers to choose from. Epiphany is the recommended browser for most websites, although it’s good to be aware of the others because they can be faster (albeit they achieve speed by stripping out some of the web page’s features). Open the Programs menu, and you’ll see the browsers in the Internet category:
Figure 4-9 shows the Epiphany browser in use. Its layout is similar to other browsers you might have used in the past, with a thin toolbar at the top, and most of the screen given over to the web page you’re viewing. To get started with it, either run it from the Programs menu or double-click its icon on the desktop.
If you know the address of the website you want to visit, you can type it into the address bar (see Figure 4-9). When you start to type an address, a menu under the address bar suggests pages you’ve previously visited that might match what you want. Click one of these to go straight to it or carry on typing. When you’ve finished typing the address, press the Enter key.
You can scroll your page using the scrollbar on the right of the browser, or the scrollwheel on your mouse.
When your mouse pointer is over a link, the pointer changes to a small hand. You can then click the left mouse button to follow that link to another web page. The browser keeps a list of the web pages you visit (called your history), so you can click the Back button (indicated in Figure 4-9) to retrace your steps and revisit the pages you browsed before the current one. The Forward button beside it takes you forward through your history again.
Some web pages update frequently with new information, so you can click the Reload button to download the current page again and see any updates since you first opened it. While a page is downloading, this button becomes a Stop button. Click it to halt the download.
To find a word or phrase within a web page, press Ctrl+F after the page has loaded. The Find bar opens at the top of the screen, with a box for you to type into. The first occurrence of the text you’re looking for is highlighted on the page in yellow, and you can press the Enter key or click the Down button in the Find bar to move to the next one. You can close the Find bar again by clicking the Close button (an X) on the far right of the Find bar.
Like many other browsers today, Epiphany uses tabs to enable you to switch between several websites you have open at the same time. Click the button in the top right (refer to Figure 4-9) to add a new tab, which opens to show your most visited websites. You can click to visit one of these or type an address in the address bar.
To switch to a page, just click its tab above the main web page area. In Figure 4-9, Facebook and Sean’s website are open, and we can click the tabs to flick between those pages instantly. To close a tab, click the Close button to the right of its name.
Bookmarks make it easy to revisit your favorite web pages. You can add a bookmark by going through the menu in the top right, or by using Ctrl+D.
The New Bookmark window looks like Figure 4-10. The default name for a bookmark is the web page’s title, but you can edit it, and choose a topic to file it under. You can click to show the existing topics, or type a new topic into the Topics box. When you browse your bookmarks, the topics are like folders, organizing your bookmarks. To add the bookmark, you click the Add button.
To access your bookmarks while you’re browsing, click the menu in the top-right (its icon is indicated in Figure 4-9), and choose Bookmarks.
As you know, your browser stores the history of web pages you visit. If you want to make a visit to a website without any traces being left in the browser, perhaps to plan your Christmas shopping without the risk of other family members coming across the websites you’ve visited, open a new incognito window first. You do this through the menu in the top right. When you close the private browsing window, your secret session stops.
When information has already been stored in the browser, you can delete it by viewing your Personal Data and History from the menu in the top right.
It’s easy to look at your digital photos and other images using LXDE. Among the accessories in the Programs menu is the Image Viewer. You can start it through the menu, or by right-clicking an image file.
The Image Viewer displays your picture, with a toolbar along the bottom underneath it, as you can see in Figure 4-11. From left to right, this is what the buttons do:
Among the accessories in the Programs menu is Leafpad, which is a simple text editor (see Figure 4-12). You can use it for writing and word processing, but it’s not ideal for creating print-ready documents. It’s most useful for editing documents intended to be read by computers, such as web pages and configuration files.
The menus are logically organized, and if you’ve ever used a text editor on another computer, you’ll find your way around in Leafpad easily.
The File menu is used to start new documents and open, save, and print files. There’s also an option to Quit here, although you can just close the Leafpad window.
The Edit menu gives you tools for undoing and redoing your work, cutting, copying, pasting, and deleting, and selecting all your text. Leafpad uses Windows shortcuts too, so you can use Ctrl+C to copy, Ctrl+V to paste, Ctrl+X to cut, and Ctrl+A to select all the text.
The Search menu has options to find a particular word or phrase, jump to a particular line in the document, or replace a chosen word or phrase with an alternative. You can click the box to replace all in one go, or step through them individually. The search and replace features highlight all the occurrences in yellow, and the one that it’s currently focused on in blue. You can use the Search menu to move forward or backward through the list of results.
The Options menu (shown in Figure 4-12) has options to change the font (although the choices available are more limited than you’re probably used to), switch on Word Wrap (which means text goes on to a new line when it reaches the edge of the window, instead of a horizontal scrollbar appearing), and switch on Line Numbers (shown in the upper left in Figure 4-12). The auto indent feature means that any indentation used on one line is automatically applied to the next line when you press Enter.
You can do quite a few things to stamp your identity on LXDE and make it easier to use. Just like other desktop computers you might have used, you can change the look and feel of it. To find the options for this, click Customise Look and Feel in the Preferences section of the Programs menu. You can choose the default font and pick from different colors and styles used for the content of windows in the Widget tab, including a style named Redmond for the location of Microsoft’s HQ, which might be a suitable look for Windows users suffering from homesickness on their Raspberry Pi. In the Colour tab, you can choose your own color scheme. The Icon Theme tab gives you a choice of different icon sets, and you can change the layout of toolbars in the Other tab.
To adjust the sensitivity of the keyboard and mouse, use the keyboard and mouse settings in the Programs menu. For left-handers, you can swap the left and right mouse buttons too.
Two other entries in the Programs menu are available to tailor your desktop environment. The Openbox Configuration Manager gives you control over the look of menus and title bars at the top of your windows, where new windows appear, and how many desktops you have.
The Preferred Applications settings let you choose your default web browser and e-mail program, which is opened when you click on links to web pages or e-mail addresses. There is no e-mail program in LXDE, but you can add one of your own choice. Claws Mail is an e-mail program that works on the Raspberry Pi. The Raspberry Pi isn’t the ideal machine for this kind of application. Usually, you’d run something like this in the background while you do other things, but with the Pi’s limited memory, it can be a bit slow even when it’s focused exclusively on these activities. E-mail is one of the most popular computer activities today, however, so if you’d like to try it on the Raspberry Pi, give Claws a go. You can install using the following command line instruction (see Chapter 5):
sudo apt-get install claws-mail
It appears among Other applications in the Programs menu.
The taskbar at the bottom of the screen can be customized by right-clicking it and then selecting Panel Settings. You can move it to the top or one of the sides of the screen, change its height and the size of icons, change its background picture and colors, and change the tools you have on there (Panel Applets). Not all of these are useful on the Raspberry Pi, but you can add a volume control, which is useful. If you would rather not see the taskbar, you can set it to hide (minimize) when you’re not using it by going to Advanced options.
If you want to change your desktop wallpaper (the image behind the windows and icons), right-click the background and click Desktop Preferences. Click the filename of the wallpaper to choose a new one using a file browser that is a bit like File Manager. Click the pi icon in the Places list on the left to find your own photos to use as a background. You can set the wallpaper to be centered onscreen, repeated to cover it, or stretched to fill it.
To log out from LXDE and get back to the command prompt, click the red power off icon in the bottom right of the screen, or open the Programs menu and click Logout. You are prompted to confirm you want to log out, and LXDE then closes and returns you to the command line prompt. When you’ve finished with the command line, issue a command to shut down, as described in Chapter 5.
To switch off your Raspberry Pi without logging out, use the Shutdown icon on the desktop. After it’s shut down, you can disconnect the power. When you reconnect it, your Pi will start up again.
18.220.233.134