Fixed formatting

This commit is contained in:
Drauthius 2018-11-10 13:56:31 +01:00
parent 954b24addf
commit f18fbbd44a
1 changed files with 60 additions and 64 deletions

124
README.md
View File

@ -25,76 +25,72 @@ Installation
configuration is included in the repository for easy comparison, but keep
reading for a textual description.
1. Require the `sharedtags` library somewhere at the top of the file.
```lua
local sharedtags = require("sharedtags")
```
```lua
local sharedtags = require("sharedtags")
```
2. Create the tags using the `sharedtags()` method, instead of the original
ones created with `awful.tag()`.
```lua
local tags = sharedtags(
{ name = "main", layout = layouts[2] },
{ name = "www", layout = awful.layout.suit.max },
{ name = "chat", screen = 2, layout = layouts[1] },
{ layout = layouts[2] },
{ screen = 2, layout = layouts[2] }
)
```
```lua
local tags = sharedtags(
{ name = "main", layout = layouts[2] },
{ name = "www", layout = awful.layout.suit.max },
{ name = "chat", screen = 2, layout = layouts[1] },
{ layout = layouts[2] },
{ screen = 2, layout = layouts[2] }
)
```
3. The code for handling tags and clients needs to be changed to use the
library.
```lua
for i = 1, 9 do
globalkeys = awful.util.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
function ()
local tag = tags[i]
if tag then
sharedtags.viewonly(tag)
end
end),
-- Toggle tag.
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local tag = tags[i]
if tag then
sharedtags.viewtoggle(tag)
end
end),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = tags[i]
if tag then
awful.client.movetotag(tag)
end
end
end),
-- Toggle tag.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = tags[i]
if tag then
awful.client.toggletag(tag)
end
end
end))
end
```
```lua
for i = 1, 9 do
globalkeys = awful.util.table.join(globalkeys,
-- View tag only.
awful.key({ modkey }, "#" .. i + 9,
function ()
local tag = tags[i]
if tag then
sharedtags.viewonly(tag)
end
end),
-- Toggle tag.
awful.key({ modkey, "Control" }, "#" .. i + 9,
function ()
local tag = tags[i]
if tag then
sharedtags.viewtoggle(tag)
end
end),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = tags[i]
if tag then
awful.client.movetotag(tag)
end
end
end),
-- Toggle tag.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = tags[i]
if tag then
awful.client.toggletag(tag)
end
end
end))
end
```
4. Lastly, since the tag list is now a one-dimensional array, any references
to the `tags` array needs to be changed, for example in the rules section.
```lua
awful.rules.rules = {
-- Set Firefox to always map on tag number 2.
{ rule = { class = "Firefox" },
properties = { tag = tags[2] } }, -- or tags["www"] to map it to the name instead
}
```
```lua
awful.rules.rules = {
-- Set Firefox to always map on tag number 2.
{ rule = { class = "Firefox" },
properties = { tag = tags[2] } }, -- or tags["www"] to map it to the name instead
}
```
3. Restart or reload *awesome*.
Notes