mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
tests: Add a flexible dummy client.
XTerm isn't really a perfect test candidate.
This commit is contained in:
parent
6bc99fe52f
commit
9798b455cb
1 changed files with 32 additions and 0 deletions
32
tests/_client.lua
Normal file
32
tests/_client.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local spawn = require("awful.spawn")
|
||||
|
||||
-- This file provide a simple, yet flexible, test client.
|
||||
-- It is used to test the `awful.rules`
|
||||
|
||||
return function(class, title)
|
||||
title = title or 'Awesome test client'
|
||||
|
||||
local cmd = {"lua" , "-e", table.concat {
|
||||
"local lgi = require 'lgi';",
|
||||
"local Gtk = lgi.require('Gtk');",
|
||||
"Gtk.init();",
|
||||
"local class = '",
|
||||
class or 'test_app',"';",
|
||||
"local window = Gtk.Window {",
|
||||
" default_width = 100,",
|
||||
" default_height = 100,",
|
||||
" title = '",title,
|
||||
"'};",
|
||||
"window:set_wmclass(class, class);",
|
||||
"local app = Gtk.Application {",
|
||||
" application_id = 'org.awesomewm.tests.",class,
|
||||
"'};",
|
||||
"function app:on_activate()",
|
||||
" window.application = self;",
|
||||
" window:show_all();",
|
||||
"end;",
|
||||
"app:run {''}"
|
||||
}}
|
||||
|
||||
spawn(cmd)
|
||||
end
|
Loading…
Reference in a new issue