summaryrefslogtreecommitdiff
path: root/lib/sway/workspace.vala
blob: c5e62344dd0ca9ecd8bde41225b9c471617354d3 (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
namespace AstalSway {
public class Workspace : Node {
    public string representation { get; private set; }
    public bool focused { get; private set; }
    public bool visible { get; private set; }
    public int num { get; private set; }

    public Workspace() {
        node_type = NodeType.WORKSPACE;
    }

    internal override void sync(Json.Object obj) {
        var rep = obj.get_member("representation");
        if (rep != null) {
            representation = rep.get_string();
        } else {
            representation = "";
        }
        base.sync(obj);

    }

    internal void sync_workspace(Json.Object obj) {
        focused = obj.get_boolean_member("focused");
        visible = obj.get_boolean_member("visible");
        num = (int)obj.get_int_member("num");
    }

    public override void focus() {
        Sway.get_default().run_command(@"workspace $name");
    }
}
}