-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc_experiments.flr
175 lines (118 loc) · 4.53 KB
/
misc_experiments.flr
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
:- setsemantics{equality(basic)}.
newmodule{test_log}.
insertrule{%insert_hook(_Module,Term) :-
writeln(flora_concat_items(['Inserting ', Term]))}.
flora_add_hook(test_log,insertfact,after,0,insert_hook(?X,?Y))@_plg(flrhooks).
/*
[persistentmodules>>pm].
newmodule{db_mod3}.
db_mod3[attach('hey', 'flora2', 'flora2', 'flora2')]@pm.
db_mod3[detach]@pm.
aux_get_db_handle('db_mod3', ?X)@_plg(flrpm),
catch{db_query(?X, Y, "asd",[])@_plg(db_interface),
xsb_error(database(?Db), ?Msg),
writeln('OK, HERE IS AN ERROR')@_plg}.
aux_get_db_handle('db_mod3', ?X)@_plg(flrpm),
db_DML_sql_internal(?X, qHnd, ['selectfrom'], [], 'whatev', [])@_plg(flrpm).
a@db_mod3.
main[%attach('hey', 'flora2', 'flora2', 'flora2')]@pm.
*/
Container[name *=> string, contents *=> Containee].
Containee[name *=> string].
WSClient::Containee[clientId *=> string].
WSManager::Container[contents *=> WSClient].
WebTab::Containee[url *=> string, tabId *=> integer].
WebBrowser::Container[contents *=> WebTab].
BufferView::Containee[id *=> string]. // TODO file type, non-filetype
BufferEditor::Container[contents *=> BufferView].
Terminal::Containee[id *=> integer].
Terminal::Container[contents *=> BufferEditor].
TerminalContainer::Container[contents *=> Terminal].
//////
flora2:BufferView[name -> '*flora2*'].
flora2emacs:BufferEditor[name -> 'emacs', contents -> {flora2}].
// this line should let emacs be DIRECTLY in tmux
term1:Terminal[name -> 'emacs', contents -> {flora2emacs}].
term2:Terminal[name -> 'zsh'].
tmux1:WSClient[name -> 'flora-2'].
tmux1:TerminalContainer[contents -> {term1, term2}].
term3:Terminal[name -> 'openconnect'].
tmux2:WSClient[name -> 'route'],
tmux2:TerminalContainer[contents -> term3].
tab1:WebTab[name -> 'GMail', url -> 'http://www.gmail.com', tabId -> 1].
tab2:WebTab[name -> 'Facebook', url -> 'http://www.facebook.com', tabId -> 2].
chrome:WebBrowser[contents -> {tab1, tab2}].
chrome:WSClient[name -> 'chromium'].
tabsOutliner:WSClient[name -> 'Tabs Outliner'].
vlc:WSClient[name -> 'John Coltrane - Liberia - VLC media player', clientId -> '0x200000d'].
FocusTarget[].
Operation[handler *=> OperationHandler].
// what handles the operation
OperationHandler[id *=> string].
FocusOperation::Operation[target *=> FocusTarget].
//Wmii:WSManager[name -> 'wmii', contents -> {chrome, tmux1, vlc}].
// WMII windowing layout - column oriented
Wmii[tag(string) *=> WmiiTag].
Wmii::WSManager.
WmiiTag[name *=> string, columns *=> WmiiColumn].
WmiiTag::FocusTarget.
WmiiColumn::Container[contents *=> WSClient].
WmiiColumn::FocusTarget.
?X:Wmii[contents -> ?Y] :-
?X:Wmii[tag(?) -> ?T],
?Y = ?T.columns.contents.
key("Mod4-t", ?Action) :-
?Action = 'jess'.
wmii:Wmii[name -> 'wmii (singleton/main window manager)'].
tag1LeftCol:WmiiColumn[name -> '1 (leftmost column)'].
tag1LeftCol[contents -> tabsOutliner].
tag1RightCol:WmiiColumn[name -> '2 (right column)', contents -> {tmux2, chrome}].
wmii[tag('1') -> _#:WmiiTag[name -> '1', columns -> {tag1LeftCol, tag1RightCol}]].
wmii[tag('2') -> _#:WmiiTag[name -> '2',
columns -> {_#:WmiiColumn[name -> '1 (only)', contents -> {tmux1}]}]].
%printClient(?x, ?tabs) :-
?x:Container[name -> ?xName],
(tab(?tabs), write(?xName), write(' ('), write(?x), write(') ->'), nl)@_plg,
?x:Container[contents -> ?xItem],
?tabs2 is ?tabs + 4,
%printClient(?xItem, ?tabs2).
%printClient(?view, ?tabs) :-
?view:Containee[name -> ?viewName],
\+ ?view:Container,
(tab(?tabs), write(?viewName), write(' ('), write(?view), write(')'), nl)@_plg,
fail.
%dump_state :-
?wm:Wmii[name -> ?wmName],
(write('Window manager: '), writeln(?wmName))@_plg,
?wm:Wmii[contents -> ?wmWindow],
%printClient(?wmWindow, 4).
//newmodule{mod}.
// full path of containee
//fullName(?c, ?a, ?n) :-
// ?n:Container[contents->?c].
?X:Wmii[z -> ?Y] :-
?Y = ?X.
//////////////////////
// Key maps //
//////////////////////
// Q: how is the system going to give a result about what action to execute
:- use_argumentation_theory.
@!{rule1[defeasible,tag->tag1,foo->1,bar->2]} ppp(?X) :- qqq(?X).
//x :- writeln(_@!)@_plg.
/*
@!{dbd[tag -> {xyz}, name->jess]} :-
jess[lastname -> balint].
*/
cc :=: Wmii.
KeyMap[].
// TODO viewManagerPreviousView ... needs defined
globalKeyMap:KeyMap[key("Mod4-b") -> viewManagerPreviousView].
// wmii standard stuff
globalKeyMap:KeyMap[key("Mod4-t") -> inputAndGotoTag].
globalKeyMap:KeyMap[key("Mod4-k") -> goUp].
// wmii-focus-manager
WmiiTagFocusRequest[tagName *=> string].
WmiiClientFocusRequest[clientId *=> string].
// NOW how to route to wmii focus manager,
// tmux focus manager,
// emacs focus manager