summaryrefslogtreecommitdiff
path: root/devilspie/scripts/awesome.lua
blob: dc11905862b8ddcbeb822b1a9c16ce7cca68b5a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
-- Support Awesome 3.5 WM

local posix	= require("posix");
local os		= require("os");

local awesome = "/usr/bin/awesome-client"
if not posix.stat(awesome, "type") == "file" then
	awesome = nil;
end

-- Check for tiling mode
function is_tiling()
	if awesome then
		return true;
	end
	return false;
end

-- Make window floating
-- Parameters: state - true to make window floating, else make window tiled
function set_tile_floating( state )
	if not awesome then
		return nil;
	end

	if state then state = "true" else state = "false" end

	local xid = get_window_xid();

	local command = "echo ";
	command = command .. "'";
	command = command .. " local naughty    = require(\"naughty\");";
	command = command .. " local awcl       = require(\"awful.client\");";
	command = command .. " local client     = require(\"client\");";
	command = command .. " for k, c in pairs( client.get() ) do";
	command = command .. "     if c.window == " .. xid .. " then";
	command = command .. "         awcl.floating.set(c, " .. state .. ");";
	command = command .. "    end";
	command = command .. " end";
	command = command .. "'";
	command = command .. " | ";
	command = command .. awesome;

	debug_print("Awesome floating: " .. command);
	return os.execute( command );
end