1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

[RB] Add (unfinished regex test)

This commit is contained in:
Dave Davenport 2023-05-10 18:09:54 +02:00
parent 848277001f
commit 4d2941caf3
3 changed files with 8 additions and 3 deletions

View file

@ -11,6 +11,7 @@ if [[ $ROFI_RETV = 0 ]]
then then
echo -en "\x00delim\x1f\\x1\n" echo -en "\x00delim\x1f\\x1\n"
fi fi
echo -en "\x00message\x1fmy line1\nmyline2\nmy line3\x1"
echo -en "\x00prompt\x1fChange prompt\x1" echo -en "\x00prompt\x1fChange prompt\x1"
for a in {1..10} for a in {1..10}
do do

View file

@ -257,8 +257,6 @@ static gpointer read_input_thread(gpointer userdata) {
ssize_t nread = 0; ssize_t nread = 0;
ssize_t len = 0; ssize_t len = 0;
char *line = NULL; char *line = NULL;
// Create the message passing queue to the UI thread.
pd->async_queue = g_async_queue_new();
Block *block = NULL; Block *block = NULL;
GTimer *tim = g_timer_new(); GTimer *tim = g_timer_new();
@ -616,6 +614,8 @@ static int dmenu_mode_init(Mode *sw) {
} }
pd->wake_source = pd->wake_source =
g_unix_fd_add(pd->pipefd2[0], G_IO_IN, dmenu_async_read_proc, pd); g_unix_fd_add(pd->pipefd2[0], G_IO_IN, dmenu_async_read_proc, pd);
// Create the message passing queue to the UI thread.
pd->async_queue = g_async_queue_new();
pd->reading_thread = pd->reading_thread =
g_thread_new("dmenu-read", (GThreadFunc)read_input_thread, pd); g_thread_new("dmenu-read", (GThreadFunc)read_input_thread, pd);
pd->loading = TRUE; pd->loading = TRUE;

View file

@ -110,6 +110,7 @@ typedef struct {
guint end_thread; guint end_thread;
gboolean loading; gboolean loading;
int pipefd2[2]; int pipefd2[2];
GRegex *filter_regex;
} FileBrowserModePrivateData; } FileBrowserModePrivateData;
/** /**
@ -253,7 +254,9 @@ static void scan_dir(FileBrowserModePrivateData *pd, GFile *path) {
if (g_strcmp0(rd->d_name, ".") == 0) { if (g_strcmp0(rd->d_name, ".") == 0) {
continue; continue;
} }
if (rd->d_name[0] == '.') { if (pd->filter_regex &&
g_regex_match(pd->filter_regex, rd->d_name, 0, NULL)) {
printf("skip: %s\n", rd->d_name);
continue; continue;
} }
switch (rd->d_type) { switch (rd->d_type) {
@ -377,6 +380,7 @@ static int recursive_browser_mode_init(Mode *sw) {
if (pipe(pd->pipefd2) == -1) { if (pipe(pd->pipefd2) == -1) {
g_error("Failed to create pipe"); g_error("Failed to create pipe");
} }
pd->filter_regex = g_regex_new("^(\\..*)", G_REGEX_OPTIMIZE, 0, NULL);
pd->wake_source = g_unix_fd_add(pd->pipefd2[0], G_IO_IN, pd->wake_source = g_unix_fd_add(pd->pipefd2[0], G_IO_IN,
recursive_browser_async_read_proc, pd); recursive_browser_async_read_proc, pd);