doc: Add a client border color example.

This commit is contained in:
Emmanuel Lepage Vallee 2021-03-21 23:54:51 -07:00
parent 9e755d59ea
commit 31fcce436c
4 changed files with 211 additions and 0 deletions

View File

@ -234,6 +234,7 @@ end
-- @tfield integer table.right The padding on the right.
-- @tfield integer table.top The padding on the top.
-- @tfield integer table.bottom The padding on the bottom.
-- @usebeautiful beautiful.maximized_honor_padding Honor the screen padding when maximizing.
function screen.object.get_padding(self)
local p = data.padding[self] or {}

View File

@ -667,6 +667,8 @@ lua_class_t client_class;
* cause several other changes to the state in order to ensure that
* a client's position and its screen are consistent.
*
* @DOC_sequences_client_screen_EXAMPLE@
*
* @property screen
* @tparam screen screen
* @propemits false false
@ -714,18 +716,79 @@ lua_class_t client_class;
* @property border_width
* @tparam integer border_width
* @propemits false false
* @usebeautiful beautiful.border_width_active
* @usebeautiful beautiful.border_width_normal
* @usebeautiful beautiful.border_width_new
* @usebeautiful beautiful.border_width_urgent
* @usebeautiful beautiful.border_width_floating
* @usebeautiful beautiful.border_width_floating_active
* @usebeautiful beautiful.border_width_floating_normal
* @usebeautiful beautiful.border_width_floating_new
* @usebeautiful beautiful.border_width_floating_urgent
* @usebeautiful beautiful.border_width_maximized
* @usebeautiful beautiful.border_width_maximized_active
* @usebeautiful beautiful.border_width_maximized_normal
* @usebeautiful beautiful.border_width_maximized_new
* @usebeautiful beautiful.border_width_maximized_urgent
* @usebeautiful beautiful.border_width_fullscreen
* @usebeautiful beautiful.border_width_fullscreen_active
* @usebeautiful beautiful.border_width_fullscreen_normal
* @usebeautiful beautiful.border_width_fullscreen_new
* @usebeautiful beautiful.border_width_fullscreen_urgent
* @usebeautiful beautiful.fullscreen_hide_border Hide the border on fullscreen clients.
* @usebeautiful beautiful.maximized_hide_border Hide the border on maximized clients.
* @see request::border
* @see awful.permissions.update_border
* @see border_color
*/
/**
* The client border color.
*
* @DOC_awful_client_border_width_EXAMPLE@
*
* Note that setting this directly will override and disable all related theme
* variables.
*
* @property border_color
* @tparam color border_color Any string, gradients and patterns will be converted to a
* cairo pattern.
* @propemits false false
* @usebeautiful beautiful.border_color_marked The fallback color when the
* client is marked.
* @usebeautiful beautiful.border_color_active The fallback color when the
* client is active (focused).
* @usebeautiful beautiful.border_color_normal The fallback color when the
* client isn't active/floating/new/urgent/maximized/floating/fullscreen.
* @usebeautiful beautiful.border_color_new The fallback color when the
* client is new.
* @usebeautiful beautiful.border_color_urgent The fallback color when the
* client is urgent.
* @usebeautiful beautiful.border_color_floating The fallback color when the
* client is floating and the other colors are not set.
* @usebeautiful beautiful.border_color_floating_active The color when the
* client is floating and is active (focused).
* @usebeautiful beautiful.border_color_floating_normal The color when the
* client is floating and not new/urgent/active.
* @usebeautiful beautiful.border_color_floating_new
* @usebeautiful beautiful.border_color_floating_urgent The color when the
* client is floating and urgent.
* @usebeautiful beautiful.border_color_maximized
* @usebeautiful beautiful.border_color_maximized_active
* @usebeautiful beautiful.border_color_maximized_normal
* @usebeautiful beautiful.border_color_maximized_new
* @usebeautiful beautiful.border_color_maximized_urgent The color when the
* client is urbent and maximized.
* @usebeautiful beautiful.border_color_fullscreen
* @usebeautiful beautiful.border_color_fullscreen_active
* @usebeautiful beautiful.border_color_fullscreen_normal
* @usebeautiful beautiful.border_color_fullscreen_new
* @usebeautiful beautiful.border_color_fullscreen_urgent The color when the
* client is fullscreen and urgent.
* @see request::border
* @see awful.permissions.update_border
* @see gears.color
* @see border_width
*/
/**
@ -735,6 +798,22 @@ lua_class_t client_class;
* @tparam boolean urgent
* @propemits false false
* @see request::border
* @usebeautiful beautiful.border_color_urgent The fallback color when the
* client is urgent.
* @usebeautiful beautiful.border_color_floating_urgent The color when the
* client is floating and urgent.
* @usebeautiful beautiful.border_color_maximized_urgent The color when the
* client is urbent and maximized.
* @usebeautiful beautiful.border_color_fullscreen_urgent The color when the
* client is fullscreen and urgent.
* @usebeautiful beautiful.border_width_urgent The fallback border width when
* the client is urgent.
* @usebeautiful beautiful.border_width_floating_urgent The border width when
* the client is floating and urgent.
* @usebeautiful beautiful.border_width_maximized_urgent The border width when
* the client is maximized and urgent.
* @usebeautiful beautiful.border_width_fullscreen_urgent The border width when
* the client is fullscreen and urgent.
*/
/**

View File

@ -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")
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

View File

@ -0,0 +1,46 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE --DOC_ASTERISK
local module = ... --DOC_HIDE
require("ruled.client") --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
awful.placement = require("awful.placement") --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]:fake_resize(0, 0, 800, 480) --DOC_HIDE
screen.fake_add(830, 0, 800, 480).outputs = {["eVGA1"] = {mm_height=50, mm_width=80 }} --DOC_HIDE
screen.fake_add(1660, 0, 800, 480).outputs = {["DVI1" ] = {mm_height=50, mm_width=80 }} --DOC_HIDE
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) --DOC_HIDE
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[2], awful.layout.suit.corner.nw) --DOC_HIDE
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[3], awful.layout.suit.corner.nw) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=screen[3]} --DOC_HIDE
end --DOC_HIDE
--DOC_NEWLINE
module.add_event("Spawn a client on screen #3", function() --DOC_HIDE
-- Move the mouse to screen 3
mouse.coords {x = 1800, y = 100 }
assert(mouse.screen == screen[3]) --DOC_HIDE
--DOC_NEWLINE
-- Spawn a client on screen #3
awful.spawn("firefox")
assert(client.get()[1].screen == screen[3]) --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Move to screen #2", function() --DOC_HIDE
client.get()[1].screen = screen[2]
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = true , display_clients = true, --DOC_HIDE
display_label = false, display_client_name = true, --DOC_HIDE
display_mouse = true , --DOC_HIDE
} --DOC_HIDE