author | Fabien Ninoles <fabien@tzone.org> |
Sun, 13 Sep 2015 14:47:26 -0400 | |
changeset 14 | 6348b9f842b2 |
parent 13 | e9e2f624cd99 |
child 15 | 73df43769340 |
permissions | -rw-r--r-- |
7 | 1 |
-- Standard awesome library |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
2 |
local gears = require("gears") |
11 | 3 |
local awful = require("awful") |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
4 |
awful.rules = require("awful.rules") |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
5 |
require("awful.autofocus") |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
6 |
-- Widget and layout library |
11 | 7 |
local wibox = require("wibox") |
7 | 8 |
-- Theme handling library |
11 | 9 |
local beautiful = require("beautiful") |
7 | 10 |
-- Notification library |
11 | 11 |
local naughty = require("naughty") |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
12 |
local menubar = require("menubar") |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
13 |
|
7 | 14 |
-- Load Debian menu entries |
15 |
require("debian.menu") |
|
16 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
17 |
local my = require("my") |
7 | 18 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
19 |
local titlebars_enabled = false |
7 | 20 |
|
21 |
-- {{{ Error handling |
|
22 |
-- Check if awesome encountered an error during startup and fell back to |
|
23 |
-- another config (This code will only ever execute for the fallback config) |
|
24 |
if awesome.startup_errors then |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
25 |
naughty.notify({ preset = naughty.config.presets.critical, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
26 |
title = "Oops, there were errors during startup!", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
27 |
text = awesome.startup_errors }) |
7 | 28 |
end |
29 |
||
30 |
-- Handle runtime errors after startup |
|
31 |
do |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
32 |
local in_error = false |
11 | 33 |
awesome.connect_signal("debug::error", my.notify_error) |
12 | 34 |
awesome.connect_signal("debug::deprecation", my.notify_error) |
35 |
awesome.connect_signal("debug::index::miss", |
|
36 |
function (obj, key) |
|
37 |
my.notify_error("Invalid key " .. key .. " on object") |
|
38 |
end) |
|
39 |
awesome.connect_signal("debug::newindex::miss", |
|
40 |
function (obj, key, value) |
|
41 |
my.notify_error("Trying to set key " .. key .. " on object") |
|
42 |
end) |
|
7 | 43 |
end |
44 |
-- }}} |
|
45 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
46 |
-- {{{ Variable definitions |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
47 |
-- Themes define colours, icons, font and wallpapers. |
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
48 |
theme_path = awful.util.getdir("config") .. "/current_theme/theme.lua" |
7 | 49 |
-- This is used later as the default terminal and editor to run. |
50 |
terminal = "x-terminal-emulator" |
|
8 | 51 |
-- terminal = "terminology" |
7 | 52 |
editor = os.getenv("EDITOR") or "editor" |
53 |
editor_cmd = terminal .. " -e " .. editor |
|
54 |
browser = "iceweasel" |
|
55 |
mail = "icedove" |
|
56 |
musicplayer = "ario" |
|
57 |
monitor = "gnome-system-monitor" |
|
58 |
filemanager = "pcmanfm" |
|
59 |
lookup = "pcmanfm -f" |
|
60 |
calculator = "galculator" |
|
8 | 61 |
-- Logout method |
62 |
-- logout = awesome.quit |
|
63 |
logout = my.mkspawn("obsession-logout") |
|
7 | 64 |
|
65 |
-- Default modkey. |
|
66 |
-- 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
|
67 |
-- 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
|
68 |
-- 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
|
69 |
-- However, you can use another modifier like Mod1, but it may interact with others. |
7 | 70 |
modkey = "Mod4" |
71 |
||
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
72 |
wallpaper = awful.util.getdir("config") .. "/default" |
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
73 |
wallpaper_cmd = "fbsetbg -a " .. wallpaper |
7 | 74 |
|
75 |
-- Actually load theme |
|
76 |
beautiful.init(theme_path) |
|
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
77 |
beautiful.wallpaper_cmd = { wallpaper_cmd } |
7 | 78 |
awful.util.spawn_with_shell("pgrep unagi || unagi &") |
79 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
80 |
-- 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
|
81 |
local layouts = |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
82 |
{ |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
83 |
awful.layout.suit.floating, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
84 |
awful.layout.suit.tile, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
85 |
awful.layout.suit.tile.left, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
86 |
awful.layout.suit.tile.bottom, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
87 |
awful.layout.suit.tile.top, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
88 |
awful.layout.suit.fair, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
89 |
awful.layout.suit.fair.horizontal, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
90 |
awful.layout.suit.spiral, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
91 |
awful.layout.suit.spiral.dwindle, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
92 |
awful.layout.suit.max, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
93 |
-- awful.layout.suit.max.fullscreen, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
94 |
awful.layout.suit.magnifier, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
95 |
} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
96 |
local default_layout = 2 |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
97 |
-- }}} |
7 | 98 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
99 |
-- {{{ Wallpaper |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
100 |
if beautiful.wallpaper then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
101 |
for s = 1, screen.count() do |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
102 |
gears.wallpaper.maximized(beautiful.wallpaper, s, true) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
103 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
104 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
105 |
-- }}} |
7 | 106 |
|
107 |
-- Define if we want to use titlebar on all applications. |
|
108 |
use_titlebar = true |
|
109 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
110 |
-- {{{ Tags |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
111 |
-- Define a tag table which hold all screen tags. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
112 |
tags = {} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
113 |
for s = 1, screen.count() do |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
114 |
-- Each screen has its own tag table. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
115 |
tags[s] = awful.tag({ 1, 2, 3, 4, 5, 6, 7, 8, 9 }, s, layouts[default_layout]) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
116 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
117 |
-- }}} |
7 | 118 |
|
119 |
-- Create a laucher widget and a main menu |
|
120 |
myawesomemenu = { |
|
121 |
{"manual", terminal .. " -e man awesome"}, |
|
122 |
{"edit config", |
|
123 |
editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua"}, |
|
13
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
124 |
{"themes", my.theme_menu()}, |
e9e2f624cd99
Add themes and wallpapers menus.
Fabien Ninoles <fabien@tzone.org>
parents:
12
diff
changeset
|
125 |
{"wallpapers", my.wallpaper_menu()}, |
7 | 126 |
{"restart", awesome.restart}, |
127 |
{"quit", my.quit} |
|
128 |
} |
|
129 |
||
130 |
mymainmenu = awful.menu( |
|
131 |
{ |
|
132 |
items = { |
|
133 |
{"awesome", myawesomemenu, beautiful.awesome_icon}, |
|
134 |
{ "Debian", debian.menu.Debian_menu.Debian }, |
|
135 |
{"open terminal", terminal}} |
|
136 |
}) |
|
137 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
138 |
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
139 |
menu = mymainmenu }) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
140 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
141 |
-- Menubar configuration |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
142 |
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
|
143 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
144 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
145 |
-- {{{ Wibox |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
146 |
-- Create a textclock widget |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
147 |
mytextclock = awful.widget.textclock() |
7 | 148 |
|
149 |
-- Create a systray |
|
11 | 150 |
mysystray = wibox.widget.systray({align = "right"}) |
7 | 151 |
|
152 |
-- Create a wibox for each screen and add it |
|
153 |
mywibox = {} |
|
154 |
mypromptbox = {} |
|
155 |
mylayoutbox = {} |
|
156 |
mytaglist = {} |
|
157 |
mytaglist.buttons = awful.util.table.join( |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
158 |
awful.button({ }, 1, awful.tag.viewonly), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
159 |
awful.button({ modkey }, 1, awful.client.movetotag), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
160 |
awful.button({ }, 3, awful.tag.viewtoggle), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
161 |
awful.button({ modkey }, 3, awful.client.toggletag), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
162 |
awful.button({ }, 4, function(t) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
163 |
awful.tag.viewnext(awful.tag.getscreen(t)) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
164 |
awful.button({ }, 5, function(t) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
165 |
awful.tag.viewprev(awful.tag.getscreen(t)) end) |
7 | 166 |
) |
167 |
mytasklist = {} |
|
168 |
mytasklist.buttons = awful.util.table.join( |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
169 |
awful.button({ }, 1, function (c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
170 |
if c == client.focus then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
171 |
c.minimized = true |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
172 |
else |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
173 |
-- Without this, the following |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
174 |
-- :isvisible() makes no sense |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
175 |
c.minimized = false |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
176 |
if not c:isvisible() then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
177 |
awful.tag.viewonly(c:tags()[1]) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
178 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
179 |
-- This will also un-minimize |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
180 |
-- the client, if needed |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
181 |
client.focus = c |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
182 |
c:raise() |
7 | 183 |
end |
184 |
end), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
185 |
awful.button({ }, 3, function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
186 |
if instance then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
187 |
instance:hide() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
188 |
instance = nil |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
189 |
else |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
190 |
instance = awful.menu.clients({ |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
191 |
theme = { width = 250 } |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
192 |
}) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
193 |
end |
7 | 194 |
end), |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
195 |
awful.button({ }, 4, function () |
7 | 196 |
awful.client.focus.byidx(1) |
197 |
if client.focus then client.focus:raise() end |
|
198 |
end), |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
199 |
awful.button({ }, 5, function () |
7 | 200 |
awful.client.focus.byidx(-1) |
201 |
if client.focus then client.focus:raise() end |
|
202 |
end)) |
|
203 |
||
204 |
local mycpuwidget = my.widgets.decorated(my.widgets.cpu(), my.mkspawn(monitor)) |
|
205 |
local mymemwidget = my.widgets.decorated(my.widgets.mem(), my.mkspawn(monitor)) |
|
206 |
local mynetwidget = my.widgets.decorated(my.widgets.net("eth1"), my.mkspawn(monitor)) |
|
207 |
-- local mynetupwidget = my.decorated_monitor_widget(make_netwidget("eth1", "up")) |
|
208 |
-- 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
|
209 |
local mymodewidget = my.widgets.mode() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
210 |
|
7 | 211 |
|
212 |
for s = 1, screen.count() do |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
213 |
-- Create a promptbox for each screen |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
214 |
mypromptbox[s] = awful.widget.prompt() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
215 |
-- Create an imagebox widget which will contains an icon indicating which layout we're using. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
216 |
-- We need one layoutbox per screen. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
217 |
mylayoutbox[s] = awful.widget.layoutbox(s) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
218 |
mylayoutbox[s]:buttons(awful.util.table.join( |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
219 |
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
220 |
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
221 |
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
222 |
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
223 |
-- Create a taglist widget |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
224 |
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons) |
7 | 225 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
226 |
-- Create a tasklist widget |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
227 |
mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons) |
7 | 228 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
229 |
-- Create the wibox |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
230 |
mywibox[s] = awful.wibox({ position = "top", screen = s }) |
7 | 231 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
232 |
-- Widgets that are aligned to the left |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
233 |
local left_layout = wibox.layout.fixed.horizontal() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
234 |
left_layout:add(mymodewidget) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
235 |
left_layout:add(mylauncher) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
236 |
if s == 1 then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
237 |
left_layout:add(mycpuwidget) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
238 |
left_layout:add(mymemwidget) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
239 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
240 |
left_layout:add(mytaglist[s]) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
241 |
left_layout:add(mypromptbox[s]) |
11 | 242 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
243 |
-- Widgets that are aligned to the right |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
244 |
local right_layout = wibox.layout.fixed.horizontal() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
245 |
if s == 1 then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
246 |
right_layout:add(mynetwidget) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
247 |
right_layout:add(mysystray) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
248 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
249 |
right_layout:add(mytextclock) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
250 |
right_layout:add(mylayoutbox[s]) |
7 | 251 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
252 |
-- Now bring it all together (with the tasklist in the middle) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
253 |
local layout = wibox.layout.align.horizontal() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
254 |
layout:set_left(left_layout) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
255 |
layout:set_middle(mytasklist[s]) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
256 |
layout:set_right(right_layout) |
7 | 257 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
258 |
mywibox[s]:set_widget(layout) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
259 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
260 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
261 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
262 |
-- {{{ Mouse bindings |
7 | 263 |
root.buttons(awful.util.table.join( |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
264 |
awful.button({ }, 3, function () mymainmenu:toggle() end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
265 |
awful.button({ }, 4, awful.tag.viewnext), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
266 |
awful.button({ }, 5, awful.tag.viewprev) |
7 | 267 |
)) |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
268 |
-- }}} |
7 | 269 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
270 |
-- {{{ Key tables |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
271 |
local global_table = { |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
272 |
my.make_single_key("Up", "View prev", awful.tag.viewprev), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
273 |
my.make_single_key("Down", "View next", awful.tag.viewnext), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
274 |
my.make_single_key("Escape", "Restore history", awful.tag.history.restore), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
275 |
my.make_single_key("Right", "Next screen", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
276 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
277 |
awful.client.focus.byidx( 1) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
278 |
if client.focus then client.focus:raise() end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
279 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
280 |
my.make_single_key("Left", "Previous screen", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
281 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
282 |
awful.client.focus.byidx(-1) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
283 |
if client.focus then client.focus:raise() end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
284 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
285 |
my.make_single_key("w", "Main menu", function () mymainmenu:show() end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
286 |
my.make_single_key("Shift+Right", "Swap with next", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
287 |
function () awful.client.swap.byidx( 1); end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
288 |
my.make_single_key("Shift+Left", "Swap with prev", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
289 |
function () awful.client.swap.byidx(-1); end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
290 |
-- Is this work ? |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
291 |
my.make_single_key("Control+Right", "Focus next screen", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
292 |
function () awful.screen.focus_relative( 1); end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
293 |
-- Is this work ? |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
294 |
my.make_single_key("Control+Left", "Focus prev screen", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
295 |
function () awful.screen.focus_relative(-1); end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
296 |
my.make_single_key("u", "Go to urgent", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
297 |
function () awful.client.urgent.jumpto(); end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
298 |
my.make_single_key("Tab", "Next client", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
299 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
300 |
awful.client.focus.history.previous() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
301 |
if client.focus then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
302 |
client.focus:raise() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
303 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
304 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
305 |
my.make_single_key("Return", "Start terminal", my.mkspawn(terminal)), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
306 |
my.make_single_key("Control+r", "Restart", awesome.restart), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
307 |
my.make_single_key("Shift+q", "Quit", logout), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
308 |
my.make_single_key("l", "Inc Master Size", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
309 |
function () awful.tag.incmwfact( 0.05 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
310 |
my.make_single_key("h", "Dec Master Size", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
311 |
function () awful.tag.incmwfact( -0.05 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
312 |
my.make_single_key("Shift+l", "Inc Master Count", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
313 |
function () awful.tag.incnmaster( 1 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
314 |
my.make_single_key("Shift+h", "Dec Master Count", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
315 |
function () awful.tag.incnmaster( -1 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
316 |
my.make_single_key("Control+l", "Inc Column Count", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
317 |
function () awful.tag.incncol( 1 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
318 |
my.make_single_key("Control+h", "Dec Column Count", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
319 |
function () awful.tag.incncol( -1 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
320 |
my.make_single_key("Space", "Next layout", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
321 |
function () awful.layout.inc(layouts, 1 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
322 |
my.make_single_key("Shift+Space", "Prev layout", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
323 |
function () awful.layout.inc(layouts, -1 ) end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
324 |
my.make_single_key("Control+n", "Restore clients", awful.client.restore), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
325 |
my.make_single_key("r", "Run", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
326 |
function () mypromptbox[mouse.screen]:run() end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
327 |
my.make_single_key("x", "Lua prompt", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
328 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
329 |
awful.prompt.run({ prompt = "Run Lua code: " }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
330 |
mypromptbox[mouse.screen].widget, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
331 |
awful.util.eval, nil, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
332 |
awful.util.getdir("cache") .. "/history_eval") |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
333 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
334 |
-- This one returns an error. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
335 |
my.make_single_key("p", "Menu bar", function () menubar.show() end) |
7 | 336 |
} |
337 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
338 |
client_table = { |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
339 |
my.make_single_key("f", "Toggle fullscreen", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
340 |
function (c) c.fullscreen = not c.fullscreen end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
341 |
my.make_single_key("Shift+c", "Kill client", function (c) c:kill() end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
342 |
my.make_single_key("Control+Space", "Toggle floating", awful.client.floating.toggle), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
343 |
my.make_single_key("o", "Move to screen", awful.client.movetoscreen), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
344 |
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
|
345 |
my.make_single_key("n", "Iconized", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
346 |
function (c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
347 |
-- The client currently has the input focus, so it cannot be |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
348 |
-- minimized, since minimized clients can't have the focus. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
349 |
c.minimized = true |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
350 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
351 |
my.make_single_key("m", "Toggle maximized", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
352 |
function (c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
353 |
maximized = not c.maximized_horizontal |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
354 |
c.maximized_horizontal = maximized |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
355 |
c.maximized_vertical = maximized |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
356 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
357 |
my.make_single_key("Shift+t", "Toggle mark", awful.client.togglemarked) |
7 | 358 |
} |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
359 |
-- }}} |
7 | 360 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
361 |
-- {{{ Key bindings |
7 | 362 |
globalkeys = awful.util.table.join( |
363 |
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
|
364 |
-- make the client binding help available even when there is no client. |
7 | 365 |
awful.key({modkey, "Shift"}, "F1", |
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
366 |
function () my.show_kt(client_table, "Client binding") end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
367 |
my.make_globalkeys({modkey}, global_table) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
368 |
) |
7 | 369 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
370 |
clientkeys = awful.util.table.join( |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
371 |
my.make_globalkeys({modkey}, client_table) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
372 |
) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
373 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
374 |
-- Bind all key numbers to tags. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
375 |
-- 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
|
376 |
-- This should map on the top row of your keyboard, usually 1 to 9. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
377 |
for i = 1, 9 do |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
378 |
globalkeys = awful.util.table.join(globalkeys, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
379 |
-- View tag only. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
380 |
awful.key({ modkey }, "#" .. i + 9, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
381 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
382 |
local screen = mouse.screen |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
383 |
local tag = awful.tag.gettags(screen)[i] |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
384 |
if tag then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
385 |
awful.tag.viewonly(tag) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
386 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
387 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
388 |
-- Toggle tag. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
389 |
awful.key({ modkey, "Control" }, "#" .. i + 9, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
390 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
391 |
local screen = mouse.screen |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
392 |
local tag = awful.tag.gettags(screen)[i] |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
393 |
if tag then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
394 |
awful.tag.viewtoggle(tag) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
395 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
396 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
397 |
-- Move client to tag. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
398 |
awful.key({ modkey, "Shift" }, "#" .. i + 9, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
399 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
400 |
if client.focus then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
401 |
local tag = awful.tag.gettags(client.focus.screen)[i] |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
402 |
if tag then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
403 |
awful.client.movetotag(tag) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
404 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
405 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
406 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
407 |
-- Toggle tag. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
408 |
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
409 |
function () |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
410 |
if client.focus then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
411 |
local tag = awful.tag.gettags(client.focus.screen)[i] |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
412 |
if tag then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
413 |
awful.client.toggletag(tag) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
414 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
415 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
416 |
end)) |
7 | 417 |
end |
418 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
419 |
clientbuttons = awful.util.table.join( |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
420 |
awful.button({ }, 1, function (c) client.focus = c; c:raise() end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
421 |
awful.button({ modkey }, 1, awful.mouse.client.move), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
422 |
awful.button({ modkey }, 3, awful.mouse.client.resize)) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
423 |
|
7 | 424 |
-- Set keys |
425 |
root.keys(globalkeys) |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
426 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
427 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
428 |
-- {{{ Rules |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
429 |
-- 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
|
430 |
awful.rules.rules = { |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
431 |
-- All clients will match this rule. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
432 |
{ rule = { }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
433 |
properties = { border_width = beautiful.border_width, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
434 |
border_color = beautiful.border_normal, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
435 |
focus = awful.client.focus.filter, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
436 |
raise = true, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
437 |
keys = clientkeys, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
438 |
buttons = clientbuttons } }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
439 |
{ rule = { class = "MPlayer" }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
440 |
properties = { floating = true } }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
441 |
{ rule = { class = "pinentry" }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
442 |
properties = { floating = true } }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
443 |
{ rule = { class = "gimp" }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
444 |
properties = { floating = true } }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
445 |
-- Set Firefox to always map on tags number 2 of screen 1. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
446 |
-- { rule = { class = "Firefox" }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
447 |
-- properties = { tag = tags[1][2] } }, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
448 |
} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
449 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
450 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
451 |
-- {{{ Signals |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
452 |
-- Signal function to execute when a new client appears. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
453 |
client.connect_signal("manage", function (c, startup) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
454 |
-- Enable sloppy focus |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
455 |
-- c:connect_signal("mouse::enter", function(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
456 |
-- if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
457 |
-- and awful.client.focus.filter(c) then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
458 |
-- client.focus = c |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
459 |
-- end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
460 |
-- end) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
461 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
462 |
if not startup then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
463 |
-- Set the windows at the slave, |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
464 |
-- i.e. put it at the end of others instead of setting it master. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
465 |
-- awful.client.setslave(c) |
7 | 466 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
467 |
-- Put windows in a smart way, only if they does not set an initial position. |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
468 |
if not c.size_hints.user_position and not c.size_hints.program_position then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
469 |
awful.placement.no_overlap(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
470 |
awful.placement.no_offscreen(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
471 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
472 |
elseif not c.size_hints.user_position and not c.size_hints.program_position then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
473 |
-- Prevent clients from being unreachable after screen count change |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
474 |
awful.placement.no_offscreen(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
475 |
end |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
476 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
477 |
if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
478 |
-- buttons for the titlebar |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
479 |
local buttons = awful.util.table.join( |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
480 |
awful.button({ }, 1, function() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
481 |
client.focus = c |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
482 |
c:raise() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
483 |
awful.mouse.client.move(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
484 |
end), |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
485 |
awful.button({ }, 3, function() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
486 |
client.focus = c |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
487 |
c:raise() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
488 |
awful.mouse.client.resize(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
489 |
end) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
490 |
) |
7 | 491 |
|
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
492 |
-- Widgets that are aligned to the left |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
493 |
local left_layout = wibox.layout.fixed.horizontal() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
494 |
left_layout:add(awful.titlebar.widget.iconwidget(c)) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
495 |
left_layout:buttons(buttons) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
496 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
497 |
-- Widgets that are aligned to the right |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
498 |
local right_layout = wibox.layout.fixed.horizontal() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
499 |
right_layout:add(awful.titlebar.widget.floatingbutton(c)) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
500 |
right_layout:add(awful.titlebar.widget.maximizedbutton(c)) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
501 |
right_layout:add(awful.titlebar.widget.stickybutton(c)) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
502 |
right_layout:add(awful.titlebar.widget.ontopbutton(c)) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
503 |
right_layout:add(awful.titlebar.widget.closebutton(c)) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
504 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
505 |
-- The title goes in the middle |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
506 |
local middle_layout = wibox.layout.flex.horizontal() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
507 |
local title = awful.titlebar.widget.titlewidget(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
508 |
title:set_align("center") |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
509 |
middle_layout:add(title) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
510 |
middle_layout:buttons(buttons) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
511 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
512 |
-- Now bring it all together |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
513 |
local layout = wibox.layout.align.horizontal() |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
514 |
layout:set_left(left_layout) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
515 |
layout:set_right(right_layout) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
516 |
layout:set_middle(middle_layout) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
517 |
|
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
518 |
awful.titlebar(c):set_widget(layout) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
519 |
end |
7 | 520 |
end) |
521 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
522 |
client.connect_signal("focus", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
523 |
function(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
524 |
c.border_color = beautiful.border_focus |
7 | 525 |
end) |
526 |
||
14
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
527 |
client.connect_signal("unfocus", |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
528 |
function(c) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
529 |
c.border_color = beautiful.border_normal |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
530 |
end) |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
531 |
-- }}} |
6348b9f842b2
Move back to non-shifty awesomeness.
Fabien Ninoles <fabien@tzone.org>
parents:
13
diff
changeset
|
532 |
|
8 | 533 |
my.sloppy_install(0.5) |