fixed css doing the opposite check, writing errors to stderr, swapped !(==) for !=, fixed oopsies in manpage
This commit is contained in:
parent
c597c088d6
commit
7956e253be
@ -109,6 +109,9 @@ Specifies something to search for immediately on opening
|
||||
.B monitor=\fISTRING\fR
|
||||
Sets the monitor to open on
|
||||
.TP
|
||||
.B pre_display_cmd=\fSTR\fR
|
||||
Specifies a printf-like string which is used on the entries prior to displaying them. This command is only used to represent the label widget's string, and won't affect the the output of the selected label.
|
||||
.TP
|
||||
.B orientation=\fIORIENTATION\fR
|
||||
Specifies the orientation, it can be either horizontal or vertical, default is vertical.
|
||||
.TP
|
||||
@ -183,8 +186,6 @@ Specifies the layer to open on. The options are background, bottom, top, and ove
|
||||
.TP
|
||||
.B copy_exec=\fIPATH\fR
|
||||
Specifies the executable to pipe copy data into. $PATH will be scanned, this is not passed to a shell and must be an executable. Default is wl-copy.
|
||||
.B pre_display_cmd=\fSTR\fR
|
||||
Specifies a printf-like string which is used on the entries prior to displaying them. This command is only used to represent the label widget's string, and won't affect the the output of the selected label.
|
||||
|
||||
.SH CSS SELECTORS
|
||||
Any GTK widget can be selected by using the name of its CSS node, these however might change with updates and are not guaranteed to stay constant. Wofi also provides certain widgets with names and classes which can be referenced from CSS to give access to the most important widgets easily. \fBwofi\fR(7) contains the current widget layout used by wofi so if you want to get into CSS directly using GTK widget names look there for info.
|
||||
|
@ -107,8 +107,8 @@ void wofi_load_css(bool nyan) {
|
||||
ssize_t size = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
char* data = malloc(size + 1);
|
||||
if (fread(data, 1, size, file) != 0) {
|
||||
printf("failed to read stylesheet data from file");
|
||||
if (fread(data, 1, size, file) == 0) {
|
||||
printf(stderr, "failed to read stylesheet data from file");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fclose(file);
|
||||
|
13
src/wofi.c
13
src/wofi.c
@ -539,20 +539,19 @@ static gboolean _insert_widget(gpointer data) {
|
||||
}
|
||||
char* nodetext = NULL;
|
||||
|
||||
if (!(pre_display_cmd == NULL)) {
|
||||
if (pre_display_cmd != NULL) {
|
||||
FILE *fp_labeltext;
|
||||
char *cmd_labeltext;
|
||||
char line[128]; // you'd think this caps the line's length to 128, but it's just a buffer which due to the nature of fgets() splits on lines
|
||||
unsigned int size = 0;
|
||||
size_t size = 0;
|
||||
// first, prepare cmd_labeltext to be each entry's actual comamand to run, aka replacing 'cat %s' to be 'cat filename'
|
||||
if ((asprintf(&cmd_labeltext, pre_display_cmd, node->text[0])) == -1) {
|
||||
printf("error parsing pre_display_cmd to run\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf(stderr, "error parsing pre_display_cmd to run\n");
|
||||
exit(EXIT_FAILURE); }
|
||||
// then, run the command
|
||||
fp_labeltext = popen(cmd_labeltext, "r");
|
||||
if (fp_labeltext == NULL) {
|
||||
printf("error executing '%s'\n", cmd_labeltext);
|
||||
printf(stderr, "error executing '%s'\n", cmd_labeltext);
|
||||
exit(EXIT_FAILURE);
|
||||
} else if (fgets(line, sizeof(line), fp_labeltext)) {
|
||||
// lastly, read the output of said command, and put it into the text variable to be used for the label widgets
|
||||
@ -1282,7 +1281,7 @@ static void do_copy(void) {
|
||||
}
|
||||
close(fds[0]);
|
||||
|
||||
if (!(write(fds[1], action, strlen(action)) == 0)) {
|
||||
if (write(fds[1], action, strlen(action)) != 0) {
|
||||
printf("fd pipe failed to write");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user