Mirror / include / setup.h

#ifndef SETUP_H
#define SETUP_H
#include <vector>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <cstring>
#include <string>
#include <tuple>

#include <xcb/xcb.h>
#include <xcb/xcb_ewmh.h>
#include <xcb/randr.h>
 
#include "ewmh.h"

class Monitor;
class StatusBar;
class Window;

struct OtherWindowManager: std::exception {
      const char* what() const noexcept {return "couldn't grab substructure notify on the root window\n";}

};

typedef std::tuple<std::string, std::string, std::string, bool> Rule;

class Setup
{
    public:
        Setup(std::vector<std::string> tags, std::vector<Rule> windowRules);
        ~Setup();
        xcb_connection_t* conn;
        xcb_ewmh_connection_t* ewmh;
        xcb_window_t root;
        xcb_screen_t *screen;
        std::vector<Monitor> monitors;
        int currentMonitor;

        int statusBarHeight = 20;
        std::vector<std::string> tags;
        std::vector<Rule> windowRules;

        Window& findWindow(xcb_window_t window);
        void addWindow(xcb_window_t window);
        void addWindow(Window window);
        void removeWindow(xcb_window_t window);
        void removeWindow(Window window);
        void focusWindow(xcb_window_t window);
        void layoutWindows();
        Monitor& getCurrentMonitor();
        void nextTag();
        void prevTag();
        void launchApp(std::string command);



    private:
        bool getXrandrMonitors();
        void getMonitors();
};

#endif //SETUP_H
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.