From 82e952597834f2d7e12011fd0110d2f71adfb550 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Tue, 25 May 2021 17:37:29 +0200 Subject: [PATCH] init --- configuration/applications.lua | 15 ++ configuration/client_keybindings.lua | 65 +++++++++ configuration/client_mousebindings.lua | 25 ++++ configuration/global_keybindings.lua | 64 +++++++++ configuration/global_mousebindings.lua | 14 ++ configuration/init.lua | 17 +++ configuration/menu/init.lua | 6 + configuration/menu/myawesomemenu.lua | 16 +++ configuration/menu/mymainmenu.lua | 11 ++ configuration/rules/client/firefox.lua | 7 + configuration/rules/client/floating.lua | 21 +++ configuration/rules/client/global.lua | 16 +++ configuration/rules/client/init.lua | 8 ++ configuration/rules/client/titlebars.lua | 9 ++ configuration/rules/init.lua | 6 + configuration/rules/notification/global.lua | 11 ++ configuration/rules/notification/init.lua | 5 + configuration/tag_layouts.lua | 19 +++ init.lua | 149 ++++++++++++++++++++ slots/init.lua | 80 +++++++++++ theme/init.lua | 5 + ui/desktop_decoration/bar.lua | 130 +++++++++++++++++ ui/hotkeys_popup/init.lua | 12 ++ ui/menu/mymainmenu.lua | 32 +++++ 24 files changed, 743 insertions(+) create mode 100644 configuration/applications.lua create mode 100644 configuration/client_keybindings.lua create mode 100644 configuration/client_mousebindings.lua create mode 100644 configuration/global_keybindings.lua create mode 100644 configuration/global_mousebindings.lua create mode 100644 configuration/init.lua create mode 100644 configuration/menu/init.lua create mode 100644 configuration/menu/myawesomemenu.lua create mode 100644 configuration/menu/mymainmenu.lua create mode 100644 configuration/rules/client/firefox.lua create mode 100644 configuration/rules/client/floating.lua create mode 100644 configuration/rules/client/global.lua create mode 100644 configuration/rules/client/init.lua create mode 100644 configuration/rules/client/titlebars.lua create mode 100644 configuration/rules/init.lua create mode 100644 configuration/rules/notification/global.lua create mode 100644 configuration/rules/notification/init.lua create mode 100644 configuration/tag_layouts.lua create mode 100644 init.lua create mode 100644 slots/init.lua create mode 100644 theme/init.lua create mode 100644 ui/desktop_decoration/bar.lua create mode 100644 ui/hotkeys_popup/init.lua create mode 100644 ui/menu/mymainmenu.lua diff --git a/configuration/applications.lua b/configuration/applications.lua new file mode 100644 index 0000000..c8e9ff7 --- /dev/null +++ b/configuration/applications.lua @@ -0,0 +1,15 @@ +local applications = {} + +applications.terminal = 'xterm' +applications.editor = os.getenv('EDITOR') or 'vim' + +applications.open_editor = function (file) + return applications.terminal + .. ' -e ' .. applications.editor .. ' ' .. file +end + +applications.open_man = function (file) + return applications.terminal .. ' -e man ' .. file +end + +return applications diff --git a/configuration/client_keybindings.lua b/configuration/client_keybindings.lua new file mode 100644 index 0000000..58c7353 --- /dev/null +++ b/configuration/client_keybindings.lua @@ -0,0 +1,65 @@ +local akey = require 'awful.key' +local aclient = require 'awful.client' + +local control = 'Control' +local modkey = 'Mod4' +local shift = 'Shift' + +local client_keybindings = { + akey({ modkey }, 'f', + function (client) + client.fullscreen = not client.fullscreen + client:raise() + end, + { description = 'toggle fullscreen', group = 'client' }), + akey({ modkey, shift }, 'c', + function (client) + client:kill() + end, + { description = 'close', group = 'client' }), + akey({ modkey, control }, 'space', + aclient.floating.toggle, + { description = 'toggle floating', group = 'client' }), + akey({ modkey, control }, 'Return', + function (client) + client:swap(aclient.getmaster()) + end, + { description = 'move to master', group = 'client' }), + akey({ modkey }, 'o', + function (client) + client:move_to_screen() + end, + { description = 'move to screen', group = 'client' }), + akey({ modkey }, 't', + function (client) + client.ontop = not client.ontop + end, + { description = 'toggle keep on top', group = 'client' }), + akey({ modkey }, 'n', + function (client) + -- The client currently has the input focus, so it cannot be + -- minimized, since minimized clients can't have the focus. + client.minimized = true + end , + { description = 'minimize', group = 'client' }), + akey({ modkey }, 'm', + function (client) + client.maximized = not client.maximized + client:raise() + end, + { description = '(un)maximize', group = 'client' }), + akey({ modkey, control }, 'm', + function (client) + client.maximized_vertical = not client.maximized_vertical + client:raise() + end, + { description = '(un)maximize vertically', group = 'client' }), + akey({ modkey, shift }, 'm', + function (client) + client.maximized_horizontal = not client.maximized_horizontal + client:raise() + end, + { description = '(un)maximize horizontally', group = 'client' }) +} + +return client_keybindings diff --git a/configuration/client_mousebindings.lua b/configuration/client_mousebindings.lua new file mode 100644 index 0000000..8e3d020 --- /dev/null +++ b/configuration/client_mousebindings.lua @@ -0,0 +1,25 @@ +local abutton = require 'awful.button' + +local modkey = 'Mod4' + +local mousebindings = { + abutton({ }, 1, function (client) + client:activate { + context = 'mouse_click' + } + end), + abutton({ modkey }, 1, function (client) + client:activate { + context = 'mouse_click', + action = 'mouse_move' + } + end), + abutton({ modkey }, 3, function (client) + client:activate { + context = 'mouse_click', + action = 'mouse_resize' + } + end) +} + +return mousebindings diff --git a/configuration/global_keybindings.lua b/configuration/global_keybindings.lua new file mode 100644 index 0000000..f60385e --- /dev/null +++ b/configuration/global_keybindings.lua @@ -0,0 +1,64 @@ +local akey = require 'awful.key' +local aprompt = require 'awful.prompt' +local autil = require 'awful.util' +local ascreen = require 'awful.screen' +local aspawn = require 'awful.spawn' + +local menubar = require 'menubar' + +local applications = require 'rc.configuration.applications' +local desktop_bar = require 'rc.ui.desktop_decoration.bar' +local hotkeys_popup = require 'rc.ui.hotkeys_popup' +local mymainmenu = require 'rc.ui.menu.mymainmenu' + +local capi = { + awesome = awesome +} + +local control = 'Control' +local modkey = 'Mod4' +local shift = 'Shift' + +local global_keybindings = { + akey({ modkey }, 's', + hotkeys_popup.show_help, + { description = 'show help', group = 'awesome' }), + akey({ modkey }, 'w', + function () + mymainmenu():show() + end, + { description = 'show main menu', group = 'awesome' }), + akey({ modkey, control }, 'r', + capi.awesome.restart, + { description = 'reload awesome', group = 'awesome' }), + akey({ modkey, shift }, 'q', + capi.awesome.quit, + { description = 'quit awesome', group = 'awesome' }), + akey({ modkey }, 'x', + function () + aprompt.run { + prompt = 'Run Lua code: ', + textbox = desktop_bar(ascreen.focused()).promptbox.widget, + exe_callback = autil.eval, + history_path = autil.get_cache_dir() .. '/history_eval' + } + end, + { description = 'lua execute prompt', group = 'awesome' }), + akey({ modkey }, 'Return', + function () + aspawn(applications.terminal) + end, + { description = 'open a terminal', group = 'launcher' }), + akey({ modkey }, 'r', + function () + desktop_bar(ascreen.focused()).promptbox:run() + end, + { description = 'run prompt', group = 'launcher' }), + akey({ modkey }, 'p', + function () + menubar.show() + end, + { description = 'show the menubar', group = 'launcher' }) +} + +return global_keybindings diff --git a/configuration/global_mousebindings.lua b/configuration/global_mousebindings.lua new file mode 100644 index 0000000..bab33f3 --- /dev/null +++ b/configuration/global_mousebindings.lua @@ -0,0 +1,14 @@ +local abutton = require 'awful.button' +local atag = require 'awful.tag' + +local mymainmenu = require 'rc.ui.menu.mymainmenu' + +local global_mousebindings = { + abutton({ }, 3, function () + mymainmenu():toggle() + end), + abutton({ }, 4, atag.viewprev), + abutton({ }, 5, atag.viewnext) +} + +return global_mousebindings diff --git a/configuration/init.lua b/configuration/init.lua new file mode 100644 index 0000000..30b897b --- /dev/null +++ b/configuration/init.lua @@ -0,0 +1,17 @@ +local rc_configuration = {} + +rc_configuration.applications = require 'rc.configuration.applications' + +rc_configuration.client_keybindings = require 'rc.configuration.client_keybindings' +rc_configuration.client_mousebindings = require 'rc.configuration.client_mousebindings' + +rc_configuration.global_keybindings = require 'rc.configuration.global_keybindings' +rc_configuration.global_mousebindings = require 'rc.configuration.global_mousebindings' + +rc_configuration.menu = require 'rc.configuration.menu' + +rc_configuration.rules = require 'rc.configuration.rules' + +rc_configuration.tag_layouts = require 'rc.configuration.tag_layouts' + +return rc_configuration diff --git a/configuration/menu/init.lua b/configuration/menu/init.lua new file mode 100644 index 0000000..8a30c2b --- /dev/null +++ b/configuration/menu/init.lua @@ -0,0 +1,6 @@ +local configuration_menu = {} + +configuration_menu.myawesomemenu = require 'rc.configuration.menu.myawesomemenu' +configuration_menu.mymainmenu = require 'rc.configuration.menu.mymainmenu' + +return configuration_menu diff --git a/configuration/menu/myawesomemenu.lua b/configuration/menu/myawesomemenu.lua new file mode 100644 index 0000000..cf2f845 --- /dev/null +++ b/configuration/menu/myawesomemenu.lua @@ -0,0 +1,16 @@ +local applications = require 'rc.configuration.applications' +local hotkeys_popup = require 'rc.ui.hotkeys_popup' + +local capi = { + awesome = _G.awesome +} + +local myawesomemenu = { + { 'hotkeys', function () hotkeys_popup.show_help() end }, + { 'manual', applications.open_man('awesome') }, + { 'edit config', applications.open_editor(capi.awesome.conffile) }, + { 'restart', capi.awesome.restart }, + { 'quit', capi.awesome.quit } +} + +return myawesomemenu diff --git a/configuration/menu/mymainmenu.lua b/configuration/menu/mymainmenu.lua new file mode 100644 index 0000000..7e67e2d --- /dev/null +++ b/configuration/menu/mymainmenu.lua @@ -0,0 +1,11 @@ +local beautiful = require 'beautiful' + +local applications = require 'rc.configuration.applications' +local myawesomemenu = require 'rc.configuration.menu.myawesomemenu' + +local mymainmenu = { + { 'awesome', myawesomemenu, beautiful.awesome_icon }, + { 'open terminal', applications.terminal } +} + +return mymainmenu diff --git a/configuration/rules/client/firefox.lua b/configuration/rules/client/firefox.lua new file mode 100644 index 0000000..c0e0673 --- /dev/null +++ b/configuration/rules/client/firefox.lua @@ -0,0 +1,7 @@ +local firefox_rule = { + id = 'firefox', + rule = { class = 'Firefox' }, + properties = { screen = 1, tag = '2' } +} + +return firefox_rule diff --git a/configuration/rules/client/floating.lua b/configuration/rules/client/floating.lua new file mode 100644 index 0000000..cb4fe28 --- /dev/null +++ b/configuration/rules/client/floating.lua @@ -0,0 +1,21 @@ +local floating_rule = { + id = 'floating', + rule_any = { + instance = { 'copyq', 'pinentry' }, + class = { + 'Arandr', 'Blueman-manager', 'Gpick', 'Kruler', 'Sxiv', + 'Tor Browser', 'Wpa_gui', 'veromix', 'xtightvncviewer' + }, + name = { + 'Event Tester', -- xev. + }, + role = { + 'AlarmWindow', -- Thunderbird's calendar. + 'ConfigManager', -- Thunderbird's about:config. + 'pop-up',-- e.g. Google Chrome's (detached) Developer Tools. + } + }, + properties = { floating = true } +} + +return floating_rule diff --git a/configuration/rules/client/global.lua b/configuration/rules/client/global.lua new file mode 100644 index 0000000..1a3a1f0 --- /dev/null +++ b/configuration/rules/client/global.lua @@ -0,0 +1,16 @@ +local aclient = require 'awful.client' +local aplacement = require 'awful.placement' +local ascreen = require 'awful.screen' + +local global_rule = { + id = 'global', + rule = {}, + properties = { + focus = aclient.focus.filter, + raise = true, + screen = ascreen.preferred, + placement = aplacement.no_overlap + aplacement.no_offscreen + } +} + +return global_rule diff --git a/configuration/rules/client/init.lua b/configuration/rules/client/init.lua new file mode 100644 index 0000000..94a581c --- /dev/null +++ b/configuration/rules/client/init.lua @@ -0,0 +1,8 @@ +local client_rules = {} + +client_rules.global = require 'rc.configuration.rules.client.global' +client_rules.floating = require 'rc.configuration.rules.client.floating' +client_rules.titlebar = require 'rc.configuration.rules.client.titlebars' +-- client_rules.firefox = require 'rc.configuration.rules.client.firefox' + +return client_rules diff --git a/configuration/rules/client/titlebars.lua b/configuration/rules/client/titlebars.lua new file mode 100644 index 0000000..6007168 --- /dev/null +++ b/configuration/rules/client/titlebars.lua @@ -0,0 +1,9 @@ +local titlebar_rule = { + id = 'titlebars', + rule_any = { + type = { 'normal', 'dialog' } + }, + properties = { titlebars_enabled = true } +} + +return titlebar_rule diff --git a/configuration/rules/init.lua b/configuration/rules/init.lua new file mode 100644 index 0000000..1732a34 --- /dev/null +++ b/configuration/rules/init.lua @@ -0,0 +1,6 @@ +local rules = {} + +rules.client = require 'rc.configuration.rules.client' +rules.notification = require 'rc.configuration.rules.notification' + +return rules diff --git a/configuration/rules/notification/global.lua b/configuration/rules/notification/global.lua new file mode 100644 index 0000000..1ee034e --- /dev/null +++ b/configuration/rules/notification/global.lua @@ -0,0 +1,11 @@ +local ascreen = require 'awful.screen' + +local global_rule = { + rule = {}, + properties = { + screen = ascreen.preferred, + implicit_timeout = 5, + } +} + +return global_rule diff --git a/configuration/rules/notification/init.lua b/configuration/rules/notification/init.lua new file mode 100644 index 0000000..552eaa8 --- /dev/null +++ b/configuration/rules/notification/init.lua @@ -0,0 +1,5 @@ +local notification_rules = {} + +notification_rules.global = require 'rc.configuration.rules.notification.global' + +return notification_rules diff --git a/configuration/tag_layouts.lua b/configuration/tag_layouts.lua new file mode 100644 index 0000000..f31fa52 --- /dev/null +++ b/configuration/tag_layouts.lua @@ -0,0 +1,19 @@ +local alayout = require 'awful.layout' + +local tag_layouts = { + alayout.suit.floating, + alayout.suit.tile, + alayout.suit.tile.left, + alayout.suit.tile.bottom, + alayout.suit.tile.top, + alayout.suit.fair, + alayout.suit.fair.horizontal, + alayout.suit.spiral, + alayout.suit.spiral.dwindle, + alayout.suit.max, + alayout.suit.max.fullscreen, + alayout.suit.magnifier, + alayout.suit.corner.nw +} + +return tag_layouts diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..ee725d7 --- /dev/null +++ b/init.lua @@ -0,0 +1,149 @@ +-- awesome_mode: api-level=4:screen=on + +-- If LuaRocks is installed, make sure that packages installed through it are +-- found (e.g. lgi). If LuaRocks is not installed, do nothing. +pcall(require, 'luarocks.loader') + +local gtimer = require 'gears.timer' +local legacy = require 'awesome-legacy' +local naughty = require 'naughty' +local ruled = require 'ruled' +local slot = require 'awesome-slot' + +-- Load global awesome components from the C API +local capi = { + client = _G.client, + screen = _G.screen, + tag = _G.tag +} + +-- Beautiful needs to be initialized as soon as possible to make theme +-- variables available to the configuration module. +legacy.beautiful { + base = 'default', + theme = require 'rc.theme' +} + +legacy.manage_error() +legacy.autofocus() +legacy.sloppy_focus() + +local configuration = require 'rc.configuration' +local my_slots = require 'rc.slots' + +-- This needs to be run after awesome has completed C API initialization and +-- the `root` object is available. +gtimer.delayed_call(function () + legacy.global_mouse_bindings(configuration.global_mousebindings) + legacy.global_keybindings(configuration.global_keybindings) +end) + +-- luacheck: ignore unused variable load_wallpaper +local load_wallpaper = slot { + id = 'LOAD_WALLPAPER', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = capi.screen, + signal = 'request::wallpaper', + slot = slot.slots.screen.wallpaper +} + +-- luacheck: ignore unused variable default_layout +local default_layout = slot { + id = 'DEFAULT_LAYOUTS', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = capi.tag, + signal = 'request::default_layouts', + slot = slot.slots.tag.default_layouts, + slot_params = { + layouts = configuration.tag_layouts + } +} + +-- luacheck: ignore unused variable create_tag +local create_tag = slot { + id = 'CREATE_TAGS', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = capi.screen, + signal = 'request::desktop_decoration', + slot = my_slots.create_tags +} + +-- luacheck: ignore unused variable desktop_decoration +local desktop_decoration = slot { + id = 'DESKTOP_DECORATION', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = capi.screen, + signal = 'request::desktop_decoration', + slot = my_slots.build_desktop_decoration +} + +-- luacheck: ignore unused variable client_mousebinding +local client_mousebinding = slot { + id = 'CLIENT_MOUSE_BINDINGS', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = capi.client, + signal = 'request::default_mousebindings', + slot = slot.slots.client.append_mousebindings, + slot_params = { + mousebindings = configuration.client_mousebindings + } +} + +-- luacheck: ignore unused variable client_keybinding +local client_keybinding = slot { + id = 'CLIENT_KEY_BINDINGS', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = capi.client, + signal = 'request::default_keybindings', + slot = slot.slots.client.append_keybindings, + slot_params = { + keybindings = configuration.client_keybindings + } +} + +-- luacheck: ignore unused variable ruled_client +local ruled_client = slot { + id = 'RULED_CLIENT', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = ruled.client, + signal = 'request::rules', + slot = slot.slots.ruled.append_client_rules, + slot_params = { + rules = configuration.rules.client + } +} + +-- luacheck: ignore unused variable client_titlebar +local client_titlebar = slot { + id = 'CLIENT_TITLEBAR', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = capi.client, + signal = 'request::titlebars', + slot = my_slots.build_client_titlebars +} + +-- luacheck: ignore unused variable ruled_notification +local ruled_notification = slot { + id = 'RULED_NOTIFICATION', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = ruled.notification, + signal = 'request::rules', + slot = slot.slots.ruled.append_notification_rules, + slot_params = { + rules = configuration.rules.notification + } +} + +-- luacheck: ignore unused variable naughty_display +local naughty_display = slot { + id = 'NAUGHTY_DISPLAY', + action = slot.actions.CREATE | slot.actions.CONNECT, + target = naughty, + signal = 'request::display', + slot = my_slots.naughty_display +} + +naughty.notify { + title = 'Aire-One dots', + message = 'You successfully ran the Aire-One default rc!' +} diff --git a/slots/init.lua b/slots/init.lua new file mode 100644 index 0000000..32dabb2 --- /dev/null +++ b/slots/init.lua @@ -0,0 +1,80 @@ +local abutton = require 'awful.button' +local atag = require 'awful.tag' +local atitlebar = require 'awful.titlebar' +local lalign = require 'wibox.layout.align' +local lfixed = require 'wibox.layout.fixed' +local lflex = require 'wibox.layout.flex' +local naughty = require 'naughty' + +-- You can require the configuration module to get access to other +-- configurations. +-- local configuration = require 'rc.configuration' +-- This would result in a depency loop as this file is part of the +-- configuration module. +-- +-- If you need to access a configuration from the rc.configuration module, +-- you should add a direct require to the submodule here: +local configuration = { + tag_layouts = require 'rc.configuration.tag_layouts' +} + +local slots = {} + +function slots.create_tags (screen) + atag( + { '1', '2', '3', '4', '5', '6', '7', '8', '9' }, + screen, + configuration.tag_layouts) +end + +function slots.build_desktop_decoration (screen) + local desktop_bar = require 'rc.ui.desktop_decoration.bar' + + desktop_bar(screen) +end + +function slots.build_client_titlebars (client) + -- Mouse buttons bindings for the titlebar + local buttons = { + abutton({}, 1, + function () + client:activate { context = 'titlebar', action = 'mouse_move' } + end), + abutton({}, 3, + function () + client:activate { context = 'titlebar', action = 'mouse_resize' } + end), + } + + -- Titlebar UI + atitlebar(client).widget = { + { -- Left + atitlebar.widget.iconwidget(client), + buttons = buttons, + layout = lfixed.horizontal + }, + { -- Middle + { -- Title + align = 'center', + widget = atitlebar.widget.titlewidget(client) + }, + buttons = buttons, + layout = lflex.horizontal + }, + { -- Right + atitlebar.widget.floatingbutton(client), + atitlebar.widget.maximizedbutton(client), + atitlebar.widget.stickybutton(client), + atitlebar.widget.ontopbutton(client), + atitlebar.widget.closebutton(client), + layout = lfixed.horizontal() + }, + layout = lalign.horizontal + } +end + +function slots.naughty_display (notification) + naughty.layout.box { notification = notification } +end + +return slots diff --git a/theme/init.lua b/theme/init.lua new file mode 100644 index 0000000..21199b4 --- /dev/null +++ b/theme/init.lua @@ -0,0 +1,5 @@ +local theme = {} + +theme.border_color_normal = '#0000ff' + +return theme diff --git a/ui/desktop_decoration/bar.lua b/ui/desktop_decoration/bar.lua new file mode 100644 index 0000000..0f12403 --- /dev/null +++ b/ui/desktop_decoration/bar.lua @@ -0,0 +1,130 @@ +local awibar = require 'awful.wibar' +local awful = require 'awful' +local beautiful = require 'beautiful' +local wibox = require 'wibox' + +local mymainmenu = require 'rc.ui.menu.mymainmenu' + +local capi = { + client = _G.client, + screen = _G.screen +} + +local modkey = 'Mod4' + +local bar = { _private = { instances = {} }, mt = {} } + +local function get_screen_id(screen) + local s = capi.screen[screen] or screen + + return s.index +end + +-- Get the bar instance for a given screen +function bar:instance(screen) + local screen_id = get_screen_id(screen) + local instance = self._private.instances[screen_id] + + if not instance then + instance = bar.new(screen) + self._private.instances[screen_id] = instance + end + + return instance +end + +function bar.new (screen) + local my_bar = {} + + my_bar.wibar = awibar { + screen = screen, + position = 'top' + } + + my_bar.launcher = awful.widget.launcher { + image = beautiful.awesome_icon, + menu = mymainmenu() + } + + my_bar.keyboardlayout = awful.widget.keyboardlayout() + + my_bar.textclock = wibox.widget.textclock() + + my_bar.promptbox = awful.widget.prompt() + + my_bar.layoutbox = awful.widget.layoutbox { + screen = screen, + buttons = { + awful.button({ }, 1, function () awful.layout.inc( 1) end), + awful.button({ }, 3, function () awful.layout.inc(-1) end), + awful.button({ }, 4, function () awful.layout.inc(-1) end), + awful.button({ }, 5, function () awful.layout.inc( 1) end), + } + } + + my_bar.taglist = awful.widget.taglist { + screen = screen, + filter = awful.widget.taglist.filter.all, + buttons = { + awful.button({}, 1, function(tag) + tag:view_only() + end), + awful.button({ modkey }, 1, function(tag) + if capi.client.focus then + capi.client.focus:move_to_tag(tag) + end + end), + awful.button({}, 3, awful.tag.viewtoggle), + awful.button({ modkey }, 3, function(tag) + if capi.client.focus then + capi.client.focus:toggle_tag(tag) + end + end), + awful.button({ }, 4, function(tag) + awful.tag.viewprev(tag.screen) + end), + awful.button({ }, 5, function(tag) + awful.tag.viewnext(tag.screen) + end) + } + } + + my_bar.tasklist = awful.widget.tasklist { + screen = screen, + filter = awful.widget.tasklist.filter.currenttags, + buttons = { + awful.button({ }, 1, function (c) + c:activate { context = "tasklist", action = "toggle_minimization" } + end), + awful.button({ }, 3, function() awful.menu.client_list { theme = { width = 250 } } end), + awful.button({ }, 4, function() awful.client.focus.byidx(-1) end), + awful.button({ }, 5, function() awful.client.focus.byidx( 1) end), + } + } + + my_bar.wibar:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + my_bar.launcher, + my_bar.taglist, + my_bar.promptbox, + }, + screen.mytasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + my_bar.keyboardlayout, + wibox.widget.systray(), + my_bar.textclock, + my_bar.layoutbox, + } + } + + return my_bar +end + +function bar.mt:__call(...) + return self:instance(...) +end + +return setmetatable(bar, bar.mt) diff --git a/ui/hotkeys_popup/init.lua b/ui/hotkeys_popup/init.lua new file mode 100644 index 0000000..ec6ad36 --- /dev/null +++ b/ui/hotkeys_popup/init.lua @@ -0,0 +1,12 @@ +local hotkeys_popup = require 'awful.hotkeys_popup' + +-- luacheck: ignore unset variable keys +local keys = { + vim = require 'awful.hotkeys_popup.keys.vim', + firefox = require 'awful.hotkeys_popup.keys.firefox', + tmux = require 'awful.hotkeys_popup.keys.tmux', + qutebrowser = require 'awful.hotkeys_popup.keys.qutebrowser', + termite = require 'awful.hotkeys_popup.keys.termite' +} + +return hotkeys_popup diff --git a/ui/menu/mymainmenu.lua b/ui/menu/mymainmenu.lua new file mode 100644 index 0000000..b0a66e3 --- /dev/null +++ b/ui/menu/mymainmenu.lua @@ -0,0 +1,32 @@ +local amenu = require 'awful.menu' + +local configuration = { + menu = require 'rc.configuration.menu' +} + +local mymainmenu = { _private = {}, mt = {} } + +function mymainmenu:instance() + local instance = self._private.instance + + if not instance then + instance = mymainmenu.new() + self._private.instance = instance + end + + return instance +end + +function mymainmenu.new () + local menu = amenu { + items = configuration.menu.mymainmenu + } + + return menu +end + +function mymainmenu.mt:__call() + return self:instance() +end + +return setmetatable(mymainmenu, mymainmenu.mt)