]> git.pld-linux.org Git - packages/awesome-plugin-effect.git/blob - example-using.lua
- initial
[packages/awesome-plugin-effect.git] / example-using.lua
1 function initEffect (c, options, name)
2         if not name then name = 'fx' end
3         
4         
5         if not awful.client.property.get(c, name) then
6         
7                 require("effect");
8                 
9                 if not options then
10                         options = {
11                                 duration = 1, 
12                                 transition = Effect.Transitions.easeIn.Bounce
13                         }
14                 end
15                 
16                 awful.client.property.set(c, name, Effect.create(
17                         function (props) 
18                                 return c:geometry(props)
19                         end, 
20                         options
21                 ))
22         end
23         return awful.client.property.get(c, name)
24 end
25
26 -- Vogel functionality
27 vogel = nil
28
29 function vogelEffect ()
30         if not vogel then
31                 return awful.util.spawn(terminal .. " -title vogel")
32         end
33         vogel.screen = mouse.screen
34         client.focus = vogel
35         vogel:raise()
36         vogel:tags({awful.tag.selected(mouse.screen)})
37         initEffect(vogel):start({
38                 x = mouse.coords().x - vogel:geometry().width/2, 
39                 y = mouse.coords().y - vogel:geometry().height/2
40         })
41 end
42
43 globalkeys = awful.util.table.join(globalkeys,
44         awful.key({ "Shift" }, "F1", vogelEffect)
45 )
46
47 client.add_signal("manage", function (c, startup)
48         if c.name == 'vogel' then
49                 vogel = c
50                 vogelEffect()
51         end
52 end)
53
54 client.add_signal("unmanage", function (c, startup)
55         if c.name == 'vogel' then
56                 vogel = nil
57         end
58 end)
59
60
61 -- Move windows
62 clientkeys = awful.util.table.join(clientkeys,
63         -- move client to right screen edge
64         awful.key({ modkey, "Control"  }, "Right",              function (c)
65                 initEffect(c):start({x = screen[c.screen].workarea.width - c:geometry().width});
66         end),
67         -- move client to left screen edge
68         awful.key({ modkey, "Control"  }, "Left",               function (c)
69                 initEffect(c):start({x = 0});
70         end),
71         -- move client to top screen edge
72         awful.key({ modkey, "Control"  }, "Up",         function (c)
73                 initEffect(c):start({y = 0});
74         end),
75         -- move client to bottom screen edge
76         awful.key({ modkey, "Control"  }, "Down",               function (c)
77                 initEffect(c):start({y = screen[c.screen].workarea.height - c:geometry().height});
78         end),
79         
80         -- make client height smaller
81         awful.key({ modkey, "Control", "Shift"  }, "Up",                function (c)
82                 initEffect(c, {
83                         duration = 0.2, 
84                         transition = Effect.Transitions.linear
85                 }, 'fx-size'):start({height = c:geometry().height - 50});
86         end),
87         -- make client height bigger
88         awful.key({ modkey, "Control", "Shift"  }, "Down",              function (c)
89                 initEffect(c, {
90                         duration = 0.2, 
91                         transition = Effect.Transitions.linear
92                 }, 'fx-size'):start({height = c:geometry().height + 50});
93         end),
94         -- make client width smaller
95         awful.key({ modkey, "Control", "Shift"  }, "Left",              function (c)
96                 initEffect(c, {
97                         duration = 0.2, 
98                         transition = Effect.Transitions.linear
99                 }, 'fx-size'):start({width = c:geometry().width - 50});
100         end),
101         -- make client width bigger
102         awful.key({ modkey, "Control", "Shift"  }, "Right",             function (c)
103                 initEffect(c, {
104                         duration = 0.2, 
105                         transition = Effect.Transitions.linear
106                 }, 'fx-size'):start({width = c:geometry().width + 50});
107         end)
108 )
This page took 0.132411 seconds and 3 git commands to generate.