CrunchBang Linux Pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

CrunchBang Linux Pastebin

Posted by mahatman2 on Tue 22nd Feb 02:27 (modification of post by view diff)
download | new post

  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. -- Revelation
  10. require("revelation")
  11. -- Obvious Volume
  12. require("obvious.volume_alsa")
  13.  
  14. -- Load Debian menu entries
  15. require("debian.menu")
  16.  
  17. -- {{{ Variable definitions
  18. -- Themes define colours, icons, and wallpapers
  19. beautiful.init("/home/case/.config/awesome/themes/nice-and-clean-theme/theme.lua")
  20.  
  21. -- This is used later as the default terminal and editor to run.
  22. terminal = "x-terminal-emulator"
  23. editor = os.getenv("EDITOR") or "nano"
  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.  
  33. -- Table of layouts to cover with awful.layout.inc, order matters.
  34. layouts =
  35. {
  36.     awful.layout.suit.floating,         --1
  37.     awful.layout.suit.tile,             --2
  38.     awful.layout.suit.tile.left,        --3
  39.     awful.layout.suit.tile.bottom,      --4
  40.     awful.layout.suit.tile.top,         --5
  41.     awful.layout.suit.fair,             --6
  42.     awful.layout.suit.fair.horizontal,  --7
  43.     awful.layout.suit.spiral,           --8
  44.     awful.layout.suit.spiral.dwindle,   --9
  45.     awful.layout.suit.max,              --10
  46.     awful.layout.suit.max.fullscreen,   --11
  47.     awful.layout.suit.magnifier         --12w
  48. }
  49. -- }}}
  50.  
  51. -- {{{ Tags
  52. -- Define a tag table which hold all screen tags.
  53. tags = {
  54.     names = {"main", "www", "work" },
  55.     layout = { layouts[2], layouts[1], layouts[2]
  56. }}
  57. for s = 1, screen.count() do
  58.     -- Each screen has its own tag table.
  59.     tags[s] = awful.tag(tags.names, s, tags.layout)
  60. end
  61. -- }}}
  62.  
  63. -- {{{ Menu
  64. -- Create a laucher widget and a main menu
  65. myawesomemenu = {
  66.    { "manual", terminal .. " -e man awesome" },
  67.    { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
  68.    { "restart", awesome.restart },
  69.    { "quit", awesome.quit }
  70. }
  71.  
  72. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
  73.                                     { "Debian", debian.menu.Debian_menu.Debian },
  74.                                     { "open terminal", terminal }
  75.                                   }
  76.                         })
  77.  
  78. mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
  79.                                      menu = mymainmenu })
  80. -- }}}
  81.  
  82. -- {{{ Wibox
  83. -- Create a textclock widget
  84. mytextclock = awful.widget.textclock({ align = "right" }, "%l:%M %a%e")
  85.  
  86. -- Create a systray
  87. mysystray = widget({ type = "systray" })
  88.  
  89. -- Create a wibox for each screen and add it
  90. mywibox = {}
  91. mypromptbox = {}
  92. mylayoutbox = {}
  93. mytaglist = {}
  94. mytaglist.buttons = awful.util.table.join(
  95.                     awful.button({ }, 1, awful.tag.viewonly),
  96.                     awful.button({ modkey }, 1, awful.client.movetotag),
  97.                     awful.button({ }, 3, awful.tag.viewtoggle),
  98.                     awful.button({ modkey }, 3, awful.client.toggletag),
  99.                     awful.button({ }, 4, awful.tag.viewnext),
  100.                     awful.button({ }, 5, awful.tag.viewprev)
  101.                     )
  102. mytasklist = {}
  103. mytasklist.buttons = awful.util.table.join(
  104.                      awful.button({ }, 1, function (c)
  105.                                               if not c:isvisible() then
  106.                                                   awful.tag.viewonly(c:tags()[1])
  107.                                               end
  108.                                               client.focus = c
  109.                                               c:raise()
  110.                                           end),
  111.                      awful.button({ }, 3, function ()
  112.                                               if instance then
  113.                                                   instance:hide()
  114.                                                   instance = nil
  115.                                               else
  116.                                                   instance = awful.menu.clients({ width=250 })
  117.                                               end
  118.                                           end),
  119.                      awful.button({ }, 4, function ()
  120.                                               awful.client.focus.byidx(1)
  121.                                               if client.focus then client.focus:raise() end
  122.                                           end),
  123.                      awful.button({ }, 5, function ()
  124.                                               awful.client.focus.byidx(-1)
  125.                                               if client.focus then client.focus:raise() end
  126.                                           end))
  127.  
  128. for s = 1, screen.count() do
  129.     -- Create a promptbox for each screen
  130.     mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  131.     -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  132.     -- We need one layoutbox per screen.
  133.     mylayoutbox[s] = awful.widget.layoutbox(s)
  134.     mylayoutbox[s]:buttons(awful.util.table.join(
  135.                            awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  136.                            awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  137.                            awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  138.                            awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  139.     -- Create a taglist widget
  140.     mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  141.  
  142.     -- Create a tasklist widget
  143.     mytasklist[s] = awful.widget.tasklist(function(c)
  144.                                               return awful.widget.tasklist.label.currenttags(c, s)
  145.                                           end, mytasklist.buttons)
  146.  
  147.     -- Create the wibox
  148.     mywibox[s] = awful.wibox({ position = "top", height = "18", screen = s })
  149.     -- Add widgets to the wibox - order matters
  150.     mywibox[s].widgets = {
  151.         {
  152.             -- mylauncher,
  153.             mytaglist[s],
  154.             mypromptbox[s],
  155.             layout = awful.widget.layout.horizontal.leftright
  156.         },
  157.         mylayoutbox[s],
  158.         mytextclock,
  159.         --obvious.volume_alsa(),
  160.         s == 1 and mysystray or nil,
  161.         mytasklist[s],
  162.         layout = awful.widget.layout.horizontal.rightleft
  163.     }
  164. end
  165. -- }}}
  166.  
  167. -- {{{ Mouse bindings
  168. root.buttons(awful.util.table.join(
  169.     awful.button({ }, 3, function () mymainmenu:toggle() end),
  170.     awful.button({ }, 4, awful.tag.viewnext),
  171.     awful.button({ }, 5, awful.tag.viewprev)
  172. ))
  173. -- }}}
  174.  
  175. -- {{{ Key bindings
  176. globalkeys = awful.util.table.join(
  177.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev       ),
  178.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext       ),
  179.     awful.key({ modkey,           }, "Escape", awful.tag.history.restore),
  180.  
  181.     awful.key({ modkey,           }, "j",
  182.         function ()
  183.             awful.client.focus.byidx( 1)
  184.             if client.focus then client.focus:raise() end
  185.         end),
  186.     awful.key({ modkey,           }, "k",
  187.         function ()
  188.             awful.client.focus.byidx(-1)
  189.             if client.focus then client.focus:raise() end
  190.         end),
  191.     awful.key({ modkey,           }, "w", function () mymainmenu:show({keygrabber=true}) end),
  192.  
  193.     -- Layout manipulation
  194.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end),
  195.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end),
  196.     awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  197.     awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  198.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto),
  199.     awful.key({ modkey,           }, "Tab",
  200.         function ()
  201.             awful.client.focus.history.previous()
  202.             if client.focus then
  203.                 client.focus:raise()
  204.             end
  205.         end),
  206.     awful.key({ modkey,          }, "e", revelation.revelation),
  207.  
  208.     -- Standard program
  209.     awful.key({ modkey,           }, "Return", function () awful.util.spawn(terminal) end),
  210.     awful.key({ modkey, "Control" }, "r", awesome.restart),
  211.     awful.key({ modkey, "Shift"   }, "q", awesome.quit),
  212.  
  213.     awful.key({ modkey,           }, "l",     function () awful.tag.incmwfact( 0.05)    end),
  214.     awful.key({ modkey,           }, "h",     function () awful.tag.incmwfact(-0.05)    end),
  215.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1)      end),
  216.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1)      end),
  217.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1)         end),
  218.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1)         end),
  219.     awful.key({ modkey,           }, "space", function () awful.layout.inc(layouts,  1) end),
  220.     awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(layouts, -1) end),
  221.    
  222.     -- Volume (uses obvious)
  223.     awful.key({},                    "XF86AudioLowerVolume", function() obvious.volume_alsa.lower(0, "Master", 1) end),
  224.     awful.key({},                    "XF86AudioRaiseVolume", function() obvious.volume_alsa.raise(0, "Master", 1) end),
  225.     awful.key({},                    "XF86AudioMute", function ()obvious.volume_alsa.mute(0, "Master") end),
  226.  
  227.     -- Prompt
  228.     awful.key({ modkey },            "x",     function () mypromptbox[mouse.screen]:run() end),
  229.  
  230.     awful.key({ modkey },            "z",
  231.               function ()
  232.                   awful.prompt.run({ prompt = "Run Lua code: " },
  233.                   mypromptbox[mouse.screen].widget,
  234.                   awful.util.eval, nil,
  235.                   awful.util.getdir("cache") .. "/history_eval")
  236.               end)
  237. )
  238.  
  239. clientkeys = awful.util.table.join(
  240.     awful.key({ modkey,           }, "f",      function (c) c.fullscreen = not c.fullscreen  end),
  241.     awful.key({ modkey,           }, "c",      function (c) c:kill()                         end),
  242.     awful.key({ modkey, "Control" }, "space",  awful.client.floating.toggle                     ),
  243.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  244.     awful.key({ modkey,           }, "o",      awful.client.movetoscreen                        ),
  245.     awful.key({ modkey, "Shift"   }, "r",      function (c) c:redraw()                       end),
  246.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end),
  247.     awful.key({ modkey,           }, "n",      function (c) c.minimized = not c.minimized    end),
  248.     awful.key({ modkey,           }, "m",
  249.         function (c)
  250.             c.maximized_horizontal = not c.maximized_horizontal
  251.             c.maximized_vertical   = not c.maximized_vertical
  252.         end)
  253. )
  254.  
  255. -- Compute the maximum number of digit we need, limited to 9
  256. keynumber = 0
  257. for s = 1, screen.count() do
  258.    keynumber = math.min(9, math.max(#tags[s], keynumber));
  259. end
  260.  
  261. -- Bind all key numbers to tags.
  262. -- Be careful: we use keycodes to make it works on any keyboard layout.
  263. -- This should map on the top row of your keyboard, usually 1 to 9.
  264. for i = 1, keynumber do
  265.     globalkeys = awful.util.table.join(globalkeys,
  266.         awful.key({ modkey }, "#" .. i + 9,
  267.                   function ()
  268.                         local screen = mouse.screen
  269.                         if tags[screen][i] then
  270.                             awful.tag.viewonly(tags[screen][i])
  271.                         end
  272.                   end),
  273.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  274.                   function ()
  275.                       local screen = mouse.screen
  276.                       if tags[screen][i] then
  277.                           awful.tag.viewtoggle(tags[screen][i])
  278.                       end
  279.                   end),
  280.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  281.                   function ()
  282.                       if client.focus and tags[client.focus.screen][i] then
  283.                           awful.client.movetotag(tags[client.focus.screen][i])
  284.                       end
  285.                   end),
  286.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  287.                   function ()
  288.                       if client.focus and tags[client.focus.screen][i] then
  289.                           awful.client.toggletag(tags[client.focus.screen][i])
  290.                       end
  291.                   end))
  292. end
  293.  
  294. clientbuttons = awful.util.table.join(
  295.     awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  296.     awful.button({ modkey }, 1, awful.mouse.client.move),
  297.     awful.button({ modkey }, 3, awful.mouse.client.resize))
  298.  
  299. -- Set keys
  300. root.keys(globalkeys)
  301. -- }}}
  302.  
  303. -- {{{ Rules
  304. awful.rules.rules = {
  305.     -- All clients will match this rule.
  306.     { rule = { },
  307.       properties = { border_width = beautiful.border_width,
  308.                      border_color = beautiful.border_normal,
  309.                      focus = true,
  310.                      keys = clientkeys,
  311.                      buttons = clientbuttons } },
  312.     { rule = { class = "MPlayer" },
  313.       properties = { floating = true } },
  314.     { rule = { class = "pinentry" },
  315.       properties = { floating = true } },
  316.     { rule = { class = "gimp" },
  317.       properties = { floating = true } },
  318.     { rule = { class = "zathura" },
  319.       properties = { floating = true } },
  320.     -- Set Firefox to always map on tags number 2 of screen 1.
  321.     -- { rule = { class = "Firefox" },
  322.     --   properties = { tag = tags[1][2] } },
  323. }
  324. -- }}}
  325.  
  326. -- {{{ Signals
  327. -- Signal function to execute when a new client appears.
  328. client.add_signal("manage", function (c, startup)
  329.     -- Add a titlebar
  330.     -- awful.titlebar.add(c, { modkey = modkey })
  331.  
  332.     -- Enable sloppy focus
  333.     c:add_signal("mouse::enter", function(c)
  334.         if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  335.             and awful.client.focus.filter(c) then
  336.             client.focus = c
  337.         end
  338.     end)
  339.  
  340.     if not startup then
  341.         -- Set the windows at the slave,
  342.         -- i.e. put it at the end of others instead of setting it master.
  343.         -- awful.client.setslave(c)
  344.  
  345.         -- Put windows in a smart way, only if they does not set an initial position.
  346.         if not c.size_hints.user_position and not c.size_hints.program_position then
  347.             awful.placement.no_overlap(c)
  348.             awful.placement.no_offscreen(c)
  349.         end
  350.     end
  351. end)
  352.  
  353. client.add_signal("focus", function(c)
  354.     c.border_color = beautiful.border_focus
  355.     c.opacity = 1
  356. end)
  357. client.add_signal("unfocus", function(c)
  358.     c.border_color = beautiful.border_normal
  359.     c.opacity = 0.7
  360. end)
  361. -- }}}
  362.  
  363. -- {{{ Autostart
  364. awful.util.spawn_with_shell("awesome-autostart")
  365. -- }}}

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me