Commit bbcdeb670ee168c958065c72853affc868fddc92

Authored by Ian Foster
1 parent 1548af88f7
Exists in master

termlayout has 4 quad option and added useless layouts

Showing 3 changed files with 8 additions and 4 deletions Inline Diff

awesome/awesome/darkburn/theme.lua View file @ bbcdeb6
-------------------------------- 1 1 --------------------------------
-- "Darkburn" awesome theme -- 2 2 -- "Darkburn" awesome theme --
-- By LANRAT -- 3 3 -- By LANRAT --
-------------------------------- 4 4 --------------------------------
5 5
-- {{{ Main 6 6 -- {{{ Main
theme = {} 7 7 theme = {}
theme.confdir = awful.util.getdir("config") 8 8 theme.confdir = awful.util.getdir("config")
theme.themedir = theme.confdir .. "/darkburn/" 9 9 theme.themedir = theme.confdir .. "/darkburn/"
theme.wallpaper_cmd = { "awsetbg -a .wallpaper.jpg" } 10 10 theme.wallpaper_cmd = { "awsetbg -a .wallpaper.jpg" }
-- }}} 11 11 -- }}}
12 12
-- {{{ Styles 13 13 -- {{{ Styles
theme.font = "sans 8" 14 14 theme.font = "sans 8"
15 15
-- {{{ Colors 16 16 -- {{{ Colors
theme.fg_normal = "#DCDCCC" 17 17 theme.fg_normal = "#DCDCCC"
theme.fg_focus = "#F0DFAF" 18 18 theme.fg_focus = "#F0DFAF"
theme.fg_urgent = "#CC9393" 19 19 theme.fg_urgent = "#CC9393"
theme.bg_normal = "#000000" 20 20 theme.bg_normal = "#000000"
theme.bg_focus = "#111111" 21 21 theme.bg_focus = "#111111"
theme.bg_urgent = "#3F3F3F" 22 22 theme.bg_urgent = "#3F3F3F"
-- }}} 23 23 -- }}}
24 24
-- {{{ Borders 25 25 -- {{{ Borders
theme.useless_gap_width = 3 26 26 theme.useless_gap_width = 2
theme.border_width = 0 27 27 theme.border_width = 0
theme.border_normal = "#3F3F3F" 28 28 theme.border_normal = "#3F3F3F"
theme.border_focus = "#6F6F6F" 29 29 theme.border_focus = "#6F6F6F"
--theme.border_marked = "#CC9393" 30 30 --theme.border_marked = "#CC9393"
-- }}} 31 31 -- }}}
32 32
-- {{{ Titlebars 33 33 -- {{{ Titlebars
theme.titlebar_bg_focus = "#3F3F3F" 34 34 theme.titlebar_bg_focus = "#3F3F3F"
theme.titlebar_bg_normal = "#3F3F3F" 35 35 theme.titlebar_bg_normal = "#3F3F3F"
-- }}} 36 36 -- }}}
37 37
-- There are other variable sets 38 38 -- There are other variable sets
-- overriding the default one when 39 39 -- overriding the default one when
-- defined, the sets are: 40 40 -- defined, the sets are:
-- [taglist|tasklist]_[bg|fg]_[focus|urgent] 41 41 -- [taglist|tasklist]_[bg|fg]_[focus|urgent]
-- titlebar_[normal|focus] 42 42 -- titlebar_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color] 43 43 -- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- Example: 44 44 -- Example:
--theme.taglist_bg_focus = "#CC9393" 45 45 --theme.taglist_bg_focus = "#CC9393"
-- }}} 46 46 -- }}}
47 47
48 48
-- {{{ Widgets 49 49 -- {{{ Widgets
-- You can add as many variables as 50 50 -- You can add as many variables as
-- you wish and access them by using 51 51 -- you wish and access them by using
-- beautiful.variableName in your rc.lua 52 52 -- beautiful.variableName in your rc.lua
theme.fg_widget = "#AECF96" 53 53 theme.fg_widget = "#AECF96"
theme.fg_center_widget = "#FFCF00" 54 54 theme.fg_center_widget = "#FFCF00"
theme.fg_end_widget = "#FF5656" 55 55 theme.fg_end_widget = "#FF5656"
theme.bg_widget = "#111111" 56 56 theme.bg_widget = "#111111"
--theme.border_widget = "#3F3F3F" 57 57 --theme.border_widget = "#3F3F3F"
-- }}} 58 58 -- }}}
59 59
-- {{{ Mouse finder 60 60 -- {{{ Mouse finder
--theme.mouse_finder_color = "#CC9393" 61 61 --theme.mouse_finder_color = "#CC9393"
-- mouse_finder_[timeout|animate_timeout|radius|factor] 62 62 -- mouse_finder_[timeout|animate_timeout|radius|factor]
-- }}} 63 63 -- }}}
64 64
-- {{{ Menu 65 65 -- {{{ Menu
-- Variables set for theming the menu: 66 66 -- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus] 67 67 -- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width] 68 68 -- menu_[border_color|border_width]
theme.menu_height = 16 69 69 theme.menu_height = 16
theme.menu_width = 150 70 70 theme.menu_width = 150
-- }}} 71 71 -- }}}
72 72
-- {{{ Icons 73 73 -- {{{ Icons
-- {{{ Taglist 74 74 -- {{{ Taglist
theme.taglist_squares_sel = theme.themedir .. "taglist/filled_corner.png" 75 75 theme.taglist_squares_sel = theme.themedir .. "taglist/filled_corner.png"
theme.taglist_squares_unsel = theme.themedir .. "taglist/corner.png" 76 76 theme.taglist_squares_unsel = theme.themedir .. "taglist/corner.png"
--theme.taglist_squares_resize = "false" 77 77 --theme.taglist_squares_resize = "false"
-- }}} 78 78 -- }}}
79 79
-- {{{ Misc 80 80 -- {{{ Misc
theme.awesome_icon = theme.themedir .. "awesome-icon.png" 81 81 theme.awesome_icon = theme.themedir .. "awesome-icon.png"
theme.menu_submenu_icon = theme.themedir .. "submenu.png" 82 82 theme.menu_submenu_icon = theme.themedir .. "submenu.png"
theme.tasklist_floating_icon = "/usr/share/awesome/themes/default/tasklist/floatingw.png" 83 83 theme.tasklist_floating_icon = "/usr/share/awesome/themes/default/tasklist/floatingw.png"
-- }}} 84 84 -- }}}
85 85
-- {{{ Layout 86 86 -- {{{ Layout
theme.layout_tile = theme.themedir .. "layouts/tile.png" 87 87 theme.layout_tile = theme.themedir .. "layouts/tile.png"
theme.layout_tileleft = theme.themedir .. "layouts/tileleft.png" 88 88 theme.layout_tileleft = theme.themedir .. "layouts/tileleft.png"
theme.layout_tilebottom = theme.themedir .. "layouts/tilebottom.png" 89 89 theme.layout_tilebottom = theme.themedir .. "layouts/tilebottom.png"
theme.layout_tiletop = theme.themedir .. "layouts/tiletop.png" 90 90 theme.layout_tiletop = theme.themedir .. "layouts/tiletop.png"
theme.layout_fairv = theme.themedir .. "layouts/fairv.png" 91 91 theme.layout_fairv = theme.themedir .. "layouts/fairv.png"
theme.layout_fairh = theme.themedir .. "layouts/fairh.png" 92 92 theme.layout_fairh = theme.themedir .. "layouts/fairh.png"
theme.layout_spiral = theme.themedir .. "layouts/spiral.png" 93 93 theme.layout_spiral = theme.themedir .. "layouts/spiral.png"
theme.layout_dwindle = theme.themedir .. "layouts/dwindle.png" 94 94 theme.layout_dwindle = theme.themedir .. "layouts/dwindle.png"
theme.layout_max = theme.themedir .. "layouts/max.png" 95 95 theme.layout_max = theme.themedir .. "layouts/max.png"
theme.layout_fullscreen = theme.themedir .. "layouts/fullscreen.png" 96 96 theme.layout_fullscreen = theme.themedir .. "layouts/fullscreen.png"
theme.layout_magnifier = theme.themedir .. "layouts/magnifier.png" 97 97 theme.layout_magnifier = theme.themedir .. "layouts/magnifier.png"
theme.layout_floating = theme.themedir .. "layouts/floating.png" 98 98 theme.layout_floating = theme.themedir .. "layouts/floating.png"
theme.layout_browse = theme.themedir .. "layouts/browse.png" 99 99 theme.layout_browse = theme.themedir .. "layouts/browse.png"
theme.layout_termfair = theme.themedir .. "layouts/termfair.png" 100 100 theme.layout_termfair = theme.themedir .. "layouts/termfair.png"
theme.layout_uselesstile = theme.themedir .. "layouts/tile.png" 101 101 theme.layout_uselesstile = theme.themedir .. "layouts/tile.png"
102 theme.layout_uselesstilebottom = theme.themedir .. "layouts/tilebottom.png"
theme.layout_fairh = theme.themedir .. "layouts/fairh.png" 102 103 theme.layout_fairh = theme.themedir .. "layouts/fairh.png"
-- }}} 103 104 -- }}}
104 105
-- {{{ Titlebar 105 106 -- {{{ Titlebar
theme.titlebar_close_button_focus = theme.themedir .. "titlebar/close_focus.png" 106 107 theme.titlebar_close_button_focus = theme.themedir .. "titlebar/close_focus.png"
theme.titlebar_close_button_normal = theme.themedir .. "titlebar/close_normal.png" 107 108 theme.titlebar_close_button_normal = theme.themedir .. "titlebar/close_normal.png"
108 109
theme.titlebar_ontop_button_focus_active = theme.themedir .. "titlebar/ontop_focus_active.png" 109 110 theme.titlebar_ontop_button_focus_active = theme.themedir .. "titlebar/ontop_focus_active.png"
theme.titlebar_ontop_button_normal_active = theme.themedir .. "titlebar/ontop_normal_active.png" 110 111 theme.titlebar_ontop_button_normal_active = theme.themedir .. "titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_inactive = theme.themedir .. "titlebar/ontop_focus_inactive.png" 111 112 theme.titlebar_ontop_button_focus_inactive = theme.themedir .. "titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_inactive = theme.themedir .. "titlebar/ontop_normal_inactive.png" 112 113 theme.titlebar_ontop_button_normal_inactive = theme.themedir .. "titlebar/ontop_normal_inactive.png"
113 114
awesome/awesome/layouts/termfair.lua View file @ bbcdeb6
-- Grab environment. 1 1 -- Grab environment.
local tag = require("awful.tag") 2 2 local tag = require("awful.tag")
local beautiful = require("beautiful") 3 3 local beautiful = require("beautiful")
local math = math 4 4 local math = math
local tonumber = tonumber 5 5 local tonumber = tonumber
6 6
module("vain.layout.termfair") 7 7 module("vain.layout.termfair")
8 8
nmaster = 3 9 9 nmaster = 3
ncol = 2 10 10 ncol = 2
11 11
name = "termfair" 12 12 name = "termfair"
13 13
function arrange(p) 14 14 function arrange(p)
15 15
-- Layout with fixed number of vertical columns (read from nmaster). 16 16 -- Layout with fixed number of vertical columns (read from nmaster).
-- New windows align from left to right. When a row is full, a now 17 17 -- New windows align from left to right. When a row is full, a now
-- one above it is created. Like this: 18 18 -- one above it is created. Like this:
19 19
-- (1) (2) (3) 20 20 -- (1) (2) (3)
-- +---+---+---+ +---+---+---+ +---+---+---+ 21 21 -- +---+---+---+ +---+---+---+ +---+---+---+
-- | | | | | | | | | | | | 22 22 -- | | | | | | | | | | | |
-- | 1 | | | -> | 2 | 1 | | -> | 3 | 2 | 1 | -> 23 23 -- | 1 | | | -> | 2 | 1 | | -> | 3 | 2 | 1 | ->
-- | | | | | | | | | | | | 24 24 -- | | | | | | | | | | | |
-- +---+---+---+ +---+---+---+ +---+---+---+ 25 25 -- +---+---+---+ +---+---+---+ +---+---+---+
26 26
-- (4) (5) (6) 27 27 -- (4) (5) (6)
-- +---+---+---+ +---+---+---+ +---+---+---+ 28 28 -- +---+---+---+ +---+---+---+ +---+---+---+
-- | 4 | | | | 5 | 4 | | | 6 | 5 | 4 | 29 29 -- | 4 | | | | 5 | 4 | | | 6 | 5 | 4 |
-- +---+---+---+ -> +---+---+---+ -> +---+---+---+ 30 30 -- +---+---+---+ -> +---+---+---+ -> +---+---+---+
-- | 3 | 2 | 1 | | 3 | 2 | 1 | | 3 | 2 | 1 | 31 31 -- | 3 | 2 | 1 | | 3 | 2 | 1 | | 3 | 2 | 1 |
-- +---+---+---+ +---+---+---+ +---+---+---+ 32 32 -- +---+---+---+ +---+---+---+ +---+---+---+
33 33
-- A useless gap (like the dwm patch) can be defined with 34 34 -- A useless gap (like the dwm patch) can be defined with
-- beautiful.useless_gap_width. 35 35 -- beautiful.useless_gap_width.
local useless_gap = tonumber(beautiful.useless_gap_width) 36 36 local useless_gap = tonumber(beautiful.useless_gap_width)
if useless_gap == nil 37 37 if useless_gap == nil
then 38 38 then
useless_gap = 0 39 39 useless_gap = 0
end 40 40 end
41 41
-- Screen. 42 42 -- Screen.
local wa = p.workarea 43 43 local wa = p.workarea
local cls = p.clients 44 44 local cls = p.clients
45 45
-- How many vertical columns? Read from nmaster on the tag. 46 46 -- How many vertical columns? Read from nmaster on the tag.
--local t = tag.selected(p.screen) 47 47 --local t = tag.selected(p.screen)
--local num_x = tag.getnmaster(t) 48 48 --local num_x = tag.getnmaster(t)
local num_x = nmaster 49 49 local num_x = nmaster
50 50
-- Do at least "desired_y" rows. Read this from ncol. (Yes, I use a 51 51 -- Do at least "desired_y" rows. Read this from ncol. (Yes, I use a
-- *column* setting to set the number of *rows*. That's because 52 52 -- *column* setting to set the number of *rows*. That's because
-- num_x is the *master* setting -- it's the setting that's most 53 53 -- num_x is the *master* setting -- it's the setting that's most
-- important to me.) 54 54 -- important to me.)
--local desired_y = tag.getncol(t) 55 55 --local desired_y = tag.getncol(t)
local desired_y = ncol 56 56 local desired_y = ncol
57 57
--dynamic positioning 58 58 --dynamic positioning
if #cls < 4 59 59 if #cls < 4
then 60 60 then
num_x = #cls 61 61 num_x = #cls
62 elseif #cls == 4
63 then
64 num_x = 2
end 62 65 end
63 66
64 67
if #cls > 0 65 68 if #cls > 0
then 66 69 then
local num_y = math.max(math.ceil(#cls / num_x), desired_y) 67 70 local num_y = math.max(math.ceil(#cls / num_x), desired_y)
local cur_num_x = num_x 68 71 local cur_num_x = num_x
local at_x = 0 69 72 local at_x = 0
local at_y = 0 70 73 local at_y = 0
local remaining_clients = #cls 71 74 local remaining_clients = #cls
local width = math.floor(wa.width / num_x) 72 75 local width = math.floor(wa.width / num_x)
local height = math.floor(wa.height / num_y) 73 76 local height = math.floor(wa.height / num_y)
74 77
-- We start the first row. Left-align by limiting the number of 75 78 -- We start the first row. Left-align by limiting the number of
-- available slots. 76 79 -- available slots.
if remaining_clients < num_x 77 80 if remaining_clients < num_x
then 78 81 then
cur_num_x = remaining_clients 79 82 cur_num_x = remaining_clients
end 80 83 end
81 84
-- Iterate in reversed order. 82 85 -- Iterate in reversed order.
for i = #cls,1,-1 83 86 for i = #cls,1,-1
do 84 87 do
-- Get x and y position. 85 88 -- Get x and y position.
local c = cls[i] 86 89 local c = cls[i]
local this_x = cur_num_x - at_x - 1 87 90 local this_x = cur_num_x - at_x - 1
local this_y = num_y - at_y - 1 88 91 local this_y = num_y - at_y - 1
89 92
-- Calc geometry. 90 93 -- Calc geometry.
local g = {} 91 94 local g = {}
if this_x == (num_x - 1) 92 95 if this_x == (num_x - 1)
then 93 96 then
g.width = wa.width - (num_x - 1) * width 94 97 g.width = wa.width - (num_x - 1) * width
else 95 98 else
g.width = width 96 99 g.width = width
end 97 100 end
if this_y == (num_y - 1) 98 101 if this_y == (num_y - 1)
then 99 102 then
g.height = wa.height - (num_y - 1) * height 100 103 g.height = wa.height - (num_y - 1) * height
else 101 104 else
g.height = height 102 105 g.height = height
end 103 106 end
g.x = wa.x + this_x * width 104 107 g.x = wa.x + this_x * width
g.y = wa.y + this_y * height 105 108 g.y = wa.y + this_y * height
if useless_gap > 0 106 109 if useless_gap > 0
then 107 110 then
-- Top and left clients are shrinked by two steps and 108 111 -- Top and left clients are shrinked by two steps and
-- get moved away from the border. Other clients just 109 112 -- get moved away from the border. Other clients just
-- get shrinked in one direction. 110 113 -- get shrinked in one direction.
if this_x == 0 111 114 if this_x == 0
then 112 115 then
g.width = g.width - 2 * useless_gap 113 116 g.width = g.width - 2 * useless_gap
g.x = g.x + useless_gap 114 117 g.x = g.x + useless_gap
else 115 118 else
g.width = g.width - useless_gap 116 119 g.width = g.width - useless_gap
end 117 120 end
118 121
if this_y == 0 119 122 if this_y == 0
then 120 123 then
g.height = g.height - 2 * useless_gap 121 124 g.height = g.height - 2 * useless_gap
g.y = g.y + useless_gap 122 125 g.y = g.y + useless_gap
else 123 126 else
g.height = g.height - useless_gap 124 127 g.height = g.height - useless_gap
end 125 128 end
end 126 129 end
c:geometry(g) 127 130 c:geometry(g)
awesome/awesome/rc.lua View file @ bbcdeb6
-------------------------------------- 1 1 --------------------------------------
---- Includes ---- 2 2 ---- Includes ----
-------------------------------------- 3 3 --------------------------------------
-- Standard awesome library 4 4 -- Standard awesome library
require("awful") 5 5 require("awful")
require("awful.autofocus") 6 6 require("awful.autofocus")
require("awful.rules") 7 7 require("awful.rules")
8 8
-- Theme handling library 9 9 -- Theme handling library
require("beautiful") 10 10 require("beautiful")
11 11
-- Notification library 12 12 -- Notification library
require("naughty") 13 13 require("naughty")
14 14
--Expose like plugin 15 15 --Expose like plugin
require("modules/revelation") 16 16 require("modules/revelation")
17 17
--calendaar popup 18 18 --calendaar popup
require('calendar2') 19 19 require('calendar2')
20 20
--freedesktop menus 21 21 --freedesktop menus
require('modules/awesome-freedesktop/freedesktop.utils') 22 22 require('modules/awesome-freedesktop/freedesktop.utils')
require('modules/awesome-freedesktop/freedesktop.menu') 23 23 require('modules/awesome-freedesktop/freedesktop.menu')
24 24
--for widgets 25 25 --for widgets
require("vicious") 26 26 require("vicious")
27 27
require("xrandr") 28 28 require("xrandr")
29 29
30 30
require("layouts/browse") 31 31 require("layouts/browse")
require("layouts/termfair") 32 32 require("layouts/termfair")
--require("layouts/uselessfair") 33 33 require("layouts/uselessfair")
--require("layouts/uselesstile") 34 34 require("layouts/uselesstile")
35 35
--local keydoc = require("keydoc") 36 36 --local keydoc = require("keydoc")
37 37
-------------------------------------- 38 38 --------------------------------------
---- Variables ---- 39 39 ---- Variables ----
-------------------------------------- 40 40 --------------------------------------
41 41
-- {{{ Variable definitions 42 42 -- {{{ Variable definitions
-- This is used later as the default terminal and editor to run. 43 43 -- This is used later as the default terminal and editor to run.
terminal = "terminator" 44 44 terminal = "terminator"
editor = os.getenv("EDITOR") or "vim" 45 45 editor = os.getenv("EDITOR") or "vim"
editor_cmd = terminal .. " -e " .. editor 46 46 editor_cmd = terminal .. " -e " .. editor
web_browser = "google-chrome" 47 47 web_browser = "google-chrome"
file_manager = "thunar" 48 48 file_manager = "thunar"
lock_command = "xscreensaver-command -lock" 49 49 lock_command = "xscreensaver-command -lock"
exit_command = "cb-exit" 50 50 exit_command = "cb-exit"
51 51
-- Default modkey. 52 52 -- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt. 53 53 -- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key, 54 54 -- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools. 55 55 -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others. 56 56 -- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4" 57 57 modkey = "Mod4"
58 58
59 59
-------------------------------------- 60 60 --------------------------------------
---- Layout Settings ---- 61 61 ---- Layout Settings ----
-------------------------------------- 62 62 --------------------------------------
63 63
-- number of columns 64 64 -- number of columns
vain.layout.termfair.nmaster = 3 65 65 vain.layout.termfair.nmaster = 3
-- min number of rows (yes the var-name is backwards) 66 66 -- min number of rows (yes the var-name is backwards)
vain.layout.termfair.ncol = 1 67 67 vain.layout.termfair.ncol = 1
68 68
-- percent of space for main window 69 69 -- percent of space for main window
vain.layout.browse.mwfact_global = 0.6 70 70 vain.layout.browse.mwfact_global = 0.6
-- 0 for non-overlapping, 1 for ovelapping 71 71 -- 0 for non-overlapping, 1 for ovelapping
vain.layout.browse.ncol = 1 72 72 vain.layout.browse.ncol = 1
-- reduces the size of the main window if "overlapping slave column" is activated. 73 73 -- reduces the size of the main window if "overlapping slave column" is activated.
-- This allows you to see if there are any windows in your slave column. 74 74 -- This allows you to see if there are any windows in your slave column.
vain.layout.browse.extra_padding = 5 75 75 vain.layout.browse.extra_padding = 5
76 76
-------------------------------------- 77 77 --------------------------------------
---- Plugin Settings ---- 78 78 ---- Plugin Settings ----
-------------------------------------- 79 79 --------------------------------------
80 80
--set default naughty timeout 81 81 --set default naughty timeout
naughty.config.default_preset.timeout = 2 82 82 naughty.config.default_preset.timeout = 2
83 83
84 84
-- Themes define colours, icons, and wallpapers 85 85 -- Themes define colours, icons, and wallpapers
beautiful.init( awful.util.getdir("config") .. "/darkburn/theme.lua") 86 86 beautiful.init( awful.util.getdir("config") .. "/darkburn/theme.lua")
87 87
88 88
-------------------------------------- 89 89 --------------------------------------
---- Error Handleing ---- 90 90 ---- Error Handleing ----
-------------------------------------- 91 91 --------------------------------------
92 92
-- {{{ Error handling 93 93 -- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to 94 94 -- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config) 95 95 -- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then 96 96 if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, 97 97 naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!", 98 98 title = "Oops, there were errors during startup!",
text = awesome.startup_errors }) 99 99 text = awesome.startup_errors })
end 100 100 end
101 101
-- Handle runtime errors after startup 102 102 -- Handle runtime errors after startup
do 103 103 do
local in_error = false 104 104 local in_error = false
awesome.add_signal("debug::error", function (err) 105 105 awesome.add_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop 106 106 -- Make sure we don't go into an endless error loop
if in_error then return end 107 107 if in_error then return end
in_error = true 108 108 in_error = true
109 109
naughty.notify({ preset = naughty.config.presets.critical, 110 110 naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!", 111 111 title = "Oops, an error happened!",
text = err }) 112 112 text = err })
in_error = false 113 113 in_error = false
end) 114 114 end)
end 115 115 end
-- }}} 116 116 -- }}}
117 117
118 118
-------------------------------------- 119 119 --------------------------------------
---- Tags and Layout ---- 120 120 ---- Tags and Layout ----
-------------------------------------- 121 121 --------------------------------------
122 122
-- Table of layouts to cover with awful.layout.inc, order matters. 123 123 -- Table of layouts to cover with awful.layout.inc, order matters.
layouts = 124 124 layouts =
{ 125 125 {
awful.layout.suit.tile, 126 126 awful.layout.suit.tile,
awful.layout.suit.tile.bottom, 127 127 awful.layout.suit.tile.bottom,
awful.layout.suit.max, 128 128 awful.layout.suit.max,
awful.layout.suit.floating, 129 129 awful.layout.suit.floating,
vain.layout.browse, 130 130 vain.layout.browse,
vain.layout.termfair, 131 131 vain.layout.termfair,
vain.layout.uselesstile, 132 132 --vain.layout.uselesstile,
vain.layout.uselessfair, 133 133 vain.layout.uselessfair,
--awful.layout.suit.magnifier, 134 134 --awful.layout.suit.magnifier,
--awful.layout.suit.tile.left, 135 135 --awful.layout.suit.tile.left,
--awful.layout.suit.tile.top, 136 136 --awful.layout.suit.tile.top,
--awful.layout.suit.fair, 137 137 --awful.layout.suit.fair,
--awful.layout.suit.fair.horizontal, 138 138 --awful.layout.suit.fair.horizontal,
--awful.layout.suit.spiral, 139 139 --awful.layout.suit.spiral,
--awful.layout.suit.spiral.dwindle, 140 140 --awful.layout.suit.spiral.dwindle,
--awful.layout.suit.max.fullscreen, 141 141 --awful.layout.suit.max.fullscreen,
} 142 142 }
-- }}} 143 143 -- }}}
144 144
-- {{{ Tags 145 145 -- {{{ Tags
-- Define a tag table which hold all screen tags. 146 146 -- Define a tag table which hold all screen tags.
tags = { 147 147 tags = {
names = { 'โ ’', 'โ “', 'โ ฃ', 'โ ง', 'โ —', 'โ ', 'โ ต', 'โ น', 'โ ณ' }, 148 148 names = { 'โ ’', 'โ “', 'โ ฃ', 'โ ง', 'โ —', 'โ ', 'โ ต', 'โ น', 'โ ณ' },
layout = { layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1],}, 149 149 layout = { layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1], layouts[1],},
} 150 150 }
for s = 1, screen.count() do 151 151 for s = 1, screen.count() do
-- Each screen has its own tag table. 152 152 -- Each screen has its own tag table.
tags[s] = awful.tag(tags.names, s, tags.layout) 153 153 tags[s] = awful.tag(tags.names, s, tags.layout)
end 154 154 end
-- }}} 155 155 -- }}}
-- 156 156 --
--awful.layout.set(vain.layout.termfair, tags[1][2]) 157 157 --awful.layout.set(vain.layout.termfair, tags[1][2])
--awful.tag.setnmaster(3, tags[1][2]) 158 158 --awful.tag.setnmaster(3, tags[1][2])
--awful.tag.setncol(1, tags[1][2]) 159 159 --awful.tag.setncol(1, tags[1][2])
160 160
-------------------------------------- 161 161 --------------------------------------
---- Menu ---- 162 162 ---- Menu ----
-------------------------------------- 163 163 --------------------------------------
164 164
-- {{{ Menu 165 165 -- {{{ Menu
-- Create a laucher widget and a main menu 166 166 -- Create a laucher widget and a main menu
myawesomemenu = { 167 167 myawesomemenu = {
{ "manual", terminal .. " -e man awesome" }, 168 168 { "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile }, 169 169 { "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart }, 170 170 { "restart", awesome.restart },
{ "quit", awesome.quit } 171 171 { "quit", awesome.quit }
} 172 172 }
173 173
menu_items = freedesktop.menu.new() 174 174 menu_items = freedesktop.menu.new()
table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon }) 175 175 table.insert(menu_items, { "awesome", myawesomemenu, beautiful.awesome_icon })
table.insert(menu_items, { "Exit", exit_command }) 176 176 table.insert(menu_items, { "Exit", exit_command })
177 177
mymainmenu = awful.menu.new({ items = menu_items, width = beautiful.menu_width }) 178 178 mymainmenu = awful.menu.new({ items = menu_items, width = beautiful.menu_width })
179 179
mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon), 180 180 mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
menu = mymainmenu }) 181 181 menu = mymainmenu })
-- }}} 182 182 -- }}}
183 183
184 184
-------------------------------------- 185 185 --------------------------------------
---- WiBox ---- 186 186 ---- WiBox ----
-------------------------------------- 187 187 --------------------------------------
188 188
-- {{{ Wibox 189 189 -- {{{ Wibox
-- Create a textclock widget 190 190 -- Create a textclock widget
mytextclock = awful.widget.textclock({ align = "right" }) 191 191 mytextclock = awful.widget.textclock({ align = "right" })
192 192
--calendar plugin 193 193 --calendar plugin
calendar2.addCalendarToWidget(mytextclock) 194 194 calendar2.addCalendarToWidget(mytextclock)
195 195
--separator widget 196 196 --separator widget
separator = widget({ type = "textbox" }) 197 197 separator = widget({ type = "textbox" })
separator.text = "|" 198 198 separator.text = "|"
199 199
--space widget 200 200 --space widget
space = widget({ type = "textbox" }) 201 201 space = widget({ type = "textbox" })
space.text = " " 202 202 space.text = " "
203 203
204 204
-- RAM usage widget 205 205 -- RAM usage widget
memwidget = awful.widget.progressbar() 206 206 memwidget = awful.widget.progressbar()
memwidget:set_width(8) 207 207 memwidget:set_width(8)
memwidget:set_height(beautiful.menu_height) 208 208 memwidget:set_height(beautiful.menu_height)
memwidget:set_vertical(true) 209 209 memwidget:set_vertical(true)
memwidget:set_background_color(beautiful.bg_widget) 210 210 memwidget:set_background_color(beautiful.bg_widget)
memwidget:set_color(beautiful.fg_widget) 211 211 memwidget:set_color(beautiful.fg_widget)
memwidget:set_gradient_colors({ beautiful.fg_widget, beautiful.fg_center_widget, beautiful.fg_end_widget }) 212 212 memwidget:set_gradient_colors({ beautiful.fg_widget, beautiful.fg_center_widget, beautiful.fg_end_widget })
-- RAM usage tooltip 213 213 -- RAM usage tooltip
memwidget_t = awful.tooltip({ objects = { memwidget.widget },}) 214 214 memwidget_t = awful.tooltip({ objects = { memwidget.widget },})
vicious.cache(vicious.widgets.mem) 215 215 vicious.cache(vicious.widgets.mem)
vicious.register(memwidget, vicious.widgets.mem, 216 216 vicious.register(memwidget, vicious.widgets.mem,
function (widget, args) 217 217 function (widget, args)
memwidget_t:set_text(" RAM: " .. args[1] .. "% " .. args[2] .. "MB / " .. args[3] .. "MB ") 218 218 memwidget_t:set_text(" RAM: " .. args[1] .. "% " .. args[2] .. "MB / " .. args[3] .. "MB ")
return args[1] 219 219 return args[1]
end, 5) 220 220 end, 5)
--update every 5 seconds 221 221 --update every 5 seconds
222 222
-- CPU usage widget 223 223 -- CPU usage widget
cpuwidget = awful.widget.graph() 224 224 cpuwidget = awful.widget.graph()
cpuwidget:set_width(30) 225 225 cpuwidget:set_width(30)
cpuwidget:set_height(beautiful.menu_height) 226 226 cpuwidget:set_height(beautiful.menu_height)
cpuwidget:set_background_color(beautiful.bg_widget) 227 227 cpuwidget:set_background_color(beautiful.bg_widget)
cpuwidget:set_color(beautiful.fg_widget) 228 228 cpuwidget:set_color(beautiful.fg_widget)
cpuwidget:set_gradient_angle(180) 229 229 cpuwidget:set_gradient_angle(180)
cpuwidget:set_gradient_colors({ beautiful.fg_widget, fg_center_widget, beautiful.fg_end_widget }) 230 230 cpuwidget:set_gradient_colors({ beautiful.fg_widget, fg_center_widget, beautiful.fg_end_widget })
cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },}) 231 231 cpuwidget_t = awful.tooltip({ objects = { cpuwidget.widget },})
-- Register CPU widget 232 232 -- Register CPU widget
vicious.register(cpuwidget, vicious.widgets.cpu, 233 233 vicious.register(cpuwidget, vicious.widgets.cpu,
function (widget, args) 234 234 function (widget, args)
cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%") 235 235 cpuwidget_t:set_text("CPU Usage: " .. args[1] .. "%")
return args[1] 236 236 return args[1]
end, 2) 237 237 end, 2)
238 238
-- Create a systray 239 239 -- Create a systray
mysystray = widget({ type = "systray" }) 240 240 mysystray = widget({ type = "systray" })
241 241
-- Create a wibox for each screen and add it 242 242 -- Create a wibox for each screen and add it
mywibox = {} 243 243 mywibox = {}
mypromptbox = {} 244 244 mypromptbox = {}
mylayoutbox = {} 245 245 mylayoutbox = {}
mytaglist = {} 246 246 mytaglist = {}
mytaglist.buttons = awful.util.table.join( 247 247 mytaglist.buttons = awful.util.table.join(
awful.button({ }, 1, awful.tag.viewonly), 248 248 awful.button({ }, 1, awful.tag.viewonly),
awful.button({ modkey }, 1, awful.client.movetotag), 249 249 awful.button({ modkey }, 1, awful.client.movetotag),
awful.button({ }, 3, awful.tag.viewtoggle), 250 250 awful.button({ }, 3, awful.tag.viewtoggle),
awful.button({ modkey }, 3, awful.client.toggletag), 251 251 awful.button({ modkey }, 3, awful.client.toggletag),
awful.button({ }, 4, awful.tag.viewnext), 252 252 awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) 253 253 awful.button({ }, 5, awful.tag.viewprev)
) 254 254 )
mytasklist = {} 255 255 mytasklist = {}
mytasklist.buttons = awful.util.table.join( 256 256 mytasklist.buttons = awful.util.table.join(
awful.button({ }, 1, function (c) 257 257 awful.button({ }, 1, function (c)
if c == client.focus then 258 258 if c == client.focus then
c.minimized = true 259 259 c.minimized = true
else 260 260 else
if not c:isvisible() then 261 261 if not c:isvisible() then
awful.tag.viewonly(c:tags()[1]) 262 262 awful.tag.viewonly(c:tags()[1])
end 263 263 end
-- This will also un-minimize 264 264 -- This will also un-minimize
-- the client, if needed 265 265 -- the client, if needed
client.focus = c 266 266 client.focus = c
c:raise() 267 267 c:raise()
end 268 268 end
end), 269 269 end),
awful.button({ }, 3, function () 270 270 awful.button({ }, 3, function ()
if instance then 271 271 if instance then
instance:hide() 272 272 instance:hide()
instance = nil 273 273 instance = nil
else 274 274 else
instance = awful.menu.clients({ width=250 }) 275 275 instance = awful.menu.clients({ width=250 })
end 276 276 end
end), 277 277 end),
awful.button({ }, 4, function () 278 278 awful.button({ }, 4, function ()
awful.client.focus.byidx(1) 279 279 awful.client.focus.byidx(1)
if client.focus then client.focus:raise() end 280 280 if client.focus then client.focus:raise() end
end), 281 281 end),
awful.button({ }, 5, function () 282 282 awful.button({ }, 5, function ()
awful.client.focus.byidx(-1) 283 283 awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end 284 284 if client.focus then client.focus:raise() end
end)) 285 285 end))
286 286
for s = 1, screen.count() do 287 287 for s = 1, screen.count() do
-- Create a promptbox for each screen 288 288 -- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright }) 289 289 mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
-- Create an imagebox widget which will contains an icon indicating which layout we're using. 290 290 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
-- We need one layoutbox per screen. 291 291 -- We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s) 292 292 mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join( 293 293 mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end), 294 294 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end), 295 295 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end), 296 296 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end))) 297 297 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget 298 298 -- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons) 299 299 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
300 300
-- Create a tasklist widget 301 301 -- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(function(c) 302 302 mytasklist[s] = awful.widget.tasklist(function(c)
return awful.widget.tasklist.label.currenttags(c, s) 303 303 return awful.widget.tasklist.label.currenttags(c, s)
end, mytasklist.buttons) 304 304 end, mytasklist.buttons)
305 305
-- Create the wibox 306 306 -- Create the wibox
mywibox[s] = awful.wibox({ position = "top", screen = s, height = beautiful.menu_height }) 307 307 mywibox[s] = awful.wibox({ position = "top", screen = s, height = beautiful.menu_height })
-- Add widgets to the wibox - order matters 308 308 -- Add widgets to the wibox - order matters
mywibox[s].widgets = { 309 309 mywibox[s].widgets = {
{ 310 310 {
mylauncher, 311 311 mylauncher,
mytaglist[s], 312 312 mytaglist[s],
mypromptbox[s], 313 313 mypromptbox[s],
layout = awful.widget.layout.horizontal.leftright 314 314 layout = awful.widget.layout.horizontal.leftright
}, 315 315 },
mylayoutbox[s], 316 316 mylayoutbox[s],
mytextclock, 317 317 mytextclock,
separator, 318 318 separator,
space, 319 319 space,
memwidget.widget, 320 320 memwidget.widget,
space, 321 321 space,
separator, 322 322 separator,
space, 323 323 space,
cpuwidget.widget, 324 324 cpuwidget.widget,
space, 325 325 space,
separator, 326 326 separator,
s == 1 and mysystray or nil, --only place the systray on the primary screen 327 327 s == 1 and mysystray or nil, --only place the systray on the primary screen
mytasklist[s], 328 328 mytasklist[s],
layout = awful.widget.layout.horizontal.rightleft 329 329 layout = awful.widget.layout.horizontal.rightleft
} 330 330 }
end 331 331 end
-- }}} 332 332 -- }}}
333 333
334 334
-------------------------------------- 335 335 --------------------------------------
---- Key bindings ---- 336 336 ---- Key bindings ----
-------------------------------------- 337 337 --------------------------------------
338 338
-- {{{ Change workspace on scroll 339 339 -- {{{ Change workspace on scroll
root.buttons(awful.util.table.join( 340 340 root.buttons(awful.util.table.join(
--awful.button({ }, 3, function () mymainmenu:toggle() end), --I dont want a menu when I click on the desktop 341 341 --awful.button({ }, 3, function () mymainmenu:toggle() end), --I dont want a menu when I click on the desktop
awful.button({ }, 4, awful.tag.viewnext), 342 342 awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) 343 343 awful.button({ }, 5, awful.tag.viewprev)
)) 344 344 ))
-- }}} 345 345 -- }}}
346 346
347 347
-- {{{ Key bindings 348 348 -- {{{ Key bindings
globalkeys = awful.util.table.join( 349 349 globalkeys = awful.util.table.join(
350 350
--keydoc.group("Layout manipulation"), 351 351 --keydoc.group("Layout manipulation"),
352 352
353 353
--plugins 354 354 --plugins
awful.key({ modkey, }, "e", revelation), 355 355 awful.key({ modkey, }, "e", revelation),
--awful.key({ modkey, }, "F1", keydoc.display), --TODO finish this, needs arg string as last param 356 356 --awful.key({ modkey, }, "F1", keydoc.display), --TODO finish this, needs arg string as last param
357 357
--TODO make work 358 358 --TODO make work
awful.key({}, "XF86Display", xrandr), 359 359 awful.key({}, "XF86Display", xrandr),
360 360
--Conky toggle 361 361 --Conky toggle
awful.key({ }, "Pause", raise_conky, lower_conky), 362 362 awful.key({ }, "Pause", raise_conky, lower_conky),
--awful.key({}, "Pause", toggle_conky) 363 363 --awful.key({}, "Pause", toggle_conky)
364 364
--Move Client to Workspace Left/Right 365 365 --Move Client to Workspace Left/Right
--only works with 3.5, For 3.4 visit link 366 366 --only works with 3.5, For 3.4 visit link
--http://awesome.naquadah.org/wiki/Move_Window_to_Workspace_Left/Right 367 367 --http://awesome.naquadah.org/wiki/Move_Window_to_Workspace_Left/Right
awful.key({ modkey, "Shift" }, "Left", 368 368 awful.key({ modkey, "Shift" }, "Left",
function (c) 369 369 function (c)
local curidx = awful.tag.getidx() 370 370 local curidx = awful.tag.getidx()
if curidx == 1 then 371 371 if curidx == 1 then
awful.client.movetotag(tags[client.focus.screen][9]) 372 372 awful.client.movetotag(tags[client.focus.screen][9])
else 373 373 else
awful.client.movetotag(tags[client.focus.screen][curidx - 1]) 374 374 awful.client.movetotag(tags[client.focus.screen][curidx - 1])
end 375 375 end
--awful.tag.viewprev 376 376 --awful.tag.viewprev
end), 377 377 end),
awful.key({ modkey, "Shift" }, "Right", 378 378 awful.key({ modkey, "Shift" }, "Right",
function (c) 379 379 function (c)
local curidx = awful.tag.getidx() 380 380 local curidx = awful.tag.getidx()
if curidx == 9 then 381 381 if curidx == 9 then
awful.client.movetotag(tags[client.focus.screen][1]) 382 382 awful.client.movetotag(tags[client.focus.screen][1])
else 383 383 else
awful.client.movetotag(tags[client.focus.screen][curidx + 1]) 384 384 awful.client.movetotag(tags[client.focus.screen][curidx + 1])
end 385 385 end
--awful.tag.viewnext 386 386 --awful.tag.viewnext
end), 387 387 end),
awful.key({ modkey, }, "Left", awful.tag.viewprev ), 388 388 awful.key({ modkey, }, "Left", awful.tag.viewprev ),
awful.key({ modkey, }, "Right", awful.tag.viewnext ), 389 389 awful.key({ modkey, }, "Right", awful.tag.viewnext ),
awful.key({ modkey, }, "Escape", awful.tag.history.restore), 390 390 awful.key({ modkey, }, "Escape", awful.tag.history.restore),
391 391
awful.key({ modkey, }, "j", 392 392 awful.key({ modkey, }, "j",
function () 393 393 function ()
awful.client.focus.byidx( 1) 394 394 awful.client.focus.byidx( 1)
if client.focus then client.focus:raise() end 395 395 if client.focus then client.focus:raise() end
end), 396 396 end),
awful.key({ modkey, }, "k", 397 397 awful.key({ modkey, }, "k",
function () 398 398 function ()
awful.client.focus.byidx(-1) 399 399 awful.client.focus.byidx(-1)
if client.focus then client.focus:raise() end 400 400 if client.focus then client.focus:raise() end
end), 401 401 end),
--awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), --we dont like the menu 402 402 --awful.key({ modkey, }, "w", function () mymainmenu:show({keygrabber=true}) end), --we dont like the menu
403 403
-- Layout manipulation 404 404 -- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end), 405 405 awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), 406 406 awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end), 407 407 awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end), 408 408 awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto), 409 409 awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
awful.key({ modkey, }, "Tab", 410 410 awful.key({ modkey, }, "Tab",
function () 411 411 function ()
awful.client.focus.history.previous() 412 412 awful.client.focus.history.previous()
if client.focus then 413 413 if client.focus then
client.focus:raise() 414 414 client.focus:raise()
end 415 415 end
end), 416 416 end),
417 417
-- Standard program 418 418 -- Standard program
awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end), 419 419 awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
awful.key({ modkey, }, "w", function () awful.util.spawn(web_browser) end), --hotkey to start web-browser 420 420 awful.key({ modkey, }, "w", function () awful.util.spawn(web_browser) end), --hotkey to start web-browser
awful.key({ modkey, }, "f", function () awful.util.spawn(file_manager) end), --hotkey to start my file manager 421 421 awful.key({ modkey, }, "f", function () awful.util.spawn(file_manager) end), --hotkey to start my file manager
awful.key({ modkey, "Control" }, "l", function () awful.util.spawn(lock_command) end), --lock screen 422 422 awful.key({ modkey, "Control" }, "l", function () awful.util.spawn(lock_command) end), --lock screen
awful.key({ modkey, "Control" }, "r", awesome.restart), 423 423 awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit), 424 424 awful.key({ modkey, "Shift" }, "q", awesome.quit),
425 425
-- Standard program 426 426 -- Standard program
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end), 427 427 awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end), 428 428 awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end), 429 429 awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end), 430 430 awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end), 431 431 awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end), 432 432 awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end), 433 433 awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end), 434 434 awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
435 435
awful.key({ modkey, "Control" }, "n", awful.client.restore), 436 436 awful.key({ modkey, "Control" }, "n", awful.client.restore),
437 437
-- Prompt 438 438 -- Prompt
awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end), 439 439 awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
440 440
awful.key({ modkey }, "x", 441 441 awful.key({ modkey }, "x",
function () 442 442 function ()
awful.prompt.run({ prompt = "Run Lua code: " }, 443 443 awful.prompt.run({ prompt = "Run Lua code: " },
mypromptbox[mouse.screen].widget, 444 444 mypromptbox[mouse.screen].widget,
awful.util.eval, nil, 445 445 awful.util.eval, nil,
awful.util.getdir("cache") .. "/history_eval") 446 446 awful.util.getdir("cache") .. "/history_eval")
end) 447 447 end)
) 448 448 )
449 449
450 450
-- Compute the maximum number of digit we need, limited to 9 451 451 -- Compute the maximum number of digit we need, limited to 9
keynumber = 0 452 452 keynumber = 0
for s = 1, screen.count() do 453 453 for s = 1, screen.count() do
keynumber = math.min(9, math.max(#tags[s], keynumber)); 454 454 keynumber = math.min(9, math.max(#tags[s], keynumber));
end 455 455 end
456 456
-- Bind all key numbers to tags. 457 457 -- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it works on any keyboard layout. 458 458 -- Be careful: we use keycodes to make it works on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9. 459 459 -- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, keynumber do 460 460 for i = 1, keynumber do
globalkeys = awful.util.table.join(globalkeys, 461 461 globalkeys = awful.util.table.join(globalkeys,
awful.key({ modkey }, "#" .. i + 9, 462 462 awful.key({ modkey }, "#" .. i + 9,
function () 463 463 function ()
local screen = mouse.screen 464 464 local screen = mouse.screen
if tags[screen][i] then 465 465 if tags[screen][i] then
awful.tag.viewonly(tags[screen][i]) 466 466 awful.tag.viewonly(tags[screen][i])
end 467 467 end
end), 468 468 end),
awful.key({ modkey, "Control" }, "#" .. i + 9, 469 469 awful.key({ modkey, "Control" }, "#" .. i + 9,
function () 470 470 function ()
local screen = mouse.screen 471 471 local screen = mouse.screen
if tags[screen][i] then 472 472 if tags[screen][i] then
awful.tag.viewtoggle(tags[screen][i]) 473 473 awful.tag.viewtoggle(tags[screen][i])
end 474 474 end
end), 475 475 end),
awful.key({ modkey, "Shift" }, "#" .. i + 9, 476 476 awful.key({ modkey, "Shift" }, "#" .. i + 9,
function () 477 477 function ()
if client.focus and tags[client.focus.screen][i] then 478 478 if client.focus and tags[client.focus.screen][i] then
awful.client.movetotag(tags[client.focus.screen][i]) 479 479 awful.client.movetotag(tags[client.focus.screen][i])
end 480 480 end
end), 481 481 end),
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9, 482 482 awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function () 483 483 function ()
if client.focus and tags[client.focus.screen][i] then 484 484 if client.focus and tags[client.focus.screen][i] then
awful.client.toggletag(tags[client.focus.screen][i]) 485 485 awful.client.toggletag(tags[client.focus.screen][i])
end 486 486 end
end)) 487 487 end))
end 488 488 end
489 489
clientbuttons = awful.util.table.join( 490 490 clientbuttons = awful.util.table.join(
awful.button({ }, 1, function (c) client.focus = c; c:raise() end), 491 491 awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
awful.button({ modkey }, 1, awful.mouse.client.move), 492 492 awful.button({ modkey }, 1, awful.mouse.client.move),
awful.button({ modkey }, 3, awful.mouse.client.resize)) 493 493 awful.button({ modkey }, 3, awful.mouse.client.resize))
494 494
-- Set keys 495 495 -- Set keys
root.keys(globalkeys) 496 496 root.keys(globalkeys)
-- }}} 497 497 -- }}}
498 498
499 499
-------------------------------------- 500 500 --------------------------------------
--- Rules ---- 501 501 --- Rules ----
-------------------------------------- 502 502 --------------------------------------
503 503
clientkeys = awful.util.table.join( 504 504 clientkeys = awful.util.table.join(
awful.key({ modkey, }, "F11", function (c) c.fullscreen = not c.fullscreen end), 505 505 awful.key({ modkey, }, "F11", function (c) c.fullscreen = not c.fullscreen end),
awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end), 506 506 awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ), 507 507 awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end), 508 508 awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
--awful.key({ modkey, }, "o", awful.client.movetoscreen ), 509 509 --awful.key({ modkey, }, "o", awful.client.movetoscreen ),
--Move Client to Monitor Left/Right 510 510 --Move Client to Monitor Left/Right
awful.key({ modkey, }, "o", function(c) awful.client.movetoscreen(c,c.screen-1) end ), 511 511 awful.key({ modkey, }, "o", function(c) awful.client.movetoscreen(c,c.screen-1) end ),
awful.key({ modkey, }, "p", function(c) awful.client.movetoscreen(c,c.screen+1) end ), 512 512 awful.key({ modkey, }, "p", function(c) awful.client.movetoscreen(c,c.screen+1) end ),
513 513
--awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end), 514 514 --awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end), 515 515 awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
awful.key({ modkey, }, "n", 516 516 awful.key({ modkey, }, "n",
function (c) 517 517 function (c)
-- The client currently has the input focus, so it cannot be 518 518 -- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus. 519 519 -- minimized, since minimized clients can't have the focus.
c.minimized = true 520 520 c.minimized = true
end), 521 521 end),
awful.key({ modkey, }, "m", 522 522 awful.key({ modkey, }, "m",
function (c) 523 523 function (c)
c.maximized_horizontal = not c.maximized_horizontal 524 524 c.maximized_horizontal = not c.maximized_horizontal
c.maximized_vertical = not c.maximized_vertical 525 525 c.maximized_vertical = not c.maximized_vertical
end) 526 526 end)
) 527 527 )
528 528
-- {{{ Rules 529 529 -- {{{ Rules
awful.rules.rules = { 530 530 awful.rules.rules = {
-- All clients will match this rule. 531 531 -- All clients will match this rule.
{ rule = { }, 532 532 { rule = { },
properties = { border_width = beautiful.border_width, 533 533 properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal, 534 534 border_color = beautiful.border_normal,
focus = true, 535 535 focus = true,
keys = clientkeys, 536 536 keys = clientkeys,
buttons = clientbuttons } }, 537 537 buttons = clientbuttons } },
{ rule = { class = "MPlayer" }, 538 538 { rule = { class = "MPlayer" },
properties = { floating = true } }, 539 539 properties = { floating = true } },
{ rule = { class = "pinentry" }, 540 540 { rule = { class = "pinentry" },
properties = { floating = true } }, 541 541 properties = { floating = true } },
{ rule = { class = "gimp" }, 542 542 { rule = { class = "gimp" },
properties = { floating = true } }, 543 543 properties = { floating = true } },
{ rule = { class = "Conky" }, 544 544 { rule = { class = "Conky" },
properties = { 545 545 properties = {
floating = true, 546 546 floating = true,
sticky = true, 547 547 sticky = true,
ontop = false, 548 548 ontop = false,
focusable = false, 549 549 focusable = false,
size_hints = {"program_position", "program_size"} 550 550 size_hints = {"program_position", "program_size"}
} 551 551 }
} 552 552 }
} 553 553 }
-- }}} 554 554 -- }}}
555 555
556 556
-------------------------------------- 557 557 --------------------------------------