Advertisement
Guest User

lid rc.lua

a guest
Feb 28th, 2010
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.06 KB | None | 0 0
  1. -- Standard awesome library
  2. require("awful")
  3. require("awful.autofocus")
  4. require("awful.rules")
  5. -- Theme handling library
  6. require("beautiful")
  7. -- Notification library
  8. require("naughty")
  9. --require("vicious")
  10. -- Custom libraries
  11. require("revelation")
  12. require("shifty")
  13. require("wicked")
  14. require("teardrop")
  15.  
  16.  
  17. -- {{{ Variable definitions
  18. -- Themes define colours, icons, and wallpapers
  19. beautiful.init("/home/lidstah/.config/awesome/themes/lapin/theme.lua")
  20.  
  21. -- This is used later as the default terminal and editor to run.
  22. terminal = "urxvt"
  23. editor = os.getenv("EDITOR") or "editor"
  24. editor_cmd = terminal .. " -e " .. editor
  25.  
  26. -- Default modkey.
  27. -- Usually, Mod4 is the key with a logo between Control and Alt.
  28. -- If you do not like this or do not have such a key,
  29. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  30. -- However, you can use another modifier like Mod1, but it may interact with others.
  31. modkey = "Mod4"
  32. modkey2 = "Mod3"
  33. -- Table of layouts to cover with awful.layout.inc, order matters.
  34. layouts =
  35. {
  36.     awful.layout.suit.tile,
  37.     awful.layout.suit.tile.left,
  38.     awful.layout.suit.tile.bottom,
  39.     awful.layout.suit.tile.top,
  40.     awful.layout.suit.fair,
  41.     awful.layout.suit.fair.horizontal,
  42.     awful.layout.suit.spiral,
  43.     awful.layout.suit.spiral.dwindle,
  44.     awful.layout.suit.max,
  45.     awful.layout.suit.max.fullscreen,
  46.     awful.layout.suit.magnifier,
  47.     awful.layout.suit.floating
  48. }
  49. -- }}}
  50.  
  51.  
  52. -- {{{ Tags
  53.  
  54. shifty.config.tags = {
  55.  
  56.     ["[main]"] = { position = 1, init = true },
  57.     ["[www]"]  = { position = 2, init = true,  spawn = browser,},
  58.     ["[gimp]"] = { position = 6, exclusive = true, nopopup = true, spawn = gimp, },
  59.     ["[sys]"]  = { position = 5, init = true, exclusive = true,  nopopup = true, },
  60.     ["[msg]"]  = { position = 7, exclusive = true,  nopopup = true,  },
  61.     ["[view]"] = { position = 8, exclusive = true, nopopup = true,  },
  62.     ["[dev]"] = { position = 9, init = true, nopopup = true },
  63.     ["[float]"] = { position = 12, nopopup = true, init = true, layout = "floating" }
  64. }
  65.  
  66. shifty.taglist = mytaglist
  67. -- Clients rules
  68.  
  69. shifty.config.apps = {
  70.  
  71.          { match = {"Transmission","Tucan.py"                    }, tag = "[bt]" },
  72.          { match = {"^Download$", "Preferences", "VideoDownloadHelper", "PokerTH" }, float = true, intrusive = true },
  73.          { match = {"Firefox","Iceweasel","Vimperator","Shiretoko"} , tag = "[www]"       } ,
  74.          { match = { "WeeChat 0.2.6.2","weechat-curses","weechat","irssi"     }, tag = "[main]"          },
  75.          { match = {"Gimp"                           }, tag = "[gimp]",  float = true    },
  76.          { match = {"gimp-image-window"              }, slave = true                     },
  77.          { match = {"MPlayer","ffplay"                       }, float = true     },
  78.          { match = {"mutt"                    }, tag = "[mail]",                                       },
  79.          { match = {"med"                          }, tag = "[med]"                                      },
  80.          { match = {"Pidgin"                         }, tag = "[main]"                      },
  81.          { match = {"htop"                           }, tag = "[sys]",                                   },
  82.          { match = {"VirtualBox"                     }, tag = "[vbox]", float = true    },
  83.          { match = {"lxappearence"                   }, float = true                     },
  84.          { match = {"gpicview", "gqview"                       }, float = true, tag = "[view]"                    },
  85.          { match = { "" },
  86.                    buttons = awful.util.table.join(
  87.                        awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  88.                     awful.button({ modkey }, 1, awful.mouse.client.move),
  89.                      awful.button({ modkey }, 3, awful.mouse.client.resize),
  90.               awful.button({ modkey }, 8, awful.mouse.client.resize))
  91.   }
  92. }
  93.  
  94. -- Options par défaut.
  95. shifty.config.defaults = {
  96.   layout = awful.layout.suit.tile,
  97.   ncol = 1,
  98.   mwfact = 0.50,
  99.   floatBars=true,
  100. }
  101.  
  102.  
  103. -- }}}
  104.  
  105. -- {{{ Menu
  106. -- Create a laucher widget and a main menu
  107. myawesomemenu = {
  108.    { "manual", terminal .. " -e man awesome" },
  109.    { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
  110.    { "restart", awesome.restart },
  111.    { "quit", awesome.quit }
  112. }
  113.  
  114. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
  115. --                                    { "Debian", debian.menu.Debian_menu.Debian },
  116.                                     { "open terminal", terminal }
  117.                                   }
  118.                         })
  119.  
  120. mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
  121.                                      menu = mymainmenu })
  122. -- }}}
  123.  
  124. -- {{{ Wibox
  125. -- Create a textclock widget
  126. mytextclock = awful.widget.textclock({ align = "right" })
  127.  
  128. -- Create a systray
  129. mysystray = widget({ type = "systray" })
  130.  
  131. -- Create a wibox for each screen and add it
  132. mywibox = {}
  133. mywibox2 = {}
  134. mypromptbox = {}
  135. mylayoutbox = {}
  136. mytaglist = {}
  137. mytaglist.buttons = awful.util.table.join(
  138.                     awful.button({ }, 1, awful.tag.viewonly),
  139.                     awful.button({ modkey }, 1, awful.client.movetotag),
  140.                     awful.button({ }, 3, awful.tag.viewtoggle),
  141.                     awful.button({ modkey }, 3, awful.client.toggletag),
  142.                     awful.button({ }, 4, awful.tag.viewnext),
  143.                     awful.button({ }, 5, awful.tag.viewprev)
  144.                     )
  145. mytasklist = {}
  146. mytasklist.buttons = awful.util.table.join(
  147.                      awful.button({ }, 1, function (c)
  148.                                               if not c:isvisible() then
  149.                                                   awful.tag.viewonly(c:tags()[1])
  150.                                               end
  151.                                               client.focus = c
  152.                                               c:raise()
  153.                                           end),
  154.                      awful.button({ }, 3, function ()
  155.                                               if instance then
  156.                                                   instance:hide()
  157.                                                   instance = nil
  158.                                               else
  159.                                                   instance = awful.menu.clients({ width=250 })
  160.                                               end
  161.                                           end),
  162.                      awful.button({ }, 4, function ()
  163.                                               awful.client.focus.byidx(1)
  164.                                               if client.focus then client.focus:raise() end
  165.                                           end),
  166.                      awful.button({ }, 5, function ()
  167.                                               awful.client.focus.byidx(-1)
  168.                                               if client.focus then client.focus:raise() end
  169.                                           end))
  170.  
  171. for s = 1, screen.count() do
  172.     -- Create a promptbox for each screen
  173.     mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  174.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  175.     -- We need one layoutbox per screen.
  176.     mylayoutbox[s] = awful.widget.layoutbox(s)
  177.     mylayoutbox[s]:buttons(awful.util.table.join(
  178.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  179.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  180.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  181.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  182.     -- Create a taglist widget
  183.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  184.  
  185.     -- Create a tasklist widget
  186.     mytasklist[s] = awful.widget.tasklist(function(c)
  187.                                               return awful.widget.tasklist.label.currenttags(c, s)
  188.                                           end, mytasklist.buttons)
  189.  
  190.  
  191. -- Widget FS (/home)
  192.  
  193. fswidget = widget({
  194.   type = 'textbox',
  195.   name = 'fswidget',
  196.   align = 'right'
  197. })
  198. wicked.register(fswidget, wicked.widgets.fs,
  199. '<span color="#dca3a3">${/home used}</span>/<span color="#c3bf9f">${/home size}</span>', 120)
  200.  
  201. -- Icones, separateurs, %, [ et ]
  202.  
  203. mycpuicon        = widget({ type = "imagebox", name = "mycpuicon" })
  204. mycpuicon.image  = image(beautiful.widget_cpu)
  205.  
  206.  
  207. myneticon         = widget({ type = "imagebox", name = "myneticon" })
  208. myneticonup       = widget({ type = "imagebox", name = "myneticonup" })
  209.  
  210. myneticonup.image = image(beautiful.widget_netup)
  211. myneticon.image   = image(beautiful.widget_net)
  212.  
  213. myvolicon       = widget({ type = "imagebox", name = "myvolicon" })
  214. myvolicon.image = image(beautiful.widget_vol)
  215.  
  216. mymeteoicon = widget({ type = "imagebox", name = "mymeteoicon" })
  217. mymeteoicon.image = image(beautiful.widget_meteo)
  218.  
  219. mymusicicon     = widget({ type = "imagebox", name = "mymusicicon"})
  220. mymusicicon.image = image(beautiful.widget_music)
  221.  
  222. myspacer         = widget({ type = "textbox", name = "myspacer" })
  223. myseparator      = widget({ type = "textbox", name = "myseparator" })
  224. mystarter    = widget({ type = "textbox", name = "mystarter" })
  225. myender      = widget({ type = "textbox", name = "myender" })
  226. myspacer.text    = " "
  227. myseparator.text = "|"
  228. mystarter.text   = "["
  229. myender.text     = "]"
  230. mydiskicon         = widget({ type = "imagebox", name = "mydiskicon" })
  231. mytimeicon       = widget({ type = "imagebox", name = "mytimeicon" })
  232. mytimeicon.image = image(beautiful.widget_date)
  233. mydiskicon.image   = image(beautiful.widget_fs)
  234.  
  235. mymailicon  = widget({ type = "imagebox", name = "mymailicon" })
  236. mymailicon.image = image(beautiful.widget_mail)
  237.  
  238. mypercent = widget({
  239.     type = 'textbox',
  240.     name = 'mypercent',
  241.     align = 'right'
  242. })
  243.  
  244. mypercent.text='<span color="#c3bf9f">%</span>'
  245.  
  246. -- Widget Mail
  247.  
  248. mailwidget = widget({
  249.     type = 'textbox',
  250.     name = 'mailwidget',
  251.     align = 'right'
  252. })
  253.  
  254. function check_mail()
  255.     local f = io.popen('ls -alF /home/lidstah/Mail/mbox/new/ | grep kadath | wc -l')
  256.     local mailnum = f:read("*all")
  257.     f:close()
  258.     mailwidget.text = mailnum
  259. end
  260.  
  261.  
  262. -- Widget Volume
  263.  
  264. volwidget = widget({
  265.     type = 'textbox',
  266.     name = 'volwidget',
  267.     align = 'right'
  268. })
  269.  
  270. pb_volume =  widget({ type = "progressbar", name = "pb_volume", align = "right" })
  271. pb_volume.width = 10
  272. pb_volume.height = 0.65
  273. pb_volume.border_padding = 1
  274. pb_volume.border_width = 1
  275. pb_volume.ticks_count = 0
  276. pb_volume.gap = 0
  277. pb_volume.vertical = true
  278.  
  279. pb_volume:bar_properties_set("volu",
  280.  {
  281.    ["bg"] = "#1f1f1f",
  282.    ["fg"] = "#c3bf9f",
  283.    ["fg_center"] = "#f0dfaf",
  284.    ["fg_end"] = "#dca3a3",
  285.    ["fg_off"] = "black",
  286.    ["border_color"] = "#FFFFFF",
  287.    ["min_value"] = 0,
  288.    ["max_value"] = 100,
  289.    ["reverse"] = false
  290.  })
  291.  
  292.  
  293. function volume()
  294.     local f = io.popen("aumix -q | grep vol | awk {'print $3'}")
  295.     local vol = f:read("*all")
  296.     f:close()
  297.     volwidget.text = vol
  298.     pb_volume:bar_data_add("volu",vol)
  299. end
  300. -- Widget uptime
  301.  
  302. uptime_widget = widget({
  303.     type = 'textbox',
  304.     name = 'uptime_widget',
  305.     align = 'right'
  306. })
  307. wicked.register(uptime_widget, wicked.widgets.uptime, '<span color="#c3bf9f">Up: $2d $3h</span>',3600)
  308.  
  309. -- Widget meteo
  310.  
  311. meteo_widget = widget({
  312.     type = 'textbox',
  313.     name = 'meteo_widget',
  314.     align = 'right'
  315. })
  316.  
  317. function meteo()
  318.     local f = io.popen("cat /tmp/weather.txt")
  319.     local met = f:read("*all")
  320.     f:close()
  321.     meteo_widget.text = met
  322. end
  323.  
  324. -- Widget CPU
  325.  
  326. cpugraphwidget = widget({
  327.   type = 'graph',
  328.   name = 'cpugraphwidget',
  329.   align = 'right'
  330. })
  331. cpugraphwidget.height = 0.85
  332. cpugraphwidget.width = 35
  333. cpugraphwidget.bg = '#333333'
  334. cpugraphwidget.border_color = 'white'
  335. cpugraphwidget.grow = 'left'
  336. cpugraphwidget:plot_properties_set('cpu', {
  337.   fg = '#c3bf9f',
  338.   fg_center = '#f0dfaf',
  339.   fg_end ='#dca3a3',
  340.   vertical_gradient = false
  341. })
  342. wicked.register(cpugraphwidget, wicked.widgets.cpu, '$1', 20, 'cpu')
  343.  
  344. -- Net Widget
  345.  
  346. netwidget = widget({
  347.   type = 'textbox',
  348.   name = 'netwidget',
  349.   align = 'right'
  350. })
  351.  
  352. wicked.register(netwidget, wicked.widgets.net, ' <span color="#dca3a3">${eth0 down}</span>/<span color="#c3bf9f">${eth0 up}</span> ', 2, nil, 3)
  353.  
  354. -- Icones mémoire & widget mémoire
  355.  
  356. mymemicon       = widget({ type = "imagebox", name = "mymemicon" })
  357. mymemicon.image = image(beautiful.widget_mem)
  358.  
  359.  
  360. membarwidget = widget({
  361.   type = 'progressbar',
  362.   name = 'membarwidget',
  363.   align = 'right'
  364. })
  365. membarwidget.width = 40
  366. membarwidget.height = 0.65
  367. membarwidget.gap = 0
  368. membarwidget.border_padding = 1
  369. membarwidget.border_width = 1
  370. membarwidget.ticks_count = 0
  371. membarwidget.ticks_gap = 0
  372. membarwidget.vertical = false
  373. membarwidget:bar_properties_set('mem', {
  374.   bg = '#2f2f2f',
  375.   fg = '#c3bf9f',
  376.   fg_center = '#f0dfaf',
  377.   fg_end = '#dca3a3',
  378.   fg_off = '#222222',
  379.   reverse = false,
  380.   min_value = 0,
  381.   max_value = 100
  382. })
  383. wicked.register(membarwidget, wicked.widgets.mem, '$1', 20, 'mem')
  384.  
  385. -- mpd widget
  386.  
  387. mpdwidget = widget({
  388.   type = 'textbox',
  389.   name = 'mpdwidget',
  390.   align = 'right'
  391. })
  392. wicked.register(mpdwidget, wicked.widgets.mpd, '<span color="#c3bf9f">$1</span>', 5)
  393.  
  394.  
  395.     -- Create the wibox
  396.     mywibox[s] = awful.wibox({ position = "top", screen = s })
  397.     mywibox2[s] = awful.wibox({ position = "bottom", screen = s })
  398.     -- Add widgets to the wibox - order matters
  399.     mywibox[s].widgets = {
  400.         {
  401.        --     mylauncher,
  402.             mytaglist[s],
  403.             mypromptbox[s],
  404.             layout = awful.widget.layout.horizontal.leftright
  405.         },
  406.         mylayoutbox[s],
  407.   --      memwidget,      
  408. --        mytextclock, mytimeicon,
  409. --        s == 1 and mysystray or nil,
  410.         myender, myspacer,
  411.     mypercent, volwidget, myspacer, pb_volume, myvolicon, myseparator,
  412.     myspacer,
  413.         mpdwidget, mymusicicon, myseparator,
  414.         myspacer,
  415.         fswidget, mydiskicon, myseparator,
  416.         myspacer,
  417.         myneticonup, netwidget, myneticon, myseparator,
  418.         myspacer,
  419.         cpugraphwidget, mycpuicon, myseparator,
  420.         myspacer,
  421.         membarwidget, mymemicon, mystarter,    
  422. --  mytasklist[s],
  423.         layout = awful.widget.layout.horizontal.rightleft
  424.     }
  425.     mywibox2[s].widgets = {
  426.         {
  427.         mylauncher,
  428.         layout = awful.widget.layout.horizontal.leftright
  429.             },
  430.     s == 1 and mysystray or nil,
  431.     myender, myspacer,
  432.     uptime_widget, myspacer, mytextclock, mytimeicon, myseparator, myspacer, mailwidget, mymailicon, myspacer, myseparator, myspacer, meteo_widget, myspacer, mymeteoicon, myspacer, mystarter,
  433.  
  434.     mytasklist[s],
  435.     layout = awful.widget.layout.horizontal.rightleft
  436.     }
  437. end
  438. -- }}}
  439.  
  440. -- {{{ Mouse bindings
  441. root.buttons(awful.util.table.join(
  442.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  443.     awful.button({ }, 4, awful.tag.viewnext),
  444.     awful.button({ }, 5, awful.tag.viewprev)
  445. ))
  446. -- }}}
  447.  
  448. -- {{{ Key bindings
  449. globalkeys = awful.util.table.join(
  450.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  451.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  452.     awful.key({ modkey, "Shift"         }, "Escape", awful.tag.history.restore),
  453.  
  454.     awful.key({ modkey,           }, "j",
  455.         function ()
  456.             awful.client.focus.byidx( 1)
  457.             if client.focus then client.focus:raise() end
  458.         end),
  459.     awful.key({ modkey,           }, "k",
  460.         function ()
  461.             awful.client.focus.byidx(-1)
  462.             if client.focus then client.focus:raise() end
  463.         end),
  464. --    awful.key({ modkey,           }, "w", function () mymainmenu:show(true)        end),
  465.  
  466.  
  467.   -- Layout manipulationi
  468. --    awful
  469.     awful.key({ modkey,           }, "Tab", function () awful.client.focus.byidx( 1)    end),
  470.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  471.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  472.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  473.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  474.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  475.     awful.key({ modkey, "Shift"   }, "Tab",
  476.         function ()
  477.             awful.client.focus.history.previous()
  478.             if client.focus then
  479.                 client.focus:raise()
  480.             end
  481.         end),
  482. -- Shifty
  483.    
  484.    -- awful.key({ modkey, "Shift"   }, "t",             shifty.add),
  485.    -- awful.key({ modkey            }, "r",           shifty.rename),
  486.    -- awful.key({ modkey            }, "w",           shifty.del),
  487.  
  488.     awful.key({ modkey, "Shift"   }, "Left",   shifty.shift_prev        ),
  489.     awful.key({ modkey, "Shift"   }, "Right",  shifty.shift_next        ),
  490.  --   awful.key({ modkey            }, "Escape", function() awful.tag.history.restore() end), -- move to prev tag by history
  491.     awful.key({ modkey, "Shift"   }, "n", shifty.send_prev), -- move client to prev tag
  492.     awful.key({ modkey            }, "n", shifty.send_next),
  493.  
  494. --    shifty.config.clientkeys = clientkeys
  495. -- Teardrop
  496.  
  497.     awful.key({ modkey            },"x",      function () teardrop("urxvt", "center", "center", 0.5) end),
  498.     awful.key({ modkey        },"w",      function () teardrop("vimprobable", "center", "center", 0.5) end),
  499.     -- Standard program
  500.    -- awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  501.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  502.     awful.key({ modkey, "Control" }, "q", awesome.quit),
  503.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  504.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  505.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  506.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  507.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  508.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  509.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  510.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  511.     awful.key({ modkey            }, "Down",                          revelation.revelation),                    
  512.  -- Keybindings Perso
  513.     awful.key({ }, "#122", function () awful.util.spawn("aumix -q -v-10") end),
  514.     awful.key({ }, "#123", function () awful.util.spawn("aumix -q -v+10") end),
  515.     awful.key({ modkey, }, "#122", function() awful.util.spawn("mpc --no-status prev") end),
  516.     awful.key({ modkey, }, "#123", function() awful.util.spawn("mpc --no-status next") end),
  517.     awful.key({ modkey, }, "#121", function() awful.util.spawn("mpc --no-status toggle") end),
  518.     awful.key({ modkey}, "Return", function () awful.util.spawn(terminal) end),
  519.  
  520.     -- Prompt
  521.     awful.key({ modkey },            "BackSpace",     function () mypromptbox[mouse.screen]:run() end)
  522.  
  523.  
  524. )
  525. clientkeys = awful.util.table.join(
  526.     awful.key({ modkey,           }, "s",      function (c) c.ontop  = not c.ontop  end        ),
  527.     awful.key({ modkey,           }, "s",      function (c) c.sticky = not c.sticky end        ),
  528.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  529.     awful.key({ modkey           }, "c",      function (c) c:kill()                         end),
  530.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  531.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  532. --    awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  533.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  534.   --  awful.key({ modkey,           }, "n",      function (c) c.minimized = not c.minimized    end),
  535.     awful.key({ modkey,           }, "m",
  536.         function (c)
  537.             c.maximized_horizontal = not c.maximized_horizontal
  538.             c.maximized_vertical   = not c.maximized_vertical
  539.         end)
  540. )
  541.  
  542. -- Compute the maximum number of digit we need, limited to 9
  543. --keynumber = 0
  544. --for s = 1, screen.count() do
  545.   -- keynumber = math.min(9, math.max(#tags[s], keynumber));
  546. --end
  547.  
  548. -- Bind all key numbers to tags.
  549. -- Be careful: we use keycodes to make it works on any keyboard layout.
  550. -- This should map on the top row of your keyboard, usually 1 to 9.
  551.  
  552. clientbuttons = awful.util.table.join(
  553.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  554.     awful.button({ modkey }, 1, awful.mouse.client.move),
  555.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  556.  
  557. -- Set keys
  558. root.keys(globalkeys)
  559. shifty.config.globalkeys = globalkeys
  560. shifty.config.clientkeys = clientkeys
  561.  
  562. -- }}}
  563. -- Old timers, deprecated.
  564. --awful.hooks.timer.register(2, function () volume() end)
  565. --awful.hooks.timer.register(30, function () check_mail() end)
  566. --awful.hooks.timer.register(60, function () meteo() end)
  567.  
  568. -- Timers
  569.  
  570. myvoltimer = timer({ timeout = 2 })
  571. myvoltimer:add_signal("timeout", function() volume() end)
  572. myvoltimer:start()
  573.  
  574. mymailtimer = timer({ timeout = 30 })
  575. mymailtimer:add_signal("timeout", function() check_mail() end)
  576. mymailtimer:start()
  577.  
  578. mymeteotimer = timer({ timeout = 120 })
  579. mymeteotimer:add_signal("timeout", function() meteo() end)
  580. mymeteotimer:start()
  581.  
  582. -- {{{ Signals
  583. -- Signal function to execute when a new client appears.
  584. client.add_signal("manage", function (c, startup)
  585.     -- Add a titlebar
  586.     -- awful.titlebar.add(c, { modkey = modkey })
  587.  
  588.     -- Enable sloppy focus
  589.     c:add_signal("mouse::enter", function(c)
  590.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  591.             and awful.client.focus.filter(c) then
  592.             client.focus = c
  593.         end
  594.     end)
  595.  
  596.     if not startup then
  597.         -- Set the windows at the slave,
  598.         -- i.e. put it at the end of others instead of setting it master.
  599.         -- awful.client.setslave(c)
  600.  
  601.         -- Put windows in a smart way, only if they does not set an initial position.
  602.         if not c.size_hints.user_position and not c.size_hints.program_position then
  603.             awful.placement.no_overlap(c)
  604.             awful.placement.no_offscreen(c)
  605.         end
  606.     end
  607. end)
  608. shifty.init()
  609. client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  610. client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  611. -- }}}
  612.  
  613. -- }}}
  614. -- Signals pour la transparence.
  615. --
  616. -- client.add_signal("focus", function(c)
  617. --   c.border_color = beautiful.border_focus
  618. --  if c.opacity < 1.0 then
  619. --    c.opacity = beautiful.opacity_focus
  620. --  end
  621. -- end)
  622.  
  623. --client.add_signal("unfocus", function(c)
  624. --  c.border_color = beautiful.border_normal
  625. --  if c.opacity < 1.0 then
  626. --    c.opacity = beautiful.opacity_normal
  627. --  end
  628. -- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement