]> git.rmz.io Git - dotfiles.git/blob - awesome/conky.lua
fix battery widget
[dotfiles.git] / awesome / conky.lua
1 -- http://awesome.naquadah.org/wiki/Conky_HUD
2 local utils = require("utils")
3
4 local function get_conky()
5 local clients = client.get()
6 local conky = nil
7 local i = 1
8 while clients[i]
9 do
10 if clients[i].class == "Conky"
11 then
12 conky = clients[i]
13 end
14 i = i + 1
15 end
16 return conky
17 end
18
19 local function raise_conky()
20 local conky = get_conky()
21 if conky
22 then
23 conky.ontop = true
24 end
25 end
26
27 local function lower_conky()
28 local conky = get_conky()
29 if conky
30 then
31 conky.ontop = false
32 end
33 end
34
35 local function toggle_conky()
36 local conky = get_conky()
37 if conky
38 then
39 if conky.ontop
40 then
41 conky.ontop = false
42 else
43 conky.ontop = true
44 end
45 end
46 end
47
48 utils.rules.append({
49 { rule = { class = "Conky" },
50 properties = { floating = true,
51 sticky = true,
52 ontop = false,
53 focusable = true,
54 size_hints = {"program_position", "program_size"}
55 } },
56 })
57
58 -- add global key
59 utils.globalkeys.append(awful.key({}, "F4", function () raise_conky() end, function () lower_conky() end))
60
61 utils.run_once("conky")