Advertisement
Phydoux

AwesomeWM Errors rc.lua

Jan 28th, 2022
752
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Edited By Phydoux
  2.  
  3. -- Changelog
  4. --07/21/2020 - Changed Termite as my default terminal (line 109)
  5. --03/01/2021 - Changed Tagname Entry from $tocks to Game (Line 117)
  6. --05/14/2021 - Changed tagname 6-Docs to 6-Office (Line 117)
  7. --05/21/2021 - Added commented out terminal lines to easily change between terminals (Lines 111-114)
  8. --06/02/2021 - Changed Control C to close applications (Line 573)
  9. --01/13/2022 - Added Autorun Processes (Line 894)
  10.  
  11. -- {{{  libraries
  12.  
  13. local awesome, client, mouse, screen, tag = awesome, client, mouse, screen, tag
  14. local ipairs, string, os, table, tostring, tonumber, type = ipairs, string, os, table, tostring, tonumber, type
  15.  
  16. --https://awesomewm.org/doc/api/documentation/05-awesomerc.md.html
  17. -- Standard awesome library
  18. local gears         = require("gears") --Utilities such as color parsing and objects
  19. local awful         = require("awful") --Everything related to window managment
  20.                       require("awful.autofocus")
  21. -- Widget and layout library
  22. local wibox         = require("wibox")
  23.  
  24. -- Theme handling library
  25. local beautiful     = require("beautiful")
  26.  
  27. -- Notification library
  28. local naughty       = require("naughty")
  29. naughty.config.defaults['icon_size'] = 100
  30.  
  31. --local menubar       = require("menubar")
  32.  
  33. local lain          = require("lain")
  34. local freedesktop   = require("freedesktop")
  35.  
  36. -- Enable hotkeys help widget for VIM and other apps
  37. -- when client with a matching name is opened:
  38. local hotkeys_popup = require("awful.hotkeys_popup").widget
  39.                       require("awful.hotkeys_popup.keys")
  40. local my_table      = awful.util.table or gears.table -- 4.{0,1} compatibility
  41. -- }}}
  42.  
  43. -- {{{ Error handling
  44. -- Check if awesome encountered an error during startup and fell back to
  45. -- another config (This code will only ever execute for the fallback config)
  46. if awesome.startup_errors then
  47.     naughty.notify({ preset = naughty.config.presets.critical,
  48.                      title = "Oops, there were errors during startup!",
  49.                      text = awesome.startup_errors })
  50. end
  51.  
  52. -- Handle runtime errors after startup
  53. do
  54.     local in_error = false
  55.     awesome.connect_signal("debug::error", function (err)
  56.         -- Make sure we don't go into an endless error loop
  57.         if in_error then return end
  58.         in_error = true
  59.  
  60.         naughty.notify({ preset = naughty.config.presets.critical,
  61.                          title = "Oops, an error happened!",
  62.                          text = tostring(err) })
  63.         in_error = false
  64.     end)
  65. end
  66. -- }}}
  67.  
  68.  
  69.  
  70. -- {{{ Autostart windowless processes
  71. local function run_once(cmd_arr)
  72.     for _, cmd in ipairs(cmd_arr) do
  73.         awful.spawn.with_shell(string.format("pgrep -u $USER -fx '%s' > /dev/null || (%s)", cmd, cmd))
  74.     end
  75. end
  76.  
  77. run_once({ "unclutter -root" }) -- entries must be comma-separated
  78. -- }}}
  79.  
  80.  
  81. -- {{{ Variable definitions
  82.  
  83. local themes = {
  84.     "powerarrow-blue", -- 1
  85.     "powerarrow",      -- 2
  86.     "multicolor",      -- 3
  87.  
  88. }
  89.  
  90. -- choose your theme here
  91. local chosen_theme = themes[3]
  92.  
  93. local theme_path = string.format("%s/.config/awesome/themes/%s/theme.lua", os.getenv("HOME"), chosen_theme)
  94. beautiful.init(theme_path)
  95.  
  96. -- modkey or mod4 = super key
  97. modkey       = "Mod4"
  98. altkey       = "Mod1"
  99. modkey1      = "Control"
  100.  
  101. -- personal variables
  102. --change these variables if you want
  103. local browser           = "firefox"
  104. --local editor            = os.getenv("EDITOR") or "vim"
  105. local editor            = "emacs"
  106. local editorgui         = "geany"
  107. local filemanager       = "pcmanfm"
  108. local mailclient        = "thunderbird"
  109. local mediaplayer       = "celluloid"
  110. --local mediaplayer       = "vlc"
  111. local virtualmachine    = "virtualbox"
  112.  
  113. --Terminals
  114. local terminal          = "terminator"
  115. --local terminal          = "termite"
  116. --local terminal          = "alacritty"
  117. --local terminal          = "kitty"
  118. --local terminal          = "~/st/st"
  119. --local terminal          = "cool-retro-term"
  120.  
  121. -- awesome variables
  122. awful.util.terminal = terminal
  123. awful.util.tagnames = { " 1-  NET ", "2- GAME ", " 3-  FILE ", " 4-  TERM ", " 5-  DEV ", " 6-  OFFICE ", " 7-  iDrac ", " 8-  PROXMOX ", " 9-  MUSIC ", " 10-  PHOTO ", " 11-  VIDEO "  }
  124.  
  125. -- Use this : https://fontawesome.com/cheatsheet
  126.  
  127. awful.layout.suit.tile.left.mirror = true
  128. awful.layout.layouts = {
  129.     awful.layout.suit.tile,
  130.     awful.layout.suit.floating,
  131.     awful.layout.suit.tile.left,
  132.     awful.layout.suit.tile.bottom,
  133.     awful.layout.suit.tile.top,
  134.     --awful.layout.suit.fair,
  135.     --awful.layout.suit.fair.horizontal,
  136.     awful.layout.suit.spiral,
  137.     awful.layout.suit.spiral.dwindle,
  138.     awful.layout.suit.max,
  139.     awful.layout.suit.max.fullscreen,
  140.     awful.layout.suit.magnifier,
  141.     --awful.layout.suit.corner.nw,
  142.     --awful.layout.suit.corner.ne,
  143.     --awful.layout.suit.corner.sw,
  144.     --awful.layout.suit.corner.se,
  145.     --lain.layout.cascade,
  146.     --lain.layout.cascade.tile,
  147.     --lain.layout.centerwork,
  148.     --lain.layout.centerwork.horizontal,
  149.     --lain.layout.termfair,
  150.     --lain.layout.termfair.center,
  151. }
  152.  
  153. awful.util.taglist_buttons = my_table.join(
  154.     awful.button({ }, 1, function(t) t:view_only() end),
  155.     awful.button({ modkey }, 1, function(t)
  156.         if client.focus then
  157.             client.focus:move_to_tag(t)
  158.         end
  159.     end),
  160.     awful.button({ }, 3, awful.tag.viewtoggle),
  161.     awful.button({ modkey }, 3, function(t)
  162.         if client.focus then
  163.             client.focus:toggle_tag(t)
  164.         end
  165.     end),
  166.     awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
  167.     awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
  168. )
  169.  
  170. awful.util.tasklist_buttons = my_table.join(
  171.     awful.button({ }, 1, function (c)
  172.         if c == client.focus then
  173.             c.minimized = true
  174.         else
  175.             c:emit_signal("request::activate", "tasklist", {raise = true})
  176.         end
  177.     end),
  178.     awful.button({ }, 3, function ()
  179.         local instance = nil
  180.  
  181.         return function ()
  182.             if instance and instance.wibox.visible then
  183.                 instance:hide()
  184.                 instance = nil
  185.             else
  186.                 instance = awful.menu.clients({theme = {width = 250}})
  187.             end
  188.         end
  189.     end),
  190.     awful.button({ }, 4, function () awful.client.focus.byidx(1) end),
  191.     awful.button({ }, 5, function () awful.client.focus.byidx(-1) end)
  192. )
  193.  
  194. lain.layout.termfair.nmaster           = 3
  195. lain.layout.termfair.ncol              = 1
  196. lain.layout.termfair.center.nmaster    = 3
  197. lain.layout.termfair.center.ncol       = 1
  198. lain.layout.cascade.tile.offset_x      = 2
  199. lain.layout.cascade.tile.offset_y      = 32
  200. lain.layout.cascade.tile.extra_padding = 5
  201. lain.layout.cascade.tile.nmaster       = 5
  202. lain.layout.cascade.tile.ncol          = 2
  203.  
  204. beautiful.init(string.format(gears.filesystem.get_configuration_dir() .. "/themes/%s/theme.lua", chosen_theme))
  205. -- }}}
  206.  
  207. -- added 8-29-2020
  208. gears.timer.start_new(10, function() collectgarbage("collect", 20000) return true end)
  209.  
  210. -- {{{ Menu
  211. local myawesomemenu = {
  212.     { "hotkeys", function() return false, hotkeys_popup.show_help end },
  213.     { "manual", terminal .. " -e 'man awesome'" },
  214.     { "edit config", terminal.." vim /home/neil/.config/awesome/rc.lua" },
  215.     { "arandr", "arandr" },
  216.     { "restart", awesome.restart },
  217. }
  218.  
  219. awful.util.mymainmenu = freedesktop.menu.build({
  220.     icon_size = beautiful.menu_height or 16,
  221.     before = {
  222.         { "Awesome", myawesomemenu, beautiful.awesome_icon },
  223.         --{ "Atom", "atom" },
  224.         -- other triads can be put here
  225.     },
  226.     after = {
  227.         { "Terminal", terminal },
  228.         { "Log out", function() awesome.quit() end },
  229.         { "Sleep", "systemctl suspend" },
  230.         { "Reboot", "systemctl reboot" },
  231.         { "Shutdown", "systemctl poweroff" },
  232.         -- other triads can be put here
  233.     }
  234. })
  235. --menubar.utils.terminal = terminal -- Set the Menubar terminal for applications that require it
  236. -- }}}
  237.  
  238. -- {{{ Screen
  239. -- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
  240. screen.connect_signal("property::geometry", function(s)
  241.     -- Wallpaper
  242.     if beautiful.wallpaper then
  243.         local wallpaper = beautiful.wallpaper
  244.         -- If wallpaper is a function, call it with the screen
  245.         if type(wallpaper) == "function" then
  246.             wallpaper = wallpaper(s)
  247.         end
  248.         gears.wallpaper.maximized(wallpaper, s, true)
  249.     end
  250. end)
  251. -- Create a wibox for each screen and add it
  252. awful.screen.connect_for_each_screen(function(s) beautiful.at_screen_connect(s) end)
  253. -- }}}
  254.  
  255. -- {{{ Mouse bindings
  256. root.buttons(my_table.join(
  257.     awful.button({ }, 3, function () awful.util.mymainmenu:toggle() end),
  258.     awful.button({ }, 4, awful.tag.viewnext),
  259.     awful.button({ }, 5, awful.tag.viewprev)
  260. ))
  261. -- }}}
  262.  
  263. -- {{{ Key bindings
  264. globalkeys = my_table.join(
  265.  
  266. -- {{{ Personal keybindings
  267.  
  268. -- Firefox
  269.     awful.key({ modkey, "Shift" }, "f", function () awful.util.spawn("firefox") end
  270. -- dmenu
  271.     awful.key({ modkey, "Shift" }, "Return",
  272.     function ()
  273.         awful.spawn(string.format("dmenu_run -i  -nb '#292d3e' -nf '#bbc5ff' -sb '#82AAFF' -sf '#292d3e' -fn 'Mononoki Nerd Font:bold:pixelsize=14'",
  274.         beautiful.bg_normal, beautiful.fg_normal, beautiful.bg_focus, beautiful.fg_focus))
  275.     end,
  276.     {description = "show dmenu", group = "hotkeys"}),
  277.  
  278.     -- My dmenu scripts (Alt+Ctrl+Key)
  279.     awful.key({ altkey, "Control" }, "e", function () awful.util.spawn( "./.dmenu/dmenu-edit-configs.sh" ) end,
  280.         {description = "edit config files" , group = "dmenu scripts" }),
  281.     awful.key({ altkey, "Control" }, "m", function () awful.util.spawn( "./.dmenu/dmenu-sysmon.sh" ) end,
  282.         {description = "system monitoring apps" , group = "dmenu scripts" }),
  283.    -- awful.key({ altkey, "Control" }, "p", function () awful.util.spawn( "passmenu" ) end,
  284.      --   {description = "passmenu" , group = "dmenu scripts" }),
  285.     awful.key({ altkey, "Control"  }, "s", function () awful.util.spawn( "./.dmenu/dmenu-surfraw.sh" ) end,
  286.         {description = "surfraw web search" , group = "dmenu scripts" }),
  287.     awful.key({ altkey, "Control"  }, "t", function () awful.util.spawn( "./.dmenu/dmenu-trading.sh" ) end,
  288.         {description = "trading programs" , group = "dmenu scripts" }),
  289.        
  290.     -- My applications (Super+Alt+Key)
  291.     awful.key({ modkey, altkey  }, "m", function () awful.util.spawn( terminal.." -e /home/neil/scripts/MuseScore.sh" ) end,
  292.         {description = "MuseScore" , group = "terminal apps" }),
  293.        
  294.     awful.key({ modkey, altkey  }, "c", function () awful.util.spawn( terminal.." -e cmus" ) end,
  295.         {description = "cmus" , group = "terminal apps" }),
  296.  
  297.     awful.key({ modkey, altkey  }, "l", function () awful.util.spawn( terminal.." -e lock" ) end,
  298.         {description = "Lock Screen" , group = "terminal apps" }),
  299.  
  300.     -- screenshots
  301.     --awful.key({ }, "Print", function () awful.util.spawn("scrot 'ArchLinux-%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f $$(xdg-user-dir PICTURES)'") end,
  302.         --{description = "Scrot", group = "screenshots"}),
  303.     --awful.key({ }, "Print", function () awful.util.spawn("scrot 'Scrot-%Y-%m-%d-%s_screenshot_$wx$h.jpg' -e 'mv $f $$(PICTURES/SCROT)'") end,
  304.     --    {description = "Scrot", group = "screenshots"}),
  305.     awful.key({ modkey1           }, "Print", function () awful.util.spawn( "gnome-screenshot --interactive" ) end,
  306.         {description = "Xfce screenshot", group = "screenshots"}),
  307.     --awful.key({ modkey1,             }, "Print", function() awful.util.spawn("gnome-screenshot -i") end,
  308.        --{description = "Gnome screenshot", group = "screenshots"}),
  309.  
  310.     -- Personal keybindings}}}
  311.  
  312.     -- Hotkeys Awesome
  313.  
  314.     awful.key({ modkey,           }, "s",      hotkeys_popup.show_help,
  315.         {description = "show help", group="awesome"}),
  316.  
  317.     -- Tag browsing with modkey
  318.     awful.key({ modkey,           }, "Left",   awful.tag.viewprev,
  319.         {description = "view previous", group = "tag"}),
  320.     awful.key({ modkey,           }, "Right",  awful.tag.viewnext,
  321.         {description = "view next", group = "tag"}),
  322.     awful.key({ altkey,           }, "Escape", awful.tag.history.restore,
  323.         {description = "go back", group = "tag"}),
  324.  
  325.      -- Tag browsing alt + tab
  326.     awful.key({ altkey,           }, "Tab",   awful.tag.viewnext,
  327.         {description = "view next", group = "tag"}),
  328.     awful.key({ altkey, "Shift"   }, "Tab",  awful.tag.viewprev,
  329.         {description = "view previous", group = "tag"}),
  330.  
  331.      -- Tag browsing modkey + tab
  332.     awful.key({ modkey,           }, "Tab",   awful.tag.viewnext,
  333.         {description = "view next", group = "tag"}),
  334.     awful.key({ modkey, "Shift"   }, "Tab",  awful.tag.viewprev,
  335.         {description = "view previous", group = "tag"}),
  336.  
  337.     -- Non-empty tag browsing
  338.     --awful.key({ modkey }, "Left", function () lain.util.tag_view_nonempty(-1) end,
  339.               --{description = "view  previous nonempty", group = "tag"}),
  340.    -- awful.key({ modkey }, "Right", function () lain.util.tag_view_nonempty(1) end,
  341.              -- {description = "view  previous nonempty", group = "tag"}),
  342.  
  343.     -- Default client focus
  344.     awful.key({ altkey,           }, "j",
  345.         function ()
  346.             awful.client.focus.byidx( 1)
  347.         end,
  348.         {description = "focus next by index", group = "client"}
  349.     ),
  350.     awful.key({ altkey,           }, "k",
  351.         function ()
  352.             awful.client.focus.byidx(-1)
  353.         end,
  354.         {description = "focus previous by index", group = "client"}
  355.     ),
  356.  
  357.     -- Bi-direction client focus
  358.     awful.key({ modkey }, "j",
  359.         function()
  360.             awful.client.focus.global_bydirection("down")
  361.             if client.focus then client.focus:raise() end
  362.         end,
  363.         {description = "focus down", group = "client"}),
  364.     awful.key({ modkey }, "k",
  365.         function()
  366.             awful.client.focus.global_bydirection("up")
  367.             if client.focus then client.focus:raise() end
  368.         end,
  369.         {description = "focus up", group = "client"}),
  370.     awful.key({ modkey }, "h",
  371.         function()
  372.             awful.client.focus.global_bydirection("left")
  373.             if client.focus then client.focus:raise() end
  374.         end,
  375.         {description = "focus left", group = "client"}),
  376.     awful.key({ modkey }, "l",
  377.         function()
  378.             awful.client.focus.global_bydirection("right")
  379.             if client.focus then client.focus:raise() end
  380.         end,
  381.         {description = "focus right", group = "client"}),
  382.  
  383.  
  384.         -- Bi-direction client focus with arrows
  385.         awful.key({ modkey1, modkey }, "Down",
  386.             function()
  387.                 awful.client.focus.global_bydirection("down")
  388.                 if client.focus then client.focus:raise() end
  389.             end,
  390.             {description = "focus down", group = "client"}),
  391.         awful.key({ modkey1, modkey }, "Up",
  392.             function()
  393.                 awful.client.focus.global_bydirection("up")
  394.                 if client.focus then client.focus:raise() end
  395.             end,
  396.             {description = "focus up", group = "client"}),
  397.         awful.key({ modkey1, modkey }, "Left",
  398.             function()
  399.                 awful.client.focus.global_bydirection("left")
  400.                 if client.focus then client.focus:raise() end
  401.             end,
  402.             {description = "focus left", group = "client"}),
  403.         awful.key({ modkey1, modkey }, "Right",
  404.             function()
  405.                 awful.client.focus.global_bydirection("right")
  406.                 if client.focus then client.focus:raise() end
  407.             end,
  408.             {description = "focus right", group = "client"}),
  409.  
  410.  
  411.  
  412.     awful.key({ modkey,           }, "w", function () awful.util.mymainmenu:show() end,
  413.               {description = "show main menu", group = "awesome"}),
  414.  
  415.     -- Layout manipulation
  416.     awful.key({ modkey, "Shift"   }, "j", function () awful.client.swap.byidx(  1)    end,
  417.               {description = "swap with next client by index", group = "client"}),
  418.     awful.key({ modkey, "Shift"   }, "k", function () awful.client.swap.byidx( -1)    end,
  419.               {description = "swap with previous client by index", group = "client"}),
  420.     awful.key({ modkey }, ".", function () awful.screen.focus_relative( 1) end,
  421.               {description = "focus the next screen", group = "screen"}),
  422.     awful.key({ modkey }, ",", function () awful.screen.focus_relative(-1) end,
  423.               {description = "focus the previous screen", group = "screen"}),
  424.     awful.key({ modkey,           }, "u", awful.client.urgent.jumpto,
  425.               {description = "jump to urgent client", group = "client"}),
  426.     awful.key({ modkey1,           }, "Tab",
  427.         function ()
  428.             awful.client.focus.history.previous()
  429.             if client.focus then
  430.                 client.focus:raise()
  431.             end
  432.         end,
  433.         {description = "go back", group = "client"}),
  434.  
  435.     -- Show/Hide Wibox
  436.     awful.key({ modkey }, "b", function ()
  437.             for s in screen do
  438.                 s.mywibox.visible = not s.mywibox.visible
  439.                 if s.mybottomwibox then
  440.                     s.mybottomwibox.visible = not s.mybottomwibox.visible
  441.                 end
  442.             end
  443.         end,
  444.         {description = "toggle wibox", group = "awesome"}),
  445.        
  446.  
  447.     -- On the fly useless gaps change
  448.     awful.key({ altkey, "Control" }, "j", function () lain.util.useless_gaps_resize(1) end,
  449.               {description = "increment useless gaps", group = "tag"}),
  450.     awful.key({ altkey, "Control" }, "l", function () lain.util.useless_gaps_resize(-1) end,
  451.               {description = "decrement useless gaps", group = "tag"}),
  452.  
  453.     -- Dynamic tagging
  454.     awful.key({ modkey, "Shift" }, "n", function () lain.util.add_tag() end,
  455.               {description = "add new tag", group = "tag"}),
  456.     awful.key({ modkey, "Control" }, "r", function () lain.util.rename_tag() end,
  457.               {description = "rename tag", group = "tag"}),
  458.     awful.key({ modkey, "Shift" }, "Left", function () lain.util.move_tag(-1) end,
  459.               {description = "move tag to the left", group = "tag"}),
  460.     awful.key({ modkey, "Shift" }, "Right", function () lain.util.move_tag(1) end,
  461.               {description = "move tag to the right", group = "tag"}),
  462.     awful.key({ modkey, "Shift" }, "d", function () lain.util.delete_tag() end,
  463.               {description = "delete tag", group = "tag"}),
  464.  
  465.     -- Standard program
  466.     awful.key({ modkey,         }, "Return", function () awful.spawn(terminal) end,
  467.               {description = terminal, group = "super"}),
  468.     awful.key({ modkey, "Shift" }, "r", awesome.restart,
  469.               {description = "reload awesome", group = "awesome"}),
  470.     awful.key({ modkey,         }, "q",  function () awful.spawn.with_shell( '~/.dmenu/prompt "are you sure?" "killall awesome"' ) end,
  471.               {description = "quit awesome", group = "awesome"}),
  472.  
  473.     awful.key({ altkey, "Shift"   }, "l",     function () awful.tag.incmwfact( 0.05)          end,
  474.               {description = "increase master width factor", group = "layout"}),
  475.     awful.key({ altkey, "Shift"   }, "h",     function () awful.tag.incmwfact(-0.05)          end,
  476.               {description = "decrease master width factor", group = "layout"}),
  477.     awful.key({ modkey, "Shift"   }, "h",     function () awful.tag.incnmaster( 1, nil, true) end,
  478.               {description = "increase the number of master clients", group = "layout"}),
  479.     awful.key({ modkey, "Shift"   }, "l",     function () awful.tag.incnmaster(-1, nil, true) end,
  480.               {description = "decrease the number of master clients", group = "layout"}),
  481.     awful.key({ modkey, "Control" }, "h",     function () awful.tag.incncol( 1, nil, true)    end,
  482.               {description = "increase the number of columns", group = "layout"}),
  483.     awful.key({ modkey, "Control" }, "l",     function () awful.tag.incncol(-1, nil, true)    end,
  484.               {description = "decrease the number of columns", group = "layout"}),
  485.     awful.key({ modkey,           }, "space", function () awful.layout.inc( 1)                end,
  486.         {description = "select next", group = "layout"}),
  487.     --awful.key({ modkey, "Control" }, "Return", function () awful.spawn(screenshot) end,
  488.               --{description = terminal, group = "super"}),
  489.     --awful.key({ modkey, "Shift"   }, "space", function () awful.layout.inc(-1)                end,
  490.              -- {description = "select previous", group = "layout"}),
  491.  
  492.     awful.key({ modkey, "Control" }, "n",
  493.               function ()
  494.                   local c = awful.client.restore()
  495.                   -- Focus restored client
  496.                   if c then
  497.                       client.focus = c
  498.                       c:raise()
  499.                   end
  500.               end,
  501.               {description = "restore minimized", group = "client"}),
  502.  
  503.     -- Dropdown application
  504.     awful.key({ modkey, }, "z", function () awful.screen.focused().quake:toggle() end,
  505.               {description = "dropdown application", group = "super"}),
  506.  
  507.     -- Widgets popups
  508.     -- awful.key({ altkey, }, "c", function () lain.widget.calendar.show(7) end,
  509.               --{description = "show calendar", group = "widgets"}),
  510.     -- awful.key({ altkey, }, "h", function () if beautiful.fs then beautiful.fs.show(7) end end,
  511.               --{description = "show filesystem", group = "widgets"}),
  512.     awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end,
  513.               {description = "show weather", group = "widgets"}),
  514.  
  515.     -- Brightness
  516.     awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end,
  517.               {description = "+10%", group = "hotkeys"}),
  518.     awful.key({ }, "XF86MonBrightnessDown", function () os.execute("xbacklight -dec 10") end,
  519.               {description = "-10%", group = "hotkeys"}),
  520.  
  521.     -- ALSA volume control
  522.     --awful.key({ modkey1 }, "Up",
  523.     awful.key({ }, "XF86AudioRaiseVolume",
  524.         function ()
  525.             os.execute(string.format("amixer -q set %s 1%%+", beautiful.volume.channel))
  526.             beautiful.volume.update()
  527.         end),
  528.     --awful.key({ modkey1 }, "Down",
  529.     awful.key({ }, "XF86AudioLowerVolume",
  530.         function ()
  531.             os.execute(string.format("amixer -q set %s 1%%-", beautiful.volume.channel))
  532.             beautiful.volume.update()
  533.         end),
  534.     awful.key({ }, "XF86AudioMute",
  535.         function ()
  536.             os.execute(string.format("amixer -q set %s toggle", beautiful.volume.togglechannel or beautiful.volume.channel))
  537.             beautiful.volume.update()
  538.         end),
  539.     awful.key({ modkey1, "Shift" }, "m",
  540.         function ()
  541.             os.execute(string.format("amixer -q set %s 100%%", beautiful.volume.channel))
  542.             beautiful.volume.update()
  543.         end),
  544.     awful.key({ modkey1, "Shift" }, "0",
  545.         function ()
  546.             os.execute(string.format("amixer -q set %s 0%%", beautiful.volume.channel))
  547.             beautiful.volume.update()
  548.         end),
  549.  
  550.     -- Copy primary to clipboard (terminals to gtk)
  551.     awful.key({ modkey }, "c", function () awful.spawn.with_shell("xsel | xsel -i -b") end,
  552.               {description = "copy terminal to gtk", group = "hotkeys"}),
  553.     -- Copy clipboard to primary (gtk to terminals)
  554.     awful.key({ modkey }, "v", function () awful.spawn.with_shell("xsel -b | xsel") end,
  555.               {description = "copy gtk to terminal", group = "hotkeys"}),
  556.  
  557.  
  558.     -- Default
  559.     --[[ Menubar
  560.  
  561.     awful.key({ modkey }, "p", function() menubar.show() end,
  562.               {description = "show the menubar", group = "super"})
  563.     --]]
  564. -- Prompt
  565.     awful.key({ modkey },            "r",     function () awful.screen.focused().mypromptbox:run() end,
  566.               {description = "run prompt", group = "launcher"}),
  567.                  
  568.     awful.key({ altkey, "Shift" }, "x",
  569.               function ()
  570.                   awful.prompt.run {
  571.                     prompt       = "Run Lua code: ",
  572.                     textbox      = awful.screen.focused().mypromptbox.widget,
  573.                     exe_callback = awful.util.eval,
  574.                     history_path = awful.util.get_cache_dir() .. "/history_eval"
  575.                   }
  576.               end,
  577.               {description = "lua execute prompt", group = "awesome"})
  578.     --]]
  579. )
  580.  
  581. clientkeys = my_table.join(
  582.     awful.key({ altkey, "Shift"   }, "m",      lain.util.magnify_client,
  583.               {description = "magnify client", group = "client"}),
  584.     awful.key({ modkey,           }, "f",
  585.         function (c)
  586.             c.fullscreen = not c.fullscreen
  587.             c:raise()
  588.         end,
  589.         {description = "toggle fullscreen", group = "client"}),
  590.     awful.key({ modkey,         }, "x",      function (c) c:kill()                         end,
  591.               {description = "close", group = "hotkeys"}),
  592.     awful.key({ modkey, "Shift" }, "space",  awful.client.floating.toggle                    ,
  593.               {description = "toggle floating", group = "client"}),
  594.     awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
  595.               {description = "move to master", group = "client"}),
  596.     awful.key({ modkey,           }, "o",      function (c) c:move_to_screen()               end,
  597.               {description = "move to screen", group = "client"}),
  598.     awful.key({ modkey,           }, "t",      function (c) c.ontop = not c.ontop            end,
  599.               {description = "toggle keep on top", group = "client"}),
  600.     awful.key({ modkey,           }, "n",
  601.         function (c)
  602.             -- The client currently has the input focus, so it cannot be
  603.             -- minimized, since minimized clients can't have the focus.
  604.             c.minimized = true
  605.         end ,
  606.         {description = "minimize", group = "client"}),
  607.     awful.key({ modkey,           }, "m",
  608.         function (c)
  609.             c.maximized = not c.maximized
  610.             c:raise()
  611.         end ,
  612.         {description = "maximize", group = "client"})
  613. )
  614.  
  615. --My Personal Keybindings
  616.  
  617. --pcmanfm
  618. awful.key({ altkey,      }, "p",      function ()
  619.     awful.spawn("Pcmanfm") end,
  620.         {description = "pcmanfm", group = "accessories"})
  621.        
  622. --Screen Grab with Screen Grabber
  623. awful.key({ modkey,  }, "/",      function ()
  624. awful.spawn("maim ~/screenshot.png") end,
  625.         {description = "maim", group = "applications"})    
  626.  
  627. -- Bind all key numbers to tags.
  628. -- Be careful: we use keycodes to make it works on any keyboard layout.
  629. -- This should map on the top row of your keyboard, usually 1 to 9.
  630. for i = 1, 12 do
  631.     -- Hack to only show tags 1 and 9 in the shortcut window (mod+s)
  632.     local descr_view, descr_toggle, descr_move, descr_toggle_focus
  633.     if i == 1 or i == 9 then
  634.         descr_view = {description = "view tag #", group = "tag"}
  635.         descr_toggle = {description = "toggle tag #", group = "tag"}
  636.         descr_move = {description = "move focused client to tag #", group = "tag"}
  637.         descr_toggle_focus = {description = "toggle focused client on tag #", group = "tag"}
  638.     end
  639.     globalkeys = my_table.join(globalkeys,
  640.         -- View tag only.
  641.         awful.key({ modkey }, "#" .. i + 9,
  642.                   function ()
  643.                         local screen = awful.screen.focused()
  644.                         local tag = screen.tags[i]
  645.                         if tag then
  646.                            tag:view_only()
  647.                         end
  648.                   end,
  649.                   descr_view),
  650.         -- Toggle tag display.
  651.         awful.key({ modkey, "Control" }, "#" .. i + 9,
  652.                   function ()
  653.                       local screen = awful.screen.focused()
  654.                       local tag = screen.tags[i]
  655.                       if tag then
  656.                          awful.tag.viewtoggle(tag)
  657.                       end
  658.                   end,
  659.                   descr_toggle),
  660.         -- Move client to tag.
  661.         awful.key({ modkey, "Shift" }, "#" .. i + 9,
  662.                   function ()
  663.                       if client.focus then
  664.                           local tag = client.focus.screen.tags[i]
  665.                           if tag then
  666.                               client.focus:move_to_tag(tag)
  667.                           end
  668.                      end
  669.                   end,
  670.                   descr_move),
  671.         -- Toggle tag on focused client.
  672.         awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  673.                   function ()
  674.                       if client.focus then
  675.                           local tag = client.focus.screen.tags[i]
  676.                           if tag then
  677.                               client.focus:toggle_tag(tag)
  678.                           end
  679.                       end
  680.                   end,
  681.                   descr_toggle_focus)
  682.     )
  683. end
  684.  
  685. clientbuttons = gears.table.join(
  686.     awful.button({ }, 1, function (c)
  687.         c:emit_signal("request::activate", "mouse_click", {raise = true})
  688.     end),
  689.     awful.button({ modkey }, 1, function (c)
  690.         c:emit_signal("request::activate", "mouse_click", {raise = true})
  691.         awful.mouse.client.move(c)
  692.     end),
  693.     awful.button({ modkey }, 3, function (c)
  694.         c:emit_signal("request::activate", "mouse_click", {raise = true})
  695.         awful.mouse.client.resize(c)
  696.     end)
  697. )
  698.  
  699. -- Set keys
  700. root.keys(globalkeys)
  701. -- }}}
  702.  
  703. -- {{{ Rules
  704. -- Rules to apply to new clients (through the "manage" signal).
  705. awful.rules.rules = {
  706.     -- All clients will match this rule.
  707.     { rule = { },
  708.       properties = { border_width = beautiful.border_width,
  709.                      border_color = beautiful.border_normal,
  710.                      focus = awful.client.focus.filter,
  711.                      raise = true,
  712.                      keys = clientkeys,
  713.                      buttons = clientbuttons,
  714.                      screen = awful.screen.preferred,
  715.                      placement = awful.placement.no_overlap+awful.placement.no_offscreen,
  716.                      size_hints_honor = false
  717.      }
  718.     },
  719. --{ rule = { instance = "Thunderbird" },
  720.   --properties = { screen = screen[1].tag[1] } }
  721.     -- Titlebars
  722.     { rule_any = { type = { "dialog", "normal" } },
  723.       properties = { titlebars_enabled = false } },
  724.  
  725.     -- Set applications to always map on the tag 1 on screen 1.
  726.     -- find class or role via xprop command
  727.     --{ rule = { class = browser1 },
  728.       --properties = { screen = 1, tag = awful.util.tagnames[1] } },
  729.  
  730.     --{ rule = { class = editorgui },
  731.         --properties = { screen = 1, tag = awful.util.tagnames[2] } },
  732.  
  733.     --{ rule = { class = "Geany" },
  734.         --properties = { screen = 1, tag = awful.util.tagnames[2] } },
  735.  
  736.     -- Set applications to always map on the tag 3 on screen 1.
  737.     --{ rule = { class = "Inkscape" },
  738.         --properties = { screen = 1, tag = awful.util.tagnames[3] } },
  739.  
  740.     -- Set applications to always map on the tag 4 on screen 1.
  741.     --{ rule = { class = "Gimp" },
  742.         --properties = { screen = 1, tag = awful.util.tagnames[4] } },
  743.  
  744.     -- Set applications to be maximized at startup.
  745.     -- find class or role via xprop command
  746.  
  747.     { rule = { class = editorgui },
  748.           properties = { maximized = true } },
  749.  
  750.     { rule = { class = "Gimp*", role = "gimp-image-window" },
  751.           properties = { maximized = true } },
  752.          
  753.     { rule = { class = "celluloid" },
  754.           properties = { maximized = true } },
  755.  
  756.     { rule = { class = "inkscape" },
  757.           properties = { maximized = true } },
  758.  
  759.     { rule = { class = mediaplayer },
  760.           properties = { maximized = true } },
  761.  
  762.     { rule = { class = "Vlc" },
  763.           properties = { maximized = true } },
  764.  
  765.     { rule = { class = "VirtualBox Manager" },
  766.           properties = { maximized = true } },
  767.  
  768.     { rule = { class = "VirtualBox Machine" },
  769.           properties = { maximized = true } },
  770.  
  771.     { rule = { class = "Xfce4-settings-manager" },
  772.           properties = { floating = false } },
  773.  
  774.     -- Floating clients.
  775.     { rule_any = {
  776.         instance = {
  777.           "DTA",  -- Firefox addon DownThemAll.
  778.           "copyq",  -- Includes session name in class.
  779.         },
  780.         class = {
  781.           "Arandr",
  782.           "Blueberry",
  783.           "Galculator",
  784.           "Gnome-font-viewer",
  785.           "Gpick",
  786.           "Imagewriter",
  787.           "Font-manager",
  788.           "Kruler",
  789.           "MessageWin",  -- kalarm.
  790.           "Oblogout",
  791.           "Peek",
  792.           "Skype",
  793.           "System-config-printer.py",
  794.           "Sxiv",
  795.           "Unetbootin.elf",
  796.           "Wpa_gui",
  797.           "pinentry",
  798.           "veromix",
  799.           "xtightvncviewer"},
  800.  
  801.         name = {
  802.           "Event Tester",  -- xev.
  803.         },
  804.         role = {
  805.           "AlarmWindow",  -- Thunderbird's calendar.
  806.           "pop-up",       -- e.g. Google Chrome's (detached) Developer Tools.
  807.           "Preferences",
  808.           "setup",
  809.         }
  810.       }, properties = { floating = true }},
  811.  
  812. }
  813. -- }}}
  814.  
  815. -- {{{ Signals
  816. -- Signal function to execute when a new client appears.
  817. client.connect_signal("manage", function (c)
  818.     -- Set the windows at the slave,
  819.     -- i.e. put it at the end of others instead of setting it master.
  820.     -- if not awesome.startup then awful.client.setslave(c) end
  821.  
  822.     if awesome.startup and
  823.       not c.size_hints.user_position
  824.       and not c.size_hints.program_position then
  825.         -- Prevent clients from being unreachable after screen count changes.
  826.         awful.placement.no_offscreen(c)
  827.     end
  828. end)
  829.  
  830. -- Add a titlebar if titlebars_enabled is set to true in the rules.
  831. client.connect_signal("request::titlebars", function(c)
  832.     -- Custom
  833.     if beautiful.titlebar_fun then
  834.         beautiful.titlebar_fun(c)
  835.         return
  836.     end
  837.  
  838.     -- Default
  839.     -- buttons for the titlebar
  840.     local buttons = my_table.join(
  841.         awful.button({ }, 1, function()
  842.             c:emit_signal("request::activate", "titlebar", {raise = true})
  843.             awful.mouse.client.move(c)
  844.         end),
  845.         awful.button({ }, 3, function()
  846.             c:emit_signal("request::activate", "titlebar", {raise = true})
  847.             awful.mouse.client.resize(c)
  848.         end)
  849.     )
  850.  
  851.     awful.titlebar(c, {size = 21}) : setup {
  852.         { -- Left
  853.             awful.titlebar.widget.iconwidget(c),
  854.             buttons = buttons,
  855.             layout  = wibox.layout.fixed.horizontal
  856.         },
  857.         { -- Middle
  858.             { -- Title
  859.                 align  = "center",
  860.                 widget = awful.titlebar.widget.titlewidget(c)
  861.             },
  862.             buttons = buttons,
  863.             layout  = wibox.layout.flex.horizontal
  864.         },
  865.         { -- Right
  866.             awful.titlebar.widget.floatingbutton (c),
  867.             awful.titlebar.widget.maximizedbutton(c),
  868.             awful.titlebar.widget.stickybutton   (c),
  869.             awful.titlebar.widget.ontopbutton    (c),
  870.             awful.titlebar.widget.closebutton    (c),
  871.             layout = wibox.layout.fixed.horizontal()
  872.         },
  873.         layout = wibox.layout.align.horizontal
  874.     }
  875. end)
  876.  
  877. -- Enable sloppy focus, so that focus follows mouse.
  878. --client.connect_signal("mouse::enter", function(c)
  879. --    c:emit_signal("request::activate", "mouse_enter", {raise = true})
  880. --end)
  881.  
  882. -- No border for maximized clients
  883. function border_adjust(c)
  884.     if c.maximized then -- no borders if only 1 client visible
  885.         c.border_width = 0
  886.     elseif #awful.screen.focused().clients > 1 then
  887.         c.border_width = beautiful.border_width
  888.         c.border_color = beautiful.border_focus
  889.     end
  890. end
  891.  
  892. client.connect_signal("focus", border_adjust)
  893. client.connect_signal("property::maximized", border_adjust)
  894. client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
  895.  
  896. -- }}}
  897.  
  898. -- Autorun Programs
  899. --autorun = true
  900. --autorunApps =
  901. --{
  902. --  "firefox",
  903. --  "thunderbird",
  904. --  "alacritty",
  905. --}
  906. --if autorun then
  907. --  for app = 1, #autorunApps do
  908. --      awful.util.spawn(autorunApps[app])
  909. --  end
  910. --end
  911.  
  912. -- Autostart applications
  913. awful.spawn.with_shell("/home/neil/.config/awesome/autostart.sh")
  914. --awful.spawn.with_shell("compton --config  $HOME/.config/compton/compton.conf")
  915. --awful.util.spawn_with_shell("picom")
  916.  
  917. -- Gaps
  918. beautiful.useless_gap = 4
  919. require('smart_borders'){ show_button_tooltips = true }
  920.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement