swayipc_command_builder/commands/
resize.rs

1use super::*;
2
3impl Command<Resize> {
4    pub fn shrink(self) -> Command<Resize<Direction>> {
5        self.push_str("shrink").transmute()
6    }
7
8    pub fn grow(self) -> Command<Resize<Direction>> {
9        self.push_str("grow").transmute()
10    }
11
12    //FIXME: sway(5)
13    pub fn set(self) -> Command<Resize<With>> {
14        self.push_str("set").transmute()
15    }
16}
17
18impl Command<Resize<With>> {
19    pub fn height(self) -> Command<Resize<With<To>>> {
20        self.push_str("height").transmute()
21    }
22
23    pub fn width(self) -> Command<Resize<With<To>>> {
24        self.push_str("width").transmute()
25    }
26}
27
28impl Command<Resize<With<To>>> {
29    pub fn to(self, val: usize) -> Command<Valid<Resize<Direction<With>>>> {
30        self.push_str(val.to_string()).transmute()
31    }
32}
33
34impl Command<Resize<Direction>> {
35    pub fn width(self) -> Command<Valid<Resize<Direction>>> {
36        self.push_str("width").transmute()
37    }
38
39    pub fn height(self) -> Command<Valid> {
40        self.push_str("height").transmute()
41    }
42}
43
44impl Command<Valid<Resize<Direction>>> {
45    pub fn amount(self, amount: usize) -> Command<Valid<Resize<Direction<With>>>> {
46        self.push_str(amount.to_string()).transmute()
47    }
48}
49
50impl Command<Valid<Resize<Direction<With>>>> {
51    pub fn px(self) -> Command<Valid> {
52        self.push_str("px").transmute()
53    }
54
55    pub fn ppt(self) -> Command<Valid> {
56        self.push_str("ppt").transmute()
57    }
58}