author | Fabien Ninoles <fabien@tzone.org> |
Sun, 13 Sep 2015 22:53:18 -0400 | |
changeset 15 | 73df43769340 |
parent 14 | 6348b9f842b2 |
child 16 | b3c1a18fe12e |
permissions | -rw-r--r-- |
15 | 1 |
local debug = require("debug") |
2 |
-- |
|
7 | 3 |
-- Standard awesome library |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
4 |
local gears = require("gears") |
11 | 5 |
local awful = require("awful") |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
6 |
awful.rules = require("awful.rules") |
15 | 7 |
awful.autofocus = require("awful.autofocus") |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
8 |
-- Widget and layout library |
11 | 9 |
local wibox = require("wibox") |
7 | 10 |
-- Theme handling library |
11 | 11 |
local beautiful = require("beautiful") |
7 | 12 |
-- Notification library |
11 | 13 |
local naughty = require("naughty") |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
14 |
local menubar = require("menubar") |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
15 |
|
15 | 16 |
-- Revelation |
17 |
local revelation = require("revelation") |
|
18 |
-- vicious widgets |
|
19 |
local vicious = require("vicious") |
|
20 |
local wicked = require("wicked") |
|
7 | 21 |
-- Load Debian menu entries |
22 |
require("debian.menu") |
|
23 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
24 |
local my = require("my") |
7 | 25 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
26 |
local titlebars_enabled = false |
7 | 27 |
|
28 |
-- {{{ Error handling |
|
29 |
-- Check if awesome encountered an error during startup and fell back to |
|
30 |
-- another config (This code will only ever execute for the fallback config) |
|
31 |
if awesome.startup_errors then |
|
15 | 32 |
naughty.notify({ preset = naughty.config.presets.critical, |
33 |
title = "Oops, there were errors during startup!", |
|
34 |
text = awesome.startup_errors }) |
|
7 | 35 |
end |
36 |
||
37 |
-- Handle runtime errors after startup |
|
38 |
do |
|
11 | 39 |
awesome.connect_signal("debug::error", my.notify_error) |
12 | 40 |
awesome.connect_signal("debug::deprecation", my.notify_error) |
41 |
awesome.connect_signal("debug::index::miss", |
|
42 |
function (obj, key) |
|
43 |
my.notify_error("Invalid key " .. key .. " on object") |
|
44 |
end) |
|
45 |
awesome.connect_signal("debug::newindex::miss", |
|
46 |
function (obj, key, value) |
|
47 |
my.notify_error("Trying to set key " .. key .. " on object") |
|
48 |
end) |
|
7 | 49 |
end |
50 |
-- }}} |
|
51 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
52 |
-- {{{ Variable definitions |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
53 |
-- Themes define colours, icons, font and wallpapers. |
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
54 |
theme_path = awful.util.getdir("config") .. "/current_theme/theme.lua" |
7 | 55 |
-- This is used later as the default terminal and editor to run. |
56 |
terminal = "x-terminal-emulator" |
|
8 | 57 |
-- terminal = "terminology" |
7 | 58 |
editor = os.getenv("EDITOR") or "editor" |
59 |
editor_cmd = terminal .. " -e " .. editor |
|
60 |
browser = "iceweasel" |
|
61 |
mail = "icedove" |
|
62 |
musicplayer = "ario" |
|
63 |
monitor = "gnome-system-monitor" |
|
64 |
filemanager = "pcmanfm" |
|
65 |
lookup = "pcmanfm -f" |
|
66 |
calculator = "galculator" |
|
8 | 67 |
-- Logout method |
68 |
-- logout = awesome.quit |
|
69 |
logout = my.mkspawn("obsession-logout") |
|
7 | 70 |
|
71 |
-- Default modkey. |
|
72 |
-- Usually, Mod4 is the key with a logo between Control and Alt. |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
73 |
-- If you do not like this or do not have such a key, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
74 |
-- I suggest you to remap Mod4 to another key using xmodmap or other tools. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
75 |
-- However, you can use another modifier like Mod1, but it may interact with others. |
7 | 76 |
modkey = "Mod4" |
77 |
||
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
78 |
wallpaper = awful.util.getdir("config") .. "/default" |
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
79 |
wallpaper_cmd = "fbsetbg -a " .. wallpaper |
7 | 80 |
|
81 |
-- Actually load theme |
|
82 |
beautiful.init(theme_path) |
|
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
83 |
beautiful.wallpaper_cmd = { wallpaper_cmd } |
7 | 84 |
awful.util.spawn_with_shell("pgrep unagi || unagi &") |
85 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
86 |
-- Table of layouts to cover with awful.layout.inc, order matters. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
87 |
local layouts = |
15 | 88 |
{ |
89 |
awful.layout.suit.floating, |
|
90 |
awful.layout.suit.tile, |
|
91 |
awful.layout.suit.tile.left, |
|
92 |
awful.layout.suit.tile.bottom, |
|
93 |
awful.layout.suit.tile.top, |
|
94 |
awful.layout.suit.fair, |
|
95 |
awful.layout.suit.fair.horizontal, |
|
96 |
awful.layout.suit.spiral, |
|
97 |
awful.layout.suit.spiral.dwindle, |
|
98 |
awful.layout.suit.max, |
|
99 |
-- awful.layout.suit.max.fullscreen, |
|
100 |
awful.layout.suit.magnifier, |
|
101 |
} |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
102 |
local default_layout = 2 |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
103 |
-- }}} |
7 | 104 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
105 |
-- {{{ Wallpaper |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
106 |
if beautiful.wallpaper then |
15 | 107 |
for s = 1, screen.count() do |
108 |
-- gears.wallpaper.maximized(beautiful.wallpaper, s, true) |
|
109 |
awful.util.spawn(wallpaper_cmd, false, s) |
|
110 |
end |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
111 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
112 |
-- }}} |
7 | 113 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
114 |
-- {{{ Tags |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
115 |
-- Define a tag table which hold all screen tags. |
15 | 116 |
local mytags = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 } |
117 |
local number_of_rows = #mytags |
|
118 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
119 |
tags = {} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
120 |
for s = 1, screen.count() do |
15 | 121 |
-- Each screen has its own tag table. |
122 |
tags[s] = awful.tag(mytags, s, layouts[default_layout]) |
|
123 |
end |
|
124 |
||
125 |
local function get_tag(s, i) |
|
126 |
return awful.tag.gettags(s)[i] |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
127 |
end |
15 | 128 |
|
129 |
local function get_next_tag(s) |
|
130 |
local idx = awful.tag.getidx() + 1 |
|
131 |
if idx > number_of_rows then |
|
132 |
idx = 1 |
|
133 |
end |
|
134 |
return get_tag(s, idx) |
|
135 |
end |
|
136 |
||
137 |
local function get_prev_tag(s) |
|
138 |
local idx = awful.tag.getidx() - 1 |
|
139 |
if idx < 1 then |
|
140 |
idx = number_of_rows |
|
141 |
end |
|
142 |
return get_tag(s, idx) |
|
143 |
end |
|
144 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
145 |
-- }}} |
7 | 146 |
|
147 |
-- Create a laucher widget and a main menu |
|
148 |
myawesomemenu = { |
|
149 |
{"manual", terminal .. " -e man awesome"}, |
|
150 |
{"edit config", |
|
151 |
editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua"}, |
|
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
152 |
{"themes", my.theme_menu()}, |
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
153 |
{"wallpapers", my.wallpaper_menu()}, |
7 | 154 |
{"restart", awesome.restart}, |
155 |
{"quit", my.quit} |
|
156 |
} |
|
157 |
||
158 |
mymainmenu = awful.menu( |
|
159 |
{ |
|
160 |
items = { |
|
161 |
{"awesome", myawesomemenu, beautiful.awesome_icon}, |
|
162 |
{ "Debian", debian.menu.Debian_menu.Debian }, |
|
163 |
{"open terminal", terminal}} |
|
164 |
}) |
|
165 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
166 |
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
167 |
menu = mymainmenu }) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
168 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
169 |
-- Menubar configuration |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
170 |
menubar.utils.terminal = terminal -- Set the terminal for applications that require it |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
171 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
172 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
173 |
-- {{{ Wibox |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
174 |
-- Create a textclock widget |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
175 |
mytextclock = awful.widget.textclock() |
7 | 176 |
|
177 |
-- Create a systray |
|
11 | 178 |
mysystray = wibox.widget.systray({align = "right"}) |
7 | 179 |
|
180 |
-- Create a wibox for each screen and add it |
|
181 |
mywibox = {} |
|
182 |
mypromptbox = {} |
|
183 |
mylayoutbox = {} |
|
184 |
mytaglist = {} |
|
185 |
mytaglist.buttons = awful.util.table.join( |
|
15 | 186 |
awful.button({ }, 1, awful.tag.viewonly), |
187 |
awful.button({ modkey }, 1, awful.client.movetotag), |
|
188 |
awful.button({ }, 3, awful.tag.viewtoggle), |
|
189 |
awful.button({ modkey }, 3, awful.client.toggletag), |
|
190 |
awful.button({ }, 4, function(t) |
|
191 |
awful.tag.viewnext(awful.tag.getscreen(t)) end), |
|
192 |
awful.button({ }, 5, function(t) |
|
193 |
awful.tag.viewprev(awful.tag.getscreen(t)) end) |
|
7 | 194 |
) |
195 |
mytasklist = {} |
|
196 |
mytasklist.buttons = awful.util.table.join( |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
197 |
awful.button({ }, 1, function (c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
198 |
if c == client.focus then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
199 |
c.minimized = true |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
200 |
else |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
201 |
-- Without this, the following |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
202 |
-- :isvisible() makes no sense |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
203 |
c.minimized = false |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
204 |
if not c:isvisible() then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
205 |
awful.tag.viewonly(c:tags()[1]) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
206 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
207 |
-- This will also un-minimize |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
208 |
-- the client, if needed |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
209 |
client.focus = c |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
210 |
c:raise() |
7 | 211 |
end |
212 |
end), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
213 |
awful.button({ }, 3, function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
214 |
if instance then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
215 |
instance:hide() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
216 |
instance = nil |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
217 |
else |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
218 |
instance = awful.menu.clients({ |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
219 |
theme = { width = 250 } |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
220 |
}) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
221 |
end |
7 | 222 |
end), |
15 | 223 |
awful.button({modkey}, 3, function(c) |
224 |
c.maximized = not c.maximized |
|
225 |
end), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
226 |
awful.button({ }, 4, function () |
7 | 227 |
awful.client.focus.byidx(1) |
228 |
if client.focus then client.focus:raise() end |
|
229 |
end), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
230 |
awful.button({ }, 5, function () |
7 | 231 |
awful.client.focus.byidx(-1) |
232 |
if client.focus then client.focus:raise() end |
|
233 |
end)) |
|
234 |
||
235 |
local mycpuwidget = my.widgets.decorated(my.widgets.cpu(), my.mkspawn(monitor)) |
|
236 |
local mymemwidget = my.widgets.decorated(my.widgets.mem(), my.mkspawn(monitor)) |
|
237 |
local mynetwidget = my.widgets.decorated(my.widgets.net("eth1"), my.mkspawn(monitor)) |
|
238 |
-- local mynetupwidget = my.decorated_monitor_widget(make_netwidget("eth1", "up")) |
|
239 |
-- local mynetdownwidget = my.decorated_monitor_widget(make_netwidget("eth1", "down")) |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
240 |
local mymodewidget = my.widgets.mode() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
241 |
|
7 | 242 |
|
243 |
for s = 1, screen.count() do |
|
244 |
||
15 | 245 |
-- Create a promptbox for each screen |
246 |
mypromptbox[s] = awful.widget.prompt() |
|
247 |
-- Create an imagebox widget which will contains an icon indicating which layout we're using. |
|
248 |
-- We need one layoutbox per screen. |
|
249 |
mylayoutbox[s] = awful.widget.layoutbox(s) |
|
250 |
mylayoutbox[s]:buttons(awful.util.table.join( |
|
251 |
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), |
|
252 |
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), |
|
253 |
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), |
|
254 |
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) |
|
255 |
-- Create a taglist widget |
|
256 |
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) |
|
7 | 257 |
|
15 | 258 |
-- Create a tasklist widget |
259 |
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) |
|
260 |
||
261 |
-- Create the wibox |
|
262 |
mywibox[s] = awful.wibox({ position = "top", screen = s }) |
|
7 | 263 |
|
15 | 264 |
-- Widgets that are aligned to the left |
265 |
local left_layout = wibox.layout.fixed.horizontal() |
|
266 |
left_layout:add(mymodewidget) |
|
267 |
left_layout:add(mylauncher) |
|
268 |
if s == 1 then |
|
269 |
left_layout:add(mycpuwidget) |
|
270 |
left_layout:add(mymemwidget) |
|
271 |
end |
|
272 |
left_layout:add(mytaglist[s]) |
|
273 |
left_layout:add(mypromptbox[s]) |
|
11 | 274 |
|
15 | 275 |
-- Widgets that are aligned to the right |
276 |
local right_layout = wibox.layout.fixed.horizontal() |
|
277 |
if s == 1 then |
|
278 |
right_layout:add(mynetwidget) |
|
279 |
right_layout:add(mysystray) |
|
280 |
end |
|
281 |
right_layout:add(mytextclock) |
|
282 |
right_layout:add(mylayoutbox[s]) |
|
7 | 283 |
|
15 | 284 |
-- Now bring it all together (with the tasklist in the middle) |
285 |
local layout = wibox.layout.align.horizontal() |
|
286 |
layout:set_left(left_layout) |
|
287 |
layout:set_middle(mytasklist[s]) |
|
288 |
layout:set_right(right_layout) |
|
7 | 289 |
|
15 | 290 |
mywibox[s]:set_widget(layout) |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
291 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
292 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
293 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
294 |
-- {{{ Mouse bindings |
7 | 295 |
root.buttons(awful.util.table.join( |
15 | 296 |
awful.button({ }, 3, function () mymainmenu:toggle() end), |
297 |
awful.button({ }, 4, awful.tag.viewnext), |
|
298 |
awful.button({ }, 5, awful.tag.viewprev) |
|
7 | 299 |
)) |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
300 |
-- }}} |
7 | 301 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
302 |
-- {{{ Key tables |
15 | 303 |
|
304 |
local awesome_table = { |
|
305 |
my.make_single_key("m", "Main menu", my.mkinteractive(function () mymainmenu:show({keygrabber=true}) end)), |
|
306 |
-- This one returns an error. |
|
307 |
my.make_single_key("b", "Menu bar", function () menubar.show() end), |
|
308 |
my.make_single_key("t", "Terminal", my.mkspawn(terminal)), |
|
309 |
my.make_single_key("f", "Toggle sloppy mouse", my.sloppy_toggle), |
|
310 |
my.make_single_key("r", "Restart", awesome.restart), |
|
311 |
my.make_single_key("q", "Quit", logout) |
|
312 |
} |
|
313 |
||
314 |
local layout_table = { |
|
315 |
-- Client movement |
|
316 |
my.make_interactive_key("Right", "Focus right", |
|
317 |
function () awful.client.focus.bydirection("right") end), |
|
318 |
my.make_interactive_key("Left", "Focus left", |
|
319 |
function () awful.client.focus.bydirection("left") end), |
|
320 |
my.make_interactive_key("Up", "Focus up", |
|
321 |
function () awful.client.focus.bydirection("up") end), |
|
322 |
my.make_interactive_key("Down", "Focus down", |
|
323 |
function () awful.client.focus.bydirection("down") end), |
|
324 |
my.make_interactive_key("Shift+Right", "Move right", |
|
325 |
function () awful.client.swap.bydirection("right") end), |
|
326 |
my.make_interactive_key("Shift+Left", "Move left", |
|
327 |
function () awful.client.swap.bydirection("left") end), |
|
328 |
my.make_interactive_key("Shift+Up", "Move up", |
|
329 |
function () awful.client.swap.bydirection("up") end), |
|
330 |
my.make_interactive_key("Shift+Down", "Move down", |
|
331 |
function () awful.client.swap.bydirection("down") end), |
|
332 |
-- Master/Client transforms |
|
333 |
my.make_interactive_key("Control+Right", "Master grow", |
|
334 |
function () awful.tag.incmwfact( 0.05 ) end), |
|
335 |
my.make_interactive_key("Control+Left", "Master shrink", |
|
336 |
function () awful.tag.incmwfact( -0.05 ) end), |
|
337 |
my.make_interactive_key("Control+Shift+Down", "Add master", |
|
338 |
function () awful.tag.incnmaster( 1 ) end), |
|
339 |
my.make_interactive_key("Control+Shift+Up", "Remove master", |
|
340 |
function () awful.tag.incnmaster( -1 ) end), |
|
341 |
my.make_interactive_key("Control+Shift+Right", "Add column", |
|
342 |
function () awful.tag.incncol( 1 ) end), |
|
343 |
my.make_interactive_key("Control+Shift+Left", "Remove column", |
|
344 |
function () awful.tag.incncol( -1 ) end), |
|
345 |
-- Layouts |
|
346 |
my.make_interactive_key("Space", "Next layout", |
|
347 |
function () awful.layout.inc(layouts, 1 ) end), |
|
348 |
my.make_interactive_key("Shift+Space", "Previous layout", |
|
349 |
function () awful.layout.inc(layouts, -1 ) end), |
|
350 |
} |
|
351 |
||
352 |
-- Media Keys table, associated globally, with no modifiers. |
|
353 |
local media_table = { |
|
354 |
-- media keys |
|
355 |
my.make_single_key("XF86HomePage", "Browser", my.mkspawn(browser)), |
|
356 |
my.make_single_key("XF86Mail", "Mail", my.mkspawn(mail)), |
|
357 |
my.make_single_key("XF86Search", "Search file...", my.mkspawn(lookup)), |
|
358 |
my.make_single_key("XF86Explorer", "File Manager", my.mkspawn(filemanager)), |
|
359 |
my.make_single_key("XF86Calculator", "Calculator", my.mkspawn(calculator)), |
|
360 |
my.make_single_key("XF86Tools", "Music", my.mkspawn(musicplayer)), |
|
361 |
my.make_single_key("XF86AudioPrev", "Previous song", my.mkspawn("mpc prev")), |
|
362 |
my.make_single_key("XF86AudioNext", "Next song", my.mkspawn("mpc next")), |
|
363 |
my.make_single_key("XF86AudioPlay", "Play song", my.mkspawn("mpc toggle")), |
|
364 |
my.make_single_key("XF86AudioMute", "Mute", my.mkspawn("pulseaudio-ctl mute")), |
|
365 |
my.make_single_key("XF86AudioLowerVolume", "Volume down", my.mkspawn("pulseaudio-ctl down")), |
|
366 |
my.make_single_key("XF86AudioRaiseVolume", "Volume up", my.mkspawn("pulseaudio-ctl up")), |
|
367 |
my.make_single_key("XF86Eject", "Eject", my.mkspawn("eject")), |
|
368 |
} |
|
369 |
||
370 |
-- Global table, associated globally to modkey. |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
371 |
local global_table = { |
15 | 372 |
-- my.make_single_key("e", "Revel windows", revelation), |
373 |
my.make_single_key("Control+n", "Restore clients", awful.client.restore), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
374 |
my.make_single_key("Escape", "Restore history", awful.tag.history.restore), |
15 | 375 |
my.make_single_key("Tab", "Previous client", |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
376 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
377 |
awful.client.focus.history.previous() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
378 |
if client.focus then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
379 |
client.focus:raise() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
380 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
381 |
end), |
15 | 382 |
my.make_single_key("u", "Go to urgent", awful.client.urgent.jumpto), |
383 |
||
384 |
-- Tag Navigation |
|
385 |
my.make_single_key("Prior", "View prev", awful.tag.viewprev), |
|
386 |
my.make_single_key("Next", "View next", awful.tag.viewnext), |
|
387 |
my.make_single_key("Shift+Prior", "Send to Previous View", |
|
388 |
function () |
|
389 |
if client.focus then |
|
390 |
local tag = get_prev_tag(client.focus.screen) |
|
391 |
awful.client.movetotag(tag) |
|
392 |
awful.tag.viewprev() |
|
393 |
end |
|
394 |
end), |
|
395 |
my.make_single_key("Shift+Next", "Send to Next View", |
|
396 |
function () |
|
397 |
if client.focus then |
|
398 |
local tag = get_next_tag(client.focus.screen) |
|
399 |
awful.client.movetotag(tag) |
|
400 |
awful.tag.viewnext() |
|
401 |
end |
|
402 |
end), |
|
403 |
||
404 |
-- Client Navigation |
|
405 |
my.make_single_key("Right", "Right client", my.make_focus_bydirection("right")), |
|
406 |
my.make_single_key("Left", "Left client", my.make_focus_bydirection("left")), |
|
407 |
my.make_single_key("Up", "Up client", my.make_focus_bydirection("up")), |
|
408 |
my.make_single_key("Down", "Down client", my.make_focus_bydirection("down")), |
|
409 |
my.make_single_key("Shift+Right", "Move right", |
|
410 |
function () awful.client.swap.bydirection("right") end), |
|
411 |
my.make_single_key("Shift+Left", "Move left", |
|
412 |
function () awful.client.swap.bydirection("left") end), |
|
413 |
my.make_single_key("Shift+Up", "Move up", |
|
414 |
function () awful.client.swap.bydirection("up") end), |
|
415 |
my.make_single_key("Shift+Down", "Move down", |
|
416 |
function () awful.client.swap.bydirection("down") end), |
|
417 |
||
418 |
-- Prompts... |
|
419 |
my.make_single_key("F2", "Run...", |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
420 |
function () mypromptbox[mouse.screen]:run() end), |
15 | 421 |
my.make_single_key("F3", "Eval...", |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
422 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
423 |
awful.prompt.run({ prompt = "Run Lua code: " }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
424 |
mypromptbox[mouse.screen].widget, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
425 |
awful.util.eval, nil, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
426 |
awful.util.getdir("cache") .. "/history_eval") |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
427 |
end), |
15 | 428 |
|
429 |
-- forcing restart of mpd. |
|
430 |
-- it sometime have difficulty to connect to pulse |
|
431 |
my.make_single_key("F6", "Restart mpd", |
|
432 |
function () |
|
433 |
awful.util.spawn("pkill -9 mpd") |
|
434 |
awful.util.spawn("mpd") |
|
435 |
end), |
|
436 |
||
437 |
-- modal key binding |
|
438 |
my.make_key("a", "Main mode...", my.make_kt(awesome_table, "awesome") ), |
|
439 |
my.make_key("l", "Layout mode...", my.make_kt(layout_table, "layout") ), |
|
7 | 440 |
} |
441 |
||
15 | 442 |
-- Client table, associated to each client with modkey. |
443 |
local client_table = { |
|
444 |
my.make_single_key("Return", "Swap master", |
|
445 |
function(c) c:swap(awful.client.getmaster()) end), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
446 |
my.make_single_key("f", "Toggle fullscreen", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
447 |
function (c) c.fullscreen = not c.fullscreen end), |
15 | 448 |
my.make_single_key("F4", "Kill client", function (c) c:kill() end), |
449 |
my.make_single_key("Space", "Toggle floating", awful.client.floating.toggle), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
450 |
my.make_single_key("t", "Toggle on top", function (c) c.ontop = not c.ontop end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
451 |
my.make_single_key("m", "Toggle maximized", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
452 |
function (c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
453 |
maximized = not c.maximized_horizontal |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
454 |
c.maximized_horizontal = maximized |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
455 |
c.maximized_vertical = maximized |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
456 |
end), |
15 | 457 |
my.make_single_key("h", "Hide", |
458 |
function (c) |
|
459 |
-- The client currently has the input focus, so it cannot be |
|
460 |
-- minimized, since minimized clients can't have the focus. |
|
461 |
c.minimized = true |
|
462 |
end), |
|
463 |
-- Client awful tagging: this is useful to tag some clients and then do stuff |
|
464 |
-- like move to tag on them |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
465 |
my.make_single_key("Shift+t", "Toggle mark", awful.client.togglemarked) |
7 | 466 |
} |
15 | 467 |
|
468 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
469 |
-- }}} |
7 | 470 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
471 |
-- {{{ Key bindings |
7 | 472 |
globalkeys = awful.util.table.join( |
473 |
awful.key({modkey}, "F1", function () my.show_kt(global_table, "Global binding") end), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
474 |
-- make the client binding help available even when there is no client. |
7 | 475 |
awful.key({modkey, "Shift"}, "F1", |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
476 |
function () my.show_kt(client_table, "Client binding") end), |
15 | 477 |
my.make_globalkeys({modkey}, global_table), |
478 |
my.make_globalkeys({}, media_table) |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
479 |
) |
7 | 480 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
481 |
clientkeys = awful.util.table.join( |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
482 |
my.make_globalkeys({modkey}, client_table) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
483 |
) |
15 | 484 |
-- }}} |
485 |
||
486 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
487 |
-- Bind all key numbers to tags. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
488 |
-- Be careful: we use keycodes to make it works on any keyboard layout. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
489 |
-- This should map on the top row of your keyboard, usually 1 to 9. |
15 | 490 |
for i = 1, number_of_rows do |
491 |
local k = "#" .. i + 9 |
|
492 |
globalkeys = awful.util.table.join( |
|
493 |
globalkeys, |
|
494 |
-- View tag only. |
|
495 |
awful.key({ modkey }, k, |
|
496 |
function () |
|
497 |
local tag = get_tag(mouse.screen, i) |
|
498 |
if tag then |
|
499 |
awful.tag.viewonly(tag) |
|
500 |
end |
|
501 |
end), |
|
502 |
-- Toggle view tag. |
|
503 |
awful.key({ modkey, "Control" }, k, |
|
504 |
function () |
|
505 |
local tag = get_tag(mouse.screen, i) |
|
506 |
if tag then |
|
507 |
awful.tag.viewtoggle(tag) |
|
508 |
end |
|
509 |
end), |
|
510 |
-- Move client to tag. |
|
511 |
awful.key({ modkey, "Shift" }, k, |
|
512 |
function () |
|
513 |
if client.focus then |
|
514 |
local tag = get_tag(client.focus.screen, i) |
|
515 |
if tag then |
|
516 |
awful.client.movetotag(tag) |
|
517 |
end |
|
518 |
end |
|
519 |
end), |
|
520 |
-- Toggle client tag. |
|
521 |
awful.key({ modkey, "Control", "Shift" }, k, |
|
522 |
function () |
|
523 |
if client.focus then |
|
524 |
local tag = get_tag(client.focus.screen, i) |
|
525 |
if tag then |
|
526 |
awful.client.toggletag(tag) |
|
527 |
end |
|
528 |
end |
|
529 |
end)) |
|
7 | 530 |
end |
531 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
532 |
clientbuttons = awful.util.table.join( |
15 | 533 |
awful.button({ }, 1, function (c) client.focus = c; c:raise() end), |
534 |
awful.button({ modkey }, 1, awful.mouse.client.move), |
|
535 |
awful.button({ modkey }, 3, awful.mouse.client.resize)) |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
536 |
|
7 | 537 |
-- Set keys |
15 | 538 |
-- mympdwidget:append_global_keys() |
7 | 539 |
root.keys(globalkeys) |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
540 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
541 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
542 |
-- {{{ Rules |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
543 |
-- Rules to apply to new clients (through the "manage" signal). |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
544 |
awful.rules.rules = { |
15 | 545 |
-- All clients will match this rule. |
546 |
{ rule = { }, |
|
547 |
properties = { border_width = beautiful.border_width, |
|
548 |
border_color = beautiful.border_normal, |
|
549 |
focus = awful.client.focus.filter, |
|
550 |
raise = true, |
|
551 |
keys = clientkeys, |
|
552 |
buttons = clientbuttons } }, |
|
553 |
{ rule = { class = "MPlayer" }, |
|
554 |
properties = { floating = true } }, |
|
555 |
{ rule = { class = "pinentry" }, |
|
556 |
properties = { floating = true } }, |
|
557 |
{ rule = { class = "gimp" }, |
|
558 |
properties = { floating = true } }, |
|
559 |
-- Set Firefox to always map on tags number 2 of screen 1. |
|
560 |
-- { rule = { class = "Firefox" }, |
|
561 |
-- properties = { tag = tags[1][2] } }, |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
562 |
} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
563 |
-- }}} |
15 | 564 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
565 |
-- {{{ Signals |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
566 |
-- Signal function to execute when a new client appears. |
15 | 567 |
function manage_clients(c, startup) |
568 |
-- Enable sloppy focus |
|
569 |
-- c:connect_signal("mouse::enter", function(c) |
|
570 |
-- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier |
|
571 |
-- and awful.client.focus.filter(c) then |
|
572 |
-- client.focus = c |
|
573 |
-- end |
|
574 |
-- end) |
|
575 |
||
576 |
if not startup then |
|
577 |
-- Set the windows at the slave, |
|
578 |
-- i.e. put it at the end of others instead of setting it master. |
|
579 |
-- awful.client.setslave(c) |
|
580 |
||
581 |
-- Put windows in a smart way, only if they does not set an initial position. |
|
582 |
if not c.size_hints.user_position and not c.size_hints.program_position then |
|
583 |
awful.placement.no_overlap(c) |
|
584 |
awful.placement.no_offscreen(c) |
|
585 |
end |
|
586 |
elseif not c.size_hints.user_position and not c.size_hints.program_position then |
|
587 |
-- Prevent clients from being unreachable after screen count change |
|
588 |
awful.placement.no_offscreen(c) |
|
589 |
end |
|
590 |
||
591 |
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then |
|
592 |
-- buttons for the titlebar |
|
593 |
local buttons = awful.util.table.join( |
|
594 |
awful.button({ }, 1, function() |
|
595 |
client.focus = c |
|
596 |
c:raise() |
|
597 |
awful.mouse.client.move(c) |
|
598 |
end), |
|
599 |
awful.button({ }, 3, function() |
|
600 |
client.focus = c |
|
601 |
c:raise() |
|
602 |
awful.mouse.client.resize(c) |
|
603 |
end) |
|
604 |
) |
|
605 |
||
606 |
-- Widgets that are aligned to the left |
|
607 |
local left_layout = wibox.layout.fixed.horizontal() |
|
608 |
left_layout:add(awful.titlebar.widget.iconwidget(c)) |
|
609 |
left_layout:buttons(buttons) |
|
610 |
||
611 |
-- Widgets that are aligned to the right |
|
612 |
local right_layout = wibox.layout.fixed.horizontal() |
|
613 |
right_layout:add(awful.titlebar.widget.floatingbutton(c)) |
|
614 |
right_layout:add(awful.titlebar.widget.maximizedbutton(c)) |
|
615 |
right_layout:add(awful.titlebar.widget.stickybutton(c)) |
|
616 |
right_layout:add(awful.titlebar.widget.ontopbutton(c)) |
|
617 |
right_layout:add(awful.titlebar.widget.closebutton(c)) |
|
618 |
||
619 |
-- The title goes in the middle |
|
620 |
local middle_layout = wibox.layout.flex.horizontal() |
|
621 |
local title = awful.titlebar.widget.titlewidget(c) |
|
622 |
title:set_align("center") |
|
623 |
middle_layout:add(title) |
|
624 |
middle_layout:buttons(buttons) |
|
625 |
||
626 |
-- Now bring it all together |
|
627 |
local layout = wibox.layout.align.horizontal() |
|
628 |
layout:set_left(left_layout) |
|
629 |
layout:set_right(right_layout) |
|
630 |
layout:set_middle(middle_layout) |
|
631 |
||
632 |
awful.titlebar(c):set_widget(layout) |
|
633 |
end |
|
634 |
end |
|
635 |
client.connect_signal("manage", manage_clients) |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
636 |
|
15 | 637 |
-- Hook function to execute when focusing a client. |
638 |
client.connect_signal("focus", |
|
639 |
function(c) |
|
640 |
if not awful.client.ismarked(c) then |
|
641 |
c.border_color = beautiful.border_focus |
|
642 |
-- c.opacity = 13.0 |
|
643 |
end |
|
7 | 644 |
end) |
645 |
||
15 | 646 |
-- Hook function to execute when unfocusing a client. |
647 |
client.connect_signal("unfocus", function(c) |
|
648 |
if not awful.client.ismarked(c) then |
|
649 |
c.border_color = beautiful.border_normal |
|
650 |
-- c.opacity = 0.8 |
|
651 |
end |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
652 |
end) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
653 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
654 |
|
8 | 655 |
my.sloppy_install(0.5) |