]> git.madduck.net Git - etc/awesome.git/blob - Utilities.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Updated yawn (rest)
[etc/awesome.git] / Utilities.md
1 [<- home](https://github.com/copycat-killer/lain/wiki)
2
3 markup
4 ------
5
6 This is a submodule which helps you markupping your text.
7
8 First, require it like this:
9
10     local markup = require("lain.util.markup")
11
12 then you can call its functions:
13
14      +-- markup
15      |
16      |`-- bold()        Set bold.
17      |`-- italic()      Set italicized text.
18      |`-- strike()      Set strikethrough text.
19      |`-- underline()   Set underlined text.
20      |`-- monospace()   Set monospaced text.
21      |`-- big()         Set bigger text.
22      |`-- small()       Set smaller text.
23      |`-- font()        Set the font of the text.
24      |
25      |`--+ bg
26      |   |
27      |   |`-- color()   Set background color.
28      |   |`-- focus()   Set focus  background color.
29      |   |`-- normal()  Set normal background color.
30      |    `-- urgent()  Set urgent background color.
31      |
32      |`--+ fg
33      |   |
34      |   |`-- color()   Set foreground color.
35      |   |`-- focus()   Set focus  foreground color.
36      |   |`-- normal()  Set normal foreground color.
37      |    `-- urgent()  Set urgent foreground color.
38      |
39      |`-- focus()       Set both foreground and background focus  colors.
40      |`-- normal()      Set both foreground and background normal colors.
41       `-- urgent()      Set both foreground and background urgent colors.
42
43 they all take one argument, which is the text to markup, except `fg.color` and `bg.color`:
44
45     markup.fg.color(text, color)
46     markup.bg.color(text, color)
47
48 menu\_clients\_current\_tags
49 ----------------------------
50
51 Similar to `awful.menu.clients()`, but this menu only shows the clients
52 of currently visible tags. Use it with a key binding like this:
53
54     awful.key({ "Mod1" }, "Tab", function()
55         awful.menu.menu_keys.down = { "Down", "Alt_L", "Tab", "j" }
56         awful.menu.menu_keys.up = { "Up", "k" }
57         lain.util.menu_clients_current_tags({ width = 350 }, { keygrabber = true })
58     end),
59
60 magnify\_client
61 ---------------
62
63 Set a client to floating and resize it in the same way the "magnifier"
64 layout does it. Place it on the "current" screen (derived from the mouse
65 position). This allows you to magnify any client you wish, regardless of
66 the currently used layout. Use it with a client keybinding like this:
67
68         clientkeys = awful.util.table.join(
69                 ...
70                 awful.key({ modkey, "Control" }, "m", lain.util.magnify_client),
71                 ...
72         )
73
74 If you want to "de-magnify" it, just reset the clients floating state to
75 `false` (hit `Mod4`+`CTRL`+`Space`, for example).
76
77 niceborder\_{focus, unfocus}
78 ----------------------------
79
80 By default, your `rc.lua` contains something like this:
81
82         client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
83         client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
84
85 You can change it to this:
86
87         client.connect_signal("focus", lain.util.niceborder_focus(c))
88         client.connect_signal("unfocus", lain.util.niceborder_unfocus(c))
89
90 Now, when a client is focused or unfocused, Awesome will look up its
91 nice value in `/proc/<pid>/stat`. If it's less than 0, the client is
92 classified as "high priority"; if it's greater than 0, the client is
93 classified as "low priority". If it's equal to 0, nothing special
94 happens.
95
96 This requires to define additional colors in your `theme.lua`. For example:
97
98         theme.border_focus_highprio  = "#FF0000"
99         theme.border_normal_highprio = "#A03333"
100
101         theme.border_focus_lowprio   = "#3333FF"
102         theme.border_normal_lowprio  = "#333366"
103
104 tag\_view\_nonempty
105 -------------------
106
107 This function lets you jump to the next/previous non-empty tag.
108 It takes two arguments:
109
110 * `direction`: `1` for next non-empty tag, `-1` for previous.
111 * `sc`: Screen which the taglist is in. Default is `mouse.screen` or `1`. This
112   argument is optional.
113
114 You can use it with key bindings like these:
115
116     -- Non-empty tag browsing
117     awful.key({ altkey }, "Left", function () lain.util.tag_view_nonempty(-1) end),
118     awful.key({ altkey }, "Right", function () lain.util.tag_view_nonempty(1) end),
119
120 where `altkey = "Mod1"`.
121
122 prompt\_rename\_tag
123 -------------------
124
125 This function enables you to dynamically rename the current tag you have focused.
126
127 You can use it with a key binding like this:
128
129     awful.key({ modkey, "Shift" }, "r", function () lain.util.prompt_rename_tag(mypromptbox) end)
130
131 Credits goes to [minism](https://bbs.archlinux.org/viewtopic.php?pid=1315135#p1315135).