]> git.rmz.io Git - dotfiles.git/blob - awesome/topbar.lua
mutt: only use utf8
[dotfiles.git] / awesome / topbar.lua
1 -- utils
2 local utils = require("utils")
3
4 -- Widget and layout library
5 local wibox = require("wibox")
6
7 -- Create a textclock widget
8 separator = wibox.widget.textbox()
9 separator:set_markup('<span font="Symbola 10" color="#404040">│</span>')
10
11 -- Wibox {{{1
12 -- Create a wibox for each screen and add it
13 local taglist_buttons = awful.util.table.join(
14 awful.button({ }, 1, function(t) t:view_only() end),
15 awful.button({ modkey }, 1, function(t)
16 if client.focus then
17 client.focus:move_to_tag(t)
18 end
19 end),
20 awful.button({ }, 3, awful.tag.viewtoggle),
21 awful.button({ modkey }, 3, function(t)
22 if client.focus then
23 client.focus:toggle_tag(t)
24 end
25 end),
26 awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
27 awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
28 )
29
30 local tasklist_buttons = awful.util.table.join(
31 awful.button({ }, 1, function (c)
32 if c == client.focus then
33 c.minimized = true
34 else
35 -- Without this, the following
36 -- :isvisible() makes no sense
37 c.minimized = false
38 if not c:isvisible() and c.first_tag then
39 c.first_tag:view_only()
40 end
41 -- This will also un-minimize
42 -- the client, if needed
43 client.focus = c
44 c:raise()
45 end
46 end),
47 awful.button({ }, 2, function (c) c:kill() end),
48 awful.button({ }, 3, function ()
49 if instance and instance.wibox.visible then
50 instance:hide()
51 instance = nil
52 else
53 instance = awful.menu.clients({ theme = { width=250 }})
54 end
55 end),
56 awful.button({ }, 4, function ()
57 awful.client.focus.byidx(1)
58 end),
59 awful.button({ }, 5, function ()
60 awful.client.focus.byidx(-1)
61 end))
62
63
64 awful.screen.connect_for_each_screen(function(s)
65 -- Create a promptbox for each screen
66 s.mypromptbox = awful.widget.prompt()
67 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
68 -- We need one layoutbox per screen.
69 s.mylayoutbox = awful.widget.layoutbox(s)
70 s.mylayoutbox:buttons(awful.util.table.join(
71 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
72 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
73 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
74 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
75 -- Create a taglist widget
76 s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
77
78 -- Create a tasklist widget
79 s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
80
81 -- Create the wibox
82 s.mywibox = awful.wibar({ position = "top", screen = s })
83
84 -- Add widgets to the wibox
85 s.mywibox:setup {
86 layout = wibox.layout.align.horizontal,
87 { -- Left widgets
88 layout = wibox.layout.fixed.horizontal,
89 -- mylauncher,
90 s.mytaglist,
91 s.mypromptbox,
92 },
93 s.mytasklist, -- Middle widget
94 { -- Right widgets
95 layout = wibox.layout.fixed.horizontal,
96 mykeyboardlayout,
97 wibox.widget.systray(),
98 separator,
99 require("widgets/pomodoro"),
100 separator,
101 require("widgets/awesompd"),
102 require("widgets/volume_widget"),
103 utils.has_battery() and {
104 layout = wibox.layout.fixed.horizontal,
105 separator,
106 require("widgets/battery_widget"),
107 },
108 separator,
109 require("widgets/network_widget"),
110 separator,
111 require("widgets/calendar"),
112 s.mylayoutbox,
113 },
114 }
115 end)