tests: Port the hardcoded awful.rules test to the sequence template.
This commit is contained in:
parent
71c230035c
commit
171a14dbc8
|
@ -0,0 +1,55 @@
|
|||
--DOC_GEN_IMAGE --DOC_NO_USAGE
|
||||
local module = ... --DOC_HIDE
|
||||
local ruled = {client = 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, 1280, 720) --DOC_HIDE
|
||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) --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
|
||||
|
||||
client.connect_signal("request::rules", function() --DOC_HIDE
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "mplayer" },
|
||||
properties = {
|
||||
floating = true,
|
||||
placement = awful.placement.centered,
|
||||
width = 640,
|
||||
height = 480,
|
||||
},
|
||||
}
|
||||
end) --DOC_HIDE
|
||||
|
||||
client.emit_signal("request::rules") --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.add_event("Spawn xterm", function() --DOC_HIDE
|
||||
-- Spawn xterm
|
||||
for _=1, 5 do
|
||||
awful.spawn("xterm")
|
||||
end
|
||||
|
||||
end) --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.display_tags() --DOC_HIDE
|
||||
|
||||
module.add_event("Spawn mplayer", function() --DOC_HIDE
|
||||
-- Spawn mplayer
|
||||
awful.spawn("mplayer")
|
||||
|
||||
for _, c in ipairs(client.get()) do --DOC_HIDE
|
||||
assert(#c:tags() == 1) --DOC_HIDE
|
||||
assert(c.floating == (c.class == "mplayer")) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
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
|
|
@ -0,0 +1,38 @@
|
|||
--DOC_GEN_IMAGE --DOC_NO_USAGE
|
||||
local module = ... --DOC_HIDE
|
||||
local ruled = {client = require("ruled.client") } --DOC_HIDE
|
||||
local awful = {tag = require("awful.tag"), layout = require("awful.layout")} --DOC_HIDE
|
||||
require("awful.ewmh") --DOC_HIDE
|
||||
screen[1]:fake_resize(0, 0, 1280, 720) --DOC_HIDE
|
||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.layouts[1]) --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
|
||||
|
||||
client.connect_signal("request::rules", function() --DOC_HIDE
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "xterm" },
|
||||
properties = {
|
||||
maximized_vertical = true,
|
||||
maximized_horizontal = true
|
||||
},
|
||||
}
|
||||
end) --DOC_HIDE
|
||||
|
||||
client.emit_signal("request::rules") --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.add_event("Spawn xterm", function() --DOC_HIDE
|
||||
-- Spawn xterm
|
||||
awful.spawn("xterm")
|
||||
|
||||
assert(client.get()[1].maximized_vertical ) --DOC_HIDE
|
||||
assert(client.get()[1].maximized_horizontal) --DOC_HIDE
|
||||
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
|
|
@ -0,0 +1,68 @@
|
|||
--DOC_GEN_IMAGE --DOC_NO_USAGE
|
||||
local module = ... --DOC_HIDE
|
||||
local ruled = {client = require("ruled.client") } --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 = 128, height = 96} --DOC_HIDE
|
||||
awful.tag({ "one", "two", "three", "four", "five" }, screen[1], awful.layout.layouts[1]) --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.display_tags() --DOC_HIDE
|
||||
|
||||
client.connect_signal("request::rules", function() --DOC_HIDE
|
||||
-- Create a new tags with some properties:
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "firefox" },
|
||||
properties = {
|
||||
switch_to_tags = true,
|
||||
new_tag = {
|
||||
name = "My_new_tag!", -- The tag name.
|
||||
layout = awful.layout.suit.max, -- Set the tag layout.
|
||||
volatile = true, -- Remove the tag when the client is closed.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
-- Create a new tag with just a name:
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "thunderbird" },
|
||||
properties = {
|
||||
switch_to_tags = true,
|
||||
new_tag = "JUST_A_NAME!",
|
||||
}
|
||||
}
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
-- Create a new tag using the client metadata:
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "xterm" },
|
||||
properties = {
|
||||
switch_to_tags = true,
|
||||
new_tag = true,
|
||||
}
|
||||
}
|
||||
|
||||
end) --DOC_HIDE
|
||||
|
||||
client.emit_signal("request::rules") --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.add_event("Spawn some apps", function() --DOC_HIDE
|
||||
-- Spawn firefox
|
||||
awful.spawn("firefox")
|
||||
awful.spawn("thunderbird")
|
||||
awful.spawn("xterm")
|
||||
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
|
|
@ -0,0 +1,43 @@
|
|||
--DOC_GEN_IMAGE --DOC_NO_USAGE
|
||||
local module = ... --DOC_HIDE
|
||||
local ruled = {client = 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, 1280, 720) --DOC_HIDE
|
||||
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, screen[1], awful.layout.suit.corner.nw) --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
|
||||
|
||||
client.connect_signal("request::rules", function() --DOC_HIDE
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "mplayer" },
|
||||
properties = {
|
||||
floating = true,
|
||||
placement = awful.placement.centered,
|
||||
width = 640,
|
||||
height = 480,
|
||||
},
|
||||
}
|
||||
end) --DOC_HIDE
|
||||
|
||||
client.emit_signal("request::rules") --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.add_event("Spawn mplayer", function() --DOC_HIDE
|
||||
-- Spawn mplayer
|
||||
awful.spawn("mplayer")
|
||||
|
||||
for _, c in ipairs(client.get()) do --DOC_HIDE
|
||||
assert(#c:tags() == 1) --DOC_HIDE
|
||||
assert(c.floating == (c.class == "mplayer")) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
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
|
|
@ -0,0 +1,85 @@
|
|||
--DOC_GEN_IMAGE --DOC_NO_USAGE
|
||||
local module = ... --DOC_HIDE
|
||||
local ruled = {client = 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, 1024, 768) --DOC_HIDE
|
||||
screen.fake_add(1034, 0, 1024, 768).outputs = {["eVGA1"] = {mm_height=60, mm_width=80 }} --DOC_HIDE
|
||||
screen.fake_add(2074, 0, 1024, 768).outputs = {["DVI1" ] = {mm_height=60, 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 = 10, y=10, width = 60, height =50} --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
mouse.coords {x = 2500, y = 100 }
|
||||
assert(mouse.screen == screen[3]) --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
client.connect_signal("request::rules", function() --DOC_HIDE
|
||||
-- Screen by IDs:
|
||||
ruled.client.append_rule {
|
||||
rule_any = {
|
||||
class = {"firefox"}
|
||||
},
|
||||
properties = {
|
||||
screen = 2,
|
||||
tag = "1", --DOC_HIDE
|
||||
width = 640, height =480, floating = true, --DOC_HIDE
|
||||
},
|
||||
}
|
||||
--DOC_NEWLINE
|
||||
-- Screen by object:
|
||||
ruled.client.append_rule {
|
||||
rule_any = {
|
||||
class = {"thunderbird"}
|
||||
},
|
||||
properties = {
|
||||
screen = mouse.screen,
|
||||
tag = "1", --DOC_HIDE
|
||||
width = 640, height =480, floating = true, --DOC_HIDE
|
||||
},
|
||||
}
|
||||
--DOC_NEWLINE
|
||||
-- Screen by output name:
|
||||
ruled.client.append_rule {
|
||||
rule_any = {
|
||||
class = {"xterm"}
|
||||
},
|
||||
properties = {
|
||||
screen = "LVDS1",
|
||||
tag = "1", --DOC_HIDE
|
||||
width = 640, height =480, floating = true, --DOC_HIDE
|
||||
},
|
||||
}
|
||||
|
||||
end) --DOC_HIDE
|
||||
|
||||
client.emit_signal("request::rules") --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.add_event("Spawn some applications", function() --DOC_HIDE
|
||||
-- Spawn firefox, thunderbird and xterm
|
||||
awful.spawn("firefox")
|
||||
awful.spawn("thunderbird")
|
||||
awful.spawn("xterm")
|
||||
|
||||
assert(client.get()[1].screen == screen[2]) --DOC_HIDE
|
||||
assert(client.get()[2].screen == screen[3]) --DOC_HIDE
|
||||
assert(client.get()[3].screen == screen[1]) --DOC_HIDE
|
||||
assert(client.get()[1]:tags()[1] == screen[2].selected_tag) --DOC_HIDE
|
||||
assert(client.get()[2]:tags()[1] == screen[3].selected_tag) --DOC_HIDE
|
||||
assert(client.get()[3]:tags()[1] == screen[1].selected_tag) --DOC_HIDE
|
||||
end) --DOC_HIDE
|
||||
|
||||
module.display_tags() --DOC_HIDE
|
||||
|
||||
module.execute { display_screen = true , display_clients = true, --DOC_HIDE
|
||||
display_label = true , display_client_name = true, --DOC_HIDE
|
||||
display_mouse = true , --DOC_HIDE
|
||||
} --DOC_HIDE
|
|
@ -0,0 +1,40 @@
|
|||
--DOC_GEN_IMAGE --DOC_NO_USAGE
|
||||
local module = ... --DOC_HIDE
|
||||
local ruled = {client = require("ruled.client") } --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 = 128, height = 96} --DOC_HIDE
|
||||
awful.tag({ "one", "two", "three", "four", "five" }, screen[1], awful.layout.layouts[1]) --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.display_tags() --DOC_HIDE
|
||||
|
||||
client.connect_signal("request::rules", function() --DOC_HIDE
|
||||
-- Select tag by object reference:
|
||||
ruled.client.append_rule {
|
||||
rule = { class = "firefox" },
|
||||
properties = {
|
||||
tag = screen[1].tags[4],
|
||||
switch_to_tags = true
|
||||
}
|
||||
}
|
||||
|
||||
end) --DOC_HIDE
|
||||
|
||||
client.emit_signal("request::rules") --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.add_event("Spawn xterm", function() --DOC_HIDE
|
||||
-- Spawn firefox
|
||||
awful.spawn("firefox")
|
||||
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
|
|
@ -0,0 +1,51 @@
|
|||
--DOC_GEN_IMAGE --DOC_NO_USAGE
|
||||
local module = ... --DOC_HIDE
|
||||
local ruled = {client = require("ruled.client") } --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 = 128, height = 96} --DOC_HIDE
|
||||
awful.tag({ "one", "two", "three", "four", "five" }, screen[1], awful.layout.layouts[1]) --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
|
||||
|
||||
|
||||
client.connect_signal("request::rules", function() --DOC_HIDE
|
||||
-- Select tag by object reference:
|
||||
ruled.client.append_rule {
|
||||
rule_any = {
|
||||
class = {"firefox"}
|
||||
},
|
||||
properties = {
|
||||
tag = screen[1].tags[3],
|
||||
},
|
||||
}
|
||||
--DOC_NEWLINE
|
||||
-- Select tag by name:
|
||||
ruled.client.append_rule {
|
||||
rule_any = {
|
||||
class = {"thunderbird"}
|
||||
},
|
||||
properties = {
|
||||
tag = "five",
|
||||
},
|
||||
}
|
||||
|
||||
end) --DOC_HIDE
|
||||
|
||||
client.emit_signal("request::rules") --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
module.add_event("Spawn xterm", function() --DOC_HIDE
|
||||
-- Spawn firefox and thunderbird
|
||||
awful.spawn("firefox")
|
||||
awful.spawn("thunderbird")
|
||||
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
|
Loading…
Reference in New Issue