mirror of
https://github.com/kolunmi/dwlb.git
synced 2025-10-29 11:14:15 +00:00
Add an option to retrieve the current focused window title from dwlb
This commit is contained in:
parent
48dbe00bdb
commit
641899d473
14
dwlb.c
14
dwlb.c
@ -208,6 +208,8 @@ static uint32_t height, textpadding, buffer_scale;
|
|||||||
|
|
||||||
static bool run_display;
|
static bool run_display;
|
||||||
|
|
||||||
|
static char *last_logged_title = NULL;
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1219,6 +1221,7 @@ read_stdin(void)
|
|||||||
if (!(bar->window_title = strdup(wordend)))
|
if (!(bar->window_title = strdup(wordend)))
|
||||||
EDIE("strdup");
|
EDIE("strdup");
|
||||||
bar->redraw = true;
|
bar->redraw = true;
|
||||||
|
last_logged_title = strdup(wordend);
|
||||||
} else if (!strcmp(wordbeg, "selmon")) {
|
} else if (!strcmp(wordbeg, "selmon")) {
|
||||||
ADVANCE();
|
ADVANCE();
|
||||||
if ((val = atoi(wordbeg)) != bar->sel) {
|
if ((val = atoi(wordbeg)) != bar->sel) {
|
||||||
@ -1543,6 +1546,12 @@ read_socket(void)
|
|||||||
if (!bar->hidden)
|
if (!bar->hidden)
|
||||||
hide_bar(bar);
|
hide_bar(bar);
|
||||||
}
|
}
|
||||||
|
} else if (!strcmp(wordbeg, "printinfo")) {
|
||||||
|
FILE *f = fopen("/tmp/dwlb_info", "w");
|
||||||
|
if (f) {
|
||||||
|
fprintf(f, "%s", last_logged_title ? last_logged_title : "(none)");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
} else if (!strcmp(wordbeg, "toggle-visibility")) {
|
} else if (!strcmp(wordbeg, "toggle-visibility")) {
|
||||||
if (all) {
|
if (all) {
|
||||||
wl_list_for_each(bar, &bar_list, link)
|
wl_list_for_each(bar, &bar_list, link)
|
||||||
@ -1738,6 +1747,11 @@ main(int argc, char **argv)
|
|||||||
DIE("Option -hide requires an argument");
|
DIE("Option -hide requires an argument");
|
||||||
client_send_command(&sock_address, argv[i], "hide", NULL, target_socket);
|
client_send_command(&sock_address, argv[i], "hide", NULL, target_socket);
|
||||||
return 0;
|
return 0;
|
||||||
|
} else if (!strcmp(argv[i], "-printinfo")) {
|
||||||
|
if (++i >= argc)
|
||||||
|
DIE("Option -printinfo requires an argument");
|
||||||
|
client_send_command(&sock_address, argv[i], "printinfo", NULL, target_socket);
|
||||||
|
return 0;
|
||||||
} else if (!strcmp(argv[i], "-toggle-visibility")) {
|
} else if (!strcmp(argv[i], "-toggle-visibility")) {
|
||||||
if (++i >= argc)
|
if (++i >= argc)
|
||||||
DIE("Option -toggle requires an argument");
|
DIE("Option -toggle requires an argument");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user