Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.90 KB | None | 0 0
  1. -- '!!!' indicates a change that rob has made from the base rc.lua
  2. -- Standard awesome library
  3. require("awful")
  4. require("awful.autofocus")
  5. require("awful.rules")
  6. -- Theme handling library
  7. require("beautiful")
  8. -- Notification library
  9. require("naughty")
  10. --Eminent dynamic tagging
  11. --require("eminent")
  12. -- Load Debian menu entries
  13. require("debian.menu")
  14. --Terminal Geometry
  15. --client.size_hints_honor = false
  16. -- {{{ Variable definitions
  17. -- Themes define colours, icons, and wallpapers
  18. beautiful.init("/usr/share/awesome/themes/telescope/theme.lua")
  19.  
  20. -- This is used later as the default terminal and editor to run.
  21. terminal = "gnome-terminal"
  22. editor = os.getenv("EDITOR") or "editor"
  23. editor_cmd = terminal .. " -e " .. editor
  24.  
  25. -- Default modkey.
  26. -- Usually, Mod4 is the key with a logo between Control and Alt.
  27. -- If you do not like this or do not have such a key,
  28. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  29. -- However, you can use another modifier like Mod1, but it may interact with others.
  30. modkey = "Mod4"
  31.  
  32. -- Table of layouts to cover with awful.layout.inc, order matters.
  33. layouts =
  34. {
  35. -- awful.layout.suit.floating,
  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.max,
  43. -- awful.layout.suit.magnifier
  44. }
  45. -- }}}
  46.  
  47. -- {{{ Tags
  48. -- Define a tag table which hold all screen tags.
  49. tags = {}
  50. for s = 1, screen.count() do
  51. -- Each screen has its own tag table.
  52. tags[s] = awful.tag({ "☿", "♀", "♁", "♂", "♃", "♄", "♅", "♆", "♇"}, s, layouts[1])
  53. --
  54. end
  55. -- }}}
  56.  
  57. -- {{{ Menu
  58. -- Create a laucher widget and a main menu
  59. myawesomemenu = {
  60. { "manual", terminal .. " -e man awesome" },
  61. { "edit config", editor_cmd .. " " .. awful.util.getdir("config") .. "/rc.lua" },
  62. { "restart", awesome.restart },
  63. { "quit", awesome.quit }
  64. }
  65.  
  66. mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
  67. { "Debian", debian.menu.Debian_menu.Debian },
  68. { "open terminal", terminal },
  69. {"Log out", '/home/rob/programs/shutdown_dialog.sh'}
  70. }
  71. })
  72.  
  73. mylauncher = awful.widget.launcher({ image = image(beautiful.awesome_icon),
  74. menu = mymainmenu })
  75. -- }}}
  76.  
  77. -- {{{ Wibox
  78. -- Create a textclock widget
  79. --!!!disabled clock as it is redundant relative to wristwatch
  80. --mytextclock = awful.widget.textclock({ align = "right" })
  81.  
  82. -- Create a systray
  83. mysystray = widget({ type = "systray" })
  84.  
  85. -- Create a wibox for each screen and add it
  86. mywibox = {}
  87. mypromptbox = {}
  88. mylayoutbox = {}
  89. mytaglist = {}
  90. mytaglist.buttons = awful.util.table.join(
  91. awful.button({ }, 1, awful.tag.viewonly),
  92. awful.button({ modkey }, 1, awful.client.movetotag),
  93. awful.button({ }, 3, awful.tag.viewtoggle),
  94. awful.button({ modkey }, 3, awful.client.toggletag),
  95. awful.button({ }, 4, awful.tag.viewnext),
  96. awful.button({ }, 5, awful.tag.viewprev)
  97. )
  98. mytasklist = {}
  99. mytasklist.buttons = awful.util.table.join(
  100. awful.button({ }, 1, function (c)
  101. if not c:isvisible() then
  102. awful.tag.viewonly(c:tags()[1])
  103. end
  104. client.focus = c
  105. c:raise()
  106. end),
  107. awful.button({ }, 3, function ()
  108. if instance then
  109. instance:hide()
  110. instance = nil
  111. else
  112. instance = awful.menu.clients({ width=250 })
  113. end
  114. end),
  115. awful.button({ }, 4, function ()
  116. awful.client.focus.byidx(1)
  117. if client.focus then client.focus:raise() end
  118. end),
  119. awful.button({ }, 5, function ()
  120. awful.client.focus.byidx(-1)
  121. if client.focus then client.focus:raise() end
  122. end))
  123.  
  124. for s = 1, screen.count() do
  125. -- Create a promptbox for each screen
  126. mypromptbox[s] = awful.widget.prompt({ layout = awful.widget.layout.horizontal.leftright })
  127. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  128. -- We need one layoutbox per screen.
  129. mylayoutbox[s] = awful.widget.layoutbox(s)
  130. mylayoutbox[s]:buttons(awful.util.table.join(
  131. awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
  132. awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
  133. awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
  134. awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
  135. -- Create a taglist widget
  136. mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.label.all, mytaglist.buttons)
  137.  
  138. -- Create a tasklist widget
  139. mytasklist[s] = awful.widget.tasklist(function(c)
  140. return awful.widget.tasklist.label.currenttags(c, s)
  141. end, mytasklist.buttons)
  142.  
  143. -- Create the wibox
  144. mywibox[s] = awful.wibox({ position = "top", screen = s })
  145. -- Add widgets to the wibox - order matters
  146. mywibox[s].widgets = {
  147. {
  148. --mylauncher,
  149. mytaglist[s],
  150. mypromptbox[s],
  151. layout = awful.widget.layout.horizontal.leftright
  152. },
  153. mylayoutbox[s],
  154. mytextclock,
  155. s == 1 and mysystray or nil,
  156. mytasklist[s],
  157. layout = awful.widget.layout.horizontal.rightleft
  158. }
  159. end
  160. -- }}}
  161.  
  162. -- {{{ Mouse bindings
  163. root.buttons(awful.util.table.join(
  164. awful.button({ }, 3, function () mymainmenu:toggle() end),
  165. awful.button({ }, 4, awful.tag.viewnext),
  166. awful.button({ }, 5, awful.tag.viewprev)
  167. ))
  168. -- }}}
  169.  
  170. -- {{{ Key bindings
  171. globalkeys = awful.util.table.join(
  172. awful.key({ modkey, }, "Left", awful.tag.viewprev ),
  173. awful.key({ modkey, }, "Right", awful.tag.viewnext ),
  174. awful.key({ modkey, }, "Escape", awful.tag.history.restore),
  175.  
  176. awful.key({ modkey, }, "j",
  177. function ()
  178. awful.client.focus.byidx( 1)
  179. if client.focus then client.focus:raise() end
  180. end),
  181. awful.key({ modkey, }, "k",
  182. function ()
  183. awful.client.focus.byidx(-1)
  184. if client.focus then client.focus:raise() end
  185. end),
  186. awful.key({ modkey, }, "w", function () mymainmenu:show(true) end),
  187.  
  188. -- Layout manipulation
  189. awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
  190. awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
  191. awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
  192. awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
  193. awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
  194. awful.key({ modkey, }, "Tab",
  195. function ()
  196. awful.client.focus.history.previous()
  197. if client.focus then
  198. client.focus:raise()
  199. end
  200. end),
  201.  
  202. -- Standard program
  203. awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
  204. awful.key({ modkey, "Control" }, "r", awesome.restart),
  205. awful.key({ modkey, "Shift" }, "q", awesome.quit),
  206.  
  207. awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
  208. awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
  209. awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
  210. awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
  211. awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
  212. awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
  213. awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
  214. awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
  215.  
  216. -- Prompt
  217. awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
  218.  
  219. awful.key({ modkey }, "x",
  220. function ()
  221. awful.prompt.run({ prompt = "Run Lua code: " },
  222. mypromptbox[mouse.screen].widget,
  223. awful.util.eval, nil,
  224. awful.util.getdir("cache") .. "/history_eval")
  225. end)
  226. )
  227.  
  228. clientkeys = awful.util.table.join(
  229. awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
  230. awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
  231. awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
  232. awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
  233. awful.key({ modkey, }, "o", awful.client.movetoscreen ),
  234. awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
  235. awful.key({ modkey, }, "n", function (c) c.minimized = not c.minimized end),
  236. awful.key({ modkey, }, "m",
  237. function (c)
  238. c.maximized_horizontal = not c.maximized_horizontal
  239. c.maximized_vertical = not c.maximized_vertical
  240. end)
  241. )
  242.  
  243. -- Compute the maximum number of digit we need, limited to 9
  244. keynumber = 0
  245. for s = 1, screen.count() do
  246. keynumber = math.min(9, math.max(#tags[s], keynumber));
  247. end
  248.  
  249. -- Bind all key numbers to tags.
  250. -- Be careful: we use keycodes to make it works on any keyboard layout.
  251. -- This should map on the top row of your keyboard, usually 1 to 9.
  252. for i = 1, keynumber do
  253. globalkeys = awful.util.table.join(globalkeys,
  254. awful.key({ modkey }, "#" .. i + 9,
  255. function ()
  256. local screen = mouse.screen
  257. if tags[screen][i] then
  258. awful.tag.viewonly(tags[screen][i])
  259. end
  260. end),
  261. awful.key({ modkey, "Control" }, "#" .. i + 9,
  262. function ()
  263. local screen = mouse.screen
  264. if tags[screen][i] then
  265. awful.tag.viewtoggle(tags[screen][i])
  266. end
  267. end),
  268. awful.key({ modkey, "Shift" }, "#" .. i + 9,
  269. function ()
  270. if client.focus and tags[client.focus.screen][i] then
  271. awful.client.movetotag(tags[client.focus.screen][i])
  272. end
  273. end),
  274. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  275. function ()
  276. if client.focus and tags[client.focus.screen][i] then
  277. awful.client.toggletag(tags[client.focus.screen][i])
  278. end
  279. end))
  280. end
  281.  
  282. clientbuttons = awful.util.table.join(
  283. awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
  284. awful.button({ modkey }, 1, awful.mouse.client.move),
  285. awful.button({ modkey }, 3, awful.mouse.client.resize))
  286.  
  287. -- Set keys
  288. root.keys(globalkeys)
  289. -- }}}
  290.  
  291. -- {{{ Rules
  292. awful.rules.rules = {
  293. -- All clients will match this rule.
  294. { rule = { },
  295. properties = { border_width = beautiful.border_width,
  296. border_color = beautiful.border_normal,
  297. focus = true,
  298. keys = clientkeys,
  299. buttons = clientbuttons } },
  300. { rule = { class = "MPlayer" },
  301. properties = { floating = true } },
  302. { rule = { class = "pinentry" },
  303. properties = { floating = true } },
  304. { rule = { class = "gimp" },
  305. properties = { floating = true } },
  306. -- Set Firefox to always map on tags number 2 of screen 1.
  307. -- { rule = { class = "Firefox" },
  308. -- properties = { tag = tags[1][2] } },
  309. }
  310. -- }}}
  311. -- {{{ Signals
  312. -- Signal function to execute when a new client appears.
  313. client.add_signal("manage", function (c, startup)
  314. -- Add a titlebar
  315. -- awful.titlebar.add(c, { modkey = modkey })
  316.  
  317. -- Enable sloppy focus
  318. c:add_signal("mouse::enter", function(c)
  319. if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  320. and awful.client.focus.filter(c) then
  321. client.focus = c
  322. end
  323. end)
  324.  
  325. if not startup then
  326. -- Set the windows at the slave,
  327. -- i.e. put it at the end of others instead of setting it master.
  328. -- awful.client.setslave(c)
  329.  
  330. -- Put windows in a smart way, only if they does not set an initial position.
  331. if not c.size_hints.user_position and not c.size_hints.program_position then
  332. awful.placement.no_overlap(c)
  333. awful.placement.no_offscreen(c)
  334. end
  335. end
  336. end)
  337.  
  338. client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  339. client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  340. -- }}}
  341.  
  342. --Run nm-applet
  343. os.execute("nm-applet &")
  344. os.execute("~/programs/dropbox/dropbox.py start &")
  345. os.execute("xbindkeys &")
  346. os.execute("gnome-keyring-daemon -d")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement