mirror of
https://github.com/lbonn/rofi
synced 2024-11-26 22:00:20 +00:00
[ROFI] -e '-' reads from stdin
This commit is contained in:
parent
635fbd0464
commit
7814da7ee4
3 changed files with 25 additions and 2 deletions
|
@ -1142,6 +1142,9 @@ cause slowdowns when set too high)
|
|||
Pops up a message dialog (used internally for showing errors) with \fImessage\fP\&.
|
||||
Message can be multi-line.
|
||||
|
||||
.PP
|
||||
Passing \fB\fC-e -\fR reads (blocking) from standard in and displays this.
|
||||
|
||||
.SS File browser settings
|
||||
.PP
|
||||
File browser behavior can be controlled via the following options:
|
||||
|
|
|
@ -740,6 +740,8 @@ cause slowdowns when set too high)
|
|||
Pops up a message dialog (used internally for showing errors) with *message*.
|
||||
Message can be multi-line.
|
||||
|
||||
Passing `-e -` reads (blocking) from standard in and displays this.
|
||||
|
||||
### File browser settings
|
||||
|
||||
File browser behavior can be controlled via the following options:
|
||||
|
|
|
@ -797,8 +797,26 @@ static gboolean startup(G_GNUC_UNUSED gpointer data) {
|
|||
if (find_arg("-markup") >= 0) {
|
||||
markup = TRUE;
|
||||
}
|
||||
if (!rofi_view_error_dialog(msg, markup)) {
|
||||
g_main_loop_quit(main_loop);
|
||||
// When we pass -, we read from stdin.
|
||||
if (g_strcmp0(msg, "-") == 0) {
|
||||
size_t index = 0, i = 0;
|
||||
size_t length = 1024;
|
||||
msg = malloc(length * sizeof(char));
|
||||
while ((i = fread(&msg[index], 1, 1024, stdin))>0) {
|
||||
index+=i;
|
||||
length+=i;
|
||||
msg = realloc(msg,length * sizeof(char));
|
||||
}
|
||||
|
||||
if (!rofi_view_error_dialog(msg, markup)) {
|
||||
g_main_loop_quit(main_loop);
|
||||
}
|
||||
g_free(msg);
|
||||
} else {
|
||||
// Normal version
|
||||
if (!rofi_view_error_dialog(msg, markup)) {
|
||||
g_main_loop_quit(main_loop);
|
||||
}
|
||||
}
|
||||
} else if (find_arg_str("-show", &sname) == TRUE) {
|
||||
int index = mode_lookup(sname);
|
||||
|
|
Loading…
Reference in a new issue