-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapi.c
More file actions
97 lines (78 loc) · 1.84 KB
/
api.c
File metadata and controls
97 lines (78 loc) · 1.84 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//
// Created by jaakko on 10.4.2020.
//
#include <X11/Xlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
#include "api.h"
#include "instance.h"
void closeActiveWindow(Arg a) {
wmWindow* activeWindow = wmWorkspaces[wmActiveWorkspace].activeWindow;
if (activeWindow) {
wmRequestCloseWindow(activeWindow);
}
}
void focus(Arg a) {
wmWorkspace* workspace = &wmWorkspaces[wmActiveWorkspace];
wmWindow* activeWindow = workspace->activeWindow;
if (activeWindow && workspace->fullscreen == NULL) {
wmWindow* focus =
a.i == 1
? wmNextVisibleWindow(wmActiveWorkspace)
: wmPreviousVisibleWindow(wmActiveWorkspace);
if (focus) {
wmFocusWindow(focus);
}
}
}
void openApplication(Arg a) {
if (fork() == 0) {
setsid();
execvp(((const char**)a.v)[0], (char**)a.v);
exit(EXIT_SUCCESS);
}
}
void quit(Arg a) {
wmRunning = False;
wmExitCode = a.i;
}
void selectWorkspace(Arg a) {
if (a.i != wmActiveWorkspace) {
wmSelectWorkspace(a.i);
}
}
void moveToWorkspace(Arg a) {
wmMoveActiveWindow(a.i);
}
void toggleToWorkspace(Arg a) {
wmToggleActiveWindow(a.i);
}
void lowerSplit(Arg a) {
wmLowerSplit(a.i);
}
void raiseSplit(Arg a) {
wmRaiseSplit(a.i);
}
void clearSplitHints(Arg a) {
wmWorkspaces[wmActiveWorkspace].showSplitBorder = 0;
wmUpdateBorders();
}
void moveLeftEdgeHorizontally(Arg a) {
wmMoveLeftEdgeHorizontally(a.i);
}
void moveRightEdgeHorizontally(Arg a) {
wmMoveRightEdgeHorizontally(a.i);
}
void moveUpperEdgeVertically(Arg a) {
wmMoveUpperEdgeVertically(a.i);
}
void moveLowerEdgeVertically(Arg a) {
wmMoveLowerEdgeVertically(a.i);
}
void moveNode(Arg a) {
wmMoveNode(a.i);
}
void toggleFullscreen(Arg a) {
wmToggleFullscreen();
}