howm
howm
howm.c File Reference

The glue that holds howm together. This file houses the main event loop as well as setup and cleanup. More...

#include <errno.h>
#include <getopt.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <unistd.h>
#include <xcb/xcb.h>
#include <xcb/randr.h>
#include <xcb/xcb_ewmh.h>
#include "handler.h"
#include "helper.h"
#include "howm.h"
#include "ipc.h"
#include "monitor.h"
#include "scratchpad.h"
#include "xcb_help.h"
#include "workspace.h"

Functions

static void setup (void)
 Occurs when howm first starts. More...
 
static void cleanup (void)
 Cleanup howm's resources. More...
 
static void exec_config (char *conf_path)
 Execute the script located at conf_path in order to configure howm. More...
 
int main (int argc, char *argv[])
 The code that glues howm together... More...
 
void howm_info (void)
 Print debug information about the current state of howm. More...
 
uint32_t get_colour (char *colour)
 Converts a hexcode colour into an X11 colourmap pixel. More...
 
void quit (const int exit_status)
 Quit howm and set the return value. More...
 
void spawn (char *cmd[])
 Spawns a command. More...
 

Variables

struct config conf
 
bool running = true
 
xcb_connection_t * dpy = NULL
 
xcb_screen_t * screen = NULL
 
xcb_ewmh_connection_t * ewmh = NULL
 
const char * WM_ATOM_NAMES [] = { "WM_DELETE_WINDOW", "WM_PROTOCOLS" }
 
xcb_atom_t wm_atoms [LENGTH(WM_ATOM_NAMES)]
 
int retval = EXIT_FAILURE
 
uint32_t border_focus = 0
 
uint32_t border_unfocus = 0
 
uint32_t border_prev_focus = 0
 
uint32_t border_urgent = 0
 
uint16_t screen_height = 0
 
uint16_t screen_width = 0
 
int cur_state = OPERATOR_STATE
 
unsigned int mon_cnt = 0
 
unsigned int workspace_cnt
 
monitor_tmon = NULL
 
monitor_tmon_head = NULL
 
monitor_tmon_tail = NULL
 

Detailed Description

The glue that holds howm together. This file houses the main event loop as well as setup and cleanup.

Author
Harvey Hunt
Date
2015

Function Documentation

static void cleanup ( void  )
static

Cleanup howm's resources.

Delete all of the windows that have been created, remove button grabs and remove pointer focus.

static void exec_config ( char *  conf_path)
static

Execute the script located at conf_path in order to configure howm.

Parameters
conf_pathThe file path to the config file.
uint32_t get_colour ( char *  colour)

Converts a hexcode colour into an X11 colourmap pixel.

Parameters
colourA string of the format "#RRGGBB", that will be interpreted as a colour code.
Returns
An X11 colourmap pixel.
void howm_info ( void  )

Print debug information about the current state of howm.

This can be parsed by programs such as scripts that will pipe their input into a status bar.

int main ( int  argc,
char *  argv[] 
)

The code that glues howm together...

static void setup ( void  )
static

Occurs when howm first starts.

Workspaces are initialised, screen size is determined and atoms are then grabbed.

Atoms are gathered.

Variable Documentation

uint32_t border_focus = 0
uint32_t border_prev_focus = 0
uint32_t border_unfocus = 0
uint32_t border_urgent = 0
struct config conf
Initial value:
= {
.focus_mouse = false,
.focus_mouse_click = true,
.follow_move = true,
.border_px = 2,
.border_focus = 0,
.border_unfocus = 0,
.border_prev_focus = 0,
.border_urgent = 0,
.bar_bottom = true,
.bar_height = 20,
.op_gap_size = 4,
.center_floating = true,
.zoom_gap = true,
.float_spawn_width = 500,
.float_spawn_height = 500,
.delete_register_size = 5,
.scratchpad_height = 500,
.scratchpad_width = 500,
}
int cur_state = OPERATOR_STATE
xcb_connection_t* dpy = NULL
xcb_ewmh_connection_t* ewmh = NULL
monitor_t* mon = NULL
unsigned int mon_cnt = 0
monitor_t* mon_head = NULL
monitor_t* mon_tail = NULL
int retval = EXIT_FAILURE
bool running = true
xcb_screen_t* screen = NULL
uint16_t screen_height = 0
uint16_t screen_width = 0
const char* WM_ATOM_NAMES[] = { "WM_DELETE_WINDOW", "WM_PROTOCOLS" }
xcb_atom_t wm_atoms[LENGTH(WM_ATOM_NAMES)]
unsigned int workspace_cnt