|
diff --git a/main.c b/main.c
|
| ... |
| 23 |
#define COLOR_TITLE (TB_YELLOW | TB_BOLD) |
23 |
#define COLOR_TITLE (TB_YELLOW | TB_BOLD) |
| 24 |
#define COLOR_SELECTED TB_BLUE |
24 |
#define COLOR_SELECTED TB_BLUE |
| 25 |
#define COLOR_DEFAULT TB_WHITE |
25 |
#define COLOR_DEFAULT TB_WHITE |
| 26 |
#define COLOR_DIM TB_DIM |
26 |
#define COLOR_BG TB_BLACK |
|
|
27 |
#define COLOR_DIM TB_WHITE |
| 27 |
#define COLOR_SUCCESS TB_GREEN |
28 |
#define COLOR_SUCCESS TB_GREEN |
| 28 |
#define COLOR_ERROR TB_RED |
29 |
#define COLOR_ERROR TB_RED |
| 29 |
|
30 |
|
| ... |
| 100 |
} |
101 |
} |
| 101 |
|
102 |
|
| 102 |
void draw_titles() { |
103 |
void draw_titles() { |
| 103 |
tb_print(X_OFF_CATEGORIES, Y_OFF_TITLES, COLOR_TITLE, TB_DEFAULT, "CATEGORIES"); |
104 |
tb_print(X_OFF_CATEGORIES, Y_OFF_TITLES, COLOR_TITLE, COLOR_BG, "CATEGORIES"); |
| 104 |
tb_print(X_OFF_APPS, Y_OFF_TITLES, COLOR_TITLE, TB_DEFAULT, "APPLICATIONS"); |
105 |
tb_print(X_OFF_APPS, Y_OFF_TITLES, COLOR_TITLE, COLOR_BG, "APPLICATIONS"); |
| 105 |
tb_print(X_OFF_FILE, Y_OFF_TITLES, COLOR_TITLE, TB_DEFAULT, "FILE"); |
106 |
tb_print(X_OFF_FILE, Y_OFF_TITLES, COLOR_TITLE, COLOR_BG, "FILE"); |
| 106 |
} |
107 |
} |
| 107 |
|
108 |
|
| 108 |
void draw_categories(State *state) { |
109 |
void draw_categories(State *state) { |
| ... |
| 111 |
for (int i = 0; i < height && (i + state->category_offset) < count; ++i) { |
112 |
for (int i = 0; i < height && (i + state->category_offset) < count; ++i) { |
| 112 |
int idx = i + state->category_offset; |
113 |
int idx = i + state->category_offset; |
| 113 |
uint16_t fg = COLOR_DEFAULT; |
114 |
uint16_t fg = COLOR_DEFAULT; |
| 114 |
uint16_t bg = TB_DEFAULT; |
115 |
uint16_t bg = COLOR_BG; |
| 115 |
if (state->col == 0 && state->category_idx == idx) { |
116 |
if (state->col == 0 && state->category_idx == idx) { |
| 116 |
bg = COLOR_SELECTED; |
117 |
bg = COLOR_SELECTED; |
| 117 |
} else if (state->category_idx == idx) { |
118 |
} else if (state->category_idx == idx) { |
| ... |
| 131 |
int idx = i + state->app_offset; |
132 |
int idx = i + state->app_offset; |
| 132 |
char *app_name = (char *)l->data; |
133 |
char *app_name = (char *)l->data; |
| 133 |
uint16_t fg = COLOR_DEFAULT; |
134 |
uint16_t fg = COLOR_DEFAULT; |
| 134 |
uint16_t bg = TB_DEFAULT; |
135 |
uint16_t bg = COLOR_BG; |
| 135 |
if (state->col == 1 && state->app_idx == idx) { |
136 |
if (state->col == 1 && state->app_idx == idx) { |
| 136 |
bg = COLOR_SELECTED; |
137 |
bg = COLOR_SELECTED; |
| 137 |
} |
138 |
} |
| ... |
| 166 |
int idx = i + state->app_offset; |
167 |
int idx = i + state->app_offset; |
| 167 |
GAppInfo *app = (GAppInfo *)l->data; |
168 |
GAppInfo *app = (GAppInfo *)l->data; |
| 168 |
uint16_t fg = COLOR_DEFAULT; |
169 |
uint16_t fg = COLOR_DEFAULT; |
| 169 |
uint16_t bg = TB_DEFAULT; |
170 |
uint16_t bg = COLOR_BG; |
| 170 |
if (state->col == 1 && state->app_idx == idx) { |
171 |
if (state->col == 1 && state->app_idx == idx) { |
| 171 |
bg = COLOR_SELECTED; |
172 |
bg = COLOR_SELECTED; |
| 172 |
} |
173 |
} |
| ... |
| 204 |
if (strncmp(state->message, "Failed", 6) == 0) { |
205 |
if (strncmp(state->message, "Failed", 6) == 0) { |
| 205 |
msg_col = COLOR_ERROR; |
206 |
msg_col = COLOR_ERROR; |
| 206 |
} |
207 |
} |
| 207 |
tb_print(X_OFF_CATEGORIES, tb_height() - 1, msg_col, TB_DEFAULT, state->message); |
208 |
tb_print(X_OFF_CATEGORIES, tb_height() - 1, msg_col, COLOR_BG, state->message); |
| 208 |
} |
209 |
} |
| 209 |
|
210 |
|
| 210 |
tb_present(); |
211 |
tb_present(); |
| ... |
| 214 |
if (tb_init() != 0) { |
215 |
if (tb_init() != 0) { |
| 215 |
return 1; |
216 |
return 1; |
| 216 |
} |
217 |
} |
|
|
218 |
tb_set_clear_attrs(COLOR_DEFAULT, COLOR_BG); |
| 217 |
|
219 |
|
| 218 |
State state = {0, 0, 0, 0, 0, {0}, NULL, 0, 0}; |
220 |
State state = {0, 0, 0, 0, 0, {0}, NULL, 0, 0}; |
| 219 |
char *dev_env = getenv("XDGCTL_DEV"); |
221 |
char *dev_env = getenv("XDGCTL_DEV"); |
| ... |