rc.lua 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. -- If LuaRocks is installed, make sure that packages installed through it are
  2. -- found (e.g. lgi). If LuaRocks is not installed, do nothing.
  3. pcall(require, "luarocks.loader")
  4. -- Standard awesome library
  5. local gears = require("gears")
  6. local awful = require("awful")
  7. require("awful.autofocus")
  8. -- Widget and layout library
  9. local wibox = require("wibox")
  10. -- Theme handling library
  11. local beautiful = require("beautiful")
  12. require("menu")
  13. -- Notification library
  14. local naughty = require("naughty")
  15. local menubar = require("menubar")
  16. local hotkeys_popup = require("awful.hotkeys_popup")
  17. local vicious = require("vicious")
  18. -- Enable hotkeys help widget for VIM and other apps
  19. -- when client with a matching name is opened:
  20. require("awful.hotkeys_popup.keys")
  21. require("message")
  22. require("volume")
  23. require("battery")
  24. require("light")
  25. require("user_scrypt")
  26. -- {{{ Variable definitions
  27. -- Themes define colours, icons, font and wallpapers.
  28. beautiful.init(gears.filesystem.get_configuration_dir() .. "themes/zenburn/theme.lua")
  29. -- This is used later as the default terminal and editor to run.
  30. terminal = "kitty" or "xterm"
  31. editor = "nvim" or "vim" or "vi" or "mc" or "nano"
  32. editor_cmd = terminal .. " -e " .. editor
  33. web_browser = "chromium"
  34. file_browser = "thunar"
  35. -- Default modkey.
  36. -- Usually, Mod4 is the key with a logo between Control and Alt.
  37. -- If you do not like this or do not have such a key,
  38. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  39. -- However, you can use another modifier like Mod1, but it may interact with others.
  40. modkey = "Mod4"
  41. -- Table of layouts to cover with awful.layout.inc, order matters.
  42. awful.layout.layouts = {
  43. awful.layout.suit.tile,
  44. awful.layout.suit.spiral.dwindle,
  45. awful.layout.suit.max,
  46. awful.layout.suit.magnifier,
  47. awful.layout.suit.floating,
  48. }
  49. -- }}}
  50. -- {{{ Menu
  51. -- Create a launcher widget and a main menu
  52. mymainmenu = awful.menu
  53. ({
  54. items =
  55. {
  56. { "restart", awesome.restart },
  57. { "reboot", terminal .. " systemctl reboot" },
  58. { "powerof", terminal .. " systemctl poweroff" },
  59. { "killall", function() kill_all() end },
  60. { "quit", function() awesome.quit() end },
  61. }
  62. })
  63. mylauncher = awful.widget.launcher
  64. ({
  65. image = beautiful.awesome_icon,
  66. menu = mymainmenu
  67. })
  68. -- Menubar configuration
  69. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  70. -- }}}
  71. -- Keyboard map indicator and switcher
  72. mykeyboardlayout = awful.widget.keyboardlayout()
  73. -- {{{ Wibar
  74. -- Create a textclock widget
  75. mytextclock = wibox.widget.textclock('%d.%m, %H:%M')
  76. -- Create a wibox for each screen and add it
  77. local taglist_buttons = gears.table.join
  78. (
  79. awful.button({ }, 1, function(t) t:view_only() end),
  80. awful.button({ modkey }, 1, function(t)
  81. if client.focus then
  82. client.focus:move_to_tag(t)
  83. end
  84. end),
  85. awful.button({ }, 3, awful.tag.viewtoggle),
  86. awful.button({ modkey }, 3, function(t)
  87. if client.focus then
  88. client.focus:toggle_tag(t)
  89. end
  90. end),
  91. awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
  92. awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
  93. )
  94. local tasklist_buttons = gears.table.join
  95. (
  96. awful.button
  97. (
  98. { }, 1, function (c)
  99. if c == client.focus then
  100. c.minimized = true
  101. else
  102. c:emit_signal
  103. (
  104. "request::activate",
  105. "tasklist",
  106. {raise = true}
  107. )
  108. end
  109. end),
  110. awful.button
  111. (
  112. { }, 3, function()
  113. awful.menu.client_list({ theme = { width = 250 } })
  114. end),
  115. awful.button
  116. (
  117. { }, 4, function ()
  118. awful.client.focus.byidx(1)
  119. end),
  120. awful.button
  121. (
  122. { }, 5, function ()
  123. awful.client.focus.byidx(-1)
  124. end)
  125. )
  126. local function set_wallpaper(s)
  127. -- Wallpaper
  128. if beautiful.wallpaper then
  129. local wallpaper = beautiful.wallpaper
  130. -- If wallpaper is a function, call it with the screen
  131. if type(wallpaper) == "function" then
  132. wallpaper = wallpaper(s)
  133. end
  134. gears.wallpaper.maximized(wallpaper, s, true)
  135. end
  136. end
  137. -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
  138. screen.connect_signal("property::geometry", set_wallpaper)
  139. awful.screen.connect_for_each_screen(function(s)
  140. -- Wallpaper
  141. set_wallpaper(s)
  142. -- Each screen has its own tag table.
  143. awful.tag({ "1", "2", "3", "4", "5", "6" }, s, awful.layout.layouts[1])
  144. -- Create a promptbox for each screen
  145. s.mypromptbox = awful.widget.prompt()
  146. -- Create an imagebox widget which will contain an icon indicating which layout we're using.
  147. -- We need one layoutbox per screen.
  148. s.mylayoutbox = awful.widget.layoutbox(s)
  149. s.mylayoutbox:buttons
  150. (
  151. gears.table.join
  152. (
  153. awful.button({ }, 1, function () awful.layout.inc( 1) end),
  154. awful.button({ }, 3, function () awful.layout.inc(-1) end),
  155. awful.button({ }, 4, function () awful.layout.inc( 1) end),
  156. awful.button({ }, 5, function () awful.layout.inc(-1) end)
  157. )
  158. )
  159. -- Create a taglist widget
  160. s.mytaglist = awful.widget.taglist
  161. {
  162. screen = s,
  163. filter = awful.widget.taglist.filter.all,
  164. buttons = taglist_buttons
  165. }
  166. -- Create a tasklist widget
  167. s.mytasklist = awful.widget.tasklist
  168. {
  169. screen = s,
  170. filter = awful.widget.tasklist.filter.currenttags,
  171. buttons = tasklist_buttons
  172. }
  173. -- Create the wibox
  174. s.mywibox = awful.wibar({ position = "top", screen = s })
  175. -- Add widgets to the wibox
  176. s.mywibox:setup {
  177. layout = wibox.layout.align.horizontal,
  178. { -- Left widgets
  179. layout = wibox.layout.fixed.horizontal,
  180. --mylauncher,
  181. s.mytaglist,
  182. s.mypromptbox,
  183. },
  184. --s.mytasklist, -- Middle widget
  185. { -- center widgets
  186. layout = wibox.layout.fixed.horizontal,
  187. wibox.widget{
  188. markup = "",
  189. widget = wibox.widget.textbox
  190. },
  191. spacing = 790,
  192. mytextclock,
  193. },
  194. { -- Right widgets
  195. layout = wibox.layout.fixed.horizontal,
  196. spacing = 5,
  197. mykeyboardlayout,
  198. volume_widget,
  199. battery_widget,
  200. light_widget,
  201. wibox.widget.systray(),
  202. s.mylayoutbox,
  203. },
  204. }
  205. end)
  206. -- }}}
  207. -- {{{ Mouse bindings
  208. root.buttons
  209. (
  210. gears.table.join
  211. (
  212. awful.button({ }, 3, function () mymainmenu:toggle() end),
  213. awful.button({ }, 4, awful.tag.viewnext),
  214. awful.button({ }, 5, awful.tag.viewprev)
  215. )
  216. )
  217. -- }}}
  218. -- {{{ Key bindings
  219. globalkeys = gears.table.join
  220. (
  221. awful.key
  222. (
  223. { }, "XF86AudioRaiseVolume",
  224. function ()
  225. awful.util.spawn("amixer set Master 5%+")
  226. end
  227. ),
  228. awful.key
  229. (
  230. { }, "XF86AudioLowerVolume",
  231. function ()
  232. awful.util.spawn("amixer set Master 5%-")
  233. end
  234. ),
  235. awful.key
  236. (
  237. { }, "XF86AudioMute",
  238. function ()
  239. awful.util.spawn("amixer sset Master toggle")
  240. end
  241. ),
  242. awful.key
  243. (
  244. { }, "XF86MonBrightnessDown",
  245. function ()
  246. awful.util.spawn("brightnessctl s 10%+")
  247. end
  248. ),
  249. awful.key
  250. (
  251. { }, "XF86MonBrightnessUp",
  252. function ()
  253. awful.util.spawn("brightnessctl s 10%-")
  254. end
  255. ),
  256. awful.key
  257. (
  258. { modkey,}, "s",
  259. hotkeys_popup.show_help,
  260. {description="show help", group="awesome"}
  261. ),
  262. awful.key
  263. (
  264. { modkey,}, "Left",
  265. awful.tag.viewprev,
  266. {description = "view previous", group = "tag"}
  267. ),
  268. awful.key
  269. (
  270. { modkey,}, "Right",
  271. awful.tag.viewnext,
  272. {description = "view next", group = "tag"}
  273. ),
  274. awful.key
  275. (
  276. { modkey,}, "Escape",
  277. awful.tag.history.restore,
  278. {description = "go back", group = "tag"}
  279. ),
  280. awful.key
  281. (
  282. { modkey,}, "j",
  283. function ()
  284. awful.client.focus.byidx( 1)
  285. end,
  286. {description = "focus next by index", group = "client"}
  287. ),
  288. awful.key
  289. (
  290. { modkey, }, "k",
  291. function ()
  292. awful.client.focus.byidx(-1)
  293. end,
  294. {description = "focus previous by index", group = "client"}
  295. ),
  296. awful.key
  297. (
  298. { modkey, "Shift" }, "q",
  299. function () mymainmenu:show() end,
  300. {description = "show main menu", group = "awesome"}
  301. ),
  302. awful.key
  303. (
  304. { modkey, }, "w",
  305. function () awful.util.spawn(web_browser) end,
  306. {description = "show main menu", group = "awesome"}
  307. ),
  308. awful.key
  309. (
  310. { modkey, }, "e",
  311. function () awful.util.spawn(file_browser) end,
  312. {description = "show main menu", group = "awesome"}
  313. ),
  314. -- Layout manipulation
  315. awful.key
  316. (
  317. { modkey, "Shift"},
  318. "j",
  319. function () awful.client.swap.byidx( 1) end,
  320. {description = "swap with next client by index", group = "client"}
  321. ),
  322. awful.key
  323. (
  324. {modkey, "Shift" },
  325. "k",
  326. function () awful.client.swap.byidx( -1) end,
  327. {description = "swap with previous client by index", group = "client"}
  328. ),
  329. awful.key
  330. (
  331. { modkey, "Control" },
  332. "j",
  333. function () awful.screen.focus_relative( 1) end,
  334. {description = "focus the next screen", group = "screen"}
  335. ),
  336. awful.key
  337. (
  338. { modkey, "Control" },
  339. "k",
  340. function () awful.screen.focus_relative(-1) end,
  341. {description = "focus the previous screen", group = "screen"}
  342. ),
  343. awful.key
  344. (
  345. { modkey,},
  346. "u",
  347. awful.client.urgent.jumpto,
  348. {description = "jump to urgent client", group = "client"}
  349. ),
  350. awful.key
  351. (
  352. { modkey,},
  353. "Tab",
  354. function ()
  355. awful.client.focus.history.previous()
  356. if client.focus then
  357. client.focus:raise()
  358. end
  359. end,
  360. {description = "go back", group = "client"}
  361. ),
  362. -- Standard program
  363. awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
  364. {description = "open a terminal", group = "launcher"}),
  365. awful.key({ modkey, "Control" }, "r", awesome.restart,
  366. {description = "reload awesome", group = "awesome"}),
  367. awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
  368. {description = "increase master width factor", group = "layout"}),
  369. awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
  370. {description = "decrease master width factor", group = "layout"}),
  371. awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
  372. {description = "increase the number of master clients", group = "layout"}),
  373. awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
  374. {description = "decrease the number of master clients", group = "layout"}),
  375. awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
  376. {description = "increase the number of columns", group = "layout"}),
  377. awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
  378. {description = "decrease the number of columns", group = "layout"}),
  379. awful.key({"Shift"}, "space", function () awful.layout.inc( 1) end,
  380. {description = "select next", group = "layout"}),
  381. awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
  382. {description = "select previous", group = "layout"}),
  383. awful.key({ modkey, "Control" }, "n",
  384. function ()
  385. local c = awful.client.restore()
  386. -- Focus restored client
  387. if c then
  388. c:emit_signal(
  389. "request::activate", "key.unminimize", {raise = true}
  390. )
  391. end
  392. end,
  393. {description = "restore minimized", group = "client"}),
  394. -- Prompt
  395. awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
  396. {description = "run prompt", group = "launcher"}),
  397. awful.key({ modkey }, "x",
  398. function ()
  399. awful.prompt.run {
  400. prompt = "Run Lua code: ",
  401. textbox = awful.screen.focused().mypromptbox.widget,
  402. exe_callback = awful.util.eval,
  403. history_path = awful.util.get_cache_dir() .. "/history_eval"
  404. }
  405. end,
  406. {description = "lua execute prompt", group = "awesome"}),
  407. -- Menubar
  408. awful.key({ modkey }, "p", function() menubar.show() end,
  409. {description = "show the menubar", group = "launcher"})
  410. --Volume
  411. -- awful.key({}, "p", function() menubar.show() end,
  412. -- {description = "show the menubar", group = "launcher"})
  413. )
  414. clientkeys = gears.table.join
  415. (
  416. awful.key({ modkey, }, "f",
  417. function (c)
  418. c.fullscreen = not c.fullscreen
  419. c:raise()
  420. end,
  421. {description = "toggle fullscreen", group = "client"}),
  422. awful.key
  423. (
  424. { modkey,}, "q",
  425. function (c) c:kill() end,
  426. {description = "close", group = "client"}
  427. ),
  428. awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
  429. {description = "toggle floating", group = "client"}),
  430. awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
  431. {description = "move to master", group = "client"}),
  432. awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
  433. {description = "move to screen", group = "client"}),
  434. awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
  435. {description = "toggle keep on top", group = "client"}),
  436. awful.key({ modkey, }, "n",
  437. function (c)
  438. -- The client currently has the input focus, so it cannot be
  439. -- minimized, since minimized clients can't have the focus.
  440. c.minimized = true
  441. end ,
  442. {description = "minimize", group = "client"}),
  443. awful.key({ modkey, }, "m",
  444. function (c)
  445. c.maximized = not c.maximized
  446. c:raise()
  447. end ,
  448. {description = "(un)maximize", group = "client"}),
  449. awful.key({ modkey, "Control" }, "m",
  450. function (c)
  451. c.maximized_vertical = not c.maximized_vertical
  452. c:raise()
  453. end ,
  454. {description = "(un)maximize vertically", group = "client"}),
  455. awful.key({ modkey, "Shift" }, "m",
  456. function (c)
  457. c.maximized_horizontal = not c.maximized_horizontal
  458. c:raise()
  459. end ,
  460. {description = "(un)maximize horizontally", group = "client"})
  461. )
  462. -- Bind all key numbers to tags.
  463. -- Be careful: we use keycodes to make it work on any keyboard layout.
  464. -- This should map on the top row of your keyboard, usually 1 to 9.
  465. for i = 1, 9 do
  466. globalkeys = gears.table.join(globalkeys,
  467. -- View tag only.
  468. awful.key
  469. (
  470. { modkey },
  471. "#" .. i + 9,
  472. function ()
  473. local screen = awful.screen.focused()
  474. local tag = screen.tags[i]
  475. if tag then
  476. tag:view_only()
  477. end
  478. end,
  479. {description = "view tag #"..i, group = "tag"}
  480. ),
  481. -- Toggle tag display.
  482. awful.key({ modkey, "Control" }, "#" .. i + 9,
  483. function ()
  484. local screen = awful.screen.focused()
  485. local tag = screen.tags[i]
  486. if tag then
  487. awful.tag.viewtoggle(tag)
  488. end
  489. end,
  490. {description = "toggle tag #" .. i, group = "tag"}),
  491. -- Move client to tag.
  492. awful.key({ modkey, "Shift" }, "#" .. i + 9,
  493. function ()
  494. if client.focus then
  495. local tag = client.focus.screen.tags[i]
  496. if tag then
  497. client.focus:move_to_tag(tag)
  498. end
  499. end
  500. end,
  501. {description = "move focused client to tag #"..i, group = "tag"}),
  502. -- Toggle tag on focused client.
  503. awful.key
  504. (
  505. { modkey, "Control", "Shift" }, "#" .. i + 9,
  506. function ()
  507. if client.focus then
  508. local tag = client.focus.screen.tags[i]
  509. if tag then
  510. client.focus:toggle_tag(tag)
  511. end
  512. end
  513. end,
  514. {description = "toggle focused client on tag #" .. i, group = "tag"})
  515. )
  516. end
  517. clientbuttons = gears.table.join(
  518. awful.button({ }, 1, function (c)
  519. c:emit_signal("request::activate", "mouse_click", {raise = true})
  520. end),
  521. awful.button({ modkey }, 1, function (c)
  522. c:emit_signal("request::activate", "mouse_click", {raise = true})
  523. awful.mouse.client.move(c)
  524. end),
  525. awful.button({ modkey }, 3, function (c)
  526. c:emit_signal("request::activate", "mouse_click", {raise = true})
  527. awful.mouse.client.resize(c)
  528. end)
  529. )
  530. -- Set keys
  531. root.keys(globalkeys)
  532. -- }}}
  533. -- {{{ Rules
  534. -- Rules to apply to new clients (through the "manage" signal).
  535. awful.rules.rules = {
  536. -- All clients will match this rule.
  537. { rule = { },
  538. properties = { border_width = beautiful.border_width,
  539. border_color = beautiful.border_normal,
  540. focus = awful.client.focus.filter,
  541. raise = true,
  542. size_hints_honor = false,
  543. keys = clientkeys,
  544. buttons = clientbuttons,
  545. screen = awful.screen.preferred,
  546. placement = awful.placement.no_overlap+awful.placement.no_offscreen
  547. }
  548. },
  549. -- Floating clients.
  550. { rule_any = {
  551. instance = {
  552. "DTA", -- Firefox addon DownThemAll.
  553. "copyq", -- Includes session name in class.
  554. "pinentry",
  555. },
  556. class = {
  557. "Arandr",
  558. "Blueman-manager",
  559. "Gpick",
  560. "Kruler",
  561. "MessageWin", -- kalarm.
  562. "Sxiv",
  563. "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
  564. "Wpa_gui",
  565. "veromix",
  566. "xtightvncviewer"},
  567. -- Note that the name property shown in xprop might be set slightly after creation of the client
  568. -- and the name shown there might not match defined rules here.
  569. name = {
  570. "Event Tester", -- xev.
  571. },
  572. role = {
  573. "AlarmWindow", -- Thunderbird's calendar.
  574. "ConfigManager", -- Thunderbird's about:config.
  575. "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
  576. }
  577. }, properties = { floating = true }},
  578. -- Add titlebars to normal clients and dialogs
  579. { rule_any = {type = { "normal", "dialog" }
  580. }, properties = { titlebars_enabled = false }
  581. },
  582. -- Set Firefox to always map on the tag named "2" on screen 1.
  583. -- { rule = { class = "Firefox" },
  584. -- properties = { screen = 1, tag = "2" } },
  585. }
  586. -- }}}
  587. -- {{{ Signals
  588. -- Signal function to execute when a new client appears.
  589. client.connect_signal("manage", function (c)
  590. -- Set the windows at the slave,
  591. -- i.e. put it at the end of others instead of setting it master.
  592. if not awesome.startup then awful.client.setslave(c) end
  593. if awesome.startup
  594. and not c.size_hints.user_position
  595. and not c.size_hints.program_position then
  596. -- Prevent clients from being unreachable after screen count changes.
  597. awful.placement.no_offscreen(c)
  598. end
  599. end)
  600. -- Add a titlebar if titlebars_enabled is set to true in the rules.
  601. client.connect_signal("request::titlebars", function(c)
  602. -- buttons for the titlebar
  603. local buttons = gears.table.join
  604. (
  605. awful.button({ }, 1, function()
  606. c:emit_signal("request::activate", "titlebar", {raise = true})
  607. awful.mouse.client.move(c)
  608. end),
  609. awful.button({ }, 3, function()
  610. c:emit_signal("request::activate", "titlebar", {raise = true})
  611. awful.mouse.client.resize(c)
  612. end)
  613. )
  614. awful.titlebar(c) : setup
  615. {
  616. { -- Left
  617. awful.titlebar.widget.iconwidget(c),
  618. buttons = buttons,
  619. layout = wibox.layout.fixed.horizontal
  620. },
  621. { -- Middle
  622. { -- Title
  623. align = "center",
  624. widget = awful.titlebar.widget.titlewidget(c)
  625. },
  626. buttons = buttons,
  627. layout = wibox.layout.flex.horizontal
  628. },
  629. { -- Right
  630. awful.titlebar.widget.floatingbutton (c),
  631. awful.titlebar.widget.maximizedbutton(c),
  632. awful.titlebar.widget.stickybutton (c),
  633. awful.titlebar.widget.ontopbutton (c),
  634. awful.titlebar.widget.closebutton (c),
  635. layout = wibox.layout.fixed.horizontal()
  636. },
  637. layout = wibox.layout.align.horizontal
  638. }
  639. end)
  640. -- Enable sloppy focus, so that focus follows mouse.
  641. client.connect_signal("mouse::enter", function(c)
  642. c:emit_signal("request::activate", "mouse_enter", {raise = false})
  643. end)
  644. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  645. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  646. -- }}}
  647. do
  648. local cmds =
  649. {
  650. "start-pulseaudio-x11"
  651. }
  652. local kills_and_runs =
  653. {
  654. "nm-applet"
  655. }
  656. for _,i in pairs(kills_and_runs) do
  657. check_and_run(i)
  658. end
  659. for _,i in pairs(cmds) do
  660. awful.util.spawn(i)
  661. end
  662. end