11 parser::parser(keytree
*kt
)
12 : _kt(kt
), _mask(0), _action(Action::noaction
), _key(""), _arg("")
18 // nothing to see here. move along.
21 void parser::parse(string rc_file
)
23 extern int yyparse(void *);
26 yyin
= fopen(rc_file
.c_str(), "r");
34 void parser::setAction(string act
)
38 Action::ActionType act
;
41 { "noaction", Action::noaction
},
42 { "execute", Action::execute
},
43 { "iconify", Action::iconify
},
44 { "raise", Action::raise
},
45 { "lower", Action::lower
},
46 { "close", Action::close
},
47 { "toggleshade", Action::toggleshade
},
48 { "toggleomnipresent", Action::toggleomnipresent
},
49 { "movewindowup", Action::moveWindowUp
},
50 { "movewindowdown", Action::moveWindowDown
},
51 { "movewindowleft", Action::moveWindowLeft
},
52 { "movewindowright", Action::moveWindowRight
},
53 { "resizewindowwidth", Action::resizeWindowWidth
},
54 { "resizewindowheight", Action::resizeWindowHeight
},
55 { "togglemaximizefull", Action::toggleMaximizeFull
},
56 { "togglemaximizevertical", Action::toggleMaximizeVertical
},
57 { "togglemaximizehorizontal", Action::toggleMaximizeHorizontal
},
58 { "sendtoworkspace", Action::sendToWorkspace
},
59 { "nextwindow", Action::nextWindow
},
60 { "prevwindow", Action::prevWindow
},
61 { "nextwindowonallworkspaces", Action::nextWindowOnAllWorkspaces
},
62 { "prevwindowonallworkspaces", Action::prevWindowOnAllWorkspaces
},
63 { "nextwindowonallscreens", Action::nextWindowOnAllScreens
},
64 { "prevwindowonallscreens", Action::prevWindowOnAllScreens
},
65 { "nextwindowofclass", Action::nextWindowOfClass
},
66 { "prevwindowofclass", Action::prevWindowOfClass
},
67 { "nextwindowofclassonallworkspaces", Action::nextWindowOfClassOnAllWorkspaces
},
68 { "prevwindowofclassonallworkspaces", Action::prevWindowOfClassOnAllWorkspaces
},
69 { "changeworkspace", Action::changeWorkspace
},
70 { "nextworkspace", Action::nextWorkspace
},
71 { "prevworkspace", Action::prevWorkspace
},
72 { "nextscreen", Action::nextScreen
},
73 { "prevscreen", Action::prevScreen
},
74 { "showrootmenu", Action::showRootMenu
},
75 { "showworkspacemenu", Action::showWorkspaceMenu
},
76 { "stringchain", Action::stringChain
},
77 { "keychain", Action::keyChain
},
78 { "numberchain", Action::numberChain
},
79 { "cancel", Action::cancel
},
80 { "", Action::noaction
}
85 for (int i
= 0; actions
[i
].str
!= ""; ++i
) {
86 if ( strcasecmp(actions
[i
].str
, act
.c_str()) == 0 ) {
87 _action
= actions
[i
].act
;
93 _action
= Action::noaction
;
96 void parser::addModifier(string mod
)
103 { "Mod1", Mod1Mask
},
104 { "Mod2", Mod2Mask
},
105 { "Mod3", Mod3Mask
},
106 { "Mod4", Mod4Mask
},
107 { "Control", ControlMask
},
108 { "Shift", ShiftMask
},
112 for (int i
= 0; modifiers
[i
].str
!= ""; ++i
) {
113 if (modifiers
[i
].str
== mod
)
114 _mask
|= modifiers
[i
].mask
;
118 void parser::endAction()
120 _kt
->addAction(_action
, _mask
, _key
, _arg
);
124 void parser::startChain()
126 _kt
->advanceOnNewNode();
131 void parser::endChain()
137 void parser::setChainBinding()
139 if (_mask
!= 0 && _key
!= "") {
140 _kt
->setCurrentNodeProps(Action::noaction
, _mask
, _key
, "");
148 _action
= Action::noaction
;