Merge pull request #2939 from SethBarberee/layoutbox-doc

Add layoutbox example
This commit is contained in:
Emmanuel Lepage Vallée 2019-12-06 00:18:24 -05:00 committed by GitHub
commit d2b7d292b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 0 deletions

View File

@ -1,6 +1,7 @@
---------------------------------------------------------------------------
--- Display the current client layout (`awful.layout`) icon or name.
--
-- @DOC_awful_widget_layoutbox_default_EXAMPLE@
--
-- @author Julien Danjou <julien@danjou.info>
-- @copyright 2009 Julien Danjou

View File

@ -18,6 +18,7 @@ local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.al
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {}) --DOC_HIDE
local hotkeys_popup = nil --DOC_HIDE
local --DOC_HIDE
myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", "xterm" .. " -e man awesome" },
@ -27,6 +28,7 @@ local hotkeys_popup = nil --DOC_HIDE
--DOC_NEWLINE
local --DOC_HIDE
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", "xterm"}
}
@ -34,6 +36,7 @@ local hotkeys_popup = nil --DOC_HIDE
--DOC_NEWLINE
local --DOC_HIDE
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })

View File

@ -0,0 +1,50 @@
--DOC_NO_USAGE --DOC_GEN_IMAGE
local awful = require("awful") --DOC_HIDE
local wibox = require("wibox") --DOC_HIDE
screen[1]._resize {width = 480, height = 100} --DOC_HIDE
local wb = awful.wibar { position = "top", } --DOC_HIDE
--DOC_HIDE Create the same number of tags as the default config
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.layouts[1]) --DOC_HIDE
--DOC_HIDE Only bother with widgets that are visible by default
local mykeyboardlayout = awful.widget.keyboardlayout() --DOC_HIDE
local mytextclock = wibox.widget.textclock() --DOC_HIDE
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {}) --DOC_HIDE
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {}) --DOC_HIDE
local s = screen[1]
--DOC_NEWLINE
local mylayoutbox = awful.widget.layoutbox {
screen = s,
-- Add buttons, allowing you to change the layout
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),
}
}
--DOC_NEWLINE
wb:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
mytaglist,
layout = wibox.layout.fixed.horizontal,
},
mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
mytextclock,
mylayoutbox,
},
}
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80