Commit bfc657d49625bd75a9bb80d800adc0af6a386dc3

Authored by Ian Foster
1 parent b8902b96c1
Exists in master

fixed new awesome layouts

Showing 4 changed files with 32 additions and 9 deletions Inline Diff

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