-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpanel.lua
89 lines (79 loc) · 3.31 KB
/
panel.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
require "taglist"
local volume_widget = require("volume-control")
mykeyboardlayout = awful.widget.keyboardlayout()
mytextclock = awful.widget.watch("date +'%a %b %d %R'", 60)
local tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end),
awful.button({ }, 3, function()
awful.menu.client_list()
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
function create_panel(s)
-- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6" }, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(gears.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
-- Create a taglist widget
s.mytaglist = create_taglist(s)
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = tasklist_buttons,
}
-- Create the wibox
s.mywibox = awful.wibar({ position = "top",
screen = s,
height = 20,
})
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
s.mytaglist,
},
{
layout = wibox.layout.fixed.horizontal,
s.mytasklist, -- Middle widget
},
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
wibox.widget.systray(),
mykeyboardlayout,
mytextclock,
volume_widget({
device = "pulse"
}),
s.mylayoutbox,
},
}
end
awful.screen.connect_for_each_screen(
function(s)
create_panel(s)
end
)