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