doc: Add a client.border_width example.
This commit is contained in:
parent
c1d25cd70d
commit
028d01590a
|
@ -727,6 +727,15 @@ lua_class_t client_class;
|
||||||
/**
|
/**
|
||||||
* The client border width.
|
* The client border width.
|
||||||
*
|
*
|
||||||
|
* When manually set (for example, in `ruled.client` rules), this value
|
||||||
|
* will be static. Otherwise, it is controlled by many `beautiful` variables.
|
||||||
|
*
|
||||||
|
* Be careful, the borders are **around** the geometry, not part of it. If
|
||||||
|
* you want more fancy border, use the `awful.titlebar` API to create
|
||||||
|
* titlebars on each side of the client.
|
||||||
|
*
|
||||||
|
* @DOC_awful_client_border_width_EXAMPLE@
|
||||||
|
*
|
||||||
* @property border_width
|
* @property border_width
|
||||||
* @tparam integer border_width
|
* @tparam integer border_width
|
||||||
* @propemits false false
|
* @propemits false false
|
||||||
|
@ -759,7 +768,7 @@ lua_class_t client_class;
|
||||||
/**
|
/**
|
||||||
* The client border color.
|
* The client border color.
|
||||||
*
|
*
|
||||||
* @DOC_awful_client_border_width_EXAMPLE@
|
* @DOC_awful_client_border_color_EXAMPLE@
|
||||||
*
|
*
|
||||||
* Note that setting this directly will override and disable all related theme
|
* Note that setting this directly will override and disable all related theme
|
||||||
* variables.
|
* variables.
|
||||||
|
@ -3087,6 +3096,9 @@ luaA_client_kill(lua_State *L)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Swap a client with another one in global client list.
|
/** Swap a client with another one in global client list.
|
||||||
|
*
|
||||||
|
* @DOC_sequences_client_swap1_EXAMPLE@
|
||||||
|
*
|
||||||
* @tparam client c A client to swap with.
|
* @tparam client c A client to swap with.
|
||||||
* @method swap
|
* @method swap
|
||||||
* @emits swapped
|
* @emits swapped
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
--DOC_NO_USAGE --DOC_GEN_IMAGE --DOC_ASTERISK
|
||||||
|
local awful = require("awful") --DOC_HIDE
|
||||||
|
local wibox = require("wibox") --DOC_HIDE
|
||||||
|
local beautiful = require("beautiful") --DOC_HIDE
|
||||||
|
|
||||||
|
screen[1]._resize {width = 480, height = 200} --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
|
||||||
|
|
||||||
|
client.connect_signal("request::titlebars", function(c)--DOC_HIDE
|
||||||
|
local top_titlebar = awful.titlebar(c, {--DOC_HIDE
|
||||||
|
height = 20,--DOC_HIDE
|
||||||
|
bg_normal = beautiful.bg_normal,--DOC_HIDE
|
||||||
|
})--DOC_HIDE
|
||||||
|
|
||||||
|
top_titlebar : setup {--DOC_HIDE
|
||||||
|
{ -- Left--DOC_HIDE
|
||||||
|
awful.titlebar.widget.iconwidget(c),--DOC_HIDE
|
||||||
|
layout = wibox.layout.fixed.horizontal--DOC_HIDE
|
||||||
|
},--DOC_HIDE
|
||||||
|
{ -- Middle--DOC_HIDE
|
||||||
|
{ -- Title--DOC_HIDE
|
||||||
|
align = "center",--DOC_HIDE
|
||||||
|
widget = awful.titlebar.widget.titlewidget(c)--DOC_HIDE
|
||||||
|
},--DOC_HIDE
|
||||||
|
layout = wibox.layout.flex.horizontal--DOC_HIDE
|
||||||
|
},--DOC_HIDE
|
||||||
|
{ -- Right--DOC_HIDE
|
||||||
|
awful.titlebar.widget.floatingbutton (c),--DOC_HIDE
|
||||||
|
awful.titlebar.widget.maximizedbutton(c),--DOC_HIDE
|
||||||
|
awful.titlebar.widget.stickybutton (c),--DOC_HIDE
|
||||||
|
awful.titlebar.widget.ontopbutton (c),--DOC_HIDE
|
||||||
|
awful.titlebar.widget.closebutton (c),--DOC_HIDE
|
||||||
|
layout = wibox.layout.fixed.horizontal()--DOC_HIDE
|
||||||
|
},--DOC_HIDE
|
||||||
|
layout = wibox.layout.align.horizontal--DOC_HIDE
|
||||||
|
}--DOC_HIDE
|
||||||
|
end)--DOC_HIDE
|
||||||
|
|
||||||
|
|
||||||
|
wb:setup { --DOC_HIDE
|
||||||
|
layout = wibox.layout.align.horizontal, --DOC_HIDE
|
||||||
|
{ --DOC_HIDE
|
||||||
|
mytaglist, --DOC_HIDE
|
||||||
|
layout = wibox.layout.fixed.horizontal, --DOC_HIDE
|
||||||
|
}, --DOC_HIDE
|
||||||
|
mytasklist, --DOC_HIDE
|
||||||
|
{ --DOC_HIDE
|
||||||
|
layout = wibox.layout.fixed.horizontal, --DOC_HIDE
|
||||||
|
mykeyboardlayout, --DOC_HIDE
|
||||||
|
mytextclock, --DOC_HIDE
|
||||||
|
}, --DOC_HIDE
|
||||||
|
} --DOC_HIDE
|
||||||
|
|
||||||
|
require("gears.timer").run_delayed_calls_now()--DOC_HIDE
|
||||||
|
|
||||||
|
local function gen_client(label)--DOC_HIDE
|
||||||
|
local c = client.gen_fake {hide_first=true} --DOC_HIDE
|
||||||
|
|
||||||
|
c:geometry {--DOC_HIDE
|
||||||
|
x = 105,--DOC_HIDE
|
||||||
|
y = 60,--DOC_HIDE
|
||||||
|
height = 60,--DOC_HIDE
|
||||||
|
width = 230,--DOC_HIDE
|
||||||
|
}--DOC_HIDE
|
||||||
|
c._old_geo = {c:geometry()} --DOC_HIDE
|
||||||
|
c:set_label(label) --DOC_HIDE
|
||||||
|
c:emit_signal("request::titlebars")--DOC_HIDE
|
||||||
|
return c --DOC_HIDE
|
||||||
|
end --DOC_HIDE
|
||||||
|
|
||||||
|
local c = gen_client("A manually set border_color") --DOC_HIDE
|
||||||
|
c.border_color = "#ff00ff"
|
||||||
|
|
||||||
|
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
|
|
|
@ -1,85 +1,95 @@
|
||||||
--DOC_NO_USAGE --DOC_GEN_IMAGE --DOC_ASTERISK
|
--DOC_NO_USAGE --DOC_GEN_IMAGE --DOC_ASTERISK --DOC_HIDE_START
|
||||||
local awful = require("awful") --DOC_HIDE
|
local awful = require("awful")
|
||||||
local wibox = require("wibox") --DOC_HIDE
|
local wibox = require("wibox")
|
||||||
local beautiful = require("beautiful") --DOC_HIDE
|
local beautiful = require("beautiful")
|
||||||
|
|
||||||
screen[1]._resize {width = 480, height = 200} --DOC_HIDE
|
screen[1]._resize {width = 480, height = 200}
|
||||||
|
|
||||||
local wb = awful.wibar { position = "top" }--DOC_HIDE
|
local wb = awful.wibar { position = "top" }
|
||||||
|
|
||||||
--DOC_HIDE Create the same number of tags as the default config
|
-- 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
|
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.layouts[1])
|
||||||
|
|
||||||
--DOC_HIDE Only bother with widgets that are visible by default
|
-- Only bother with widgets that are visible by default
|
||||||
local mykeyboardlayout = awful.widget.keyboardlayout() --DOC_HIDE
|
local mykeyboardlayout = awful.widget.keyboardlayout()
|
||||||
local mytextclock = wibox.widget.textclock() --DOC_HIDE
|
local mytextclock = wibox.widget.textclock()
|
||||||
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {}) --DOC_HIDE
|
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {})
|
||||||
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {}) --DOC_HIDE
|
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {})
|
||||||
|
|
||||||
client.connect_signal("request::titlebars", function(c)--DOC_HIDE
|
client.connect_signal("request::titlebars", function(c)
|
||||||
local top_titlebar = awful.titlebar(c, {--DOC_HIDE
|
local top_titlebar = awful.titlebar(c, {
|
||||||
height = 20,--DOC_HIDE
|
height = 20,
|
||||||
bg_normal = beautiful.bg_normal,--DOC_HIDE
|
bg_normal = beautiful.bg_normal,
|
||||||
})--DOC_HIDE
|
})
|
||||||
|
|
||||||
top_titlebar : setup {--DOC_HIDE
|
top_titlebar : setup {
|
||||||
{ -- Left--DOC_HIDE
|
{ -- Left
|
||||||
awful.titlebar.widget.iconwidget(c),--DOC_HIDE
|
awful.titlebar.widget.iconwidget(c),
|
||||||
layout = wibox.layout.fixed.horizontal--DOC_HIDE
|
layout = wibox.layout.fixed.horizontal
|
||||||
},--DOC_HIDE
|
},
|
||||||
{ -- Middle--DOC_HIDE
|
{ -- Middle
|
||||||
{ -- Title--DOC_HIDE
|
{ -- Title
|
||||||
align = "center",--DOC_HIDE
|
align = "center",
|
||||||
widget = awful.titlebar.widget.titlewidget(c)--DOC_HIDE
|
widget = awful.titlebar.widget.titlewidget(c)
|
||||||
},--DOC_HIDE
|
},
|
||||||
layout = wibox.layout.flex.horizontal--DOC_HIDE
|
layout = wibox.layout.flex.horizontal
|
||||||
},--DOC_HIDE
|
},
|
||||||
{ -- Right--DOC_HIDE
|
{ -- Right
|
||||||
awful.titlebar.widget.floatingbutton (c),--DOC_HIDE
|
awful.titlebar.widget.floatingbutton (c),
|
||||||
awful.titlebar.widget.maximizedbutton(c),--DOC_HIDE
|
awful.titlebar.widget.maximizedbutton(c),
|
||||||
awful.titlebar.widget.stickybutton (c),--DOC_HIDE
|
awful.titlebar.widget.stickybutton (c),
|
||||||
awful.titlebar.widget.ontopbutton (c),--DOC_HIDE
|
awful.titlebar.widget.ontopbutton (c),
|
||||||
awful.titlebar.widget.closebutton (c),--DOC_HIDE
|
awful.titlebar.widget.closebutton (c),
|
||||||
layout = wibox.layout.fixed.horizontal()--DOC_HIDE
|
layout = wibox.layout.fixed.horizontal()
|
||||||
},--DOC_HIDE
|
},
|
||||||
layout = wibox.layout.align.horizontal--DOC_HIDE
|
layout = wibox.layout.align.horizontal
|
||||||
}--DOC_HIDE
|
}
|
||||||
end)--DOC_HIDE
|
end)
|
||||||
|
|
||||||
|
|
||||||
wb:setup { --DOC_HIDE
|
wb:setup {
|
||||||
layout = wibox.layout.align.horizontal, --DOC_HIDE
|
layout = wibox.layout.align.horizontal,
|
||||||
{ --DOC_HIDE
|
{
|
||||||
mytaglist, --DOC_HIDE
|
mytaglist,
|
||||||
layout = wibox.layout.fixed.horizontal, --DOC_HIDE
|
layout = wibox.layout.fixed.horizontal,
|
||||||
}, --DOC_HIDE
|
},
|
||||||
mytasklist, --DOC_HIDE
|
mytasklist,
|
||||||
{ --DOC_HIDE
|
{
|
||||||
layout = wibox.layout.fixed.horizontal, --DOC_HIDE
|
layout = wibox.layout.fixed.horizontal,
|
||||||
mykeyboardlayout, --DOC_HIDE
|
mykeyboardlayout,
|
||||||
mytextclock, --DOC_HIDE
|
mytextclock,
|
||||||
}, --DOC_HIDE
|
},
|
||||||
} --DOC_HIDE
|
}
|
||||||
|
|
||||||
require("gears.timer").run_delayed_calls_now()--DOC_HIDE
|
require("gears.timer").run_delayed_calls_now()
|
||||||
|
local counter = 0
|
||||||
|
|
||||||
local function gen_client(label)--DOC_HIDE
|
local function gen_client(label)
|
||||||
local c = client.gen_fake {hide_first=true} --DOC_HIDE
|
local c = client.gen_fake {hide_first=true}
|
||||||
|
|
||||||
c:geometry {--DOC_HIDE
|
c:geometry {
|
||||||
x = 105,--DOC_HIDE
|
x = 45 + counter*1.75,
|
||||||
y = 60,--DOC_HIDE
|
y = 30 + counter,
|
||||||
height = 60,--DOC_HIDE
|
height = 60,
|
||||||
width = 230,--DOC_HIDE
|
width = 230,
|
||||||
}--DOC_HIDE
|
}
|
||||||
c._old_geo = {c:geometry()} --DOC_HIDE
|
c._old_geo = {c:geometry()}
|
||||||
c:set_label(label) --DOC_HIDE
|
c:set_label(label)
|
||||||
c:emit_signal("request::titlebars")--DOC_HIDE
|
c:emit_signal("request::titlebars")
|
||||||
return c --DOC_HIDE
|
c.border_color = beautiful.bg_highlight
|
||||||
end --DOC_HIDE
|
counter = counter + 40
|
||||||
|
|
||||||
local c = gen_client("A manually set border_color") --DOC_HIDE
|
return c
|
||||||
c.border_color = "#ff00ff"
|
end
|
||||||
|
|
||||||
|
local c1 = gen_client("Border width: 0")
|
||||||
|
local c2 = gen_client("Border width: 2")
|
||||||
|
local c3 = gen_client("Border width: 10")
|
||||||
|
--DOC_HIDE_END
|
||||||
|
|
||||||
|
c1.border_width = 0
|
||||||
|
c2.border_width = 2
|
||||||
|
c3.border_width = 10
|
||||||
|
|
||||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue