Some stylechanges to previous commit
This commit is contained in:
parent
6376cf99d2
commit
992612c89d
|
@ -24,12 +24,12 @@ struct rect_t {
|
||||||
|
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "child.h"
|
#include "child.h"
|
||||||
#include "config.h"
|
|
||||||
#include "ipc.h"
|
#include "ipc.h"
|
||||||
#include "outputs.h"
|
#include "outputs.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "workspaces.h"
|
#include "workspaces.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "ucs2_to_utf8.h"
|
#include "ucs2_to_utf8.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#ifndef CONFIG_H_
|
#ifndef CONFIG_H_
|
||||||
#define CONFIL_H_
|
#define CONFIG_H_
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
typedef struct config_t {
|
typedef struct config_t {
|
||||||
int hide_on_modifier;
|
int hide_on_modifier;
|
||||||
int verbose;
|
int verbose;
|
||||||
|
xcb_colors_t *colors;
|
||||||
} config_t;
|
} config_t;
|
||||||
|
|
||||||
config_t config;
|
config_t config;
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
#define XCB_H_
|
#define XCB_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
//#include "outputs.h"
|
||||||
|
|
||||||
struct colors_t {
|
struct xcb_color_strings_t {
|
||||||
char *bar_fg;
|
char *bar_fg;
|
||||||
char *bar_bg;
|
char *bar_bg;
|
||||||
char *active_ws_fg;
|
char *active_ws_fg;
|
||||||
|
@ -22,16 +23,7 @@ struct colors_t {
|
||||||
char *urgent_ws_fg;
|
char *urgent_ws_fg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct parsed_colors_t {
|
typedef struct xcb_colors_t xcb_colors_t;
|
||||||
uint32_t bar_fg;
|
|
||||||
uint32_t bar_bg;
|
|
||||||
uint32_t active_ws_fg;
|
|
||||||
uint32_t active_ws_bg;
|
|
||||||
uint32_t inactive_ws_fg;
|
|
||||||
uint32_t inactive_ws_bg;
|
|
||||||
uint32_t urgent_ws_bg;
|
|
||||||
uint32_t urgent_ws_fg;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize xcb and use the specified fontname for text-rendering
|
* Initialize xcb and use the specified fontname for text-rendering
|
||||||
|
@ -43,7 +35,7 @@ void init_xcb();
|
||||||
* Initialize the colors
|
* Initialize the colors
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void init_colors(const struct colors_t *colors);
|
void init_colors(const struct xcb_color_strings_t *colors);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cleanup the xcb-stuff.
|
* Cleanup the xcb-stuff.
|
||||||
|
|
|
@ -37,8 +37,7 @@ char *expand_path(char *path) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_color(char **color)
|
static void read_color(char **color) {
|
||||||
{
|
|
||||||
int len = strlen(optarg);
|
int len = strlen(optarg);
|
||||||
if (len == 6 || (len == 7 && optarg[0] == '#')) {
|
if (len == 6 || (len == 7 && optarg[0] == '#')) {
|
||||||
int offset = len - 6;
|
int offset = len - 6;
|
||||||
|
@ -62,8 +61,7 @@ static void read_color(char **color)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_colors(struct colors_t *colors)
|
static void free_colors(struct xcb_color_strings_t *colors) {
|
||||||
{
|
|
||||||
#define FREE_COLOR(x) \
|
#define FREE_COLOR(x) \
|
||||||
do { \
|
do { \
|
||||||
if (colors->x) \
|
if (colors->x) \
|
||||||
|
@ -99,7 +97,7 @@ int main(int argc, char **argv) {
|
||||||
char *command = NULL;
|
char *command = NULL;
|
||||||
char *fontname = NULL;
|
char *fontname = NULL;
|
||||||
char *i3_default_sock_path = "~/.i3/ipc.sock";
|
char *i3_default_sock_path = "~/.i3/ipc.sock";
|
||||||
struct colors_t colors = {0,};
|
struct xcb_color_strings_t colors = { NULL, };
|
||||||
|
|
||||||
/* Definition of the standard-config */
|
/* Definition of the standard-config */
|
||||||
config.hide_on_modifier = 0;
|
config.hide_on_modifier = 0;
|
||||||
|
|
|
@ -64,7 +64,17 @@ ev_io *xcb_io;
|
||||||
ev_io *xkb_io;
|
ev_io *xkb_io;
|
||||||
|
|
||||||
/* The parsed colors */
|
/* The parsed colors */
|
||||||
struct parsed_colors_t colors;
|
struct xcb_colors_t {
|
||||||
|
uint32_t bar_fg;
|
||||||
|
uint32_t bar_bg;
|
||||||
|
uint32_t active_ws_fg;
|
||||||
|
uint32_t active_ws_bg;
|
||||||
|
uint32_t inactive_ws_fg;
|
||||||
|
uint32_t inactive_ws_bg;
|
||||||
|
uint32_t urgent_ws_bg;
|
||||||
|
uint32_t urgent_ws_fg;
|
||||||
|
};
|
||||||
|
struct xcb_colors_t colors;
|
||||||
|
|
||||||
/* We define xcb_request_failed as a macro to include the relevant line-number */
|
/* We define xcb_request_failed as a macro to include the relevant line-number */
|
||||||
#define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__)
|
#define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__)
|
||||||
|
@ -254,7 +264,7 @@ void unhide_bars() {
|
||||||
* Parse the colors into a format that we can use
|
* Parse the colors into a format that we can use
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void init_colors(const struct colors_t *new_colors) {
|
void init_colors(const struct xcb_color_strings_t *new_colors) {
|
||||||
#define PARSE_COLOR(name, def) \
|
#define PARSE_COLOR(name, def) \
|
||||||
do { \
|
do { \
|
||||||
colors.name = get_colorpixel(new_colors->name ? new_colors->name : def); \
|
colors.name = get_colorpixel(new_colors->name ? new_colors->name : def); \
|
||||||
|
|
Loading…
Reference in New Issue