From 8f71ef6dff802476a1e7e9bea9a21bf87e030e57 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sat, 13 Nov 2021 00:21:21 -0800 Subject: [PATCH] doc: Document the tasklist widget. --- lib/awful/widget/tasklist.lua | 64 +++++++++- .../client/tasklist_custom_filter1.lua | 96 ++++++++++++++ .../client/tasklist_custom_source1.lua | 102 +++++++++++++++ .../client/tasklist_filter_allscreen1.lua | 82 ++++++++++++ .../client/tasklist_filter_alltags1.lua | 79 ++++++++++++ .../client/tasklist_filter_currenttags1.lua | 80 ++++++++++++ .../client/tasklist_filter_focused1.lua | 73 +++++++++++ .../tasklist_filter_minimizedcurrenttags1.lua | 82 ++++++++++++ .../sequences/client/tasklist_layout1.lua | 117 ++++++++++++++++++ .../sequences/client/tasklist_screen1.lua | 87 +++++++++++++ .../client/tasklist_widget_template1.lua | 89 +++++++++++++ .../wibox/awidget/tasklist/style_align.lua | 39 ++++++ .../wibox/awidget/tasklist/style_bg_focus.lua | 64 ++++++++++ .../awidget/tasklist/style_bg_minimize.lua | 64 ++++++++++ .../awidget/tasklist/style_bg_normal.lua | 64 ++++++++++ .../awidget/tasklist/style_bg_urgent.lua | 64 ++++++++++ .../awidget/tasklist/style_disable_icon.lua | 38 ++++++ .../tasklist/style_disable_task_name.lua | 39 ++++++ .../wibox/awidget/tasklist/style_fg_focus.lua | 51 ++++++++ .../awidget/tasklist/style_fg_minimize.lua | 51 ++++++++ .../awidget/tasklist/style_fg_normal.lua | 51 ++++++++ .../awidget/tasklist/style_fg_urgent.lua | 51 ++++++++ .../wibox/awidget/tasklist/style_font.lua | 51 ++++++++ .../awidget/tasklist/style_font_focus.lua | 51 ++++++++ .../awidget/tasklist/style_font_minimized.lua | 51 ++++++++ .../awidget/tasklist/style_font_urgent.lua | 51 ++++++++ .../tasklist/style_plain_task_name.lua | 45 +++++++ .../wibox/awidget/tasklist/style_shape.lua | 51 ++++++++ .../tasklist/style_shape_border_color.lua | 58 +++++++++ .../style_shape_border_color_minimized.lua | 71 +++++++++++ .../style_shape_border_color_urgent.lua | 71 +++++++++++ .../tasklist/style_shape_border_width.lua | 46 +++++++ .../style_shape_border_width_minimized.lua | 57 +++++++++ .../style_shape_border_width_urgent.lua | 58 +++++++++ .../awidget/tasklist/style_shape_focus.lua | 63 ++++++++++ .../style_shape_focus_border_width.lua | 58 +++++++++ .../style_shape_focus_border_width_focus.lua | 71 +++++++++++ .../tasklist/style_shape_minimized.lua | 63 ++++++++++ .../awidget/tasklist/style_shape_urgent.lua | 63 ++++++++++ .../wibox/awidget/tasklist/style_spacing.lua | 39 ++++++ 40 files changed, 2541 insertions(+), 4 deletions(-) create mode 100644 tests/examples/sequences/client/tasklist_custom_filter1.lua create mode 100644 tests/examples/sequences/client/tasklist_custom_source1.lua create mode 100644 tests/examples/sequences/client/tasklist_filter_allscreen1.lua create mode 100644 tests/examples/sequences/client/tasklist_filter_alltags1.lua create mode 100644 tests/examples/sequences/client/tasklist_filter_currenttags1.lua create mode 100644 tests/examples/sequences/client/tasklist_filter_focused1.lua create mode 100644 tests/examples/sequences/client/tasklist_filter_minimizedcurrenttags1.lua create mode 100644 tests/examples/sequences/client/tasklist_layout1.lua create mode 100644 tests/examples/sequences/client/tasklist_screen1.lua create mode 100644 tests/examples/sequences/client/tasklist_widget_template1.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_align.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_bg_focus.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_bg_minimize.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_bg_normal.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_bg_urgent.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_disable_icon.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_disable_task_name.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_fg_focus.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_fg_minimize.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_fg_normal.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_fg_urgent.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_font.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_font_focus.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_font_minimized.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_font_urgent.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_plain_task_name.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_border_color.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_border_color_minimized.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_border_color_urgent.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_border_width.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_border_width_minimized.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_border_width_urgent.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_focus.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width_focus.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_minimized.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_shape_urgent.lua create mode 100644 tests/examples/wibox/awidget/tasklist/style_spacing.lua diff --git a/lib/awful/widget/tasklist.lua b/lib/awful/widget/tasklist.lua index b31c2a6f2..a2bdc40ef 100644 --- a/lib/awful/widget/tasklist.lua +++ b/lib/awful/widget/tasklist.lua @@ -105,41 +105,65 @@ local tasklist = { mt = {} } local instances --- The default foreground (text) color. +-- +-- @DOC_wibox_awidget_tasklist_style_fg_normal_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_fg_normal -- @tparam[opt=nil] string|pattern fg_normal -- @see gears.color --- The default background color. +-- +-- @DOC_wibox_awidget_tasklist_style_bg_normal_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_bg_normal -- @tparam[opt=nil] string|pattern bg_normal -- @see gears.color --- The focused client foreground (text) color. +-- +-- @DOC_wibox_awidget_tasklist_style_fg_focus_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_fg_focus -- @tparam[opt=nil] string|pattern fg_focus -- @see gears.color --- The focused client background color. +-- +-- @DOC_wibox_awidget_tasklist_style_bg_focus_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_bg_focus -- @tparam[opt=nil] string|pattern bg_focus -- @see gears.color --- The urgent clients foreground (text) color. +-- +-- @DOC_wibox_awidget_tasklist_style_fg_urgent_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_fg_urgent -- @tparam[opt=nil] string|pattern fg_urgent -- @see gears.color --- The urgent clients background color. +-- +-- @DOC_wibox_awidget_tasklist_style_bg_urgent_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_bg_urgent -- @tparam[opt=nil] string|pattern bg_urgent -- @see gears.color --- The minimized clients foreground (text) color. +-- +-- @DOC_wibox_awidget_tasklist_style_fg_minimize_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_fg_minimize -- @tparam[opt=nil] string|pattern fg_minimize -- @see gears.color --- The minimized clients background color. +-- +-- @DOC_wibox_awidget_tasklist_style_bg_minimize_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_bg_minimize -- @tparam[opt=nil] string|pattern bg_minimize -- @see gears.color @@ -161,10 +185,16 @@ local instances -- @tparam[opt=nil] string bg_image_minimize --- Disable the tasklist client icons. +-- +-- @DOC_wibox_awidget_tasklist_style_disable_icon_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_disable_icon -- @tparam[opt=false] boolean tasklist_disable_icon --- Disable the tasklist client titles. +-- +-- @DOC_wibox_awidget_tasklist_style_disable_task_name_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_disable_task_name -- @tparam[opt=false] boolean tasklist_disable_task_name @@ -172,6 +202,8 @@ local instances -- -- See the Status icons section for more details. -- +-- @DOC_wibox_awidget_tasklist_style_plain_task_name_EXAMPLE@ +-- -- @beautiful beautiful.tasklist_plain_task_name -- @tparam[opt=false] boolean tasklist_plain_task_name @@ -578,6 +610,10 @@ end --- Set the tasklist layout. -- +-- This can be used to change the layout based on the number of clients: +-- +-- @DOC_sequences_client_tasklist_layout1_EXAMPLE@ +-- -- @property base_layout -- @tparam[opt=wibox.layout.flex.horizontal] wibox.layout base_layout -- @propemits true false @@ -585,15 +621,24 @@ end --- The tasklist screen. -- +-- @DOC_sequences_client_tasklist_screen1_EXAMPLE@ +-- -- @property screen -- @tparam screen screen -- @propemits true false --- A function to narrow down the list of clients. -- +-- @DOC_sequences_client_tasklist_custom_filter1_EXAMPLE@ +-- -- @property filter -- @tparam function filter -- @propemits true false +-- @see awful.widget.tasklist.filter.allscreen +-- @see awful.widget.tasklist.filter.alltags +-- @see awful.widget.tasklist.filter.currenttags +-- @see awful.widget.tasklist.filter.minimizedcurrenttags +-- @see awful.widget.tasklist.filter.focused --- A function called when the tasklist is refreshed. -- @@ -606,15 +651,20 @@ end --- A template for creating the client widgets. -- +-- @DOC_sequences_client_tasklist_widget_template1_EXAMPLE@ +-- -- @property widget_template -- @tparam table widget_template -- @propemits true false --- A function to gather the clients to display. -- +-- @DOC_sequences_client_tasklist_custom_source1_EXAMPLE@ +-- -- @property source -- @tparam function source -- @propemits true false +-- @see awful.widget.tasklist.source.all_clients function tasklist:set_base_layout(layout) self._private.base_layout = base.make_widget_from_value( @@ -990,8 +1040,11 @@ function tasklist.filter.currenttags(c, screen) end --- Filtering function to include only the minimized clients from currently selected tags. --- @param c The client. --- @param screen The screen we are drawing on. +-- +--@DOC_sequences_client_tasklist_filter_minimizedcurrenttags1_EXAMPLE@ +-- +-- @tparam client c The client. +-- @tparam screen screen The screen we are drawing on. -- @return true if c is in a selected tag on screen and is minimized, false otherwise -- @filterfunction awful.widget.tasklist.filter.minimizedcurrenttags function tasklist.filter.minimizedcurrenttags(c, screen) @@ -1018,8 +1071,11 @@ function tasklist.filter.minimizedcurrenttags(c, screen) end --- Filtering function to include only the currently focused client. --- @param c The client. --- @param screen The screen we are drawing on. +-- +--@DOC_sequences_client_tasklist_filter_focused1_EXAMPLE@ +-- +-- @tparam client c The client. +-- @tparam screen screen The screen we are drawing on. -- @return true if c is focused on screen, false otherwise -- @filterfunction awful.widget.tasklist.filter.focused function tasklist.filter.focused(c, screen) diff --git a/tests/examples/sequences/client/tasklist_custom_filter1.lua b/tests/examples/sequences/client/tasklist_custom_filter1.lua new file mode 100644 index 000000000..d9bd0ecc9 --- /dev/null +++ b/tests/examples/sequences/client/tasklist_custom_filter1.lua @@ -0,0 +1,96 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button"), + layout = require("awful.layout") +} +require("awful.ewmh") +local wibox = require("wibox") +screen[1]:fake_resize(0, 0, 1024, 640) +screen.fake_add(1050, 0, 1024, 640).outputs = {["eVGA1"] = {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) +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[2], awful.layout.suit.tile.left) + + +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=args.screen} +end + + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for i= 1, 5 do + awful.spawn("Client #"..i, {screen = screen[1]}) + end + + --DOC_NEWLINE + + -- Spawn 3 clients on screen 2. + for i=1, 3 do + awful.spawn("Client #"..(5+i), {screen = screen[2]}) + end + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_tags() +module.display_widget(_tl, nil, 22) + +module.add_event("Set the filter to allscreen.", function() + --DOC_HIDE_END + -- Set the filter to allscreen. + tasklist.filter = awful.widget.tasklist.filter.allscreen + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.add_event("Set a custom filter function.", function() + --DOC_HIDE_END + -- Create a pointless demo filter to only have clients + -- with off numbers in the name. Because... example! + tasklist.filter = function(c, screen) -- luacheck: no unused args + return c.name:match("[13579]") and c or nil + end + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = true , display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_custom_source1.lua b/tests/examples/sequences/client/tasklist_custom_source1.lua new file mode 100644 index 000000000..29dfa161d --- /dev/null +++ b/tests/examples/sequences/client/tasklist_custom_source1.lua @@ -0,0 +1,102 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button"), + layout = require("awful.layout") +} +require("awful.ewmh") +local wibox = require("wibox") +screen[1]:fake_resize(0, 0, 1024, 640) + +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) + +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{class = name, name = name, x = 2094, y=10, width = 600, height =300, screen=args.screen} +end + + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for i= 1, 5 do + awful.spawn("Client #"..i, {screen = screen[1]}) + end + + --DOC_NEWLINE + + -- Make 2 clients floating. + client.get()[2].floating = true + client.get()[4].floating = true + + --DOC_NEWLINE + + --DOC_HIDE_START + client.get()[2]:geometry { + x = 150, y = 100, + } + client.get()[4]:geometry { + x = 300, y = 200, + } + + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_tags() +module.display_widget(_tl, nil, 22) + +module.add_event("Set a custom source function.", function() + --DOC_HIDE_END + -- Only select the floating clients for the tasklist screen. + tasklist.source = function(screen) + local ret = {} + + --DOC_NEWLINE + for _, c in ipairs(screen.clients) do + if c.floating then + table.insert(ret, c) + end + end + --DOC_NEWLINE + + return ret + end + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = true , display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_filter_allscreen1.lua b/tests/examples/sequences/client/tasklist_filter_allscreen1.lua new file mode 100644 index 000000000..93400b192 --- /dev/null +++ b/tests/examples/sequences/client/tasklist_filter_allscreen1.lua @@ -0,0 +1,82 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button"), + layout = require("awful.layout") +} +require("awful.ewmh") +local wibox = require("wibox") +screen[1]:fake_resize(0, 0, 1024, 640) +screen.fake_add(1050, 0, 1024, 640).outputs = {["eVGA1"] = {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) +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[2], awful.layout.suit.tile.left) + +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=args.screen} +end + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for i= 1, 5 do + awful.spawn("Client #"..i, {screen = screen[1]}) + end + + --DOC_NEWLINE + + -- Spawn 3 clients on screen 2. + for i=1, 3 do + awful.spawn("Client #"..(5+i), {screen = screen[2]}) + end + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_tags() +module.display_widget(_tl, nil, 22) + +module.add_event("Set the filter to allscreen.", function() + --DOC_HIDE_END + -- Set the filter to allscreen. + tasklist.filter = awful.widget.tasklist.filter.allscreen + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = true , display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_filter_alltags1.lua b/tests/examples/sequences/client/tasklist_filter_alltags1.lua new file mode 100644 index 000000000..2823129f4 --- /dev/null +++ b/tests/examples/sequences/client/tasklist_filter_alltags1.lua @@ -0,0 +1,79 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button"), + layout = require("awful.layout") +} +require("awful.ewmh") +local wibox = require("wibox") + +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) + +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, tags=args.tags} +end + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for i= 1, 5 do + awful.spawn("Client #"..i, {tags = {screen[1].tags[1]}}) + end + + --DOC_NEWLINE + + -- Spawn 3 clients on screen 2. + for i=1, 3 do + awful.spawn("Client #"..(5+i), {tags = {screen[1].tags[2]}}) + end + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_tags() +module.display_widget(_tl, nil, 22) + +module.add_event("Set the filter to alltags.", function() + --DOC_HIDE_END + -- Set the filter to alltags. + tasklist.filter = awful.widget.tasklist.filter.alltags + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = false, display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_filter_currenttags1.lua b/tests/examples/sequences/client/tasklist_filter_currenttags1.lua new file mode 100644 index 000000000..43f2ea635 --- /dev/null +++ b/tests/examples/sequences/client/tasklist_filter_currenttags1.lua @@ -0,0 +1,80 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button"), + layout = require("awful.layout") +} +require("awful.ewmh") +local wibox = require("wibox") + +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) + +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, tags=args.tags} +end + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for k, t in ipairs(screen[1].tags) do + for i= 1, 2 do + awful.spawn("Client #"..(k-1)*2 + i, {tags = {t}}) + end + end + + --DOC_NEWLINE + + -- Selected some tags. + screen[1].tags[3].selected = true + screen[1].tags[5].selected = true + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_tags() +module.display_widget(_tl, nil, 22) + +module.add_event("Set the filter to currenttags.", function() + --DOC_HIDE_END + -- Set the filter to currenttags. + tasklist.filter = awful.widget.tasklist.filter.currenttags + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = false, display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_filter_focused1.lua b/tests/examples/sequences/client/tasklist_filter_focused1.lua new file mode 100644 index 000000000..c85afc0d3 --- /dev/null +++ b/tests/examples/sequences/client/tasklist_filter_focused1.lua @@ -0,0 +1,73 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button"), + layout = require("awful.layout") +} +require("awful.ewmh") +local wibox = require("wibox") +screen[1]:fake_resize(0, 0, 1024, 640) + +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) + +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=args.screen} +end + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for i= 1, 5 do + awful.spawn("Client #"..i, {screen = screen[1]}) + end + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_tags() +module.display_widget(_tl, nil, 22) + +module.add_event("Set the filter to focused.", function() + --DOC_HIDE_END + -- Set the filter to focused. + tasklist.filter = awful.widget.tasklist.filter.focused + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = true , display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_filter_minimizedcurrenttags1.lua b/tests/examples/sequences/client/tasklist_filter_minimizedcurrenttags1.lua new file mode 100644 index 000000000..07374239a --- /dev/null +++ b/tests/examples/sequences/client/tasklist_filter_minimizedcurrenttags1.lua @@ -0,0 +1,82 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button"), + layout = require("awful.layout") +} +require("awful.ewmh") +local wibox = require("wibox") + +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) + +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{ + class = name, name = name, x = 2094, y=10, width = 60, height =50, tags=args.tags, minimized=args.minimized + } +end + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for k, t in ipairs(screen[1].tags) do + for i= 1, 2 do + awful.spawn("Client #"..(k-1)*2 + i, {tags = {t}, minimized = i == 1}) + end + end + + --DOC_NEWLINE + + -- Selected some tags. + screen[1].tags[3].selected = true + screen[1].tags[5].selected = true + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_tags() +module.display_widget(_tl, nil, 22) + +module.add_event("Set the filter to minimizedcurrenttags.", function() + --DOC_HIDE_END + -- Set the filter to minimizedcurrenttags. + tasklist.filter = awful.widget.tasklist.filter.minimizedcurrenttags + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = false, display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_layout1.lua b/tests/examples/sequences/client/tasklist_layout1.lua new file mode 100644 index 000000000..5619de919 --- /dev/null +++ b/tests/examples/sequences/client/tasklist_layout1.lua @@ -0,0 +1,117 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button") +} +require("awful.ewmh") +local wibox = require("wibox") +screen[1]:fake_resize(0, 0, 800, 480) +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1]) +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + 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), + }, + } + + --DOC_NEWLINE + + tasklist:connect_signal("property::count", function(self) + local count = self.count + --DOC_NEWLINE + if count > 5 and not self.is_grid then + self.base_layout = wibox.widget { + forced_num_rows = 2, + homogeneous = true, + expand = true, + spacing = 2, + layout = wibox.layout.grid.horizontal + } + --DOC_NEWLINE + self.is_grid = true + elseif count <= 5 and self.is_grid then + self.base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal + } + --DOC_NEWLINE + self.is_grid = false + end + end) + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +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.", function() + --DOC_HIDE_END + + -- Spawn 5 clients. + for i=1, 5 do + awful.spawn("Client #"..i) + end + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_widget(_tl, nil, 22) + +module.add_event("Spawn another client.", function() + --DOC_HIDE_END + -- Spawn another client. + awful.spawn("Client #6") + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 44) + +module.add_event("Kill 3 clients.", function() + --DOC_HIDE_END + -- Kill 3 clients. + for _=1, 3 do + client.get()[1]:kill() + end + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = true , display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_screen1.lua b/tests/examples/sequences/client/tasklist_screen1.lua new file mode 100644 index 000000000..392aa15b5 --- /dev/null +++ b/tests/examples/sequences/client/tasklist_screen1.lua @@ -0,0 +1,87 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + layout = require("awful.layout"), + button = require("awful.button") +} +require("awful.ewmh") +screen[1]:fake_resize(0, 0, 1024, 640) +screen.fake_add(1050, 0, 1024, 640).outputs = {["eVGA1"] = {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) +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[2], awful.layout.suit.tile.left) + +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = screen[1], + 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), + }, + } + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +function awful.spawn(name, args) + client.gen_fake{class = name, name = name, x = 2094, y=10, width = 60, height =50, screen=args.screen} +end + +--DOC_NEWLINE + +module.add_event("Spawn some clients.", function() + --DOC_HIDE_END + + -- Spawn 5 clients on screen 1. + for i= 1, 5 do + awful.spawn("Client #"..i, {screen = screen[1]}) + end + + --DOC_NEWLINE + + -- Spawn 3 clients on screen 2. + for i=1, 3 do + awful.spawn("Client #"..(5+i), {screen = screen[2]}) + end + + --DOC_NEWLINE + --DOC_HIDE_START + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +module.display_tags() + +--DOC_NEWLINE +module.display_widget(_tl, nil, 22) + +module.add_event("Change the tasklist screen.", function() + --DOC_HIDE_END + -- Change the tastlist screen. + tasklist.screen = screen[2] + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = true , display_clients = true, + display_label = false , display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/sequences/client/tasklist_widget_template1.lua b/tests/examples/sequences/client/tasklist_widget_template1.lua new file mode 100644 index 000000000..08e373cba --- /dev/null +++ b/tests/examples/sequences/client/tasklist_widget_template1.lua @@ -0,0 +1,89 @@ + --DOC_GEN_IMAGE --DOC_HIDE_START --DOC_NO_USAGE +local module = ... +require("ruled.client") +local awful = { + tag = require("awful.tag"), + widget = { + tasklist = require("awful.widget.tasklist") + }, + button = require("awful.button") +} +require("awful.ewmh") +local wibox = require("wibox") +screen[1]:fake_resize(0, 0, 800, 480) +awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1]) +local s = screen[1] +--DOC_HIDE_END + + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.widget { + spacing = 2, + layout = wibox.layout.fixed.horizontal, + }, + } + + --DOC_NEWLINE + --DOC_HIDE_START + +local _tl = tasklist + +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.", function() + + -- Spawn 5 clients. + for i=1, 5 do + awful.spawn("Client #"..i) + end + + client.get()[2]:activate {} + client.get()[2].color = "#ff777733" +end) + +--DOC_NEWLINE +module.display_widget(_tl, nil, 22) + +module.add_event("Change the widget template.", function() + --DOC_HIDE_END + -- Change the widget template. + tasklist.widget_template = { + { + { + { + { + id = "icon_role", + widget = wibox.widget.imagebox, + }, + margins = 2, + widget = wibox.container.margin, + }, + { + id = "text_role", + widget = wibox.widget.textbox, + }, + layout = wibox.layout.fixed.horizontal, + }, + left = 10, + right = 10, + widget = wibox.container.margin + }, + id = "background_role", + widget = wibox.container.background, + } + --DOC_NEWLINE + --DOC_HIDE_START +end) + +module.display_widget(_tl, nil, 22) + +module.execute { display_screen = true , display_clients = true, + display_label = false, display_client_name = true, + display_mouse = true , +} diff --git a/tests/examples/wibox/awidget/tasklist/style_align.lua b/tests/examples/wibox/awidget/tasklist/style_align.lua new file mode 100644 index 000000000..5ca8c0a29 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_align.lua @@ -0,0 +1,39 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +--DOC_HIDE_END +for _, value in ipairs { "left", "center", "right" } do + beautiful.tasklist_align = value + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + base_layout = wibox.layout.flex.horizontal + } + + tasklist._do_tasklist_update_now() + tasklist.forced_width = 600 + parent:add(_memento(tasklist, 600, 22, nil, true)) --luacheck: globals _memento + --DOC_HIDE_END +end + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_bg_focus.lua b/tests/examples/wibox/awidget/tasklist/style_bg_focus.lua new file mode 100644 index 000000000..cc2a2848a --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_bg_focus.lua @@ -0,0 +1,64 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local gears = { color = require("gears.color") } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_bg_focus = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_bg_minimize.lua b/tests/examples/wibox/awidget/tasklist/style_bg_minimize.lua new file mode 100644 index 000000000..5653b25a8 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_bg_minimize.lua @@ -0,0 +1,64 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local gears = { color = require("gears.color") } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_bg_minimize = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_bg_normal.lua b/tests/examples/wibox/awidget/tasklist/style_bg_normal.lua new file mode 100644 index 000000000..8b75dcb16 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_bg_normal.lua @@ -0,0 +1,64 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local gears = { color = require("gears.color") } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_bg_normal = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_bg_urgent.lua b/tests/examples/wibox/awidget/tasklist/style_bg_urgent.lua new file mode 100644 index 000000000..c29971a61 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_bg_urgent.lua @@ -0,0 +1,64 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local gears = { color = require("gears.color") } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_bg_urgent = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_disable_icon.lua b/tests/examples/wibox/awidget/tasklist/style_disable_icon.lua new file mode 100644 index 000000000..a03edd3fb --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_disable_icon.lua @@ -0,0 +1,38 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +--DOC_HIDE_END +for _, value in ipairs { true, false } do + beautiful.tasklist_disable_icon = value + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_disable_task_name.lua b/tests/examples/wibox/awidget/tasklist/style_disable_task_name.lua new file mode 100644 index 000000000..76b6ebeaa --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_disable_task_name.lua @@ -0,0 +1,39 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +--DOC_HIDE_END +for _, value in ipairs { true, false } do + beautiful.tasklist_disable_task_name = value + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_fg_focus.lua b/tests/examples/wibox/awidget/tasklist/style_fg_focus.lua new file mode 100644 index 000000000..84af9e8bd --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_fg_focus.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff" } do + beautiful.tasklist_fg_focus = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_fg_minimize.lua b/tests/examples/wibox/awidget/tasklist/style_fg_minimize.lua new file mode 100644 index 000000000..b0479f2ac --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_fg_minimize.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff" } do + beautiful.tasklist_fg_minimize = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_fg_normal.lua b/tests/examples/wibox/awidget/tasklist/style_fg_normal.lua new file mode 100644 index 000000000..029412f2c --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_fg_normal.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff" } do + beautiful.tasklist_fg_normal = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_fg_urgent.lua b/tests/examples/wibox/awidget/tasklist/style_fg_urgent.lua new file mode 100644 index 000000000..cd51b5bc6 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_fg_urgent.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff" } do + beautiful.tasklist_fg_urgent = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_font.lua b/tests/examples/wibox/awidget/tasklist/style_font.lua new file mode 100644 index 000000000..c1ca3ea3c --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_font.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, font in ipairs { "sans 8", "sans 10 bold", "sans 12 italic" } do + beautiful.tasklist_font = font + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_font_focus.lua b/tests/examples/wibox/awidget/tasklist/style_font_focus.lua new file mode 100644 index 000000000..609ebd2e3 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_font_focus.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, font in ipairs { "sans 8", "sans 10 bold", "sans 12 italic" } do + beautiful.tasklist_font_focus = font + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_font_minimized.lua b/tests/examples/wibox/awidget/tasklist/style_font_minimized.lua new file mode 100644 index 000000000..65d761cd8 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_font_minimized.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, font in ipairs { "sans 8", "sans 10 bold", "sans 12 italic" } do + beautiful.tasklist_font_minimized = font + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_font_urgent.lua b/tests/examples/wibox/awidget/tasklist/style_font_urgent.lua new file mode 100644 index 000000000..34c638e2a --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_font_urgent.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END +for _, font in ipairs { "sans 8", "sans 10 bold", "sans 12 italic" } do + beautiful.tasklist_font_urgent = font + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_plain_task_name.lua b/tests/examples/wibox/awidget/tasklist/style_plain_task_name.lua new file mode 100644 index 000000000..9585d5752 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_plain_task_name.lua @@ -0,0 +1,45 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" + +client.get()[1].floating = true +client.get()[2].sticky = true + +--DOC_HIDE_END +for _, value in ipairs { true, false } do + beautiful.tasklist_plain_task_name = value + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape.lua b/tests/examples/wibox/awidget/tasklist/style_shape.lua new file mode 100644 index 000000000..c5011281f --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape.lua @@ -0,0 +1,51 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 + +--DOC_NEWLINE + +local function customized(cr, width, height) + return gears.shape.parallelogram(cr, width, height, width - height) +end + +--DOC_NEWLINE + +for _, shape in ipairs { gears.shape.rounded_rect, gears.shape.octogon, gears.shape.hexagon, customized } do + beautiful.tasklist_shape = shape + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_border_color.lua b/tests/examples/wibox/awidget/tasklist/style_shape_border_color.lua new file mode 100644 index 000000000..9a0731aee --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_border_color.lua @@ -0,0 +1,58 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape"), color = require("gears.color") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect +beautiful.tasklist_shape_border_width = 2 + +--DOC_NEWLINE + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE + +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_shape_border_color = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_border_color_minimized.lua b/tests/examples/wibox/awidget/tasklist/style_shape_border_color_minimized.lua new file mode 100644 index 000000000..b5c91c197 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_border_color_minimized.lua @@ -0,0 +1,71 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape"), color = require("gears.color") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect +beautiful.tasklist_shape_border_width = 2 + +--DOC_NEWLINE + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE + +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_shape_border_color_minimized = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_border_color_urgent.lua b/tests/examples/wibox/awidget/tasklist/style_shape_border_color_urgent.lua new file mode 100644 index 000000000..fa6fe4e8e --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_border_color_urgent.lua @@ -0,0 +1,71 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape"), color = require("gears.color") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect +beautiful.tasklist_shape_border_width = 2 + +--DOC_NEWLINE + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE + +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_shape_border_color_urgent = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_border_width.lua b/tests/examples/wibox/awidget/tasklist/style_shape_border_width.lua new file mode 100644 index 000000000..85de4527d --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_border_width.lua @@ -0,0 +1,46 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect + +--DOC_NEWLINE + +for _, bw in ipairs { 0, 2, 4, 6 } do + beautiful.tasklist_shape_border_width = bw + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_border_width_minimized.lua b/tests/examples/wibox/awidget/tasklist/style_shape_border_width_minimized.lua new file mode 100644 index 000000000..95f4a36b5 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_border_width_minimized.lua @@ -0,0 +1,57 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape"), color = require("gears.color") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect +--DOC_NEWLINE + +for _, bw in ipairs { 0, 2, 4, 6 } do + beautiful.tasklist_shape_border_width_minimized = bw + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_border_width_urgent.lua b/tests/examples/wibox/awidget/tasklist/style_shape_border_width_urgent.lua new file mode 100644 index 000000000..cc81b854d --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_border_width_urgent.lua @@ -0,0 +1,58 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape"), color = require("gears.color") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect + +--DOC_NEWLINE + +for _, bw in ipairs { 0, 2, 4, 6 } do + beautiful.tasklist_shape_border_width_urgent = bw + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_focus.lua b/tests/examples/wibox/awidget/tasklist/style_shape_focus.lua new file mode 100644 index 000000000..9ec34ad20 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_focus.lua @@ -0,0 +1,63 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 + +--DOC_NEWLINE + +local function customized(cr, width, height) + return gears.shape.parallelogram(cr, width, height, width - height) +end + +--DOC_NEWLINE + +for _, shape in ipairs { gears.shape.rounded_rect, gears.shape.octogon, gears.shape.hexagon, customized } do + beautiful.tasklist_shape_focus = shape + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width.lua b/tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width.lua new file mode 100644 index 000000000..d83ad7f44 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width.lua @@ -0,0 +1,58 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect + +--DOC_NEWLINE + +for _, bw in ipairs { 0, 2, 4, 6 } do + beautiful.tasklist_shape_border_width_focus = bw + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width_focus.lua b/tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width_focus.lua new file mode 100644 index 000000000..8bd7196b7 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_focus_border_width_focus.lua @@ -0,0 +1,71 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape"), color = require("gears.color") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 +beautiful.tasklist_shape = gears.shape.rounded_rect +beautiful.tasklist_shape_border_width = 2 + +--DOC_NEWLINE + +local grad = gears.color { + type = "linear", + from = { 0, 0 }, + to = { 0, 22 }, + stops = { + { 0, "#ff0000" }, + { 1, "#0000ff" }, + } +} + +--DOC_NEWLINE + +for _, col in ipairs { "#ff0000", "#00ff00", "#0000ff", grad } do + beautiful.tasklist_shape_border_color_focus = col + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 32)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_minimized.lua b/tests/examples/wibox/awidget/tasklist/style_shape_minimized.lua new file mode 100644 index 000000000..bbbe20dd9 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_minimized.lua @@ -0,0 +1,63 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 + +--DOC_NEWLINE + +local function customized(cr, width, height) + return gears.shape.parallelogram(cr, width, height, width - height) +end + +--DOC_NEWLINE + +for _, shape in ipairs { gears.shape.rounded_rect, gears.shape.octogon, gears.shape.hexagon, customized } do + beautiful.tasklist_shape_minimized = shape + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_shape_urgent.lua b/tests/examples/wibox/awidget/tasklist/style_shape_urgent.lua new file mode 100644 index 000000000..9ec34ad20 --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_shape_urgent.lua @@ -0,0 +1,63 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local gears = { shape = require("gears.shape") } +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 5 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +client.get()[1].name = "Client 1# (floating)" +client.get()[2].name = "Client 2# (sticky)" +client.get()[3].name = "Client 3# (focus)" +client.get()[4].name = "Client 4# (urgent)" +client.get()[5].name = "Client 5# (minimized)" + +client.get()[1].floating = true +client.get()[2].sticky = true +client.get()[4].urgent = true +client.get()[5].minimized = true +client.focus = client.get()[3] + +--DOC_HIDE_END + +beautiful.tasklist_spacing = 5 + +--DOC_NEWLINE + +local function customized(cr, width, height) + return gears.shape.parallelogram(cr, width, height, width - height) +end + +--DOC_NEWLINE + +for _, shape in ipairs { gears.shape.rounded_rect, gears.shape.octogon, gears.shape.hexagon, customized } do + beautiful.tasklist_shape_focus = shape + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 diff --git a/tests/examples/wibox/awidget/tasklist/style_spacing.lua b/tests/examples/wibox/awidget/tasklist/style_spacing.lua new file mode 100644 index 000000000..66c4f8d6d --- /dev/null +++ b/tests/examples/wibox/awidget/tasklist/style_spacing.lua @@ -0,0 +1,39 @@ +--DOC_HIDE_START +--DOC_GEN_IMAGE +local parent = ... +local beautiful = require("beautiful") +local wibox = require("wibox") +local awful = { widget = { tasklist = require("awful.widget.tasklist") } } +local t_real = require("awful.tag").add("Test", {screen=screen[1]}) + +local s = screen[1] +parent.spacing = 5 +beautiful.tasklist_fg_focus = "#000000" + +for i=1, 3 do + client.gen_fake{ + class = "client", + name = "Client #"..i, + icon = beautiful.awesome_icon, + tags = {t_real} + } +end + +--DOC_HIDE_END +for _, spacing in ipairs { 0, 4, 8, 12 } do + beautiful.tasklist_spacing = spacing + + --DOC_HIDE_START + local tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + layout = wibox.layout.fixed.horizontal + } + + tasklist._do_tasklist_update_now() + parent:add(_memento(tasklist, nil, 22)) --luacheck: globals _memento + --DOC_HIDE_END +end + + +--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80