rc.lua 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  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. -- Notification library
  13. local naughty = require("naughty")
  14. local menubar = require("menubar")
  15. local hotkeys_popup = require("awful.hotkeys_popup")
  16. -- Enable hotkeys help widget for VIM and other apps
  17. -- when client with a matching name is opened:
  18. require("awful.hotkeys_popup.keys")
  19. -- Load Debian menu entries
  20. local debian = require("debian.menu")
  21. local has_fdo, freedesktop = pcall(require, "freedesktop")
  22. -- {{{ Error handling
  23. -- Check if awesome encountered an error during startup and fell back to
  24. -- another config (This code will only ever execute for the fallback config)
  25. if awesome.startup_errors then
  26. naughty.notify({ preset = naughty.config.presets.critical,
  27. title = "Oops, there were errors during startup!",
  28. text = awesome.startup_errors })
  29. end
  30. -- Handle runtime errors after startup
  31. do
  32. local in_error = false
  33. awesome.connect_signal("debug::error", function (err)
  34. -- Make sure we don't go into an endless error loop
  35. if in_error then return end
  36. in_error = true
  37. naughty.notify({ preset = naughty.config.presets.critical,
  38. title = "Oops, an error happened!",
  39. text = tostring(err) })
  40. in_error = false
  41. end)
  42. end
  43. -- }}}
  44. -- {{{ Variable definitions
  45. -- Themes define colours, icons, font and wallpapers.
  46. beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
  47. -- This is used later as the default terminal and editor to run.
  48. terminal = "kitty"
  49. editor = os.getenv("EDITOR") or "nvim"
  50. editor_cmd = terminal .. " -e " .. editor
  51. editorgui = "emacsclient -a '' -c"
  52. browser1 = "palemoon"
  53. browser2 = "luakit"
  54. filemanager = "rox"
  55. mailclient = "kitty -e aerc"
  56. mediaplayer = "mpv"
  57. scrlocker = "slock"
  58. -- Default modkey.
  59. -- Usually, Mod4 is the key with a logo between Control and Alt.
  60. -- If you do not like this or do not have such a key,
  61. -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
  62. -- However, you can use another modifier like Mod1, but it may interact with others.
  63. modkey = "Mod4"
  64. altkey = "Mod1"
  65. -- Table of layouts to cover with awful.layout.inc, order matters.
  66. awful.layout.layouts = {
  67. -- awful.layout.suit.floating,
  68. awful.layout.suit.tile,
  69. -- awful.layout.suit.tile.left,
  70. -- awful.layout.suit.tile.bottom,
  71. -- awful.layout.suit.tile.top,
  72. -- awful.layout.suit.fair,
  73. -- awful.layout.suit.fair.horizontal,
  74. awful.layout.suit.spiral,
  75. -- awful.layout.suit.spiral.dwindle,
  76. awful.layout.suit.max,
  77. -- awful.layout.suit.max.fullscreen,
  78. awful.layout.suit.magnifier,
  79. awful.layout.suit.corner.nw,
  80. -- awful.layout.suit.corner.ne,
  81. -- awful.layout.suit.corner.sw,
  82. -- awful.layout.suit.corner.se,
  83. }
  84. -- }}}
  85. -- {{{ Menu
  86. -- Create a launcher widget and a main menu
  87. myawesomemenu = {
  88. { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
  89. { "manual", terminal .. " -e man awesome" },
  90. { "edit config", editor_cmd .. " " .. awesome.conffile },
  91. { "restart", awesome.restart },
  92. { "quit", function() awesome.quit() end },
  93. }
  94. local menu_awesome = { "awesome", myawesomemenu, beautiful.awesome_icon }
  95. local menu_terminal = { "open terminal", terminal }
  96. if has_fdo then
  97. mymainmenu = freedesktop.menu.build({
  98. before = { menu_awesome },
  99. after = { menu_terminal }
  100. })
  101. else
  102. mymainmenu = awful.menu({
  103. items = {
  104. menu_awesome,
  105. { "Debian", debian.menu.Debian_menu.Debian },
  106. menu_terminal,
  107. }
  108. })
  109. end
  110. mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
  111. menu = mymainmenu })
  112. -- Menubar configuration
  113. menubar.utils.terminal = terminal -- Set the terminal for applications that require it
  114. -- }}}
  115. -- Keyboard map indicator and switcher
  116. mykeyboardlayout = awful.widget.keyboardlayout()
  117. -- {{{ Wibar
  118. -- Create a textclock widget
  119. mytextclock = wibox.widget.textclock()
  120. -- Create a wibox for each screen and add it
  121. local taglist_buttons = gears.table.join(
  122. awful.button({ }, 1, function(t) t:view_only() end),
  123. awful.button({ modkey }, 1, function(t)
  124. if client.focus then
  125. client.focus:move_to_tag(t)
  126. end
  127. end),
  128. awful.button({ }, 3, awful.tag.viewtoggle),
  129. awful.button({ modkey }, 3, function(t)
  130. if client.focus then
  131. client.focus:toggle_tag(t)
  132. end
  133. end),
  134. awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
  135. awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
  136. )
  137. local tasklist_buttons = gears.table.join(
  138. awful.button({ }, 1, function (c)
  139. if c == client.focus then
  140. c.minimized = true
  141. else
  142. c:emit_signal(
  143. "request::activate",
  144. "tasklist",
  145. {raise = true}
  146. )
  147. end
  148. end),
  149. awful.button({ }, 3, function()
  150. awful.menu.client_list({ theme = { width = 250 } })
  151. end),
  152. awful.button({ }, 4, function ()
  153. awful.client.focus.byidx(1)
  154. end),
  155. awful.button({ }, 5, function ()
  156. awful.client.focus.byidx(-1)
  157. end))
  158. awful.screen.connect_for_each_screen(function(s)
  159. -- Each screen has its own tag table.
  160. awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
  161. -- Create a promptbox for each screen
  162. s.mypromptbox = awful.widget.prompt()
  163. -- Create an imagebox widget which will contain an icon indicating which layout we're using.
  164. -- We need one layoutbox per screen.
  165. s.mylayoutbox = awful.widget.layoutbox(s)
  166. s.mylayoutbox:buttons(gears.table.join(
  167. awful.button({ }, 1, function () awful.layout.inc( 1) end),
  168. awful.button({ }, 3, function () awful.layout.inc(-1) end),
  169. awful.button({ }, 4, function () awful.layout.inc( 1) end),
  170. awful.button({ }, 5, function () awful.layout.inc(-1) end)))
  171. -- Create a taglist widget
  172. s.mytaglist = awful.widget.taglist {
  173. screen = s,
  174. filter = awful.widget.taglist.filter.all,
  175. buttons = taglist_buttons
  176. }
  177. -- Create a tasklist widget
  178. s.mytasklist = awful.widget.tasklist {
  179. screen = s,
  180. filter = awful.widget.tasklist.filter.currenttags,
  181. buttons = tasklist_buttons
  182. }
  183. -- Create the wibox
  184. s.mywibox = awful.wibar({ position = "top", screen = s })
  185. -- Add widgets to the wibox
  186. s.mywibox:setup {
  187. layout = wibox.layout.align.horizontal,
  188. { -- Left widgets
  189. layout = wibox.layout.fixed.horizontal,
  190. mylauncher,
  191. s.mytaglist,
  192. s.mypromptbox,
  193. },
  194. s.mytasklist, -- Middle widget
  195. { -- Right widgets
  196. layout = wibox.layout.fixed.horizontal,
  197. mykeyboardlayout,
  198. wibox.widget.systray(),
  199. mytextclock,
  200. s.mylayoutbox,
  201. },
  202. }
  203. end)
  204. -- }}}
  205. -- {{{ Mouse bindings
  206. root.buttons(gears.table.join(
  207. awful.button({ }, 3, function () mymainmenu:toggle() end),
  208. awful.button({ }, 4, awful.tag.viewnext),
  209. awful.button({ }, 5, awful.tag.viewprev)
  210. ))
  211. -- }}}
  212. -- -- {{{ Key bindings
  213. -- globalkeys = gears.table.join(
  214. -- awful.key({ modkey, }, "s", hotkeys_popup.show_help,
  215. -- {description="show help", group="awesome"}),
  216. -- awful.key({ modkey, }, "Left", awful.tag.viewprev,
  217. -- {description = "view previous", group = "tag"}),
  218. -- awful.key({ modkey, }, "Right", awful.tag.viewnext,
  219. -- {description = "view next", group = "tag"}),
  220. -- awful.key({ modkey, }, "Escape", awful.tag.history.restore,
  221. -- {description = "go back", group = "tag"}),
  222. -- awful.key({ modkey, }, "j",
  223. -- function ()
  224. -- awful.client.focus.byidx( 1)
  225. -- end,
  226. -- {description = "focus next by index", group = "client"}
  227. -- ),
  228. -- awful.key({ modkey, }, "k",
  229. -- function ()
  230. -- awful.client.focus.byidx(-1)
  231. -- end,
  232. -- {description = "focus previous by index", group = "client"}
  233. -- ),
  234. -- awful.key({ modkey, }, "w", function () mymainmenu:show() end,
  235. -- {description = "show main menu", group = "awesome"}),
  236. -- -- Layout manipulation
  237. -- awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
  238. -- {description = "swap with next client by index", group = "client"}),
  239. -- awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
  240. -- {description = "swap with previous client by index", group = "client"}),
  241. -- awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
  242. -- {description = "focus the next screen", group = "screen"}),
  243. -- awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
  244. -- {description = "focus the previous screen", group = "screen"}),
  245. -- awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
  246. -- {description = "jump to urgent client", group = "client"}),
  247. -- awful.key({ modkey, }, "Tab",
  248. -- function ()
  249. -- awful.client.focus.history.previous()
  250. -- if client.focus then
  251. -- client.focus:raise()
  252. -- end
  253. -- end,
  254. -- {description = "go back", group = "client"}),
  255. -- -- Standard program
  256. -- awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
  257. -- {description = "open a terminal", group = "launcher"}),
  258. -- awful.key({ modkey, "Control" }, "r", awesome.restart,
  259. -- {description = "reload awesome", group = "awesome"}),
  260. -- awful.key({ modkey, "Shift" }, "q", awesome.quit,
  261. -- {description = "quit awesome", group = "awesome"}),
  262. -- awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
  263. -- {description = "increase master width factor", group = "layout"}),
  264. -- awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
  265. -- {description = "decrease master width factor", group = "layout"}),
  266. -- awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
  267. -- {description = "increase the number of master clients", group = "layout"}),
  268. -- awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
  269. -- {description = "decrease the number of master clients", group = "layout"}),
  270. -- awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
  271. -- {description = "increase the number of columns", group = "layout"}),
  272. -- awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
  273. -- {description = "decrease the number of columns", group = "layout"}),
  274. -- awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
  275. -- {description = "select next", group = "layout"}),
  276. -- awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
  277. -- {description = "select previous", group = "layout"}),
  278. -- awful.key({ modkey, "Control" }, "n",
  279. -- function ()
  280. -- local c = awful.client.restore()
  281. -- -- Focus restored client
  282. -- if c then
  283. -- c:emit_signal(
  284. -- "request::activate", "key.unminimize", {raise = true}
  285. -- )
  286. -- end
  287. -- end,
  288. -- {description = "restore minimized", group = "client"}),
  289. -- -- Prompt
  290. -- awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
  291. -- {description = "run prompt", group = "launcher"}),
  292. -- awful.key({ modkey }, "x",
  293. -- function ()
  294. -- awful.prompt.run {
  295. -- prompt = "Run Lua code: ",
  296. -- textbox = awful.screen.focused().mypromptbox.widget,
  297. -- exe_callback = awful.util.eval,
  298. -- history_path = awful.util.get_cache_dir() .. "/history_eval"
  299. -- }
  300. -- end,
  301. -- {description = "lua execute prompt", group = "awesome"}),
  302. -- -- Menubar
  303. -- awful.key({ modkey }, "p", function() menubar.show() end,
  304. -- {description = "show the menubar", group = "launcher"})
  305. -- )
  306. -- clientkeys = gears.table.join(
  307. -- awful.key({ modkey, }, "f",
  308. -- function (c)
  309. -- c.fullscreen = not c.fullscreen
  310. -- c:raise()
  311. -- end,
  312. -- {description = "toggle fullscreen", group = "client"}),
  313. -- awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end,
  314. -- {description = "close", group = "client"}),
  315. -- awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
  316. -- {description = "toggle floating", group = "client"}),
  317. -- awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
  318. -- {description = "move to master", group = "client"}),
  319. -- awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
  320. -- {description = "move to screen", group = "client"}),
  321. -- awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
  322. -- {description = "toggle keep on top", group = "client"}),
  323. -- awful.key({ modkey, }, "n",
  324. -- function (c)
  325. -- -- The client currently has the input focus, so it cannot be
  326. -- -- minimized, since minimized clients can't have the focus.
  327. -- c.minimized = true
  328. -- end ,
  329. -- {description = "minimize", group = "client"}),
  330. -- awful.key({ modkey, }, "m",
  331. -- function (c)
  332. -- c.maximized = not c.maximized
  333. -- c:raise()
  334. -- end ,
  335. -- {description = "(un)maximize", group = "client"}),
  336. -- awful.key({ modkey, "Control" }, "m",
  337. -- function (c)
  338. -- c.maximized_vertical = not c.maximized_vertical
  339. -- c:raise()
  340. -- end ,
  341. -- {description = "(un)maximize vertically", group = "client"}),
  342. -- awful.key({ modkey, "Shift" }, "m",
  343. -- function (c)
  344. -- c.maximized_horizontal = not c.maximized_horizontal
  345. -- c:raise()
  346. -- end ,
  347. -- {description = "(un)maximize horizontally", group = "client"})
  348. -- )
  349. -- -- Bind all key numbers to tags.
  350. -- -- Be careful: we use keycodes to make it work on any keyboard layout.
  351. -- -- This should map on the top row of your keyboard, usually 1 to 9.
  352. -- for i = 1, 9 do
  353. -- globalkeys = gears.table.join(globalkeys,
  354. -- -- View tag only.
  355. -- awful.key({ modkey }, "#" .. i + 9,
  356. -- function ()
  357. -- local screen = awful.screen.focused()
  358. -- local tag = screen.tags[i]
  359. -- if tag then
  360. -- tag:view_only()
  361. -- end
  362. -- end,
  363. -- {description = "view tag #"..i, group = "tag"}),
  364. -- -- Toggle tag display.
  365. -- awful.key({ modkey, "Control" }, "#" .. i + 9,
  366. -- function ()
  367. -- local screen = awful.screen.focused()
  368. -- local tag = screen.tags[i]
  369. -- if tag then
  370. -- awful.tag.viewtoggle(tag)
  371. -- end
  372. -- end,
  373. -- {description = "toggle tag #" .. i, group = "tag"}),
  374. -- -- Move client to tag.
  375. -- awful.key({ modkey, "Shift" }, "#" .. i + 9,
  376. -- function ()
  377. -- if client.focus then
  378. -- local tag = client.focus.screen.tags[i]
  379. -- if tag then
  380. -- client.focus:move_to_tag(tag)
  381. -- end
  382. -- end
  383. -- end,
  384. -- {description = "move focused client to tag #"..i, group = "tag"}),
  385. -- -- Toggle tag on focused client.
  386. -- awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  387. -- function ()
  388. -- if client.focus then
  389. -- local tag = client.focus.screen.tags[i]
  390. -- if tag then
  391. -- client.focus:toggle_tag(tag)
  392. -- end
  393. -- end
  394. -- end,
  395. -- {description = "toggle focused client on tag #" .. i, group = "tag"})
  396. -- )
  397. -- end
  398. -- clientbuttons = gears.table.join(
  399. -- awful.button({ }, 1, function (c)
  400. -- c:emit_signal("request::activate", "mouse_click", {raise = true})
  401. -- end),
  402. -- awful.button({ modkey }, 1, function (c)
  403. -- c:emit_signal("request::activate", "mouse_click", {raise = true})
  404. -- awful.mouse.client.move(c)
  405. -- end),
  406. -- awful.button({ modkey }, 3, function (c)
  407. -- c:emit_signal("request::activate", "mouse_click", {raise = true})
  408. -- awful.mouse.client.resize(c)
  409. -- end)
  410. -- )
  411. -- -- Set keys
  412. -- root.keys(globalkeys)
  413. -- -- }}}
  414. globalkeys = gears.table.join(
  415. awful.key({ modkey, }, "/", hotkeys_popup.show_help,
  416. {description="show help", group="awesome"}),
  417. awful.key({ modkey, }, "Left", awful.tag.viewprev,
  418. {description = "view previous", group = "tag"}),
  419. awful.key({ modkey, }, "Right", awful.tag.viewnext,
  420. {description = "view next", group = "tag"}),
  421. awful.key({ modkey, }, "Escape", awful.tag.history.restore,
  422. {description = "go back", group = "tag"}),
  423. awful.key({ modkey, }, "j",
  424. function ()
  425. awful.client.focus.byidx( 1)
  426. end,
  427. {description = "focus next by index", group = "client"}
  428. ),
  429. awful.key({ modkey, }, "k",
  430. function ()
  431. awful.client.focus.byidx(-1)
  432. end,
  433. {description = "focus previous by index", group = "client"}
  434. ),
  435. awful.key({ modkey, }, "w", function () mymainmenu:show() end,
  436. {description = "show main menu", group = "awesome"}),
  437. awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
  438. {description = "swap with next client by index", group = "client"}),
  439. awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
  440. {description = "swap with previous client by index", group = "client"}),
  441. awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
  442. {description = "focus the next screen", group = "screen"}),
  443. awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
  444. {description = "focus the previous screen", group = "screen"}),
  445. awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
  446. {description = "jump to urgent client", group = "client"}),
  447. awful.key({ modkey, }, "Tab",
  448. function ()
  449. awful.client.focus.history.previous()
  450. if client.focus then
  451. client.focus:raise()
  452. end
  453. end,
  454. {description = "go back", group = "client"}),
  455. awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal) end,
  456. {description = "open a terminal", group = "launcher"}),
  457. awful.key({ modkey, "Shift" }, "r", awesome.restart,
  458. {description = "reload awesome", group = "awesome"}),
  459. awful.key({ modkey, "Shift" }, "q", awesome.quit,
  460. {description = "quit awesome", group = "awesome"}),
  461. awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
  462. {description = "increase master width factor", group = "layout"}),
  463. awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
  464. {description = "decrease master width factor", group = "layout"}),
  465. awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
  466. {description = "increase the number of master clients", group = "layout"}),
  467. awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
  468. {description = "decrease the number of master clients", group = "layout"}),
  469. awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
  470. {description = "increase the number of columns", group = "layout"}),
  471. awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
  472. {description = "decrease the number of columns", group = "layout"}),
  473. awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
  474. {description = "select next", group = "layout"}),
  475. awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
  476. {description = "select previous", group = "layout"}),
  477. awful.key({ altkey, "Control" }, "a", function () awful.util.spawn( terminal.." -e pulsemixer" ) end,
  478. {description = "ncpamixer" , group = "terminal apps" }),
  479. awful.key({ altkey, "Control" }, "d", function () awful.util.spawn( terminal.." -e stig" ) end,
  480. {description = "torrents" , group = "terminal apps" }),
  481. awful.key({ altkey, "Control" }, "t", function () awful.util.spawn( terminal.." -e tmux-session.sh" ) end,
  482. {description = "tmux session" , group = "terminal apps" }),
  483. awful.key({ }, "Print", function () os.execute("screenshot.sh fullscreen") end,
  484. {description = "screenshot" , group = "terminal apps" }),
  485. awful.key({ altkey, "Control" }, "m", function () os.execute("screenshot.sh fullscreen") end,
  486. {description = "screenshot" , group = "terminal apps" }),
  487. awful.key({ altkey, "Control" }, "f", function () os.execute("screenshot.sh focused") end,
  488. {description = "screenshot" , group = "terminal apps" }),
  489. awful.key({ altkey, "Control" }, "s", function () os.execute("screenshot.sh selection") end,
  490. {description = "screenshot" , group = "terminal apps" }),
  491. awful.key({ altkey, "Control" }, "u", function () os.execute("screenshot.sh selection upload") end,
  492. {description = "screenshot" , group = "terminal apps" }),
  493. awful.key({ altkey, "Control" }, "c", function () os.execute("screenshot.sh clipboard") end,
  494. {description = "screenshot" , group = "terminal apps" }),
  495. awful.key({ altkey, "Control" }, "1", function () os.execute("screenshot.sh 16x9") end,
  496. {description = "screenshot" , group = "terminal apps" }),
  497. awful.key({ altkey, "Control" }, "4", function () os.execute("screenshot.sh 4x3") end,
  498. {description = "screenshot" , group = "terminal apps" }),
  499. awful.key({ altkey, "Shift" }, "e", function () awful.util.spawn( editorgui ) end,
  500. {description = "gui text editor" , group = "gui apps" }),
  501. awful.key({ altkey, "Shift" }, "t", function () awful.util.spawn( "./Documents/ts3/ts3client_runscript.sh" ) end,
  502. {description = "gui text editor" , group = "gui apps" }),
  503. awful.key({ altkey, "Shift" }, "f", function () awful.util.spawn( filemanager ) end,
  504. {description = "file manager" , group = "gui apps" }),
  505. awful.key({ altkey, "Shift" }, "b", function () awful.util.spawn( browser1 ) end,
  506. {description = "palemoon web browser" , group = "gui apps" }),
  507. awful.key({ altkey, "Shift" }, "v", function () awful.util.spawn( browser2 ) end,
  508. {description = "luakit web browser" , group = "gui apps" }),
  509. awful.key({ altkey, "Shift" }, "g", function () awful.util.spawn( "steam" ) end,
  510. {description = "games" , group = "gui apps" }),
  511. awful.key({ altkey, "Shift" }, "y", function () awful.util.spawn( "freetube" ) end,
  512. {description = "youtube client" , group = "gui apps" }),
  513. awful.key({ altkey, "Shift" }, "a", function () awful.util.spawn( "pavucontrol" ) end,
  514. {description = "audio settings" , group = "gui apps" }),
  515. awful.key({ altkey, }, "n", function () awful.util.spawn( "nitrogen --set-zoom-fill --random" ) end,
  516. {description = "ncpamixer" , group = "signal" }),
  517. awful.key({ altkey, }, "s", function () awful.util.spawn( "redshift -b 0.95 -O 5000K" ) end,
  518. {description = "set night mode" , group = "signal" }),
  519. awful.key({ altkey, }, "r", function () awful.util.spawn( "redshift -x" ) end,
  520. {description = "reset night mode" , group = "signal" }),
  521. awful.key({ altkey, }, "p", function () awful.util.spawn( "rofi -show drun -show-icons -sidebar-mode" ) end,
  522. {description = "reset night mode" , group = "signal" }),
  523. awful.key({ altkey, }, "F2", function () awful.util.spawn( "cmus-remote -v -2%" ) end,
  524. {description = "decrease song volume" , group = "music control" }),
  525. awful.key({ altkey, }, "F3", function () awful.util.spawn( "cmus-remote -v +2%" ) end,
  526. {description = "increase song volume" , group = "music control" }),
  527. awful.key({ }, "XF86AudioLowerVolume", function () os.execute("pactl set-sink-volume @DEFAULT_SINK@ -5%") end,
  528. {description = "audio", group = "function keys"}),
  529. awful.key({ }, "XF86AudioRaiseVolume", function () os.execute("pactl set-sink-volume @DEFAULT_SINK@ +1%") end,
  530. {description = "audio", group = "function keys"}),
  531. awful.key({ }, "XF86AudioMute", function () os.execute("pactl set-sink-mute @DEFAULT_SINK@ toggle") end,
  532. {description = "audio", group = "function keys"}),
  533. awful.key({ }, "XF86AudioMicMute", function () os.execute("pactl set-source-mute @DEFAULT_SINK@ toggle") end,
  534. {description = "audio", group = "function keys"}),
  535. awful.key({ }, "XF86Tools", function () os.execute("cmus-notify.sh") end,
  536. {description = "show coverart of song" , group = "music control" }),
  537. awful.key({ }, "XF86AudioStop", function () os.execute("cmus-remote -s") end,
  538. {description = "stop cmus" , group = "music control" }),
  539. awful.key({ }, "XF86AudioPrev", function () os.execute("cmus-remote -s") end,
  540. {description = "prev song" , group = "music control" }),
  541. awful.key({ }, "XF86AudioPlay", function () os.execute("cmus-remote -u") end,
  542. {description = "play/pause song" , group = "music control" }),
  543. awful.key({ }, "XF86AudioNext", function () os.execute("cmus-remote -n") end,
  544. {description = "next song" , group = "music control" }),
  545. awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 1") end,
  546. {description = "+1%", group = "function keys"}),
  547. awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 2") end,
  548. {description = "-2%", group = "function keys"}),
  549. awful.key({ }, "XF86Mail", function () awful.util.spawn(terminal .. " -e aerc") end,
  550. {description = "mail", group = "function keys"}),
  551. awful.key({ }, "XF86HomePage", function () awful.util.spawn("rox") end,
  552. {description = "file manager", group = "function keys"}),
  553. awful.key({ }, "XF86Explorer", function () awful.util.spawn(terminal .. " -e btop") end,
  554. {description = "process manager", group = "function keys"}),
  555. awful.key({ }, "XF86Calculator", function () awful.util.spawn("rofi -show calc -modi 'calc:qalc +u8 -nocurrencies'") end,
  556. {description = "rofi calculator", group = "function keys"}),
  557. awful.key({ modkey, "Control" }, "n",
  558. function ()
  559. local c = awful.client.restore()
  560. -- Focus restored client
  561. if c then
  562. c:emit_signal(
  563. "request::activate", "key.unminimize", {raise = true}
  564. )
  565. end
  566. end,
  567. {description = "restore minimized", group = "client"}),
  568. -- Prompt
  569. awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
  570. {description = "run prompt", group = "launcher"}),
  571. awful.key({ modkey }, "x",
  572. function ()
  573. awful.prompt.run {
  574. prompt = "Run Lua code: ",
  575. textbox = awful.screen.focused().mypromptbox.widget,
  576. exe_callback = awful.util.eval,
  577. history_path = awful.util.get_cache_dir() .. "/history_eval"
  578. }
  579. end,
  580. {description = "lua execute prompt", group = "awesome"}),
  581. -- Menubar
  582. awful.key({ modkey }, "p", function() menubar.show() end,
  583. {description = "show the menubar", group = "launcher"})
  584. )
  585. clientkeys = gears.table.join(
  586. awful.key({ modkey, }, "f",
  587. function (c)
  588. c.fullscreen = not c.fullscreen
  589. c:raise()
  590. end,
  591. {description = "toggle fullscreen", group = "client"}),
  592. awful.key({ modkey, }, "q", function (c) c:kill() end,
  593. {description = "close", group = "client"}),
  594. awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
  595. {description = "toggle floating", group = "client"}),
  596. awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
  597. {description = "move to master", group = "client"}),
  598. awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
  599. {description = "move to screen", group = "client"}),
  600. awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
  601. {description = "toggle keep on top", group = "client"}),
  602. awful.key({ modkey, }, "n",
  603. function (c)
  604. -- The client currently has the input focus, so it cannot be
  605. -- minimized, since minimized clients can't have the focus.
  606. c.minimized = true
  607. end ,
  608. {description = "minimize", group = "client"}),
  609. awful.key({ modkey, }, "m",
  610. function (c)
  611. c.maximized = not c.maximized
  612. c:raise()
  613. end ,
  614. {description = "(un)maximize", group = "client"}),
  615. awful.key({ modkey, "Control" }, "m",
  616. function (c)
  617. c.maximized_vertical = not c.maximized_vertical
  618. c:raise()
  619. end ,
  620. {description = "(un)maximize vertically", group = "client"}),
  621. awful.key({ modkey, "Shift" }, "m",
  622. function (c)
  623. c.maximized_horizontal = not c.maximized_horizontal
  624. c:raise()
  625. end ,
  626. {description = "(un)maximize horizontally", group = "client"})
  627. )
  628. -- Bind all key numbers to tags.
  629. -- Be careful: we use keycodes to make it work on any keyboard layout.
  630. -- This should map on the top row of your keyboard, usually 1 to 9.
  631. for i = 1, 9 do
  632. globalkeys = gears.table.join(globalkeys,
  633. -- View tag only.
  634. awful.key({ modkey }, "#" .. i + 9,
  635. function ()
  636. local screen = awful.screen.focused()
  637. local tag = screen.tags[i]
  638. if tag then
  639. tag:view_only()
  640. end
  641. end,
  642. {description = "view tag #"..i, group = "tag"}),
  643. -- Toggle tag display.
  644. awful.key({ modkey, "Control" }, "#" .. i + 9,
  645. function ()
  646. local screen = awful.screen.focused()
  647. local tag = screen.tags[i]
  648. if tag then
  649. awful.tag.viewtoggle(tag)
  650. end
  651. end,
  652. {description = "toggle tag #" .. i, group = "tag"}),
  653. -- Move client to tag.
  654. awful.key({ modkey, "Shift" }, "#" .. i + 9,
  655. function ()
  656. if client.focus then
  657. local tag = client.focus.screen.tags[i]
  658. if tag then
  659. client.focus:move_to_tag(tag)
  660. end
  661. end
  662. end,
  663. {description = "move focused client to tag #"..i, group = "tag"}),
  664. -- Toggle tag on focused client.
  665. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  666. function ()
  667. if client.focus then
  668. local tag = client.focus.screen.tags[i]
  669. if tag then
  670. client.focus:toggle_tag(tag)
  671. end
  672. end
  673. end,
  674. {description = "toggle focused client on tag #" .. i, group = "tag"})
  675. )
  676. end
  677. clientbuttons = gears.table.join(
  678. awful.button({ }, 1, function (c)
  679. c:emit_signal("request::activate", "mouse_click", {raise = true})
  680. end),
  681. awful.button({ modkey }, 1, function (c)
  682. c:emit_signal("request::activate", "mouse_click", {raise = true})
  683. awful.mouse.client.move(c)
  684. end),
  685. awful.button({ modkey }, 3, function (c)
  686. c:emit_signal("request::activate", "mouse_click", {raise = true})
  687. awful.mouse.client.resize(c)
  688. end)
  689. )
  690. -- Set keys
  691. root.keys(globalkeys)
  692. -- {{{ Rules
  693. -- Rules to apply to new clients (through the "manage" signal).
  694. awful.rules.rules = {
  695. -- All clients will match this rule.
  696. { rule = { },
  697. properties = { border_width = beautiful.border_width,
  698. border_color = beautiful.border_normal,
  699. focus = awful.client.focus.filter,
  700. raise = true,
  701. keys = clientkeys,
  702. buttons = clientbuttons,
  703. screen = awful.screen.preferred,
  704. placement = awful.placement.no_overlap+awful.placement.no_offscreen
  705. }
  706. },
  707. -- Floating clients.
  708. { rule_any = {
  709. instance = {
  710. "DTA", -- Firefox addon DownThemAll.
  711. "copyq", -- Includes session name in class.
  712. "pinentry",
  713. },
  714. class = {
  715. "Arandr",
  716. "Blueman-manager",
  717. "Gpick",
  718. "Kruler",
  719. "MessageWin", -- kalarm.
  720. "Sxiv",
  721. "Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
  722. "Wpa_gui",
  723. "veromix",
  724. "xtightvncviewer",
  725. "Rox",
  726. "Rox-Filer",
  727. "Qalculate-gtk",
  728. "Lxappearance",
  729. "Pavucontrol",
  730. "Quodlibet",
  731. "Leafpad",
  732. "Xarchiver",
  733. "Steam",
  734. "SimpleScreenrecorder"},
  735. -- Note that the name property shown in xprop might be set slightly after creation of the client
  736. -- and the name shown there might not match defined rules here.
  737. name = {
  738. "Event Tester", -- xev.
  739. "ImageMagick",
  740. -- "Steam - News",
  741. -- "Friends List",
  742. },
  743. role = {
  744. "AlarmWindow", -- Thunderbird's calendar.
  745. "ConfigManager", -- Thunderbird's about:config.
  746. "pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
  747. "task_dialog",
  748. "About",
  749. }
  750. }, properties = { floating = true }},
  751. -- Add titlebars to normal clients and dialogs
  752. { rule_any = {type = { "normal", "dialog" }
  753. }, properties = { titlebars_enabled = true }
  754. },
  755. -- Set Firefox to always map on the tag named "2" on screen 1.
  756. -- { rule = { class = "Firefox" },
  757. -- properties = { screen = 1, tag = "2" } },
  758. -- TAG 2
  759. { rule = { class = "Microsoft*" },
  760. properties = { screen = 1, tag = "2" } },
  761. -- TAG 4
  762. { rule = { class = "Pale moon" },
  763. properties = { screen = 1, tag = "4" } },
  764. { rule = { class = "Luakit" },
  765. properties = { screen = 1, tag = "4" } },
  766. { rule = { class = "LibreWolf" },
  767. properties = { screen = 1, tag = "4" } },
  768. -- { rule = { class = "qutebrowser" },
  769. -- properties = { screen = 1, tag = "4" } },
  770. -- TAG 7
  771. { rule = { class = "Steam" },
  772. properties = { screen = 1, tag = "7" } },
  773. { rule = { class = "Lutris" },
  774. properties = { screen = 1, tag = "7" } },
  775. -- TAG 8
  776. { rule = { class = "TeamSpeak 3" },
  777. properties = { screen = 1, tag = "8" } },
  778. { rule = { class = "discord" },
  779. properties = { screen = 1, tag = "8" } },
  780. -- -- Set applications to be maximized at startup.
  781. -- -- find class or role via xprop command
  782. -- { rule = { class = editorgui },
  783. -- properties = { maximized = true } },
  784. { rule = { class = "Gimp*", role = "gimp-image-window" },
  785. properties = { maximized = true } },
  786. -- { rule = { class = "inkscape" },
  787. -- properties = { maximized = true } },
  788. -- { rule = { class = mediaplayer },
  789. -- properties = { maximized = true } },
  790. }
  791. -- }}}
  792. -- {{{ Signals
  793. -- Signal function to execute when a new client appears.
  794. client.connect_signal("manage", function (c)
  795. -- Set the windows at the slave,
  796. -- i.e. put it at the end of others instead of setting it master.
  797. -- if not awesome.startup then awful.client.setslave(c) end
  798. if awesome.startup
  799. and not c.size_hints.user_position
  800. and not c.size_hints.program_position then
  801. -- Prevent clients from being unreachable after screen count changes.
  802. awful.placement.no_offscreen(c)
  803. end
  804. end)
  805. -- Add a titlebar if titlebars_enabled is set to true in the rules.
  806. client.connect_signal("request::titlebars", function(c)
  807. -- buttons for the titlebar
  808. local buttons = gears.table.join(
  809. awful.button({ }, 1, function()
  810. c:emit_signal("request::activate", "titlebar", {raise = true})
  811. awful.mouse.client.move(c)
  812. end),
  813. awful.button({ }, 3, function()
  814. c:emit_signal("request::activate", "titlebar", {raise = true})
  815. awful.mouse.client.resize(c)
  816. end)
  817. )
  818. awful.titlebar(c) : setup {
  819. { -- Left
  820. awful.titlebar.widget.iconwidget(c),
  821. buttons = buttons,
  822. layout = wibox.layout.fixed.horizontal
  823. },
  824. { -- Middle
  825. { -- Title
  826. align = "center",
  827. widget = awful.titlebar.widget.titlewidget(c)
  828. },
  829. buttons = buttons,
  830. layout = wibox.layout.flex.horizontal
  831. },
  832. { -- Right
  833. awful.titlebar.widget.floatingbutton (c),
  834. awful.titlebar.widget.maximizedbutton(c),
  835. awful.titlebar.widget.stickybutton (c),
  836. awful.titlebar.widget.ontopbutton (c),
  837. awful.titlebar.widget.closebutton (c),
  838. layout = wibox.layout.fixed.horizontal()
  839. },
  840. layout = wibox.layout.align.horizontal
  841. }
  842. end)
  843. -- Enable sloppy focus, so that focus follows mouse.
  844. client.connect_signal("mouse::enter", function(c)
  845. c:emit_signal("request::activate", "mouse_enter", {raise = false})
  846. end)
  847. client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
  848. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  849. -- }}}
  850. awful.spawn.with_shell("autostart.sh")
  851. awful.spawn.with_shell("tmux-session.sh")
  852. awful.spawn.with_shell("downloader.sh")