Advertisement
Guest User

Untitled

a guest
May 19th, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.74 KB | None | 0 0
  1. -- Standard awesome library
  2. local gears = require("gears")
  3. local awful = require("awful")
  4. require("awful.autofocus")
  5. -- Widget and layout library
  6. local wibox = require("wibox")
  7. -- Theme handling library
  8. local beautiful = require("beautiful")
  9. -- Notification library
  10. local naughty = require("naughty")
  11. local menubar = require("menubar")
  12. local hotkeys_popup = require("awful.hotkeys_popup").widget
  13. -- Freedesktop menu
  14. local freedesktop = require("freedesktop")
  15. -- Enable VIM help for hotkeys widget when client with matching name is opened:
  16. require("awful.hotkeys_popup.keys.vim")
  17.  
  18. -- {{{ Error handling
  19. -- Check if awesome encountered an error during startup and fell back to
  20. -- another config (This code will only ever execute for the fallback config)
  21. if awesome.startup_errors then
  22. naughty.notify({ preset = naughty.config.presets.critical,
  23. title = "Oops, there were errors during startup!",
  24. text = awesome.startup_errors })
  25. end
  26. -- Handle runtime errors after startup
  27. do
  28. local in_error = false
  29. awesome.connect_signal("debug::error", function (err)
  30. -- Make sure we don't go into an endless error loop
  31. if in_error then return end
  32. in_error = true
  33. naughty.notify({ preset = naughty.config.presets.critical,
  34. title = "Oops, an error happened!",
  35. text = tostring(err) })
  36. in_error = false
  37. end)
  38. end
  39. -- }}}
  40.  
  41. -- {{{ Variable definitions
  42. -- Themes define colours, icons, font and wallpapers.
  43. -- Chosen colors and buttons look alike adapta maia theme
  44. beautiful.init("~/.config/awesome/themes/cesious/theme.lua")
  45. beautiful.icon_theme = "Papirus-Dark-Maia"
  46. beautiful.bg_normal = "#222D32"
  47. beautiful.bg_focus = "#2C3940"
  48. beautiful.titlebar_close_button_normal = "/usr/share/awesome/themes/cesious/titlebar/close_normal_adapta.png"
  49. beautiful.titlebar_close_button_focus = "/usr/share/awesome/themes/cesious/titlebar/close_focus_adapta.png"
  50. beautiful.font = "Noto Sans Regular 10"
  51. beautiful.notification_font = "Noto Sans Bold 14"
  52.  
  53. -- This is used later as the default terminal and editor to run.
  54. browser = "exo-open --launch WebBrowser" or "firefox"
  55. filemanager = "exo-open --launch FileManager" or "thunar"
  56. gui_editor = "mousepad"
  57. terminal = os.getenv("TERMINAL") or "lxterminal"
  58. music = "audacious"
  59.  
  60. -- Default modkey.
  61. -- Usually, Mod4 is the key with a logo between Control and Alt.
  62. -- If you do not like this or do not have such a key,
  63. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  64. -- However, you can use another modifier like Mod1, but it may interact with others.
  65. modkey = "Mod4"
  66. -- Table of layouts to cover with awful.layout.inc, order matters.
  67. awful.layout.layouts = {
  68. awful.layout.suit.tile,
  69. awful.layout.suit.floating,
  70. --awful.layout.suit.tile.left,
  71. awful.layout.suit.tile.bottom,
  72. -- awful.layout.suit.tile.top,
  73. awful.layout.suit.fair,
  74. awful.layout.suit.fair.horizontal,
  75. -- awful.layout.suit.spiral,
  76. -- awful.layout.suit.spiral.dwindle,
  77. awful.layout.suit.max,
  78. -- awful.layout.suit.max.fullscreen,
  79. awful.layout.suit.magnifier,
  80. -- awful.layout.suit.corner.nw,
  81. -- awful.layout.suit.corner.ne,
  82. -- awful.layout.suit.corner.sw,
  83. -- awful.layout.suit.corner.se,
  84. }
  85. -- }}}
  86.  
  87. -- {{{ Helper functions
  88. local function client_menu_toggle_fn()
  89. local instance = nil
  90. return function ()
  91. if instance and instance.wibox.visible then
  92. instance:hide()
  93. instance = nil
  94. else
  95. instance = awful.menu.clients({ theme = { width = 250 } })
  96. end
  97. end
  98. end
  99. -- }}}
  100.  
  101.  
  102. -- {{{ Menu
  103. -- Create a launcher widget and a main menu
  104. myawesomemenu = {
  105. { "hotkeys", function() return false, hotkeys_popup.show_help end, menubar.utils.lookup_icon("preferences-desktop-keyboard-shortcuts") },
  106. { "manual", terminal .. " -e man awesome", menubar.utils.lookup_icon("system-help") },
  107. { "edit config", gui_editor .. " " .. awesome.conffile, menubar.utils.lookup_icon("accessories-text-editor") },
  108. { "restart", awesome.restart, menubar.utils.lookup_icon("system-restart") }
  109. }
  110. myexitmenu = {
  111. { "log out", function() awesome.quit() end, menubar.utils.lookup_icon("system-log-out") },
  112. { "suspend", "systemctl suspend", menubar.utils.lookup_icon("system-suspend") },
  113. { "hibernate", "systemctl hibernate", menubar.utils.lookup_icon("system-suspend-hibernate") },
  114. { "reboot", "systemctl reboot", menubar.utils.lookup_icon("system-reboot") },
  115. { "shutdown", "poweroff", menubar.utils.lookup_icon("system-shutdown") }
  116. }
  117. mymainmenu = freedesktop.menu.build({
  118. icon_size = 32,
  119. before = {
  120. { "Terminal", terminal, menubar.utils.lookup_icon("utilities-terminal") },
  121. { "Browser", browser, menubar.utils.lookup_icon("internet-web-browser") },
  122. { "Files", filemanager, menubar.utils.lookup_icon("system-file-manager") },
  123. -- other triads can be put here
  124. },
  125. after = {
  126. { "Awesome", myawesomemenu, "/usr/share/awesome/icons/awesome32.png" },
  127. { "Exit", myexitmenu, menubar.utils.lookup_icon("system-shutdown") },
  128. -- other triads can be put here
  129. }
  130. })
  131. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  132. menu = mymainmenu })
  133.  
  134. -- {{{ Helper function for quitmenu
  135. myquitmenu = {
  136. { "log out", function() awesome.quit() end, menubar.utils.lookup_icon("system-log-out") },
  137. { "suspend", "systemctl suspend", menubar.utils.lookup_icon("system-suspend") },
  138. { "hibernate", "systemctl hibernate", menubar.utils.lookup_icon("system-suspend-hibernate") },
  139. { "reboot", "systemctl reboot", menubar.utils.lookup_icon("system-reboot") },
  140. { "shutdown", "poweroff", menubar.utils.lookup_icon("system-shutdown") }
  141. }
  142. m_theme={
  143. border_width=4,
  144. border_color="#16A085",
  145. height=48,
  146. width=200,
  147. font="sans bold 16"
  148. }
  149. quitpopup = awful.menu({items=myquitmenu,theme=m_theme})
  150. local function quitmenu()
  151. s = awful.screen.focused()
  152. m_coords = {
  153. x = s.geometry.x + s.workarea.width/2-100,
  154. y = s.geometry.y + s.workarea.height/2-120
  155. }
  156. quitpopup:show({coords=m_coords})
  157. end
  158. -- }}}
  159.  
  160. -- Menubar configuration
  161. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  162. -- }}}
  163.  
  164. -- {{{ Wibar
  165. -- Create a textclock widget
  166. mytextclock = wibox.widget.textclock("%H:%M ")
  167. -- Keyboard map indicator and switcher
  168. mykeyboardlayout = awful.widget.keyboardlayout()
  169.  
  170. darkblue = beautiful.bg_focus
  171. blue = "#9EBABA"
  172. red = "#EB8F8F"
  173. separator = wibox.widget.textbox(' <span color="' .. blue .. '">| </span>')
  174. spacer = wibox.widget.textbox(' <span color="' .. blue .. '"> </span>')
  175.  
  176. -- Create a wibox for each screen and add it
  177. local taglist_buttons = gears.table.join(
  178. awful.button({ }, 1, function(t) t:view_only() end),
  179. awful.button({ modkey }, 1, function(t)
  180. if client.focus then
  181. client.focus:move_to_tag(t)
  182. end
  183. end),
  184. awful.button({ }, 3, awful.tag.viewtoggle),
  185. awful.button({ modkey }, 3, function(t)
  186. if client.focus then
  187. client.focus:toggle_tag(t)
  188. end
  189. end),
  190. awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
  191. awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
  192. )
  193.  
  194. local tasklist_buttons = gears.table.join(
  195. awful.button({ }, 1, function (c)
  196. if c == client.focus then
  197. c.minimized = true
  198. else
  199. -- Without this, the following
  200. -- :isvisible() makes no sense
  201. c.minimized = false
  202. if not c:isvisible() and c.first_tag then
  203. c.first_tag:view_only()
  204. end
  205. -- This will also un-minimize
  206. -- the client, if needed
  207. client.focus = c
  208. c:raise()
  209. end
  210. end),
  211. awful.button({ }, 3, client_menu_toggle_fn()),
  212. awful.button({ }, 4, function ()
  213. awful.client.focus.byidx(1)
  214. end),
  215. awful.button({ }, 5, function ()
  216. awful.client.focus.byidx(-1)
  217. end))
  218.  
  219. local function set_wallpaper(s)
  220. -- Wallpaper
  221. if beautiful.wallpaper then
  222. local wallpaper = beautiful.wallpaper
  223. -- If wallpaper is a function, call it with the screen
  224. if type(wallpaper) == "function" then
  225. wallpaper = wallpaper(s)
  226. end
  227. gears.wallpaper.maximized(wallpaper, s, true)
  228. end
  229. end
  230.  
  231. -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
  232. screen.connect_signal("property::geometry", set_wallpaper)
  233.  
  234. awful.screen.connect_for_each_screen(function(s)
  235. -- Wallpaper
  236. set_wallpaper(s)
  237.  
  238. -- Each screen has its own tag table.
  239. awful.tag({ "1", "2", "3", "4", "5", "6" }, s, awful.layout.layouts[1])
  240.  
  241. -- Create a promptbox for each screen
  242. s.mypromptbox = awful.widget.prompt()
  243. -- Create an imagebox widget which will contains an icon indicating which layout we're using.
  244. -- We need one layoutbox per screen.
  245. s.mylayoutbox = awful.widget.layoutbox(s)
  246. s.mylayoutbox:buttons(gears.table.join(
  247. awful.button({ }, 1, function () awful.layout.inc( 1) end),
  248. awful.button({ }, 3, function () awful.layout.inc(-1) end),
  249. awful.button({ }, 4, function () awful.layout.inc( 1) end),
  250. awful.button({ }, 5, function () awful.layout.inc(-1) end)))
  251. -- Create a taglist widget
  252. s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, taglist_buttons)
  253.  
  254. -- Create a tasklist widget
  255. s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, tasklist_buttons)
  256.  
  257. -- Create the wibox
  258. s.mywibox = awful.wibar({ position = "top", screen = s })
  259.  
  260. -- Add widgets to the wibox
  261. s.mywibox:setup {
  262. layout = wibox.layout.align.horizontal,
  263. { -- Left widgets
  264. layout = wibox.layout.fixed.horizontal,
  265. mylauncher,
  266. s.mytaglist,
  267. s.mypromptbox,
  268. separator,
  269. },
  270. s.mytasklist, -- Middle widget
  271. { -- Right widgets
  272. layout = wibox.layout.fixed.horizontal,
  273. wibox.widget.systray(),
  274. mykeyboardlayout,
  275. separator,
  276. mytextclock,
  277. s.mylayoutbox,
  278. },
  279. }
  280. end)
  281. -- }}}
  282.  
  283. -- {{{ Mouse bindings
  284. root.buttons(gears.table.join(
  285. awful.button({ }, 1, function () mymainmenu:hide() end),
  286. awful.button({ }, 3, function () mymainmenu:toggle() end),
  287. awful.button({ }, 4, awful.tag.viewnext),
  288. awful.button({ }, 5, awful.tag.viewprev)
  289. ))
  290. -- }}}
  291.  
  292. -- {{{ Key bindings
  293. globalkeys = gears.table.join(
  294. awful.key({ modkey, }, "s", hotkeys_popup.show_help,
  295. {description="show help", group="awesome"}),
  296. awful.key({ modkey, }, "Left", awful.tag.viewprev,
  297. {description = "view previous", group = "tag"}),
  298. awful.key({ modkey, }, "Right", awful.tag.viewnext,
  299. {description = "view next", group = "tag"}),
  300. awful.key({ modkey, }, "Escape", awful.tag.history.restore,
  301. {description = "go back", group = "tag"}),
  302.  
  303. awful.key({ modkey, }, "j",
  304. function ()
  305. awful.client.focus.byidx( 1)
  306. end,
  307. {description = "focus next by index", group = "client"}
  308. ),
  309. awful.key({ modkey, }, "k",
  310. function ()
  311. awful.client.focus.byidx(-1)
  312. end,
  313. {description = "focus previous by index", group = "client"}
  314. ),
  315. awful.key({ modkey, }, "w", function () mymainmenu:show() end,
  316. {description = "show main menu", group = "awesome"}),
  317.  
  318. -- Layout manipulation
  319. awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
  320. {description = "swap with next client by index", group = "client"}),
  321. awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
  322. {description = "swap with previous client by index", group = "client"}),
  323. awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
  324. {description = "focus the next screen", group = "screen"}),
  325. awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
  326. {description = "focus the previous screen", group = "screen"}),
  327. awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
  328. {description = "jump to urgent client", group = "client"}),
  329. awful.key({ modkey, }, "Tab",
  330. function ()
  331. awful.client.focus.history.previous()
  332. if client.focus then
  333. client.focus:raise()
  334. end
  335. end,
  336. {description = "go back", group = "client"}),
  337.  
  338. -- Standard program
  339. awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
  340. {description = "open a terminal", group = "launcher"}),
  341. awful.key({ modkey, }, "z", function () awful.spawn(terminal) end,
  342. {description = "open a terminal", group = "launcher"}),
  343. awful.key({ modkey, "Shift" }, "r", awesome.restart,
  344. {description = "reload awesome", group = "awesome"}),
  345. -- awful.key({ modkey, "Shift" }, "q", awesome.quit,
  346. -- {description = "quit awesome", group = "awesome"}),
  347. awful.key({ modkey, "Shift" }, "q", quitmenu,
  348. {description = "open the quitmenu widget", group = "launcher"}),
  349. awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
  350. {description = "increase master width factor", group = "layout"}),
  351. awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
  352. {description = "decrease master width factor", group = "layout"}),
  353. awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
  354. {description = "increase the number of master clients", group = "layout"}),
  355. awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
  356. {description = "decrease the number of master clients", group = "layout"}),
  357. awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
  358. {description = "increase the number of columns", group = "layout"}),
  359. awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
  360. {description = "decrease the number of columns", group = "layout"}),
  361. awful.key({ modkey }, "b", function () awful.spawn(browser) end,
  362. {description = "launch Browser", group = "launcher"}),
  363. awful.key({ modkey }, "a", function () awful.spawn(music) end,
  364. {description = "launch music player", group = "launcher"}),
  365. awful.key({ modkey, "Shift"}, "Return", function () awful.spawn("/usr/bin/rofi -show drun -modi drun") end,
  366. {description = "launch rofi", group = "launcher"}),
  367. awful.key({ modkey, "Shift" }, "e", function () awful.spawn(filemanager) end,
  368. {description = "launch filemanager", group = "launcher"}),
  369. awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
  370. {description = "select previous", group = "layout"}),
  371. awful.key({ }, "Print", function () awful.spawn.with_shell("sleep 0.1 && /usr/bin/i3-scrot -d") end,
  372. {description = "capture a screenshot", group = "screenshot"}),
  373. awful.key({"Control" }, "Print", function () awful.spawn.with_shell("sleep 0.1 && /usr/bin/i3-scrot -w") end,
  374. {description = "capture a screenshot of active window", group = "screenshot"}),
  375. awful.key({"Shift" }, "Print", function () awful.spawn.with_shell("sleep 0.1 && /usr/bin/i3-scrot -s") end,
  376. {description = "capture a screenshot of selection", group = "screenshot"}),
  377.  
  378. awful.key({ modkey, "Control" }, "n",
  379. function ()
  380. local c = awful.client.restore()
  381. -- Focus restored client
  382. if c then
  383. client.focus = c
  384. c:raise()
  385. end
  386. end,
  387. {description = "restore minimized", group = "client"}),
  388.  
  389. -- Prompt
  390. awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
  391. {description = "run prompt", group = "launcher"}),
  392.  
  393. awful.key({ modkey }, "ΓΆ",
  394. function ()
  395. awful.prompt.run {
  396. prompt = "Run Lua code: ",
  397. textbox = awful.screen.focused().mypromptbox.widget,
  398. exe_callback = awful.util.eval,
  399. history_path = awful.util.get_cache_dir() .. "/history_eval"
  400. }
  401. end,
  402. {description = "lua execute prompt", group = "awesome"}),
  403. -- Menubar
  404. awful.key({ modkey }, "p", function() menubar.show() end,
  405. {description = "show the menubar", group = "launcher"})
  406. )
  407.  
  408. clientkeys = gears.table.join(
  409. awful.key({ modkey, }, "f",
  410. function (c)
  411. c.fullscreen = not c.fullscreen
  412. c:raise()
  413. end,
  414. {description = "toggle fullscreen", group = "client"}),
  415. awful.key({ modkey, }, "x", function (c) c:kill() end,
  416. {description = "close", group = "client"}),
  417. awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
  418. {description = "toggle floating", group = "client"}),
  419. awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
  420. {description = "move to master", group = "client"}),
  421. awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
  422. {description = "move to screen", group = "client"}),
  423. awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
  424. {description = "toggle keep on top", group = "client"}),
  425. awful.key({ modkey, }, "n",
  426. function (c)
  427. -- The client currently has the input focus, so it cannot be
  428. -- minimized, since minimized clients can't have the focus.
  429. c.minimized = true
  430. end ,
  431. {description = "minimize", group = "client"}),
  432. awful.key({ modkey, }, "m",
  433. function (c)
  434. c.maximized = not c.maximized
  435. c:raise()
  436. end ,
  437. {description = "(un)maximize", group = "client"}),
  438. awful.key({ modkey, "Control" }, "m",
  439. function (c)
  440. c.maximized_vertical = not c.maximized_vertical
  441. c:raise()
  442. end ,
  443. {description = "(un)maximize vertically", group = "client"}),
  444. awful.key({ modkey, "Shift" }, "m",
  445. function (c)
  446. c.maximized_horizontal = not c.maximized_horizontal
  447. c:raise()
  448. end ,
  449. {description = "(un)maximize horizontally", group = "client"})
  450. )
  451.  
  452. -- Bind all key numbers to tags.
  453. -- Be careful: we use keycodes to make it work on any keyboard layout.
  454. -- This should map on the top row of your keyboard, usually 1 to 9.
  455. for i = 1, 9 do
  456. globalkeys = gears.table.join(globalkeys,
  457. -- View tag only.
  458. awful.key({ modkey }, "#" .. i + 9,
  459. function ()
  460. local screen = awful.screen.focused()
  461. local tag = screen.tags[i]
  462. if tag then
  463. tag:view_only()
  464. end
  465. end,
  466. {description = "view tag #"..i, group = "tag"}),
  467. -- Toggle tag display.
  468. awful.key({ modkey, "Control" }, "#" .. i + 9,
  469. function ()
  470. local screen = awful.screen.focused()
  471. local tag = screen.tags[i]
  472. if tag then
  473. awful.tag.viewtoggle(tag)
  474. end
  475. end,
  476. {description = "toggle tag #" .. i, group = "tag"}),
  477. -- Move client to tag.
  478. awful.key({ modkey, "Shift" }, "#" .. i + 9,
  479. function ()
  480. if client.focus then
  481. local tag = client.focus.screen.tags[i]
  482. if tag then
  483. client.focus:move_to_tag(tag)
  484. end
  485. end
  486. end,
  487. {description = "move focused client to tag #"..i, group = "tag"}),
  488. -- Toggle tag on focused client.
  489. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  490. function ()
  491. if client.focus then
  492. local tag = client.focus.screen.tags[i]
  493. if tag then
  494. client.focus:toggle_tag(tag)
  495. end
  496. end
  497. end,
  498. {description = "toggle focused client on tag #" .. i, group = "tag"})
  499. )
  500. end
  501.  
  502. clientbuttons = gears.table.join(
  503. awful.button({ }, 1, function (c) client.focus = c; c:raise()
  504. mymainmenu:hide() end),
  505. awful.button({ modkey }, 1, awful.mouse.client.move),
  506. awful.button({ modkey }, 3, awful.mouse.client.resize))
  507.  
  508. -- Set keys
  509. root.keys(globalkeys)
  510. -- }}}
  511.  
  512. -- {{{ Rules
  513. -- Rules to apply to new clients (through the "manage" signal).
  514. awful.rules.rules = {
  515. -- All clients will match this rule.
  516. { rule = { },
  517. properties = { border_width = beautiful.border_width,
  518. border_color = beautiful.border_normal,
  519. focus = awful.client.focus.filter,
  520. raise = true,
  521. keys = clientkeys,
  522. buttons = clientbuttons,
  523. size_hints_honor = false, -- Remove gaps between terminals
  524. screen = awful.screen.preferred,
  525. callback = awful.client.setslave,
  526. placement = awful.placement.no_overlap+awful.placement.no_offscreen
  527. }
  528. },
  529.  
  530. -- Floating clients.
  531. { rule_any = {
  532. instance = {
  533. "DTA", -- Firefox addon DownThemAll.
  534. "copyq", -- Includes session name in class.
  535. },
  536. class = {
  537. "Arandr",
  538. "Gpick",
  539. "Kruler",
  540. "MessageWin", -- kalarm.
  541. "Sxiv",
  542. "Wpa_gui",
  543. "pinentry",
  544. "veromix",
  545. "xtightvncviewer"},
  546.  
  547. name = {
  548. "Event Tester", -- xev.
  549. },
  550. role = {
  551. "AlarmWindow", -- Thunderbird's calendar.
  552. "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
  553. }
  554. }, properties = { floating = true }},
  555.  
  556. -- Add titlebars to normal clients and dialogs
  557. { rule_any = {type = { "normal", "dialog" } },
  558. properties = { titlebars_enabled = true }
  559. },
  560.  
  561. -- Set Firefox to always map on the tag named "2" on screen 1.
  562. -- { rule = { class = "Firefox" },
  563. -- properties = { screen = 1, tag = "2" } },
  564.  
  565.  
  566. }
  567. -- }}}
  568.  
  569. -- {{{ Signals
  570.  
  571.  
  572. -- Signal function to execute when a new client appears.
  573. client.connect_signal("manage", function (c)
  574. -- Set the windows at the slave,
  575. -- i.e. put it at the end of others instead of setting it master.
  576. -- if not awesome.startup then awful.client.setslave(c) end
  577.  
  578. if awesome.startup and
  579. not c.size_hints.user_position
  580. and not c.size_hints.program_position then
  581. -- Prevent clients from being unreachable after screen count changes.
  582. awful.placement.no_offscreen(c)
  583. end
  584. end)
  585.  
  586. -- Add a titlebar if titlebars_enabled is set to true in the rules.
  587. client.connect_signal("request::titlebars", function(c)
  588. -- buttons for the titlebar
  589. local buttons = gears.table.join(
  590. awful.button({ }, 1, function()
  591. client.focus = c
  592. c:raise()
  593. awful.mouse.client.move(c)
  594. end),
  595. awful.button({ }, 3, function()
  596. client.focus = c
  597. c:raise()
  598. awful.mouse.client.resize(c)
  599. end)
  600. )
  601.  
  602. awful.titlebar(c) : setup {
  603. { -- Left
  604. awful.titlebar.widget.iconwidget(c),
  605. buttons = buttons,
  606. layout = wibox.layout.fixed.horizontal
  607. },
  608. { -- Middle
  609. { -- Title
  610. align = "center",
  611. widget = awful.titlebar.widget.titlewidget(c)
  612. },
  613. buttons = buttons,
  614. layout = wibox.layout.flex.horizontal
  615. },
  616. { -- Right
  617. awful.titlebar.widget.floatingbutton (c),
  618. awful.titlebar.widget.stickybutton (c),
  619. -- awful.titlebar.widget.ontopbutton (c),
  620. awful.titlebar.widget.maximizedbutton(c),
  621. awful.titlebar.widget.closebutton (c),
  622. layout = wibox.layout.fixed.horizontal()
  623. },
  624. layout = wibox.layout.align.horizontal
  625. }
  626. -- Hide the menubar if we are not floating
  627. -- local l = awful.layout.get(c.screen)
  628. -- if not (l.name == "floating" or c.floating) then
  629. -- awful.titlebar.hide(c)
  630. -- end
  631. end)
  632.  
  633. -- Enable sloppy focus, so that focus follows mouse.
  634. client.connect_signal("mouse::enter", function(c)
  635. if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
  636. and awful.client.focus.filter(c) then
  637. client.focus = c
  638. end
  639. end)
  640.  
  641. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  642. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  643.  
  644. -- Disable borders on lone windows
  645. -- Handle border sizes of clients.
  646. for s = 1, screen.count() do screen[s]:connect_signal("arrange", function ()
  647. local clients = awful.client.visible(s)
  648. local layout = awful.layout.getname(awful.layout.get(s))
  649.  
  650. for _, c in pairs(clients) do
  651. -- No borders with only one humanly visible client
  652. if c.maximized then
  653. -- NOTE: also handled in focus, but that does not cover maximizing from a
  654. -- tiled state (when the client had focus).
  655. c.border_width = 0
  656. elseif c.floating or layout == "floating" then
  657. c.border_width = beautiful.border_width
  658. elseif layout == "max" or layout == "fullscreen" then
  659. c.border_width = 0
  660. else
  661. local tiled = awful.client.tiled(c.screen)
  662. if #tiled == 1 then -- and c == tiled[1] then
  663. tiled[1].border_width = 0
  664. -- if layout ~= "max" and layout ~= "fullscreen" then
  665. -- XXX: SLOW!
  666. -- awful.client.moveresize(0, 0, 2, 0, tiled[1])
  667. -- end
  668. else
  669. c.border_width = beautiful.border_width
  670. end
  671. end
  672. end
  673. end)
  674. end
  675.  
  676. -- }}}
  677.  
  678. --client.connect_signal("property::floating", function (c)
  679. -- if c.floating then
  680. -- awful.titlebar.show(c)
  681. -- else
  682. -- awful.titlebar.hide(c)
  683. -- end
  684. --end)
  685.  
  686. beautiful.useless_gap = 5
  687.  
  688. awful.spawn.with_shell("~/.config/awesome/autorun.sh")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement