├── modules └── init.lua ├── config ├── init.lua ├── apps.lua └── vars.lua ├── bindings ├── mod.lua ├── init.lua ├── global │ ├── mouse.lua │ └── key.lua └── client │ ├── mouse.lua │ └── key.lua ├── signals ├── tag │ └── init.lua ├── init.lua ├── ruled │ └── init.lua ├── naughty │ └── init.lua ├── screen │ └── init.lua └── client │ └── init.lua ├── rc.lua ├── README.md ├── rules └── init.lua └── widgets └── init.lua /modules/init.lua: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | apps = require'config.apps', 3 | vars = require'config.vars', 4 | } 5 | -------------------------------------------------------------------------------- /bindings/mod.lua: -------------------------------------------------------------------------------- 1 | return { 2 | alt = 'Mod1', 3 | super = 'Mod4', 4 | shift = 'Shift', 5 | ctrl = 'Control', 6 | } 7 | -------------------------------------------------------------------------------- /signals/tag/init.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | 3 | local vars = require'config.vars' 4 | 5 | tag.connect_signal('request::default_layouts', function() 6 | awful.layout.append_default_layouts(vars.layouts) 7 | end) 8 | -------------------------------------------------------------------------------- /signals/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | naughty = require'signals.naughty', 3 | tag = require'signals.tag', 4 | screen = require'signals.screen', 5 | client = require'signals.client', 6 | ruled = require'signals.ruled', 7 | } 8 | -------------------------------------------------------------------------------- /config/apps.lua: -------------------------------------------------------------------------------- 1 | local _M = { 2 | terminal = os.getenv('TERMINAL') or 'xterm', 3 | editor = os.getenv('EDITOR') or 'nano', 4 | } 5 | 6 | _M.editor_cmd = _M.terminal .. ' -e ' .. _M.editor 7 | _M.manual_cmd = _M.terminal .. ' -e man awesome' 8 | 9 | return _M 10 | -------------------------------------------------------------------------------- /bindings/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | client = { 3 | key = require'bindings.client.key', 4 | mouse = require'bindings.client.mouse', 5 | }, 6 | global = { 7 | key = require'bindings.global.key', 8 | mouse = require'bindings.global.mouse', 9 | }, 10 | mod = require'bindings.mod' 11 | } 12 | 13 | -------------------------------------------------------------------------------- /signals/ruled/init.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | local ruled = require'ruled' 3 | 4 | ruled.notification.connect_signal('request::rules', function() 5 | -- All notifications will match this rule. 6 | ruled.notification.append_rule { 7 | rule = {}, 8 | properties = { 9 | screen = awful.screen.preferred, 10 | implicit_timeout = 5, 11 | } 12 | } 13 | end) 14 | -------------------------------------------------------------------------------- /rc.lua: -------------------------------------------------------------------------------- 1 | -- awesome_mode: api-level=4:screen=on 2 | 3 | -- load luarocks if installed 4 | pcall(require, 'luarocks.loader') 5 | 6 | -- load theme 7 | local beautiful = require'beautiful' 8 | local gears = require'gears' 9 | beautiful.init(gears.filesystem.get_themes_dir() .. 'default/theme.lua') 10 | 11 | -- load key and mouse bindings 12 | require'bindings' 13 | 14 | -- load rules 15 | require'rules' 16 | 17 | -- load signals 18 | require'signals' 19 | -------------------------------------------------------------------------------- /signals/naughty/init.lua: -------------------------------------------------------------------------------- 1 | local naughty = require'naughty' 2 | 3 | naughty.connect_signal('request::display_error', function(message, startup) 4 | naughty.notification{ 5 | urgency = 'critical', 6 | title = 'Oops, an error happened' .. (startup and ' during startup!' or '!'), 7 | message = message 8 | } 9 | end) 10 | 11 | naughty.connect_signal('request::display', function(n) 12 | naughty.layout.box{notification = n} 13 | end) 14 | -------------------------------------------------------------------------------- /bindings/global/mouse.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | local widgets = require'widgets' 3 | 4 | awful.mouse.append_global_mousebindings{ 5 | awful.button{ 6 | modifiers = {}, 7 | button = 3, 8 | on_press = function() widgets.mainmenu:toggle() end 9 | }, 10 | awful.button{ 11 | modifiers = {}, 12 | button = 4, 13 | on_press = awful.tag.viewprev 14 | }, 15 | awful.button{ 16 | modifiers = {}, 17 | button = 5, 18 | on_press = awful.tag.viewnext 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /config/vars.lua: -------------------------------------------------------------------------------- 1 | local _M = {} 2 | 3 | local awful = require'awful' 4 | 5 | _M.layouts = { 6 | awful.layout.suit.floating, 7 | awful.layout.suit.tile, 8 | awful.layout.suit.tile.left, 9 | awful.layout.suit.tile.bottom, 10 | awful.layout.suit.tile.top, 11 | awful.layout.suit.fair, 12 | awful.layout.suit.fair.horizontal, 13 | awful.layout.suit.spiral, 14 | awful.layout.suit.spiral.dwindle, 15 | awful.layout.suit.max, 16 | awful.layout.suit.max.fullscreen, 17 | awful.layout.suit.magnifier, 18 | awful.layout.suit.corner.nw, 19 | } 20 | 21 | _M.tags = {'1', '2', '3', '4', '5', '6', '7', '8', '9'} 22 | 23 | return _M 24 | -------------------------------------------------------------------------------- /bindings/client/mouse.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | 3 | local mod = require'bindings.mod' 4 | 5 | client.connect_signal('request::default_mousebindings', function() 6 | awful.mouse.append_client_mousebindings{ 7 | awful.button{ 8 | modifiers = {}, 9 | button = 1, 10 | on_press = function(c) c:activate{context = 'mouse_click'} end 11 | }, 12 | awful.button{ 13 | modifiers = {mod.super}, 14 | button = 1, 15 | on_press = function(c) c:activate{context = 'mouse_click', action = 'mouse_move'} end 16 | }, 17 | awful.button{ 18 | modifiers = {mod.super}, 19 | button = 3, 20 | on_press = function(c) c:activate{context = 'mouse_click', action = 'mouse_resize'} end 21 | }, 22 | } 23 | end) 24 | -------------------------------------------------------------------------------- /signals/screen/init.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | local beautiful = require'beautiful' 3 | local wibox = require'wibox' 4 | 5 | local vars = require'config.vars' 6 | local widgets = require'widgets' 7 | 8 | screen.connect_signal('request::wallpaper', function(s) 9 | awful.wallpaper{ 10 | screen = s, 11 | widget = { 12 | { 13 | image = beautiful.wallpaper, 14 | upscale = true, 15 | downscale = true, 16 | widget = wibox.widget.imagebox, 17 | }, 18 | valign = 'center', 19 | halign = 'center', 20 | tiled = false, 21 | widget = wibox.container.tile, 22 | } 23 | 24 | } 25 | end) 26 | 27 | screen.connect_signal('request::desktop_decoration', function(s) 28 | awful.tag(vars.tags, s, awful.layout.layouts[1]) 29 | s.promptbox = widgets.create_promptbox() 30 | s.layoutbox = widgets.create_layoutbox(s) 31 | s.taglist = widgets.create_taglist(s) 32 | s.tasklist = widgets.create_tasklist(s) 33 | s.wibox = widgets.create_wibox(s) 34 | end) 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Awesome AwesomeWM RC 2 | 3 | This is the default **[awesome-git](https://awesomewm.org/apidoc/)** `rc.lua`, 4 | but structured for better customization and modularity. Initially, i did 5 | it for myself, because i needed something to start with, and i decided to 6 | share because i didn't find anything similar. None of the logic was touched, 7 | but everything was reformatted to match the code style that i like. 8 | 9 | Please note that this is for **[awesome-git](https://awesomewm.org/apidoc/)** 10 | and will not work with the stable release. 11 | 12 | ## Structure 13 | 14 | The main `rc.lua` file only load the modules it was split into. 15 | Each module can have its own submodules, and they are all loaded from `init.lua`. 16 | 17 | module | description 18 | -------- | ----------- 19 | `bindings` | mouse and key bindings 20 | `config` | various variables for apps/tags etc... 21 | `modules` | third-party libraries (e.g. [bling](https://github.com/BlingCorp/bling), [lain](https://github.com/lcpz/lain)) 22 | `rules` | client rules 23 | `signals` | all signals are connected here 24 | `widgets` | all widgets are defined here 25 | 26 | The `widgets` module is now better organized in the 27 | [`widgets`](https://github.com/suconakh/awesome-awesome-rc/tree/widgets) branch. 28 | The reason for moving it to a different branch is that it is now 29 | a bit different from the default `rc.lua` logic, so I decided to 30 | move it to a different branch so as not to create confusion. 31 | 32 | Feel free to submit PRs! 33 | 34 | ## Credits 35 | 36 | [This config](https://git.linuxit.us/spider/awesome/src/commit/921c5019df6a03915e09efcb1336bbca518a4401) was used as a base. 37 | -------------------------------------------------------------------------------- /signals/client/init.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | require'awful.autofocus' 3 | local wibox = require'wibox' 4 | 5 | client.connect_signal('mouse::enter', function(c) 6 | c:activate{context = 'mouse_enter', raise = false} 7 | end) 8 | 9 | client.connect_signal('request::titlebars', function(c) 10 | -- buttons for the titlebar 11 | local buttons = { 12 | awful.button{ 13 | modifiers = {}, 14 | button = 1, 15 | on_press = function() 16 | c:activate{context = 'titlebar', action = 'mouse_move'} 17 | end 18 | }, 19 | awful.button{ 20 | modifiers = {}, 21 | button = 3, 22 | on_press = function() 23 | c:activate{context = 'titlebar', action = 'mouse_resize'} 24 | end 25 | }, 26 | } 27 | 28 | awful.titlebar(c).widget = { 29 | -- left 30 | { 31 | awful.titlebar.widget.iconwidget(c), 32 | buttons = buttons, 33 | layout = wibox.layout.fixed.horizontal, 34 | }, 35 | -- middle 36 | { 37 | -- title 38 | { 39 | align = 'center', 40 | widget = awful.titlebar.widget.titlewidget(c), 41 | }, 42 | buttons = buttons, 43 | layout = wibox.layout.flex.horizontal, 44 | }, 45 | -- right 46 | { 47 | awful.titlebar.widget.floatingbutton(c), 48 | awful.titlebar.widget.maximizedbutton(c), 49 | awful.titlebar.widget.stickybutton(c), 50 | awful.titlebar.widget.ontopbutton(c), 51 | awful.titlebar.widget.closebutton(c), 52 | layout = wibox.layout.fixed.horizontal() 53 | }, 54 | layout = wibox.layout.align.horizontal, 55 | } 56 | end) 57 | -------------------------------------------------------------------------------- /rules/init.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | local ruled = require'ruled' 3 | 4 | ruled.client.connect_signal('request::rules', function() 5 | -- All clients will match this rule. 6 | ruled.client.append_rule{ 7 | id = 'global', 8 | rule = {}, 9 | properties = { 10 | focus = awful.client.focus.filter, 11 | raise = true, 12 | screen = awful.screen.preferred, 13 | placement = awful.placement.no_overlap + awful.placement.no_offscreen 14 | } 15 | } 16 | 17 | -- Floating clients. 18 | ruled.client.append_rule{ 19 | id = 'floating', 20 | rule_any = { 21 | instance = {'copyq', 'pinentry'}, 22 | class = { 23 | 'Arandr', 24 | 'Blueman-manager', 25 | 'Gpick', 26 | 'Kruler', 27 | 'Sxiv', 28 | 'Tor Browser', 29 | 'Wpa_gui', 30 | 'veromix', 31 | 'xtightvncviewer', 32 | }, 33 | -- Note that the name property shown in xprop might be set slightly after creation of the client 34 | -- and the name shown there might not match defined rules here. 35 | name = { 36 | 'Event Tester', -- xev. 37 | }, 38 | role = { 39 | 'AlarmWindow', -- Thunderbird's calendar. 40 | 'ConfigManager', -- Thunderbird's about:config. 41 | 'pop-up', -- e.g. Google Chrome's (detached) Developer Tools. 42 | } 43 | }, 44 | properties = {floating = true} 45 | } 46 | 47 | -- Add titlebars to normal clients and dialogs 48 | ruled.client.append_rule{ 49 | id = 'titlebars', 50 | rule_any = {type = {'normal', 'dialog'}}, 51 | properties = {titlebars_enabled = true}, 52 | } 53 | 54 | -- Set Firefox to always map on the tag named '2' on screen 1. 55 | -- ruled.client.append_rule { 56 | -- rule = {class = 'Firefox'}, 57 | -- properties = {screen = 1, tag = '2'} 58 | -- } 59 | end) 60 | -------------------------------------------------------------------------------- /bindings/client/key.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | 3 | local mod = require'bindings.mod' 4 | 5 | client.connect_signal('request::default_keybindings', function() 6 | awful.keyboard.append_client_keybindings{ 7 | awful.key{ 8 | modifiers = {mod.super}, 9 | key = 'f', 10 | description = 'toggle fullscreen', 11 | group = 'client', 12 | on_press = function(c) 13 | c.fullscreen = not c.fullscreen 14 | c:raise() 15 | end, 16 | }, 17 | awful.key{ 18 | modifiers = {mod.super, mod.shift}, 19 | key = 'c', 20 | description = 'close', 21 | group = 'client', 22 | on_press = function(c) c:kill() end, 23 | }, 24 | awful.key{ 25 | modifiers = {mod.super, mod.ctrl}, 26 | key = 'space', 27 | description = 'toggle floating', 28 | group = 'client', 29 | on_press = awful.client.floating.toggle, 30 | }, 31 | awful.key{ 32 | modifiers = {mod.super, mod.ctrl}, 33 | key = 'Return', 34 | description = 'move to master', 35 | group = 'client', 36 | on_press = function(c) c:swap(awful.client.getmaster()) end, 37 | }, 38 | awful.key{ 39 | modifiers = {mod.super}, 40 | key = 'o', 41 | description = 'move to screen', 42 | group = 'client', 43 | on_press = function(c) c:move_to_screen() end, 44 | }, 45 | awful.key{ 46 | modifiers = {mod.super}, 47 | key = 't', 48 | description = 'toggle keep on top', 49 | group = 'client', 50 | on_press = function(c) c.ontop = not c.ontop end, 51 | }, 52 | awful.key{ 53 | modifiers = {mod.super}, 54 | key = 'n', 55 | description = 'minimize', 56 | group = 'client', 57 | on_press = function(c) c.minimized = true end, 58 | }, 59 | awful.key{ 60 | modifiers = {mod.super}, 61 | key = 'm', 62 | description = '(un)maximize', 63 | group = 'client', 64 | on_press = function(c) 65 | c.maximized = not c.maximized 66 | c:raise() 67 | end, 68 | }, 69 | awful.key{ 70 | modifiers = {mod.super, mod.ctrl}, 71 | key = 'm', 72 | description = '(un)maximize vertically', 73 | group = 'client', 74 | on_press = function(c) 75 | c.maximized_vertical = not c.maximized_vertical 76 | c:raise() 77 | end, 78 | }, 79 | awful.key{ 80 | modifiers = {mod.super, mod.shift}, 81 | key = 'm', 82 | description = '(un)maximize horizontally', 83 | group = 'client', 84 | on_press = function(c) 85 | c.maximized_horizontal = not c.maximized_horizontal 86 | c:raise() 87 | end, 88 | }, 89 | } 90 | end) 91 | -------------------------------------------------------------------------------- /widgets/init.lua: -------------------------------------------------------------------------------- 1 | local _M = {} 2 | 3 | local awful = require'awful' 4 | local hotkeys_popup = require'awful.hotkeys_popup' 5 | local beautiful = require'beautiful' 6 | local wibox = require'wibox' 7 | 8 | local apps = require'config.apps' 9 | local mod = require'bindings.mod' 10 | 11 | _M.awesomemenu = { 12 | {'hotkeys', function() hotkeys_popup.show_help(nil, awful.screen.focused()) end}, 13 | {'manual', apps.manual_cmd}, 14 | {'edit config', apps.editor_cmd .. ' ' .. awesome.conffile}, 15 | {'restart', awesome.restart}, 16 | {'quit', function() awesome.quit() end}, 17 | } 18 | 19 | _M.mainmenu = awful.menu{ 20 | items = { 21 | {'awesome', _M.awesomemenu, beautiful.awesome_icon}, 22 | {'open terminal', apps.terminal} 23 | } 24 | } 25 | 26 | _M.launcher = awful.widget.launcher{ 27 | image = beautiful.awesome_icon, 28 | menu = _M.mainmenu 29 | } 30 | 31 | _M.keyboardlayout = awful.widget.keyboardlayout() 32 | _M.textclock = wibox.widget.textclock() 33 | 34 | 35 | function _M.create_promptbox() return awful.widget.prompt() end 36 | 37 | function _M.create_layoutbox(s) 38 | return awful.widget.layoutbox{ 39 | screen = s, 40 | buttons = { 41 | awful.button{ 42 | modifiers = {}, 43 | button = 1, 44 | on_press = function() awful.layout.inc(1) end, 45 | }, 46 | awful.button{ 47 | modifiers = {}, 48 | button = 3, 49 | on_press = function() awful.layout.inc(-1) end, 50 | }, 51 | awful.button{ 52 | modifiers = {}, 53 | button = 4, 54 | on_press = function() awful.layout.inc(-1) end, 55 | }, 56 | awful.button{ 57 | modifiers = {}, 58 | button = 5, 59 | on_press = function() awful.layout.inc(1) end, 60 | }, 61 | } 62 | } 63 | end 64 | 65 | function _M.create_taglist(s) 66 | return awful.widget.taglist{ 67 | screen = s, 68 | filter = awful.widget.taglist.filter.all, 69 | buttons = { 70 | awful.button{ 71 | modifiers = {}, 72 | button = 1, 73 | on_press = function(t) t:view_only() end, 74 | }, 75 | awful.button{ 76 | modifiers = {mod.super}, 77 | button = 1, 78 | on_press = function(t) 79 | if client.focus then 80 | client.focus:move_to_tag(t) 81 | end 82 | end, 83 | }, 84 | awful.button{ 85 | modifiers = {}, 86 | button = 3, 87 | on_press = awful.tag.viewtoggle, 88 | }, 89 | awful.button{ 90 | modifiers = {mod.super}, 91 | button = 3, 92 | on_press = function(t) 93 | if client.focus then 94 | client.focus:toggle_tag(t) 95 | end 96 | end 97 | }, 98 | awful.button{ 99 | modifiers = {}, 100 | button = 4, 101 | on_press = function(t) awful.tag.viewprev(t.screen) end, 102 | }, 103 | awful.button{ 104 | modifiers = {}, 105 | button = 5, 106 | on_press = function(t) awful.tag.viewnext(t.screen) end, 107 | }, 108 | } 109 | } 110 | end 111 | 112 | function _M.create_tasklist(s) 113 | return awful.widget.tasklist{ 114 | screen = s, 115 | filter = awful.widget.tasklist.filter.currenttags, 116 | buttons = { 117 | awful.button{ 118 | modifiers = {}, 119 | button = 1, 120 | on_press = function(c) 121 | c:activate{context = 'tasklist', action = 'toggle_minimization'} 122 | end, 123 | }, 124 | awful.button{ 125 | modifiers = {}, 126 | button = 3, 127 | on_press = function() awful.menu.client_list{theme = {width = 250}} end 128 | }, 129 | awful.button{ 130 | modifiers = {}, 131 | button = 4, 132 | on_press = function() awful.client.focus.byidx(-1) end 133 | }, 134 | awful.button{ 135 | modifiers = {}, 136 | button = 5, 137 | on_press = function() awful.client.focus.byidx(1) end 138 | }, 139 | } 140 | } 141 | end 142 | 143 | function _M.create_wibox(s) 144 | return awful.wibar{ 145 | screen = s, 146 | position = 'top', 147 | widget = { 148 | layout = wibox.layout.align.horizontal, 149 | -- left widgets 150 | { 151 | layout = wibox.layout.fixed.horizontal, 152 | _M.launcher, 153 | s.taglist, 154 | s.promptbox, 155 | }, 156 | -- middle widgets 157 | s.tasklist, 158 | -- right widgets 159 | { 160 | layout = wibox.layout.fixed.horizontal, 161 | _M.keyboardlayout, 162 | wibox.widget.systray(), 163 | _M.textclock, 164 | s.layoutbox, 165 | } 166 | } 167 | } 168 | end 169 | 170 | return _M 171 | -------------------------------------------------------------------------------- /bindings/global/key.lua: -------------------------------------------------------------------------------- 1 | local awful = require'awful' 2 | local hotkeys_popup = require'awful.hotkeys_popup' 3 | require'awful.hotkeys_popup.keys' 4 | local menubar = require'menubar' 5 | 6 | local apps = require'config.apps' 7 | local mod = require'bindings.mod' 8 | local widgets = require'widgets' 9 | 10 | menubar.utils.terminal = apps.terminal 11 | 12 | -- general awesome keys 13 | awful.keyboard.append_global_keybindings{ 14 | awful.key{ 15 | modifiers = {mod.super}, 16 | key = 's', 17 | description = 'show help', 18 | group = 'awesome', 19 | on_press = hotkeys_popup.show_help, 20 | }, 21 | awful.key{ 22 | modifiers = {mod.super}, 23 | key = 'w', 24 | description = 'show main menu', 25 | group = 'awesome', 26 | on_press = function() widgets.mainmenu:show() end, 27 | }, 28 | awful.key{ 29 | modifiers = {mod.super, mod.ctrl}, 30 | key = 'r', 31 | description = 'reload awesome', 32 | group = 'awesome', 33 | on_press = awesome.restart, 34 | }, 35 | awful.key{ 36 | modifiers = {mod.super, mod.shift}, 37 | key = 'q', 38 | description = 'quit awesome', 39 | group = 'awesome', 40 | on_press = awesome.quit, 41 | }, 42 | awful.key{ 43 | modifiers = {mod.super}, 44 | key = 'x', 45 | description = 'lua execute prompt', 46 | group = 'awesome', 47 | on_press = function() 48 | awful.prompt.run{ 49 | prompt = 'Run Lua code: ', 50 | textbox = awful.screen.focused().promptbox.widget, 51 | exe_callback = awful.util.eval, 52 | history_path = awful.util.get_cache_dir() .. '/history_eval' 53 | } 54 | end, 55 | }, 56 | awful.key{ 57 | modifiers = {mod.super}, 58 | key = 'Return', 59 | description = 'open a terminal', 60 | group = 'launcher', 61 | on_press = function() awful.spawn(apps.terminal) end, 62 | }, 63 | awful.key{ 64 | modifiers = {mod.super}, 65 | key = 'r', 66 | description = 'run prompt', 67 | group = 'launcher', 68 | on_press = function() awful.screen.focused().promptbox:run() end, 69 | }, 70 | awful.key{ 71 | modifiers = {mod.super}, 72 | key = 'p', 73 | description = 'show the menubar', 74 | group = 'launcher', 75 | on_press = function() menubar.show() end, 76 | }, 77 | } 78 | 79 | -- tags related keybindings 80 | awful.keyboard.append_global_keybindings{ 81 | awful.key{ 82 | modifiers = {mod.super}, 83 | key = 'Left', 84 | description = 'view previous', 85 | group = 'tag', 86 | on_press = awful.tag.viewprev, 87 | }, 88 | awful.key{ 89 | modifiers = {mod.super}, 90 | key = 'Right', 91 | description = 'view next', 92 | group = 'tag', 93 | on_press = awful.tag.viewnext, 94 | }, 95 | awful.key{ 96 | modifiers = {mod.super}, 97 | key = 'Escape', 98 | description = 'go back', 99 | group = 'tag', 100 | on_press = awful.tag.history.restore, 101 | }, 102 | } 103 | 104 | -- focus related keybindings 105 | awful.keyboard.append_global_keybindings{ 106 | awful.key{ 107 | modifiers = {mod.super}, 108 | key = 'j', 109 | description = 'focus next by index', 110 | group = 'client', 111 | on_press = function() awful.client.focus.byidx(1) end, 112 | }, 113 | awful.key{ 114 | modifiers = {mod.super}, 115 | key = 'k', 116 | description = 'focus previous by index', 117 | group = 'client', 118 | on_press = function() awful.client.focus.byidx(-1) end, 119 | }, 120 | awful.key{ 121 | modifiers = {mod.super}, 122 | key = 'Tab', 123 | description = 'go back', 124 | group = 'client', 125 | on_press = function() 126 | awful.client.focus.history.previous() 127 | if client.focus then 128 | client.focus:raise() 129 | end 130 | end, 131 | }, 132 | awful.key{ 133 | modifiers = {mod.super, mod.ctrl}, 134 | key = 'j', 135 | description = 'focus the next screen', 136 | group = 'screen', 137 | on_press = function() awful.screen.focus_relative(1) end, 138 | }, 139 | awful.key{ 140 | modifiers = {mod.super, mod.ctrl}, 141 | key = 'k', 142 | description = 'focus the previous screen', 143 | group = 'screen', 144 | on_press = function() awful.screen.focus_relative(-1) end, 145 | }, 146 | awful.key{ 147 | modifiers = {mod.super, mod.ctrl}, 148 | key = 'n', 149 | description = 'restore minimized', 150 | group = 'client', 151 | on_press = function() 152 | local c = awful.client.restore() 153 | if c then 154 | c:active{raise = true, context = 'key.unminimize'} 155 | end 156 | end, 157 | }, 158 | } 159 | 160 | -- layout related keybindings 161 | awful.keyboard.append_global_keybindings{ 162 | awful.key{ 163 | modifiers = {mod.super, mod.shift}, 164 | key = 'j', 165 | description = 'swap with next client by index', 166 | group = 'client', 167 | on_press = function() awful.client.swap.byidx(1) end, 168 | }, 169 | awful.key{ 170 | modifiers = {mod.super, mod.shift}, 171 | key = 'k', 172 | description = 'swap with previous client by index', 173 | group = 'client', 174 | on_press = function() awful.client.swap.byidx(-1) end, 175 | }, 176 | awful.key{ 177 | modifiers = {mod.super}, 178 | key = 'u', 179 | description = 'jump to urgent client', 180 | group = 'client', 181 | on_press = awful.client.urgent.jumpto, 182 | }, 183 | awful.key{ 184 | modifiers = {mod.super}, 185 | key = 'l', 186 | description = 'increase master width factor', 187 | group = 'layout', 188 | on_press = function() awful.tag.incmwfact(0.05) end, 189 | }, 190 | awful.key{ 191 | modifiers = {mod.super}, 192 | key = 'h', 193 | description = 'decrease master width factor', 194 | group = 'layout', 195 | on_press = function() awful.tag.incmwfact(-0.05) end, 196 | }, 197 | awful.key{ 198 | modifiers = {mod.super, mod.shift}, 199 | key = 'h', 200 | description = 'increase the number of master clients', 201 | group = 'layout', 202 | on_press = function() awful.tag.incnmaster(1, nil, true) end, 203 | }, 204 | awful.key{ 205 | modifiers = {mod.super, mod.shift}, 206 | key = 'l', 207 | description = 'decrease the number of master clients', 208 | group = 'layout', 209 | on_press = function() awful.tag.incnmaster(-1, nil, true) end, 210 | }, 211 | awful.key{ 212 | modifiers = {mod.super, mod.ctrl}, 213 | key = 'h', 214 | description = 'increase the number of columns', 215 | group = 'layout', 216 | on_press = function() awful.tag.incncol(1, nil, true) end, 217 | }, 218 | awful.key{ 219 | modifiers = {mod.super, mod.ctrl}, 220 | key = 'l', 221 | description = 'decrease the number of columns', 222 | group = 'layout', 223 | on_press = function() awful.tag.incncol(-1, nil, true) end, 224 | }, 225 | awful.key{ 226 | modifiers = {mod.super}, 227 | key = 'space', 228 | description = 'select next', 229 | group = 'layout', 230 | on_press = function() awful.layout.inc(1) end, 231 | }, 232 | awful.key{ 233 | modifiers = {mod.super, mod.shift}, 234 | key = 'space', 235 | description = 'select previous', 236 | group = 'layout', 237 | on_press = function() awful.layout.inc(-1) end, 238 | }, 239 | } 240 | 241 | awful.keyboard.append_global_keybindings{ 242 | awful.key{ 243 | modifiers = {mod.super}, 244 | keygroup = 'numrow', 245 | description = 'only view tag', 246 | group = 'tag', 247 | on_press = function(index) 248 | local screen = awful.screen.focused() 249 | local tag = screen.tags[index] 250 | if tag then 251 | tag:view_only() 252 | end 253 | end 254 | }, 255 | awful.key{ 256 | modifiers = {mod.super, mod.ctrl}, 257 | keygroup = 'numrow', 258 | description = 'toggle tag', 259 | group = 'tag', 260 | on_press = function(index) 261 | local screen = awful.screen.focused() 262 | local tag = screen.tags[index] 263 | if tag then 264 | awful.tag.viewtoggle(tag) 265 | end 266 | end 267 | }, 268 | awful.key{ 269 | modifiers = {mod.super, mod.shift}, 270 | keygroup = 'numrow', 271 | description = 'move focused client to tag', 272 | group = 'tag', 273 | on_press = function(index) 274 | if client.focus then 275 | local tag = client.focus.screen.tags[index] 276 | if tag then 277 | client.focus:move_to_tag(tag) 278 | end 279 | end 280 | end 281 | }, 282 | awful.key { 283 | modifiers = {mod.super, mod.ctrl, mod.shift}, 284 | keygroup = 'numrow', 285 | description = 'toggle focused client on tag', 286 | group = 'tag', 287 | on_press = function(index) 288 | if client.focus then 289 | local tag = client.focus.screen.tags[index] 290 | if tag then 291 | client.focus:toggle_tag(tag) 292 | end 293 | end 294 | end, 295 | }, 296 | awful.key{ 297 | modifiers = {mod.super}, 298 | keygroup = 'numpad', 299 | description = 'select layout directly', 300 | group = 'layout', 301 | on_press = function(index) 302 | local tag = awful.screen.focused().selected_tag 303 | if tag then 304 | tag.layout = tag.layouts[index] or tag.layout 305 | end 306 | end 307 | }, 308 | } 309 | --------------------------------------------------------------------------------