mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
145 lines
8.4 KiB
Markdown
145 lines
8.4 KiB
Markdown
|
[#]: subject: "Why sysadmins should choose Awesome window manager on Linux"
|
||
|
[#]: via: "https://opensource.com/article/22/11/linux-awesome-window-manager"
|
||
|
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||
|
[#]: collector: "lkxed"
|
||
|
[#]: translator: " "
|
||
|
[#]: reviewer: " "
|
||
|
[#]: publisher: " "
|
||
|
[#]: url: " "
|
||
|
|
||
|
Why sysadmins should choose Awesome window manager on Linux
|
||
|
======
|
||
|
|
||
|
The Awesome window manager takes a "tiling" approach, meaning that each window you launch takes up a fraction of your desktop according to the number of windows you have open.
|
||
|
|
||
|
Awesome is a window manager for the [Linux desktop][1]. A "window manager" is a graphical interface that primarily (if not literally) just manages the drawing and arrangement of windows. In practice, even the [most rudimentary][2] of window managers actually provides a little more than just the ability to draw a window. Most also provide a pop-up menu so you can launch an application, some provide a dock or panel so you can switch between different applications you have running. They stop short at providing desktop conveniences such as drawing a wallpaper in the background of your screen, mounting and unmounting devices, providing a system tray, and so on. A window manager assumes you can use other applications to build a desktop experience to your own liking, and so it focuses on managing windows. The Awesome window manager takes a "tiling" approach, meaning that each window you launch takes up a fraction of your desktop according to the number of windows you have open.
|
||
|
|
||
|
![Image of the Awesome desktop.][3]
|
||
|
|
||
|
### My Linux desktop is the terminal
|
||
|
|
||
|
When you're a [systems administrator][4], you tend to spend a lot of time in a terminal window. It's a direct and efficient interface to your local machine, to remote machines, the network, the Internet, and everything else, so it's usually the easiest and most sensible way to do a lot of things to a lot of computers at once. And when you spend all day in a terminal, you understandably start to question whether you actually need a desktop at all.
|
||
|
|
||
|
To be perfectly honest, the answer's often no, at least for 80% of your tasks. The reality of modern computing, however, is that there are some applications that are just easier to use through a graphical interface. For instance, even though there are issue tracking systems, like the open source Bugzilla, that provide terminal commands as an interface, sometimes you're on a team that uses an issue tracker (usually it's not open source) that provides only a web application. Like it or not, you need a web browser to interact with the ticketing system. And even though you may use a perfectly reasonable markup language like [AsciiDoc][5], you're probably sent a word processor document sometimes and, while you could use [Pandoc][6] to convert the document into AsciiDoc and then back into an office document, that risks losing something in translation. Like it or not, you need an office suite.
|
||
|
|
||
|
The bottom line is that, whether you like it or not, you need a desktop. Or at least a window manager.
|
||
|
|
||
|
### Tiling windows
|
||
|
|
||
|
Awesome understands your plight. With Awesome, your "primary" desktop can be your terminal. When you first launch it, your terminal window is full screen, just like the text console you really want to be greeted with upon login. When you really need web browser, though, you can launch it and Awesome makes room for it by splitting your screen in half. Your terminal is on one side, the web browser's on the other.
|
||
|
|
||
|
If you need to open a third application, you can launch that and Awesome makes room for it by splitting your screen into thirds.
|
||
|
|
||
|
![Image of Awesome tiles.][7]
|
||
|
|
||
|
When you're finished with an application, Awesome adjusts your layout again until, eventually, you're back to a full-screen terminal, just the way you like it.
|
||
|
|
||
|
### Lua configuration
|
||
|
|
||
|
Awesome uses the [Lua][8] scripting language for configuration. Lua has a similar philosophy to Awesome. It's a simple language that's pretty intuitive once you understand a few basic concepts.
|
||
|
|
||
|
The simplest concept, and yet the most important, is the Lua table construct. Lua stores information in what it calls a "table", and it means that most everything in Lua has a structured hierarchy. For instance, this creates a Lua table:
|
||
|
|
||
|
```
|
||
|
zombie = {}
|
||
|
|
||
|
zombie.apocalypse = true
|
||
|
zombie.defeat = false
|
||
|
```
|
||
|
|
||
|
Now when you need to know whether there's an active zombie apocalypse, you can "call" the zombie table and query the `apocalypse` value:
|
||
|
|
||
|
```
|
||
|
> print(zombie.apocalypse)
|
||
|
true
|
||
|
```
|
||
|
|
||
|
Both the `apocalypse` and the `defeat` values are "children" of the `zombie` table, which makes them each distinct from the `apocalypse` and `defeat` values of the `alien` table.
|
||
|
|
||
|
It's a simple system of data classification, and you see several tables used in the Awesome configuration:
|
||
|
|
||
|
```
|
||
|
-- Table of layouts
|
||
|
awful.layout.layouts = {
|
||
|
awful.layout.suit.floating,
|
||
|
awful.layout.suit.tile,
|
||
|
awful.layout.suit.tile.left,
|
||
|
awful.layout.suit.tile.bottom,
|
||
|
awful.layout.suit.tile.top,
|
||
|
awful.layout.suit.fair,
|
||
|
awful.layout.suit.fair.horizontal,
|
||
|
awful.layout.suit.spiral,
|
||
|
awful.layout.suit.spiral.dwindle,
|
||
|
awful.layout.suit.max,
|
||
|
awful.layout.suit.max.fullscreen,
|
||
|
awful.layout.suit.magnifier,
|
||
|
awful.layout.suit.corner.nw,
|
||
|
}
|
||
|
```
|
||
|
|
||
|
You may not know what options are available from reading the configuration file itself, but understanding that the options are grouped into Lua tables means you know what to look up in the Awesome documentation.
|
||
|
|
||
|
Of course, if you don't feel like reading through the documentation, you can also just comment options out and see what changes. A comment in Lua are two dashes, as in the first line of this snippet:
|
||
|
|
||
|
```
|
||
|
-- Create a launcher widget and a main menu
|
||
|
myawesomemenu = {
|
||
|
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
|
||
|
{ "manual", terminal .. " -e man awesome" },
|
||
|
{ "edit config", editor_cmd .. " " .. awesome.conffile },
|
||
|
{ "restart", awesome.restart },
|
||
|
{ "quit", function() awesome.quit() end },
|
||
|
}
|
||
|
```
|
||
|
|
||
|
Lua is a consistent and logical language. Any amount of Lua you pick up from configuring Awesome is Lua you can use for real life Lua scripting. If you're ready to move up from basic Bash scripting, you might consider Lua.
|
||
|
|
||
|
### Adjusting tiles
|
||
|
|
||
|
While you're working in a split screen in Awesome, you might find the need to adjust the proportions. To do this graphically, right-click on the intersection the windows you want to adjust, and then drag all window borders to suit your preference.
|
||
|
|
||
|
When you learn enough Lua to get really good at configuring Awesome, you can configure default preferences.
|
||
|
|
||
|
### Floating windows
|
||
|
|
||
|
Some applications never make sense as tiled windows. The Awesome configuration provided by your Linux distribution probably has a few examples set:
|
||
|
|
||
|
```
|
||
|
-- Floating clients.
|
||
|
class = {
|
||
|
"Blueman-manager",
|
||
|
"Kruler",
|
||
|
"MessageWin",
|
||
|
"Tor Browser",
|
||
|
"Wpa_gui"},
|
||
|
},
|
||
|
```
|
||
|
|
||
|
### Assemble your own Linux desktop
|
||
|
|
||
|
Using a window manager instead of a desktop means you get to choose the components you use for everything else you want to do with your computer. You can launch KDE applications from the [Plasma Desktop][9], or use bits and pieces of [XFCE][10] (such as the panel, the network manager, and more), or you can eschew the desktop model entirely and use a particularly robust file manager and the terminal commands you know and love.
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
via: https://opensource.com/article/22/11/linux-awesome-window-manager
|
||
|
|
||
|
作者:[Seth Kenlon][a]
|
||
|
选题:[lkxed][b]
|
||
|
译者:[译者ID](https://github.com/译者ID)
|
||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||
|
|
||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||
|
|
||
|
[a]: https://opensource.com/users/seth
|
||
|
[b]: https://github.com/lkxed
|
||
|
[1]: https://opensource.com/article/20/5/linux-desktops
|
||
|
[2]: https://opensource.com/article/19/12/twm-linux-desktop
|
||
|
[3]: https://opensource.com/sites/default/files/2022-10/awesome-desktop.png
|
||
|
[4]: https://www.redhat.com/sysadmin/?intcmp=7013a000002qLH8AAM
|
||
|
[5]: https://opensource.com/article/22/8/drop-markdown-asciidoc
|
||
|
[6]: https://opensource.com/article/20/5/pandoc-cheat-sheet
|
||
|
[7]: https://opensource.com/sites/default/files/2022-10/awesome-tiles.png
|
||
|
[8]: https://opensource.com/article/22/11/lua-worth-learning
|
||
|
[9]: https://opensource.com/article/19/12/linux-kde-plasma
|
||
|
[10]: https://opensource.com/article/18/6/xfce-desktop
|