doc: Add a large number of `client` examples.

Backfill some under-documented APIs with yet more shiny images.
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-16 21:58:25 -07:00
parent 93283a9885
commit a8d2fa0297
29 changed files with 1239 additions and 18 deletions

View File

@ -168,8 +168,11 @@ function client.jumpto(c, merge)
end end
--- Jump to the given client. --- Jump to the given client.
--
-- Takes care of focussing the screen, the right tag, etc. -- Takes care of focussing the screen, the right tag, etc.
-- --
-- @DOC_sequences_client_jump_to1_EXAMPLE@
--
-- @method jump_to -- @method jump_to
-- @tparam bool|function merge If true then merge tags (select the client's -- @tparam bool|function merge If true then merge tags (select the client's
-- first tag additionally) when the client is not visible. -- first tag additionally) when the client is not visible.
@ -502,6 +505,9 @@ function client.moveresize(x, y, w, h, c)
end end
--- Move/resize a client relative to current coordinates. --- Move/resize a client relative to current coordinates.
--
-- @DOC_sequences_client_relative_move1_EXAMPLE@
--
-- @method relative_move -- @method relative_move
-- @see geometry -- @see geometry
-- @tparam[opt=c.x] number x The relative x coordinate. -- @tparam[opt=c.x] number x The relative x coordinate.
@ -510,10 +516,10 @@ end
-- @tparam[opt=c.height] number h The relative height. -- @tparam[opt=c.height] number h The relative height.
function client.object.relative_move(self, x, y, w, h) function client.object.relative_move(self, x, y, w, h)
local geometry = self:geometry() local geometry = self:geometry()
geometry['x'] = geometry['x'] + x geometry['x'] = geometry['x'] + (x or geometry.x)
geometry['y'] = geometry['y'] + y geometry['y'] = geometry['y'] + (y or geometry.y)
geometry['width'] = geometry['width'] + w geometry['width'] = geometry['width'] + (w or geometry.width)
geometry['height'] = geometry['height'] + h geometry['height'] = geometry['height'] + (h or geometry.height)
self:geometry(geometry) self:geometry(geometry)
end end
@ -529,6 +535,8 @@ end
--- Move a client to a tag. --- Move a client to a tag.
-- --
-- @DOC_sequences_client_move_to_tag1_EXAMPLE@
--
-- @method move_to_tag -- @method move_to_tag
-- @tparam tag target The tag to move the client to. -- @tparam tag target The tag to move the client to.
-- @request client activate client.movetotag granted When a client could be -- @request client activate client.movetotag granted When a client could be
@ -560,6 +568,8 @@ end
--- Toggle a tag on a client. --- Toggle a tag on a client.
-- --
-- @DOC_sequences_client_toggle_tag1_EXAMPLE@
--
-- @method toggle_tag -- @method toggle_tag
-- @tparam tag target The tag to move the client to. -- @tparam tag target The tag to move the client to.
-- @see tags -- @see tags
@ -597,6 +607,9 @@ function client.movetoscreen(c, s)
end end
--- Move a client to a screen. Default is next screen, cycling. --- Move a client to a screen. Default is next screen, cycling.
--
-- @DOC_sequences_client_move_to_screen1_EXAMPLE@
--
-- @method move_to_screen -- @method move_to_screen
-- @tparam[opt=c.screen.index+1] screen s The screen, default to current + 1. -- @tparam[opt=c.screen.index+1] screen s The screen, default to current + 1.
-- @see screen -- @see screen
@ -647,6 +660,8 @@ end
-- tags at the point of calling this method, it will fall back to the screen's -- tags at the point of calling this method, it will fall back to the screen's
-- full set of tags. -- full set of tags.
-- --
-- @DOC_sequences_client_to_selected_tags1_EXAMPLE@
--
-- @method to_selected_tags -- @method to_selected_tags
-- @see screen.selected_tags -- @see screen.selected_tags
function client.object.to_selected_tags(self) function client.object.to_selected_tags(self)
@ -895,6 +910,8 @@ end
-- did not set them manually. For example, windows with a type different than -- did not set them manually. For example, windows with a type different than
-- normal. -- normal.
-- --
-- @DOC_sequences_client_floating1_EXAMPLE@
--
-- @property floating -- @property floating
-- @tparam boolean floating The floating state. -- @tparam boolean floating The floating state.
-- @request client border floating granted When a border update is required -- @request client border floating granted When a border update is required
@ -976,6 +993,12 @@ end
--- The x coordinates. --- The x coordinates.
-- --
-- `x` (usually) originate from the top left. `x` does *not* include
-- the outer client border, but rather where the content and/or titlebar
-- starts.
--
-- @DOC_sequences_client_x1_EXAMPLE@
--
-- @property x -- @property x
-- @tparam integer x -- @tparam integer x
-- @emits property::geometry -- @emits property::geometry
@ -983,9 +1006,17 @@ end
-- geometry (with `x`, `y`, `width`, `height`). -- geometry (with `x`, `y`, `width`, `height`).
-- @emits property::x -- @emits property::x
-- @emits property::position -- @emits property::position
-- @see geometry
-- @see relative_move
--- The y coordinates. --- The y coordinates.
-- --
-- `y` (usually) originate from the top left. `y` does *not* include
-- the outer client border, but rather where the content and/or titlebar
-- starts.
--
-- @DOC_sequences_client_y1_EXAMPLE@
--
-- @property y -- @property y
-- @tparam integer y -- @tparam integer y
-- @emits property::geometry -- @emits property::geometry
@ -993,9 +1024,13 @@ end
-- geometry (with `x`, `y`, `width`, `height`). -- geometry (with `x`, `y`, `width`, `height`).
-- @emits property::y -- @emits property::y
-- @emits property::position -- @emits property::position
-- @see geometry
-- @see relative_move
--- The width of the client. --- The width of the client.
-- --
-- @DOC_sequences_client_width1_EXAMPLE@
--
-- @property width -- @property width
-- @tparam integer width -- @tparam integer width
-- @emits property::geometry -- @emits property::geometry
@ -1003,9 +1038,13 @@ end
-- geometry (with `x`, `y`, `width`, `height`). -- geometry (with `x`, `y`, `width`, `height`).
-- @emits property::width -- @emits property::width
-- @emits property::size -- @emits property::size
-- @see geometry
-- @see relative_move
--- The height of the client. --- The height of the client.
-- --
-- @DOC_sequences_client_height1_EXAMPLE@
--
-- @property height -- @property height
-- @tparam integer height -- @tparam integer height
-- @emits property::geometry -- @emits property::geometry
@ -1013,6 +1052,8 @@ end
-- geometry (with `x`, `y`, `width`, `height`). -- geometry (with `x`, `y`, `width`, `height`).
-- @emits property::height -- @emits property::height
-- @emits property::size -- @emits property::size
-- @see geometry
-- @see relative_move
-- Add the geometry helpers to match the wibox API -- Add the geometry helpers to match the wibox API
for _, v in ipairs {"x", "y", "width", "height"} do for _, v in ipairs {"x", "y", "width", "height"} do
@ -1239,6 +1280,7 @@ end
-- @property dockable -- @property dockable
-- @tparam boolean dockable The dockable state -- @tparam boolean dockable The dockable state
-- @propemits false false -- @propemits false false
-- @see struts
function client.object.get_dockable(c) function client.object.get_dockable(c)
local value = client.property.get(c, "dockable") local value = client.property.get(c, "dockable")
@ -1271,7 +1313,7 @@ end
--- If the client requests not to be decorated with a titlebar. --- If the client requests not to be decorated with a titlebar.
-- --
-- The motif wm hints allow a client to request not to be decorated by the WM in -- The motif wm hints allow a client to request not to be decorated by the WM in
-- various ways. This property uses the motif MWM_DECOR_TITLE hint and -- various ways. This property uses the motif `MWM_DECOR_TITLE` hint and
-- interprets it as the client (not) wanting a titlebar. -- interprets it as the client (not) wanting a titlebar.
-- --
-- @property requests_no_titlebar -- @property requests_no_titlebar
@ -1513,6 +1555,8 @@ end, true, true, "keybinding")
--- Set the client shape. --- Set the client shape.
-- --
-- @DOC_awful_client_shape1_EXAMPLE@
--
-- @property shape -- @property shape
-- @tparam gears.shape A gears.shape compatible function. -- @tparam gears.shape A gears.shape compatible function.
-- @propemits true false -- @propemits true false
@ -1556,10 +1600,13 @@ end
-- isn't already within its geometry, -- isn't already within its geometry,
-- * **toggle_minimization**: If the client is already active, minimize it. -- * **toggle_minimization**: If the client is already active, minimize it.
-- --
-- @DOC_sequences_client_activate1_EXAMPLE@
--
-- @method activate -- @method activate
-- @tparam table args -- @tparam table args
-- @tparam[opt=other] string args.context Why was this activate called? -- @tparam[opt=other] string args.context Why was this activate called?
-- @tparam[opt=true] boolean args.raise Raise the client to the top of its layer. -- @tparam[opt=true] boolean args.raise Raise the client to the top of its layer
-- and unminimize it (if needed).
-- @tparam[opt=false] boolean args.force Force the activation even for unfocusable -- @tparam[opt=false] boolean args.force Force the activation even for unfocusable
-- clients. -- clients.
-- @tparam[opt=false] boolean args.switch_to_tags -- @tparam[opt=false] boolean args.switch_to_tags
@ -1567,6 +1614,7 @@ end
-- @tparam[opt=false] boolean args.action Once activated, perform an action. -- @tparam[opt=false] boolean args.action Once activated, perform an action.
-- @tparam[opt=false] boolean args.toggle_minimization -- @tparam[opt=false] boolean args.toggle_minimization
-- @see awful.permissions.add_activate_filter -- @see awful.permissions.add_activate_filter
-- @see awful.permissions.activate
-- @see request::activate -- @see request::activate
-- @see active -- @see active
function client.object.activate(c, args) function client.object.activate(c, args)
@ -1735,6 +1783,13 @@ end)
-- @classsignal -- @classsignal
-- @see awful.permissions.update_border -- @see awful.permissions.update_border
--- Jump to the client that received the urgent hint first.
--
-- @staticfct awful.client.urgent.jumpto
-- @tparam bool|function merge If true then merge tags (select the client's
-- first tag additionally) when the client is not visible.
-- If it is a function, it will be called with the client as argument.
-- Add clients during startup to focus history. -- Add clients during startup to focus history.
-- This used to happen through permissions.activate, but that only handles visible -- This used to happen through permissions.activate, but that only handles visible
-- clients now. -- clients now.

View File

@ -28,7 +28,7 @@ local data = setmetatable({}, { __mode = 'k' })
-- Get the first client that got the urgent hint. -- Get the first client that got the urgent hint.
-- --
-- @function awful.urgent.get -- @function awful.client.urgent.get
-- @treturn client.object The first urgent client. -- @treturn client.object The first urgent client.
function urgent.get() function urgent.get()
if #data > 0 then if #data > 0 then
@ -46,7 +46,7 @@ end
--- Jump to the client that received the urgent hint first. --- Jump to the client that received the urgent hint first.
-- --
-- @function awful.urgent.jumpto -- @function awful.client.urgent.jumpto
-- @tparam bool|function merge If true then merge tags (select the client's -- @tparam bool|function merge If true then merge tags (select the client's
-- first tag additionally) when the client is not visible. -- first tag additionally) when the client is not visible.
-- If it is a function, it will be called with the client as argument. -- If it is a function, it will be called with the client as argument.
@ -59,7 +59,7 @@ end
-- Adds client to urgent stack. -- Adds client to urgent stack.
-- --
-- @function awful.urgent.add -- @function awful.client.urgent.add
-- @tparam client c The client object. -- @tparam client c The client object.
-- @param prop The property which is updated. -- @param prop The property which is updated.
-- @request client border active granted When a client becomes active and is no -- @request client border active granted When a client becomes active and is no
@ -90,7 +90,7 @@ end
-- Remove client from urgent stack. -- Remove client from urgent stack.
-- --
-- @function awful.urgent.delete -- @function awful.client.urgent.delete
-- @tparam client c The client object. -- @tparam client c The client object.
function urgent.delete(c) function urgent.delete(c)
for k, cl in ipairs(data) do for k, cl in ipairs(data) do

View File

@ -133,7 +133,9 @@ end
--- Activate a window. --- Activate a window.
-- --
-- This sets the focus only if the client is visible. -- This sets the focus only if the client is visible. If `raise` is set
-- in the hints, it will also unminimize the client and move it to the top
-- of its layer.
-- --
-- It is the default signal handler for `request::activate` on a `client`. -- It is the default signal handler for `request::activate` on a `client`.
-- --
@ -141,7 +143,8 @@ end
-- @tparam client c A client to use -- @tparam client c A client to use
-- @tparam string context The context where this signal was used. -- @tparam string context The context where this signal was used.
-- @tparam[opt] table hints A table with additional hints: -- @tparam[opt] table hints A table with additional hints:
-- @tparam[opt=false] boolean hints.raise should the client be raised? -- @tparam[opt=false] boolean hints.raise should the client be unminimized
-- and raised?
-- @tparam[opt=false] boolean hints.switch_to_tag should the client's first tag -- @tparam[opt=false] boolean hints.switch_to_tag should the client's first tag
-- be selected if none of the client's tags are selected? -- be selected if none of the client's tags are selected?
-- @tparam[opt=false] boolean hints.switch_to_tags Select all tags associated -- @tparam[opt=false] boolean hints.switch_to_tags Select all tags associated

View File

@ -475,10 +475,14 @@ lua_class_t client_class;
* `_NET_WM_STATE_SKIP_TASKBAR` X11 protocol xproperty. Clients can modify this * `_NET_WM_STATE_SKIP_TASKBAR` X11 protocol xproperty. Clients can modify this
* state through this property. * state through this property.
* *
* @DOC_awful_client_skip_tasklist1_EXAMPLE@
*
* @property skip_taskbar * @property skip_taskbar
* @tparam[opt=false] boolean skip_taskbar * @tparam[opt=false] boolean skip_taskbar
* @propemits false false * @propemits false false
* @see sticky * @see sticky
* @see hidden
* @see unmanage
*/ */
/** /**
@ -697,16 +701,28 @@ lua_class_t client_class;
* @tparam boolean hidden * @tparam boolean hidden
* @propemits false false * @propemits false false
* @see minimized * @see minimized
* @see skip_taskbar
* @see unmanage
*/ */
/** /**
* Define it the client must be iconify, i.e. only visible in * Define it the client must be iconify, i.e. only visible in
* taskbar. * taskbar.
* *
* Minimized clients are still part of tags and screens, but
* they are not displayed. You can unminimize using `c.minimized = false`,
* but if you also want to set the focus, it is better to use:
*
* c:activate { context = "unminimized", raise = true }
*
* @DOC_sequences_client_minimize1_EXAMPLE@
*
* @property minimized * @property minimized
* @tparam boolean minimized * @tparam boolean minimized
* @propemits false false * @propemits false false
* @see hidden * @see hidden
* @see isvisible
* @see activate
*/ */
/** /**
@ -819,12 +835,34 @@ lua_class_t client_class;
*/ */
/** /**
* The client urgent state. * Set to `true` when the client ask for attention.
*
* The urgent state is the visual equivalent of the "bell" noise from
* old computer. It is set by the client when their state changed and
* they need attention. For example, a chat client will set it when
* a new message arrive. Some terminals, like `rxvt-unicode`, will also
* set it when calling the `bell` command.
*
* There is many ways an urgent client can become for visible:
*
* * Highlight in the `awful.widget.taglist` and `awful.widget.tasklist`
* * Highlight in the `awful.titlebar`
* * Highlight of the client border color (or width).
* * Accessible using `Mod4+u` in the default config.
* * Emit the `property::urgent` signal.
*
* @DOC_awful_client_urgent1_EXAMPLE@
* *
* @property urgent * @property urgent
* @tparam boolean urgent * @tparam boolean urgent
* @propemits false false * @propemits false false
* @request client border active granted When a client becomes active and is no
* longer urgent.
* @request client border inactive granted When a client stop being active and
* is no longer urgent.
* @request client border urgent granted When a client stop becomes urgent.
* @see request::border * @see request::border
* @see awful.client.urgent.jumpto
* @usebeautiful beautiful.border_color_urgent The fallback color when the * @usebeautiful beautiful.border_color_urgent The fallback color when the
* client is urgent. * client is urgent.
* @usebeautiful beautiful.border_color_floating_urgent The color when the * @usebeautiful beautiful.border_color_floating_urgent The color when the
@ -841,6 +879,11 @@ lua_class_t client_class;
* the client is maximized and urgent. * the client is maximized and urgent.
* @usebeautiful beautiful.border_width_fullscreen_urgent The border width when * @usebeautiful beautiful.border_width_fullscreen_urgent The border width when
* the client is fullscreen and urgent. * the client is fullscreen and urgent.
* @usebeautiful beautiful.titlebar_fg_urgent
* @usebeautiful beautiful.titlebar_bg_urgent
* @usebeautiful beautiful.titlebar_bgimage_urgent
* @usebeautiful beautiful.fg_urgent
* @usebeautiful beautiful.bg_urgent
*/ */
/** /**
@ -875,10 +918,17 @@ lua_class_t client_class;
/** /**
* The client opacity. * The client opacity.
* *
* The opacity only works when a compositing manager, such as
* [picom](https://github.com/yshui/picom/), is used. Otherwise,
* the clients will remain opaque.
*
* @DOC_awful_client_opacity1_EXAMPLE@
*
* @property opacity * @property opacity
* @tparam number opacity Between 0 (transparent) to 1 (opaque). * @tparam number opacity Between 0 (transparent) to 1 (opaque).
* @propemits false false * @propemits false false
* @see request::border * @see request::border
* @see awesome.composite_manager_running
*/ */
/** /**
@ -1365,6 +1415,7 @@ lua_class_t client_class;
* @method struts * @method struts
* @see geometry * @see geometry
* @see screen.workarea * @see screen.workarea
* @see dockable
*/ */
/** Get or set mouse buttons bindings for a client. /** Get or set mouse buttons bindings for a client.
@ -1373,6 +1424,9 @@ lua_class_t client_class;
* @tparam table buttons * @tparam table buttons
* @propemits false false * @propemits false false
* @see awful.button * @see awful.button
* @see append_mousebinding
* @see remove_mousebinding
* @see request::default_mousebindings
*/ */
/** Get the number of instances. /** Get the number of instances.
@ -2922,7 +2976,7 @@ client_kill(client_t *c)
/** Get all clients into a table. /** Get all clients into a table.
* *
* @tparam[opt] integer screen A screen number to filter clients on. * @tparam[opt] integer|screen screen A screen number to filter clients on.
* @tparam[opt] boolean stacked Return clients in stacking order? (ordered from * @tparam[opt] boolean stacked Return clients in stacking order? (ordered from
* top to bottom). * top to bottom).
* @treturn table A table with clients. * @treturn table A table with clients.
@ -3082,7 +3136,9 @@ out:
* *
* This method can be used to close (kill) a **client** using the * This method can be used to close (kill) a **client** using the
* X11 protocol. To use the POSIX way to kill a **process**, use * X11 protocol. To use the POSIX way to kill a **process**, use
* `awesome.kill`. * `awesome.kill` (using the client `pid` property).
*
* @DOC_sequences_client_kill1_EXAMPLE@
* *
* @method kill * @method kill
* @see awesome.kill * @see awesome.kill
@ -3154,6 +3210,8 @@ luaA_client_swap(lua_State *L)
* *
* Use the `first_tag` field to access the first tag of a client directly. * Use the `first_tag` field to access the first tag of a client directly.
* *
* @DOC_sequences_client_tags1_EXAMPLE@
*
* @tparam table tags_table A table with tags to set, or `nil` to get the * @tparam table tags_table A table with tags to set, or `nil` to get the
* current tags. * current tags.
* @treturn table A table with all tags. * @treturn table A table with all tags.
@ -3514,6 +3572,8 @@ HANDLE_TITLEBAR(bottom, CLIENT_TITLEBAR_BOTTOM)
HANDLE_TITLEBAR(left, CLIENT_TITLEBAR_LEFT) HANDLE_TITLEBAR(left, CLIENT_TITLEBAR_LEFT)
/** Return or set client geometry. /** Return or set client geometry.
*
* @DOC_sequences_client_geometry1_EXAMPLE@
* *
* @tparam table|nil geo A table with new coordinates, or nil. * @tparam table|nil geo A table with new coordinates, or nil.
* @tparam integer geo.x The horizontal position. * @tparam integer geo.x The horizontal position.
@ -4190,6 +4250,9 @@ luaA_client_set_shape_input(lua_State *L, client_t *c)
* @tparam table keys * @tparam table keys
* @propemits false false * @propemits false false
* @see awful.key * @see awful.key
* @see append_keybinding
* @see remove_keybinding
* @see request::default_keybindings
*/ */
static int static int
luaA_client_keys(lua_State *L) luaA_client_keys(lua_State *L)

View File

@ -0,0 +1,96 @@
--DOC_NO_USAGE --DOC_GEN_IMAGE --DOC_ASTERISK --DOC_HIDE_START
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
screen[1]._resize {width = 480, height = 200}
local wb = awful.wibar { position = "top" }
-- 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])
-- Only bother with widgets that are visible by default
local mykeyboardlayout = awful.widget.keyboardlayout()
local mytextclock = wibox.widget.textclock()
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {})
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {})
client.connect_signal("request::titlebars", function(c)
local top_titlebar = awful.titlebar(c, {
height = 20,
bg_normal = beautiful.bg_normal,
})
top_titlebar : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
wb:setup {
layout = wibox.layout.align.horizontal,
{
mytaglist,
layout = wibox.layout.fixed.horizontal,
},
mytasklist,
{
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
mytextclock,
},
}
require("gears.timer").run_delayed_calls_now()
local counter = 0
local function gen_client(label)
local c = client.gen_fake {hide_first=true}
c:geometry {
x = 45 + counter*1.75,
y = 30 + counter,
height = 60,
width = 230,
}
c._old_geo = {c:geometry()}
c:set_label(label)
c:emit_signal("request::titlebars")
c.border_color = beautiful.bg_highlight
c.border_width = 2
counter = counter + 40
return c
end
local c1 = gen_client("Opacity: 1")
local c2 = gen_client("Opacity: 0.5")
local c3 = gen_client("Opacity: 0.1")
--DOC_HIDE_END
c1.opacity = 1
c2.opacity = 0.5
c3.opacity = 0.1
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,100 @@
--DOC_NO_USAGE --DOC_GEN_IMAGE --DOC_HIDE_START
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
local gears = { shape = require("gears.shape") }
screen[1]._resize {width = 480, height = 200}
awful.client.object.set_shape = nil
awful.client.object.get_shape = nil
local wb = awful.wibar { position = "top" }
-- 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])
-- Only bother with widgets that are visible by default
local mykeyboardlayout = awful.widget.keyboardlayout()
local mytextclock = wibox.widget.textclock()
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {})
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {})
client.connect_signal("request::titlebars", function(c)
local top_titlebar = awful.titlebar(c, {
height = 20,
bg_normal = beautiful.bg_normal,
})
top_titlebar : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
wb:setup {
layout = wibox.layout.align.horizontal,
{
mytaglist,
layout = wibox.layout.fixed.horizontal,
},
mytasklist,
{
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
mytextclock,
},
}
require("gears.timer").run_delayed_calls_now()
local counter = 0
local function gen_client(label)
local c = client.gen_fake {hide_first=true}
c:geometry {
x = 45 + counter*1.75,
y = 30 + counter,
height = 60,
width = 230,
}
c._old_geo = {c:geometry()}
c.border_width = 2
c:set_label(label)
c:emit_signal("request::titlebars")
c.border_color = beautiful.bg_highlight
counter = counter + 40
return c
end
local c1 = gen_client("Rectangle (default)")
local c2 = gen_client("Rounded rect")
local c3 = gen_client("Octogon")
--DOC_HIDE_END
c1.shape = gears.shape.rectangle
c2.shape = gears.shape.rounded_rect
c3.shape = gears.shape.octogon
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,97 @@
--DOC_NO_USAGE --DOC_GEN_IMAGE --DOC_ASTERISK --DOC_HIDE_START
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
screen[1]._resize {width = 480, height = 200}
local wb = awful.wibar { position = "top" }
-- 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])
-- Only bother with widgets that are visible by default
local mykeyboardlayout = awful.widget.keyboardlayout()
local mytextclock = wibox.widget.textclock()
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {})
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {})
client.connect_signal("request::titlebars", function(c)
local top_titlebar = awful.titlebar(c, {
height = 20,
bg_normal = beautiful.bg_normal,
})
top_titlebar : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
wb:setup {
layout = wibox.layout.align.horizontal,
{
mytaglist,
layout = wibox.layout.fixed.horizontal,
},
mytasklist,
{
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
mytextclock,
},
}
require("gears.timer").run_delayed_calls_now()
local counter = 0
local function gen_client(label)
local c = client.gen_fake {hide_first=true}
c:geometry {
x = 45 + counter*1.75,
y = 30 + counter,
height = 60,
width = 230,
}
c._old_geo = {c:geometry()}
c:set_label(label)
c:emit_signal("request::titlebars")
c.border_color = beautiful.bg_highlight
c.name = label
counter = counter + 40
return c
end
local c1 = gen_client("Client 1 (in tasktar)")
local c2 = gen_client("Client 2 (NOT in taskbar)")
local c3 = gen_client("Client 3 (in taskbar)")
--DOC_HIDE_END
c1.skip_taskbar = false
c2.skip_taskbar = true
c3.skip_taskbar = false
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,125 @@
--DOC_NO_USAGE --DOC_GEN_IMAGE --DOC_ASTERISK --DOC_HIDE_START
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
screen[1]._resize {width = 480, height = 200}
local wb = awful.wibar { position = "top" }
-- 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])
-- Only bother with widgets that are visible by default
local mykeyboardlayout = awful.widget.keyboardlayout()
local mytextclock = wibox.widget.textclock()
local mytaglist = awful.widget.taglist(screen[1], awful.widget.taglist.filter.all, {})
local mytasklist = awful.widget.tasklist(screen[1], awful.widget.tasklist.filter.currenttags, {})
client.connect_signal("request::titlebars", function(c)
local top_titlebar = awful.titlebar(c, {
height = 20,
bg_normal = beautiful.bg_normal,
})
top_titlebar : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
wb:setup {
layout = wibox.layout.align.horizontal,
{
mytaglist,
layout = wibox.layout.fixed.horizontal,
},
mytasklist,
{
layout = wibox.layout.fixed.horizontal,
mykeyboardlayout,
mytextclock,
},
}
require("gears.timer").run_delayed_calls_now()
local counter = 0
local function gen_client(label)
local c = client.gen_fake {hide_first=true}
c:geometry {
x = 45 + counter*1.75,
y = 30 + counter,
height = 60,
width = 230,
}
c._old_geo = {c:geometry()}
c:set_label(label)
counter = counter + 40
c.class = label
return c
end
local c1 = gen_client("Inactive")
local c2 = gen_client("Urgent")
local c3 = gen_client("Focus")
local c4 = gen_client("Tag")
c4:tags{screen[1].tags[2]}
--DOC_HIDE_END
-- Affects mostly the taglist and tasklist..
beautiful.fg_urgent = "#ffffff"
beautiful.bg_urgent = "#ff0000"
--DOC_NEWLINE
-- Set the client border to be orange and large.
beautiful.border_color_urgent = "#ffaa00"
beautiful.border_width_urgent = 6
--DOC_NEWLINE
-- Set the titlebar green.
beautiful.titlebar_bg_urgent = "#00ff00"
beautiful.titlebar_fg_urgent = "#000000"
--DOC_NEWLINE
-- This client is in the current tag.
c2.urgent = true
--DOC_NEWLINE
-- This client is in a deselected tag.
c4.urgent = true
--DOC_HIDE_START
c1:emit_signal("request::titlebars")
c2:emit_signal("request::titlebars")
c3:emit_signal("request::titlebars")
return {honor_titlebar_colors = true}
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -0,0 +1,64 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE --DOC_GEN_OUTPUT --DOC_HIDE_START
local module = ...
local awful = {tag = require("awful.tag"), layout = require("awful.layout")}
local beautiful = require("beautiful")
require("awful.ewmh")
screen[1]._resize {x = 0, width = 160, height = 90}
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile)
function awful.spawn(name, properties)
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, tags = properties.tags}
end
local function color_focus()
for _, c in ipairs(client.get()) do
c.color = c.active and "#ff777733" or beautiful.bg_normal
end
end
module.add_event("Spawn some apps", function()
for tag_idx = 1, 3 do
for i = 1, 3 do
awful.spawn("c"..((tag_idx-1)*3+i), {tags = {screen[1].tags[tag_idx]}})
end
end
client.get()[2]:activate{}
color_focus()
end)
--DOC_NEWLINE
module.display_tags()
module.add_event('Activate "c8"', function()
-- Mitigate a bug in the shims.
client.get()[8]:activate {
switch_to_tag = true,
raise = true,
context = "somet_reason",
}
--DOC_HIDE_END
client.get()[8]:activate {
switch_to_tag = true,
raise = true,
context = "somet_reason",
}
--DOC_NEWLINE
-- Since this isnt denied by any permission, it will be true.
print(
"Confirm:", client.get()[8].active, client.focus == client.get()[8]
)
--DOC_HIDE_START
color_focus()
end)
module.display_tags()
module.execute { display_screen = false, display_clients = true ,
display_label = false, display_client_name = true }

View File

@ -0,0 +1 @@
Confirm: true true

View File

@ -0,0 +1,34 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 800, height = 600} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn some tiled apps", function() --DOC_HIDE
for i = 1, 5 do
awful.spawn("Client #"..i)
end
client.get()[1].color = "#f8dcdb" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Raise and un-tile", function() --DOC_HIDE
client.get()[1].floating = true
client.get()[1]:geometry {x= 100, y=150, width = 500, height = 300} --DOC_HIDE
client.get()[1]:raise()
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

View File

@ -0,0 +1,52 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_ASTERISK --DOC_NO_USAGE --DOC_GEN_OUTPUT
local module = ...
require("ruled.client")
local awful = {tag = require("awful.tag"), layout = require("awful.layout")}
awful.placement = require("awful.placement")
require("awful.ewmh")
screen[1]:fake_resize(0, 0, 800, 480)
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile)
function awful.spawn(name)
client.gen_fake{class = name, name = name, x = 4, y=10, width = 60, height =50, screen=screen[1]}
end
--DOC_NEWLINE
module.add_event("Spawn a floating client.", function()
--DOC_HIDE_END
awful.spawn("")
--DOC_NEWLINE
client.get()[1].floating = true
--DOC_NEWLINE
--DOC_HIDE_START
end)
module.display_tags()
module.add_event("Move and resize it.", function()
--DOC_HIDE_END
client.get()[1]:geometry {
x = 200,
y = 200,
width = 300,
height = 240
}
--DOC_NEWLINE
-- It can also read the geometry.
local geo = client.get()[1]:geometry()
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
--DOC_HIDE_START
end)
module.display_tags()
module.execute { display_screen = true , display_clients = true,
display_label = false, display_client_name = true,
display_mouse = false,
}

View File

@ -0,0 +1 @@
Client geometry: 200 200 300 240

View File

@ -0,0 +1,29 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, floating = true} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn a client", function() --DOC_HIDE
awful.spawn("") --DOC_HIDE
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Change the `height` property", function() --DOC_HIDE
client.focus.height = 100
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,45 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
local beautiful = require("beautiful") --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name, properties) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, tags = properties.tags} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn some apps", function() --DOC_HIDE
for tag_idx = 1, 3 do
for _ = 1, 3 do
awful.spawn("", {tags = {screen[1].tags[tag_idx]}})
end
end
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Call `:jump_to()`, which will select tag #2", function() --DOC_HIDE
client.get()[6]:jump_to()
client.get()[1].color = beautiful.bg_normal --DOC_HIDE
client.get()[6].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.add_event("Call `:jump_to(true)`, which will select tag #2 and #3", function() --DOC_HIDE
--DOC_NEWLINE
client.get()[7]:jump_to(true)
client.get()[6].color = beautiful.bg_normal --DOC_HIDE
client.get()[7].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,50 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_ASTERISK --DOC_NO_USAGE
local module = ...
require("ruled.client")
local awful = {tag = require("awful.tag"), layout = require("awful.layout")}
awful.placement = require("awful.placement")
require("awful.ewmh")
screen[1]:fake_resize(0, 0, 800, 480)
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile)
function awful.spawn(name)
client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=screen[1]}
end
--DOC_NEWLINE
module.add_event("Spawn 5 clients in a `awful.layout.suit.tile` layout.", function()
--DOC_HIDE_END
-- Spawn a client on screen #3
for i=1, 5 do
awful.spawn("Client #"..i)
end
--DOC_NEWLINE
client.get()[5]:activate {}
client.get()[5].color = "#ff777733" --DOC_HIDE
--DOC_NEWLINE
--DOC_HIDE_START
end)
module.display_tags()
module.add_event("Kill the the 4th and 5th clients.", function()
--DOC_HIDE_END
local c4, c5 = client.get()[4], client.get()[5]
--DOC_NEWLINE
-- Kill the clients.
c4:kill()
c5:kill()
--DOC_HIDE_START
end)
module.display_tags()
module.execute { display_screen = true , display_clients = true,
display_label = false, display_client_name = true,
display_mouse = false,
}

View File

@ -0,0 +1,43 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE --DOC_ASTERISK
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 800, height = 600} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn some apps", function() --DOC_HIDE
for _ = 1, 3 do
awful.spawn("")
end
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Minimize the focused client", function() --DOC_HIDE
client.get()[1].minimized = true
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Raise and focus", function() --DOC_HIDE
-- That's the best way to unminimize if you also want to set the focus.
client.get()[1]:activate {
context = "unminimize",
raise = true,
}
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

View File

@ -0,0 +1,54 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
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[1]} --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 = 100, y = 100 }
assert(mouse.screen == screen[1]) --DOC_HIDE
--DOC_NEWLINE
-- Spawn a client on screen #3
awful.spawn("firefox")
assert(client.get()[1].screen == screen[1]) --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]:move_to_screen(screen[2])
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Move to next screen", function() --DOC_HIDE
-- This will default to the next screen (by index).
client.get()[1]:move_to_screen()
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

View File

@ -0,0 +1,33 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name, properties) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, tags = properties.tags} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn some apps", function() --DOC_HIDE
for tag_idx = 1, 3 do
for _ = 1, 3 do
awful.spawn("", {tags = {screen[1].tags[tag_idx]}})
end
end
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Call `:move_to_tag()`", function() --DOC_HIDE
client.get()[1]:move_to_tag(screen[1].tags[2])
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,61 @@
--DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE --DOC_GEN_OUTPUT
local module = ...
require("ruled.client")
local awful = {tag = require("awful.tag"), layout = require("awful.layout")}
awful.placement = require("awful.placement")
require("awful.ewmh")
screen[1]:fake_resize(0, 0, 800, 480)
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.tile)
function awful.spawn(name)
client.gen_fake{class = name, name = name, x = 4, y=10, width = 60, height =50, screen=screen[1]}
end
--DOC_NEWLINE
module.add_event("Spawn a floating client.", function()
--DOC_HIDE_END
awful.spawn("")
--DOC_NEWLINE
client.get()[1].floating = true
--DOC_NEWLINE
--DOC_HIDE_START
end)
module.display_tags()
module.add_event("Move it.", function()
--DOC_HIDE_END
client.get()[1]:relative_move(100, 100)
--DOC_NEWLINE
local geo = client.get()[1]:geometry()
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
--DOC_NEWLINE
--DOC_HIDE_START
end)
module.display_tags()
module.add_event("Resize it.", function()
--DOC_HIDE_END
client.get()[1]:relative_move(nil, nil, 100, 100)
--DOC_NEWLINE
local geo = client.get()[1]:geometry()
print("Client geometry:", geo.x, geo.y, geo.width, geo.height)
--DOC_HIDE_START
end)
module.display_tags()
module.execute { display_screen = true , display_clients = true,
display_label = false, display_client_name = true,
display_mouse = false,
}

View File

@ -0,0 +1,2 @@
Client geometry: 110 110 120 100
Client geometry: 220 220 220 200

View File

@ -0,0 +1,42 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE --DOC_GEN_OUTPUT --DOC_ASTERISK
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name, properties) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, tags = properties.tags} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn some apps", function() --DOC_HIDE
for tag_idx = 1, 3 do
for _ = 1, 3 do
awful.spawn("", {tags = {screen[1].tags[tag_idx]}})
end
end
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Set the tags", function() --DOC_HIDE
client.get()[1]:tags {
screen[1].tags[2],
screen[1].tags[3]
}
--DOC_NEWLINE
-- It also works to get the tags.
for _, t in ipairs(client.get()[1]:tags()) do
print("Tag:", t.index, t.name)
end
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,2 @@
Tag: 2 two
Tag: 3 three

View File

@ -0,0 +1,40 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three", "four" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn some apps", function() --DOC_HIDE
awful.spawn("Client")
--DOC_NEWLINE
client.get()[1].color = "#ff777733" --DOC_HIDE
screen[1].tags[1].selected = false
screen[1].tags[2].selected = true
screen[1].tags[3].selected = true
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Call `:to_selected_tags()`", function() --DOC_HIDE
-- Deselect all tags, otherwise it will do nothing.
client.get()[1]:tags{}
--DOC_NEWLINE
client.get()[1]:to_selected_tags()
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,33 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name, properties) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, tags = properties.tags} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn some apps", function() --DOC_HIDE
for tag_idx = 1, 3 do
for _ = 1, 3 do
awful.spawn("", {tags = {screen[1].tags[tag_idx]}})
end
end
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Call `:toggle_tag(screen[1].tags[2])`", function() --DOC_HIDE
client.get()[1]:toggle_tag(screen[1].tags[2])
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,29 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, floating = true} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn a client", function() --DOC_HIDE
awful.spawn("") --DOC_HIDE
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Change the `width` property", function() --DOC_HIDE
client.focus.width = 100
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,29 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, floating = true} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn a client", function() --DOC_HIDE
awful.spawn("") --DOC_HIDE
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Change the `x` property", function() --DOC_HIDE
client.focus.x = 100
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -0,0 +1,29 @@
--DOC_GEN_IMAGE --DOC_NO_USAGE
local module = ... --DOC_HIDE
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
require("awful.ewmh") --DOC_HIDE
screen[1]._resize {x = 0, width = 160, height = 90} --DOC_HIDE
awful.tag({ "one", "two", "three" }, screen[1], awful.layout.suit.tile) --DOC_HIDE
function awful.spawn(name) --DOC_HIDE
client.gen_fake{class = name, name = name, x = 10, y=10, width = 60, height =50, floating = true} --DOC_HIDE
end --DOC_HIDE
module.add_event("Spawn a client", function() --DOC_HIDE
awful.spawn("") --DOC_HIDE
client.get()[1].color = "#ff777733" --DOC_HIDE
end) --DOC_HIDE
--DOC_NEWLINE
module.display_tags() --DOC_HIDE
module.add_event("Change the `y` property", function() --DOC_HIDE
client.focus.y = 50
end) --DOC_HIDE
module.display_tags() --DOC_HIDE
module.execute { display_screen = false, display_clients = true , --DOC_HIDE
display_label = false, display_client_name = true } --DOC_HIDE

View File

@ -245,10 +245,18 @@ end
local function get_all_tag_clients(t) local function get_all_tag_clients(t)
local s = t.screen local s = t.screen
local clients = gtable.clone(t:clients(), false) local all_clients = gtable.clone(t:clients(), false)
local clients = {}
for _, c in ipairs(all_clients) do
if not c.minimized then
table.insert(clients, c)
end
end
for _, c in ipairs(s.clients) do for _, c in ipairs(s.clients) do
if c.sticky then if c.sticky and not c.minimized then
if not gtable.hasitem(clients, c) then if not gtable.hasitem(clients, c) then
table.insert(clients, c) table.insert(clients, c)
end end
@ -304,6 +312,7 @@ local function fake_arrange(tag)
for _, geo_src in ipairs {param.geometries, flt } do for _, geo_src in ipairs {param.geometries, flt } do
for c, geo in pairs(geo_src) do for c, geo in pairs(geo_src) do
geo.c = geo.c or c geo.c = geo.c or c
geo.color = geo.c.color
table.insert(ret, geo) table.insert(ret, geo)
end end
end end
@ -332,7 +341,7 @@ local function gen_fake_clients(tag, args)
local y = (geom.y*h)/sgeo.height local y = (geom.y*h)/sgeo.height
local width = (geom.width*w)/sgeo.width local width = (geom.width*w)/sgeo.width
local height = (geom.height*h)/sgeo.height local height = (geom.height*h)/sgeo.height
cr:set_source(color(geom.c.color or beautiful.bg_normal)) cr:set_source(color(geom.color or beautiful.bg_normal))
cr:rectangle(x,y,width,height) cr:rectangle(x,y,width,height)
cr:fill_preserve() cr:fill_preserve()
cr:set_source(color(geom.c.border_color or beautiful.border_color)) cr:set_source(color(geom.c.border_color or beautiful.border_color))