It was possible to deselect items when using a touch screen. This is done
by tapping on an item that's already selected. This would cause a segfault
in the select_item() function of src/wofi.c since
gtk_flow_box_get_selected_children() would return NULL in this case. By
setting the selection mode to GTK_SELECTION_BROWSE, we avoid this case
by ensuring an item is always selected.
If out is not initialised, GLib will attempt to free the string automagically
later, leading to a crash. To reproduce, try running
wofi --define parse_search=true --define allow_markup=true --show dmenu,drun
Since some time now, GTK3 themes can ship an optional "dark" variant
and applications like picture viewers can make use of such a variant to
appear dark (to not distract from the picture) without overwriting the
current theme (and risking optical breakage). While wofi is not a
picture viewer it may still be desirable to use a dark theme, for
example to contrast the (light) application displaying in the
background.
Of course, wofi can already be fully customized through CSS and/or the
colors file, but using the existing dark variant may be easier than
fully restyling it, if all you want is a darker appearance. The only
way to set an arbitrary GTK application to use the dark theme seems to
be setting an environment variable, but that bears two problems:
For one, one needs to specify the full theme + dark modifier in the
variable, so one would have to keep the global GTK theme and the one
used by wofi manually in sync.
More critical though, the environment variable would be propagated to
the programs wofi launches (for now at least). That would lead to all
GTK applications launched through wofi to use the dark theme, which may
not be desirable. Wofi could also unset that variable before launching
a program, but at this point adding a simple switch is probably easier.
Side note: It may be that there is some way to configure the CSS file
to include the CSS of the dark variant of the current theme, but I have
not been able to find out how. Gnome-terminal uses a switch like this
too (just with dconf), so this may just be the way to go.