X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=util%2Fepist%2Fepist.cc;h=f1c577c2df12c126e0f6df9265d66bcdc27a8893;hb=d7bf31c5b5e449aab104da8ed7844b1023fa5d46;hp=29116da3239caea4d521b63a0d077dc1d768ca72;hpb=3a9f0752745f5f77dabef3e52cfc573130676f65;p=chaz%2Fopenbox diff --git a/util/epist/epist.cc b/util/epist/epist.cc index 29116da3..f1c577c2 100644 --- a/util/epist/epist.cc +++ b/util/epist/epist.cc @@ -50,6 +50,7 @@ using std::cout; using std::endl; using std::string; +#include "actions.hh" #include "epist.hh" #include "screen.hh" #include "window.hh" @@ -68,18 +69,22 @@ epist::epist(char **argv, char *dpy_name, char *rc_file) _xatom = new XAtom(getXDisplay()); + _active = _clients.end(); + for (unsigned int i = 0; i < getNumberOfScreens(); ++i) { screen *s = new screen(this, i); - if (s->managed()) + if (s->managed()) { _screens.push_back(s); + s->updateEverything(); + } } if (_screens.empty()) { cout << "No compatible window manager found on any screens. Aborting.\n"; ::exit(1); } - addAction(Action::nextWorkspace, ControlMask, "Tab"); - addAction(Action::prevWorkspace, ControlMask | ShiftMask, "Tab"); + addAction(Action::nextScreen, ControlMask, "Tab"); + addAction(Action::prevScreen, ControlMask | ShiftMask, "Tab"); addAction(Action::nextWindow, Mod1Mask, "Tab"); addAction(Action::prevWindow, Mod1Mask | ShiftMask, "Tab"); addAction(Action::toggleshade, Mod1Mask, "F5"); @@ -87,6 +92,8 @@ epist::epist(char **argv, char *dpy_name, char *rc_file) addAction(Action::nextWindowOnAllWorkspaces, Mod1Mask | ControlMask, "Tab"); addAction(Action::prevWindowOnAllWorkspaces, Mod1Mask | ShiftMask | ControlMask, "Tab"); + addAction(Action::prevWorkspace, Mod1Mask, "Left"); + addAction(Action::nextWorkspace, Mod1Mask, "Right"); addAction(Action::raise, Mod1Mask, "Up"); addAction(Action::lower, Mod1Mask, "Down"); addAction(Action::moveWindowUp, Mod1Mask | ControlMask, "Up", 1); @@ -197,6 +204,26 @@ XWindow *epist::findWindow(Window window) const { return 0; } + +void epist::cycleScreen(int current, bool forward) const { + unsigned int i; + for (i = 0; i < _screens.size(); ++i) + if (_screens[i]->number() == current) { + current = i; + break; + } + assert(i < _screens.size()); // current is for an unmanaged screen + + int dest = current + (forward ? 1 : -1); + + if (dest < 0) dest = (signed)_screens.size() - 1; + else if (dest >= (signed)_screens.size()) dest = 0; + + const XWindow *target = _screens[dest]->lastActiveWindow(); + if (target) target->focus(); +} + + void epist::addAction(Action::ActionType act, unsigned int modifiers, string key, int number) { _actions.push_back(Action(act, XKeysymToKeycode(getXDisplay(), @@ -206,7 +233,7 @@ void epist::addAction(Action::ActionType act, unsigned int modifiers, void epist::addAction(Action::ActionType act, unsigned int modifiers, - string key, std::string str) { + string key, string str) { _actions.push_back(Action(act, XKeysymToKeycode(getXDisplay(), XStringToKeysym(key.c_str())), modifiers, str));