aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/signals/client.lua
blob: 2a24863ca406c9bfc112d4e1fe64c674f191aa23 (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
47
48
49
50
51
52
local qui = require "quarrel.ui"
local rectangle = require("gears.shape").rectangle
local qdebug = require "quarrel.debug"
local gtimer = require "gears.timer"
-- local conductor = require "ui.conductor"

client.connect_signal("request::manage", function(c)
    c.shape = qui.shape
    if c.maximized then
        c.maximized = false
        c.maximized = true
    end

    -- conductor.update()
end)

local function handle_corners(c)
    if c.maximized then
        c.shape = rectangle
        c.border_width = 0
    else
        c.shape = qui.shape
        c.border_width = qui.BORDER_WIDTH
    end
end

client.connect_signal("property::maximized", handle_corners)
client.connect_signal("property::fullscreen", handle_corners)

client.connect_signal("focus", function(c)
    if c.instance == "steamwebhelper" then
        local was_maximized = c.maximized
        c.maximized = false

        local geo = c:geometry()
        c:geometry {
            x = geo.x,
            y = geo.y,
            width = geo.width - 1,
            height = geo.height - 1
        }

        gtimer {
            callback = function()
                c:geometry(geo)
                c.maximized = was_maximized
            end,
            single_shot = true,
            timeout = 0.5
        }
    end
end)