TranslateProject/sources/tech/20191219 Go mouseless with the Linux Ratpoison window manager.md
DarkSun 5cc6600ae3 选题: 20191219 Go mouseless with the Linux Ratpoison window manager
sources/tech/20191219 Go mouseless with the Linux Ratpoison window manager.md
2019-12-20 00:55:40 +08:00

7.6 KiB

Go mouseless with the Linux Ratpoison window manager

This article is part of a special series of 24 days of Linux desktops. If you'd rather live in a terminal all day and avoid mousing around, the Ratpoison window manager is the solution for you. Buildings with different color windows

Maybe you don't like desktops. Maybe even a lightweight window manager seems excessive to you. Maybe all you really use is a graphical user interface (GUI) application or two, and you're otherwise perfectly happy living in a terminal all day. If one or more of these sentiments sound familiar, then Ratpoison is the solution.

Ratpoison

The Ratpoison window manager models itself after GNU Screen. All window controls are performed with keyboard shortcuts, so you don't have to grab the mouse just to move a window out of your way. The trade-off is that it's impossibly minimalistic, which is, conveniently, also its greatest strength.

Installing Ratpoison

Install Ratpoison from your distribution's software repository. After installing it, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in.

With GDM:

With SDDM:

Ratpoison desktop tour

The first time you log into Ratpoison, you are greeted by a black screen with some text in the upper-right corner telling you that you can press Ctrl+t for help.

That's all there is to the Ratpoison desktop.

Interacting with Ratpoison

Ratpoison documentation uses Emacs-style notation for keyboard controls, so I'll use the same notation in this article. If you're unfamiliar with Emacs or GNU Screen, it can look confusing at first, so here's explicit instruction on how to "decode" this style of notation. The Control key on your keyboard is written as C-. To trigger Ratpoison's command mode, you press C-t, which means that you press Ctrl+t.

Since the C-t shortcut puts you into command mode, it's expected that some other key sequence will follow. For instance, to launch an xterm window, press Ctrl+t, just as you would when opening a new tab in a web browser, then press c. This may feel a little unnatural at first, because most of the keyboard shortcuts you're used to probably involve only one action. Ratpoison (and GNU Screen and Emacs) more often involve two.

The first application you probably should launch is either Emacs or a terminal.

In Ratpoison, your terminal is your exclusive gateway to the rest of the computer because there's no application menu or icons to click. The default terminal is the humble xterm, and it's available with the C-t c shortcut (I remember the c as being short for "console").

Launching applications

I usually start with Emacs instead, because it has most of the features I use anyway, including the shell terminal and the dired file manager. To start an arbitrary application in Ratpoison, press C-t and then the ! (exclamation point) symbol. This provides a prompt in the upper-right corner of the screen. Type the command for the application you want to start and press Return or Enter to launch it.

Switching windows

Each application you launch takes over the entire screen by default. That means if urxvt is running, and then you launch Emacs, you can no longer interact with urxvt. Because switching back and forth between two application windows is a pretty common task, Ratpoison assigns it to the same keystroke as your usual Ratpoison command: C-t C-t. That means you press Ctrl+t once, and then Ctrl+t a second time. This is a toggle, like the default (at least in KDE and GNOME) behavior of a quick Alt+Tab.

To cycle through all open windows, use C-t n for next and C-t p for previous.

Tiling window manager

You're free to use Ratpoison as a full-screen viewscreen, but most of us are used to seeing more than one window at a time. To allow that, Ratpoison lets you split your screen into frames or tiles and launch an application within each space.

Ratpoison in split-screen mode

With at least one application open, you can split the screen horizontally with C-t s (that's a lowercase "s") or vertically with C-t S (that's a capital "S").

To switch to another frame, use C-t Tab.

To remove another frame, press C-t R.

Moving windows in split-screen mode

Rearranging frames when Ratpoison has been split into several parts is done with the Ctrl key and a corresponding Arrow key. For instance, suppose you have a vertical split in the top half of your screen and a single frame in the bottom half. If an application is in the top-left frame, and you want to move it to the lower half of the screen, then—with that application active (use C-t Tab to get there)—press C-t to enter command mode and then C-Down (that's Ctrl with the Down arrow key). The application moves to the bottom half of the screen, with the application that took up the bottom half moving into the top-left.

To move that application to the top-right frame instead, press C-t Right (Ctrl with the Right arrow key).

To remove the top-left frame entirely, use C-t R. This doesn't kill the application in the frame, it only removes the frame from your viewport. The application that once occupied the frame is sent to the background and can be reached by cycling through the windows as usual (C-t n, for instance).

Why you need to try Ratpoison

Ratpoison is a great example of an early (but current) tiling window manager. Other window managers like it exist, and some desktops even borrow concepts from this tradition by offering tiling features (KWin in KDE, for example, has an option to spawn new windows in tiles across the desktop).

If you've never used a tiling window manager, you owe it to yourself to try at least once. First, make it a goal to use Ratpoison. Then make it a goal to get through a whole afternoon without your mouse. Once you get the hang of it, you might be surprised at how quickly you can work.


via: https://opensource.com/article/19/12/ratpoison-linux-desktop

作者:Seth Kenlon 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出