#include "actions.hh"
-Action::Action(enum ActionType type, KeyCode keycode, int modifierMask):
- _type(type), _keycode(keycode), _modifierMask(modifierMask)
+Action::Action(enum ActionType type, KeyCode keycode, int modifierMask,
+ int num): _type(type), _keycode(keycode),
+ _modifierMask(modifierMask), _numberParam(num)
{ }
nextWindow,
prevWindow,
- nextWindowOnAllDesktops,
- prevWindowOnAllDesktops,
+ nextWindowOnAllWorkspaces,
+ prevWindowOnAllWorkspaces,
nextWindowOfClass,
prevWindowOfClass,
- changeDesktop,
- nextDesktop,
- prevDesktop,
+ changeWorkspace, //done
+ nextWorkspace, //done
+ prevWorkspace, //done
// these are openbox extensions
showRootMenu,
enum ActionType _type;
const KeyCode _keycode;
const int _modifierMask;
-
+
+ const int _numberParam;
public:
inline enum ActionType type() const { return _type;}
inline const KeyCode keycode() const { return _keycode; }
inline const int modifierMask() const { return _modifierMask; }
+ inline const int number() const { return _numberParam; }
- Action(enum ActionType type, KeyCode keycode, int modifierMask);
+ Action(enum ActionType type, KeyCode keycode, int modifierMask,
+ int number = 0);
};
typedef std::list<Action> ActionList;
::exit(1);
}
- _actions.push_back(Action(Action::nextDesktop,
+ _actions.push_back(Action(Action::nextWorkspace,
XKeysymToKeycode(getXDisplay(),
XStringToKeysym("Tab")),
Mod1Mask));
- _actions.push_back(Action(Action::prevDesktop,
+ _actions.push_back(Action(Action::prevWorkspace,
XKeysymToKeycode(getXDisplay(),
XStringToKeysym("Tab")),
ControlMask));
+ _actions.push_back(Action(Action::shade,
+ XKeysymToKeycode(getXDisplay(),
+ XStringToKeysym("F5")),
+ Mod1Mask));
activateGrabs();
}
delete _xatom;
}
-
-// XGrabKey(_epist->getXDisplay(), XKeysymToKeycode(_epist->getXDisplay(),
-// XStringToKeysym("F5")),
-// Mod1Mask, _root, True, GrabModeAsync, GrabModeAsync);
-
void epist::activateGrabs() {
ScreenList::const_iterator scrit, scrend = _screens.end();
e.xkey.state == it->modifierMask() )
{
switch (it->type()) {
- case Action::nextDesktop:
+ case Action::nextWorkspace:
cycleWorkspace(true);
break;
- case Action::prevDesktop:
+ case Action::prevWorkspace:
cycleWorkspace(false);
break;
+ case Action::changeWorkspace:
+ changeWorkspace(it->number());
+ break;
+ case Action::shade:
+ toggleShaded((*_active)->window());
+ break;
}
break;
}
}
*/
-void screen::cycleWorkspace(const bool forward) {
- cout << "blef" << endl;
-
+void screen::cycleWorkspace(const bool forward) const {
unsigned long currentDesktop = 0;
unsigned long numDesktops = 0;
else
--currentDesktop;
- cout << currentDesktop << endl;
-
-
_xatom->getValue(_root, XAtom::net_number_of_desktops, XAtom::cardinal,
numDesktops);
else if (currentDesktop >= numDesktops)
currentDesktop = 0;
-
- _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root,
- currentDesktop);
-
+ changeWorkspace(currentDesktop);
}
}
-
+
+void screen::changeWorkspace(const int num) const {
+ _xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
+}
+
+void screen::toggleShaded(const Window win) const {
+ _xatom->sendClientMessage(_root, XAtom::net_wm_state, win, 2,
+ XAtom::net_wm_state_shaded);
+}
void handleKeypress(const XEvent &e);
- void cycleWorkspace(const bool forward);
+ void cycleWorkspace(const bool forward)const;
+ void changeWorkspace(const int num)const;
+ void toggleShaded(const Window win) const;
};
#endif // __screen_hh