summaryrefslogtreecommitdiff
path: root/lib/sway/workspace.vala
blob: 148ac6ebfc3dab8d5fd1ee38cf8000c84505fac2 (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;
    public bool focused;
    public bool visible;
    public int num;

    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(@"focus workspace $name");
    }
  }
}