diff --git a/Makefile.am b/Makefile.am index adcda08c1..3471bb560 100644 --- a/Makefile.am +++ b/Makefile.am @@ -186,7 +186,8 @@ generate-manpage: doc/rofi.1\ doc/rofi-dmenu.5\ doc/rofi-keys.5\ doc/rofi-script.5\ - doc/rofi-theme.5 + doc/rofi-theme.5 \ + doc/rofi-thumbnails.5 doc/rofi.1: doc/rofi.1.markdown pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$< @@ -204,6 +205,8 @@ doc/rofi-script.5: doc/rofi-script.5.markdown pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$< doc/rofi-theme.5: doc/rofi-theme.5.markdown pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$< +doc/rofi-thumbnails.5: doc/rofi-thumbnails.5.markdown + pandoc --standalone --to=man --lua-filter=$(top_srcdir)/doc/man_filter.lua -f markdown-tex_math_dollars -o ./$@ ./$< endif @@ -217,10 +220,12 @@ dist_man5_MANS=\ doc/rofi-dmenu.5\ doc/rofi-keys.5\ doc/rofi-script.5\ - doc/rofi-theme.5 + doc/rofi-theme.5\ + doc/rofi-thumbnails.5 EXTRA_DIST += \ doc/rofi-theme.5.markdown \ + doc/rofi-thumbnails.5.markdown \ doc/rofi-debugging.5.markdown \ doc/rofi-script.5.markdown \ doc/rofi-keys.5.markdown \ @@ -668,6 +673,7 @@ desktop_DATA=\ data/rofi-theme-selector.desktop EXTRA_DIST += \ + doc/man_filter.lua \ doc/meson.build \ subprojects/libgwater/mpd/meson.build \ subprojects/libgwater/nl/meson.build \ @@ -692,6 +698,7 @@ EXTRA_DIST += \ subprojects/libgwater/alsa-mixer/libgwater-alsa-mixer.h \ subprojects/libgwater/alsa-mixer/libgwater-alsa-mixer.c \ data/rofi.png\ + meson-dist-script \ meson_options.txt \ meson.build diff --git a/README.md b/README.md index c50fef822..bc43c5a4f 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,7 @@ For more up to date information, please see the manpages. The other sections and - [rofi-debugging](doc/rofi-debugging.5.markdown) - [rofi-script](doc/rofi-script.5.markdown) - [rofi-theme-selector](doc/rofi-theme-selector.1.markdown) + - [rofi-thumbnails](doc/rofi-thumbnails.5.markdown) - [rofi-keys](doc/rofi-keys.5.markdown) - [rofi-dmenu](doc/rofi-dmenu.5.markdown) diff --git a/config/config.c b/config/config.c index 49fea26d2..cf627dc7c 100644 --- a/config/config.c +++ b/config/config.c @@ -46,6 +46,9 @@ Settings config = { /** Whether to load and show icons */ .show_icons = FALSE, + /** Custom command to generate preview icons */ + .preview_cmd = NULL, + /** Terminal to use. (for ssh and open in terminal) */ .terminal_emulator = "rofi-sensible-terminal", .ssh_client = "ssh", @@ -160,5 +163,5 @@ Settings config = { /** workaround for broken xserver (#300 on xserver, #611) */ .xserver_i300_workaround = FALSE, /** What browser to use for completion */ - .completer_mode = "recursivebrowser", + .completer_mode = "filebrowser", }; diff --git a/configure.ac b/configure.ac index c658aed9d..efd630966 100644 --- a/configure.ac +++ b/configure.ac @@ -74,7 +74,7 @@ AM_PROG_AR dnl --------------------------------------------------------------------- dnl Base CFLAGS dnl --------------------------------------------------------------------- -AM_CFLAGS="-Wall -Wextra -Wparentheses -Winline -pedantic -Wno-overlength-strings -Wunreachable-code" +AM_CFLAGS="-Wall -Wextra -Wparentheses -Wno-inline -pedantic -Wno-overlength-strings -Wunreachable-code" dnl --------------------------------------------------------------------- dnl Enable source code coverage reporting for GCC @@ -145,7 +145,7 @@ NK_INIT([bindings xdg-theme]) PKG_CHECK_MODULES([glib], [glib-2.0 >= ${glib_min_version} gio-unix-2.0 gmodule-2.0]) AC_DEFINE_UNQUOTED([GLIB_VERSION_MIN_REQUIRED], [(G_ENCODE_VERSION(${glib_min_major},${glib_min_minor}))], [The lower GLib version supported]) AC_DEFINE_UNQUOTED([GLIB_VERSION_MAX_ALLOWED], [(G_ENCODE_VERSION(${glib_min_major},${glib_min_minor}))], [The highest GLib version supported]) -GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon xkbcommon-x11 xcb-ewmh xcb-icccm xcb-cursor xcb-randr xcb-xinerama ]) +GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon xkbcommon-x11 xcb-ewmh xcb-icccm xcb-cursor xcb-randr xcb-xinerama xcb-keysyms ]) AC_ARG_ENABLE([imdkit], AS_HELP_STRING([--enable-imdkit], [Build with checks using check library (default: disabled)])) diff --git a/doc/meson.build b/doc/meson.build index b5bb2f015..7c399eb4c 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -7,6 +7,7 @@ man_files = [ 'rofi-keys.5', 'rofi-script.5', 'rofi-theme.5', + 'rofi-thumbnails.5', ] fs = import('fs') diff --git a/doc/rofi-script.5.markdown b/doc/rofi-script.5.markdown index 527c07a0d..aeeac8fda 100644 --- a/doc/rofi-script.5.markdown +++ b/doc/rofi-script.5.markdown @@ -109,6 +109,8 @@ The following extra options exists: - **keep-selection**: If set, the selection is not moved to the first entry, but the current position is maintained. The filter is cleared. +- **keep-filter**: If set, the filter is not cleared. + - **new-selection**: If `keep-selection` is set, this allows you to override the selected entry (absolute position). @@ -182,11 +184,20 @@ To specify a script there are the following options: - Specify an absolute path to the script. - The script is executable and located in your $PATH -Scripts located in the following location are loaded on startup: +Scripts located in the following location are **loaded** on startup +and can be directly launched based on the filename (without extension): -- The script is in `$XDG_CONFIG_PATH/rofi/scripts/`, this is usually +- The script is in `$XDG_CONFIG_HOME/rofi/scripts/`, this is usually `~/.config/rofi/scripts/`. +If you have a script 'mymode.sh' in this folder you can open it using: + +```bash +rofi -show mymode +``` + +See `rofi -h` output for a list of detected scripts. + ## SEE ALSO rofi(1), rofi-sensible-terminal(1), dmenu(1), rofi-theme(5), diff --git a/doc/rofi-thumbnails.5.markdown b/doc/rofi-thumbnails.5.markdown new file mode 100644 index 000000000..e18ced7e1 --- /dev/null +++ b/doc/rofi-thumbnails.5.markdown @@ -0,0 +1,85 @@ +# rofi-thumbnails(5) + +## NAME + +**rofi-thumbnails** - Rofi thumbnails system + +## DESCRIPTION + +**rofi** is now able to show thumbnails for all file types where an XDG compatible thumbnailer is present in the system. + +This is done by default in filebrowser and recursivebrowser mode, if **rofi** is launched with the `-show-icons` argument. + +In a custom user script or dmenu mode, it is possible to produce entry icons using XDG thumbnailers by adding the prefix `thumbnail://` to the filename +specified after `\0icon\x1f`, for example: + +```bash +echo -en "EntryName\0icon\x1fthumbnail://path/to/file\n" | rofi -dmenu -show-icons +``` + +### XDG thumbnailers + +XDG thumbnailers are files with a ".thumbnailer" suffix and a structure similar to ".desktop" files for launching applications. They are placed in `/usr/share/thumbnailers/` or `$HOME/.local/share/thumbnailers/`, and contain a list of mimetypes, for which is possible to produce the thumbnail image, and a string with the command to create said image. The example below shows the content of `librsvg.thumbnailer`, a thumbnailer for svg files using librsvg: + +``` +[Thumbnailer Entry] +TryExec=/usr/bin/gdk-pixbuf-thumbnailer +Exec=/usr/bin/gdk-pixbuf-thumbnailer -s %s %u %o +MimeType=image/svg+xml;image/svg+xml-compressed; +``` + +The images produced are named as the md5sum of the input files and placed, depending on their size, in the XDG thumbnails directories: `$HOME/.cache/thumbnails/{normal,large,x-large,xx-large}`. They are then loaded by **rofi** as entry icons and can also be used by file managers like Thunar, Caja or KDE Dolphin to show their thumbnails. Additionally, if a thumbnail for a file is found in the thumbnails directories (produced previously by **rofi** or a file manager), **rofi** will load it instead of calling the thumbnailer. + +If a suitable thumbnailer for a given file is not found, **rofi** will try to use the corresponding mimetype icon from the icon theme. + +### Custom command to create thumbnails + +It is possible to use a custom command to generate thumbnails for generic entry names, for example a script that downloads an icon given its url or selects different icons depending on the input. This can be done providing the `-preview-cmd` argument followed by a string with the command to execute, with the following syntax: + +``` +rofi ... -preview-cmd 'path/to/script_or_cmd "{input}" "{output}" "{size}"' +``` + +**rofi** will call the script or command substituting `{input}` with the input entry icon name (the string after `\0icon\x1fthumbnail://`), `{output}` with the output filename of the thumbnail and `{size}` with the requested thumbnail size. The script or command is responsible of producing a thumbnail image (if possible respecting the requested size) and saving it in the given `{output}` filename. + +### Issues with AppArmor + +In Linux distributions using AppArmor (such as Ubuntu and Debian), the default rules shipped can cause issues with thumbnails generation. If that is the case, AppArmor can be disabled by issuing the following commands + +``` +sudo systemctl stop apparmor +sudo systemctl disable apparmor +``` + +In alternative, the following apparmor profile con be placed in a file named /etc/apparmor.d/usr.bin.rofi + +``` +#vim:syntax=apparmor +# AppArmor policy for rofi + +#include + +/usr/bin/rofi { + #include + + # TCP/UDP network access for NFS + network inet stream, + network inet6 stream, + network inet dgram, + network inet6 dgram, + + /usr/bin/rofi mr, + + @{HOME}/ r, + @{HOME}/** rw, + owner @{HOME}/.cache/thumbnails/** rw, +} +``` + +then run + +``` +apparmor_parser -r /etc/apparmor.d/usr.bin.rofi +``` + +to reload the rule. This assumes that **rofi** binary is in /usr/bin, that is the case of a standard package installation. diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index 1ba4c3890..3c5a6afe0 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -302,6 +302,12 @@ Use Pango markup to format output wherever possible. Make **rofi** react like a normal application window. Useful for scripts like Clerk that are basically an application. +`-transient-window` + +Make **rofi** react like a modal dialog that is transient to the currently +focused window. Useful when you use a keyboard shortcut to run and show +on the window you are working with. + `-[no-]steal-focus` Make rofi steal focus on launch and restore close to window that held it when diff --git a/include/settings.h b/include/settings.h index 684fb6b22..f9853f20b 100644 --- a/include/settings.h +++ b/include/settings.h @@ -65,6 +65,9 @@ typedef struct { /** Whether to load and show icons */ gboolean show_icons; + + /** Custom command to generate preview icons */ + char *preview_cmd; /** Terminal to use */ char *terminal_emulator; diff --git a/include/view.h b/include/view.h index ccfe2f895..e6c8a204b 100644 --- a/include/view.h +++ b/include/view.h @@ -60,6 +60,8 @@ typedef enum { MENU_NORMAL_WINDOW = 2, /** ERROR dialog */ MENU_ERROR_DIALOG = 4, + /** Create transient window. */ + MENU_TRANSIENT_WINDOW = 8, } MenuFlags; /** diff --git a/include/widgets/icon.h b/include/widgets/icon.h index e0da5c7f4..2422a27b8 100644 --- a/include/widgets/icon.h +++ b/include/widgets/icon.h @@ -59,9 +59,9 @@ icon *icon_create(widget *parent, const char *name); void icon_set_size(widget *icon, const int size); /** - * @param icon The icon widget handle. + * @param icon_widget The icon widget handle. * @param surf The surface to display. */ -void icon_set_surface(icon *icon, cairo_surface_t *surf); +void icon_set_surface(icon *icon_widget, cairo_surface_t *surf); /**@}*/ #endif // ROFI_ICON_H diff --git a/include/widgets/listview.h b/include/widgets/listview.h index 292118383..9fee5b52a 100644 --- a/include/widgets/listview.h +++ b/include/widgets/listview.h @@ -84,10 +84,18 @@ typedef void (*listview_selection_changed_callback)(listview *lv, */ typedef void (*listview_mouse_activated_cb)(listview *, gboolean, void *); + +/** + * Callback when current page is changed. + */ +typedef void (*listview_page_changed_cb)(void); + + /** * @param parent The widget's parent. * @param name The name of the to be created widget. * @param cb The update callback. + * @param page_cb The page change callback. * @param udata The user data to pass to the callback * @param eh The height of one element * @param reverse Reverse the listview order. @@ -95,7 +103,8 @@ typedef void (*listview_mouse_activated_cb)(listview *, gboolean, void *); * @returns a new listview */ listview *listview_create(widget *parent, const char *name, - listview_update_callback cb, void *udata, + listview_update_callback cb, + listview_page_changed_cb page_cb, void *udata, unsigned int eh, gboolean reverse); /** diff --git a/include/widgets/widget.h b/include/widgets/widget.h index 2be4d9155..d5d737881 100644 --- a/include/widgets/widget.h +++ b/include/widgets/widget.h @@ -83,7 +83,7 @@ typedef enum { } WidgetTriggerActionResult; /** - * @param widget The container widget itself + * @param wid The container widget itself * @param type The widget type searched for * @param x The X coordination of the mouse event relative to #widget * @param y The Y coordination of the mouse event relative to #widget @@ -93,11 +93,11 @@ typedef enum { * * @returns A child widget if found, NULL otherwise */ -typedef widget *(*widget_find_mouse_target_cb)(widget *widget, WidgetType type, +typedef widget *(*widget_find_mouse_target_cb)(widget *wid, WidgetType type, gint x, gint y); /** - * @param widget The target widget + * @param wid The target widget * @param action The action value (which enum it is depends on the widget type) * @param x The X coordination of the mouse event relative to #widget * @param y The Y coordination of the mouse event relative to #widget @@ -108,7 +108,7 @@ typedef widget *(*widget_find_mouse_target_cb)(widget *widget, WidgetType type, * * @returns Whether the action was handled or not, see enum values for details */ -typedef WidgetTriggerActionResult (*widget_trigger_action_cb)(widget *widget, +typedef WidgetTriggerActionResult (*widget_trigger_action_cb)(widget *wid, guint action, gint x, gint y, void *user_data); @@ -117,7 +117,7 @@ typedef WidgetTriggerActionResult (*widget_trigger_action_cb)(widget *widget, #define WIDGET(a) ((widget *)(a)) /** - * @param widget The widget to check + * @param wid The widget to check * @param x The X position relative to parent window * @param y the Y position relative to parent window * @@ -125,65 +125,63 @@ typedef WidgetTriggerActionResult (*widget_trigger_action_cb)(widget *widget, * * @return TRUE if x,y falls within the widget */ -int widget_intersect(const widget *widget, int x, int y); +int widget_intersect(const widget *wid, int x, int y); /** - * @param widget The widget to move + * @param wid The widget to move * @param x The new X position relative to parent window * @param y The new Y position relative to parent window * * Moves the widget. */ -void widget_move(widget *widget, short x, short y); +void widget_move(widget *wid, short x, short y); /** - * @param widget Handle to widget + * @param wid Handle to widget * @param type The widget type. * * Set the widget type. */ -void widget_set_type(widget *widget, WidgetType type); +void widget_set_type(widget *wid, WidgetType type); /** - * @param widget Handle to widget + * @param wid Handle to widget * * Check if widget is enabled. * @returns TRUE when widget is enabled. */ -gboolean widget_enabled(widget *widget); +gboolean widget_enabled(widget *wid); /** - * @param widget Handle to widget + * @param wid Handle to widget * @param enabled The new state * * Disable the widget. */ -void widget_set_enabled(widget *widget, gboolean enabled); +void widget_set_enabled(widget *wid, gboolean enabled); /** - * @param widget Handle to widget + * @param wid Handle to widget * * Disable the widget. */ -static inline void widget_disable(widget *widget) { - widget_set_enabled(widget, FALSE); +static inline void widget_disable(widget *wid) { + widget_set_enabled(wid, FALSE); } /** - * @param widget Handle to widget + * @param wid Handle to widget * * Enable the widget. */ -static inline void widget_enable(widget *widget) { - widget_set_enabled(widget, TRUE); -} +static inline void widget_enable(widget *wid) { widget_set_enabled(wid, TRUE); } /** - * @param widget widget Handle to the widget + * @param wid widget Handle to the widget * @param d The cairo object used to draw itself. * * Render the textbox. */ -void widget_draw(widget *widget, cairo_t *d); +void widget_draw(widget *wid, cairo_t *d); /** * @param wid Handle to the widget @@ -193,58 +191,58 @@ void widget_draw(widget *widget, cairo_t *d); void widget_free(widget *wid); /** - * @param widget The widget toresize + * @param wid The widget toresize * @param w The new width * @param h The new height * * Resizes the widget. */ -void widget_resize(widget *widget, short w, short h); +void widget_resize(widget *wid, short w, short h); /** - * @param widget The widget handle + * @param wid The widget handle * * @returns the height of the widget. */ -int widget_get_height(widget *widget); +int widget_get_height(widget *wid); /** - * @param widget The widget handle + * @param wid The widget handle * * @returns the width of the widget. */ -int widget_get_width(widget *widget); +int widget_get_width(widget *wid); /** - * @param widget The widget handle + * @param wid The widget handle * * @returns the y position of the widget relative to its parent. */ -int widget_get_y_pos(widget *widget); +int widget_get_y_pos(widget *wid); /** - * @param widget The widget handle + * @param wid The widget handle * * @returns the x position of the widget relative to its parent. */ -int widget_get_x_pos(widget *widget); +int widget_get_x_pos(widget *wid); /** - * @param widget The widget handle + * @param wid The widget handle * @param x A pointer to the absolute X coordinates * @param y A pointer to the absolute Y coordinates * - * Will modify param x and param y to make them relative to param widget . + * Will modify param x and param y to make them relative to param wid . */ -void widget_xy_to_relative(widget *widget, gint *x, gint *y); +void widget_xy_to_relative(widget *wid, gint *x, gint *y); /** - * @param widget The widget handle + * @param wid The widget handle * * Update the widget, and its parent recursively. * This should be called when size of widget changes. */ -void widget_update(widget *widget); +void widget_update(widget *wid); /** * @param wid The widget handle * diff --git a/include/xcb-internal.h b/include/xcb-internal.h index 1e44cd5bc..611df1763 100644 --- a/include/xcb-internal.h +++ b/include/xcb-internal.h @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -49,6 +50,7 @@ struct _xcb_stuff { #ifdef XCB_IMDKIT xcb_xic_t ic; xcb_xim_t *im; + xcb_key_symbols_t *syms; #endif xcb_ewmh_connection_t ewmh; xcb_screen_t *screen; diff --git a/lexer/theme-parser.y b/lexer/theme-parser.y index 57651a212..89d24baaf 100644 --- a/lexer/theme-parser.y +++ b/lexer/theme-parser.y @@ -362,13 +362,13 @@ t_entry_list T_CONFIGURATION T_BOPEN t_config_property_list_optional T_BCLOSE { | t_entry_list t_name_prefix_optional t_entry_name_path_selectors T_BOPEN t_property_list_optional T_BCLOSE { for ( GList *liter = g_list_first ( $3); liter; liter = g_list_next ( liter ) ) { - ThemeWidget *widget = $1; - for ( GList *iter = g_list_first ( (GList*)liter->data ); widget && iter ; iter = g_list_next ( iter ) ) { - widget = rofi_theme_find_or_create_name ( widget, iter->data ); + ThemeWidget *wid = $1; + for ( GList *iter = g_list_first ( (GList*)liter->data ); wid && iter ; iter = g_list_next ( iter ) ) { + wid = rofi_theme_find_or_create_name ( wid, iter->data ); } g_list_free_full ( (GList*)liter->data, g_free ); - widget->set = TRUE; - rofi_theme_widget_add_properties ( widget, $5); + wid->set = TRUE; + rofi_theme_widget_add_properties ( wid, $5); } if ( $5 ) { g_hash_table_destroy ( $5 ); @@ -376,78 +376,78 @@ t_entry_list T_CONFIGURATION T_BOPEN t_config_property_list_optional T_BCLOSE { g_list_free ( $3 ); } | t_entry_list T_PDEFAULTS T_BOPEN t_property_list_optional T_BCLOSE { - ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, "*" ); - rofi_theme_widget_add_properties (widget, $4); + ThemeWidget *wid = rofi_theme_find_or_create_name ( $1, "*" ); + rofi_theme_widget_add_properties (wid, $4); if ( $4 ) { g_hash_table_destroy ( $4 ); } } | t_entry_list T_MEDIA T_PARENT_LEFT T_MEDIA_TYPE T_PSEP t_property_number T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE { gchar *name = g_strdup_printf("@media ( %s: %f )",$4, $6); - ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name ); - widget->set = TRUE; - widget->media = g_slice_new0(ThemeMedia); - widget->media->type = rofi_theme_parse_media_type ( $4 ); - widget->media->value = $6; + ThemeWidget *wid = rofi_theme_find_or_create_name ( $1, name ); + wid->set = TRUE; + wid->media = g_slice_new0(ThemeMedia); + wid->media->type = rofi_theme_parse_media_type ( $4 ); + wid->media->value = $6; for ( unsigned int i = 0; i < $9->num_widgets; i++ ) { ThemeWidget *d = $9->widgets[i]; - rofi_theme_parse_merge_widgets(widget, d); + rofi_theme_parse_merge_widgets(wid, d); } g_free ( $4 ); g_free ( name ); } | t_entry_list T_MEDIA T_PARENT_LEFT T_MEDIA_TYPE T_PSEP T_INT T_UNIT_PX T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE { gchar *name = g_strdup_printf("@media ( %s: %d px )",$4, $6); - ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name ); - widget->set = TRUE; - widget->media = g_slice_new0(ThemeMedia); - widget->media->type = rofi_theme_parse_media_type ( $4 ); - widget->media->value = (double)$6; + ThemeWidget *wid = rofi_theme_find_or_create_name ( $1, name ); + wid->set = TRUE; + wid->media = g_slice_new0(ThemeMedia); + wid->media->type = rofi_theme_parse_media_type ( $4 ); + wid->media->value = (double)$6; for ( unsigned int i = 0; i < $10->num_widgets; i++ ) { ThemeWidget *d = $10->widgets[i]; - rofi_theme_parse_merge_widgets(widget, d); + rofi_theme_parse_merge_widgets(wid, d); } g_free ( $4 ); g_free ( name ); } | t_entry_list T_MEDIA T_PARENT_LEFT T_MEDIA_TYPE T_PSEP T_BOOLEAN T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE { gchar *name = g_strdup_printf("@media ( %s: %s )",$4, $6?"true":"false"); - ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name ); - widget->set = TRUE; - widget->media = g_slice_new0(ThemeMedia); - widget->media->type = rofi_theme_parse_media_type ( $4 ); - widget->media->boolv = $6; + ThemeWidget *wid = rofi_theme_find_or_create_name ( $1, name ); + wid->set = TRUE; + wid->media = g_slice_new0(ThemeMedia); + wid->media->type = rofi_theme_parse_media_type ( $4 ); + wid->media->boolv = $6; for ( unsigned int i = 0; i < $9->num_widgets; i++ ) { ThemeWidget *d = $9->widgets[i]; - rofi_theme_parse_merge_widgets(widget, d); + rofi_theme_parse_merge_widgets(wid, d); } g_free ( $4 ); g_free ( name ); } | t_entry_list T_MEDIA T_PARENT_LEFT T_MEDIA_TYPE T_PSEP T_ENV_START T_PARENT_LEFT T_BOOLEAN T_COMMA T_BOOLEAN T_PARENT_RIGHT T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE { gchar *name = g_strdup_printf("@media ( %s: %s )",$4, $8?"true":"false"); - ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name ); - widget->set = TRUE; - widget->media = g_slice_new0(ThemeMedia); - widget->media->type = rofi_theme_parse_media_type ( $4 ); - widget->media->boolv = $8; + ThemeWidget *wid = rofi_theme_find_or_create_name ( $1, name ); + wid->set = TRUE; + wid->media = g_slice_new0(ThemeMedia); + wid->media->type = rofi_theme_parse_media_type ( $4 ); + wid->media->boolv = $8; for ( unsigned int i = 0; i < $14->num_widgets; i++ ) { ThemeWidget *d = $14->widgets[i]; - rofi_theme_parse_merge_widgets(widget, d); + rofi_theme_parse_merge_widgets(wid, d); } g_free ( $4 ); g_free ( name ); } | t_entry_list T_MEDIA T_PARENT_LEFT T_MEDIA_TYPE T_PSEP T_ENV_START T_PARENT_LEFT T_COMMA T_BOOLEAN T_PARENT_RIGHT T_PARENT_RIGHT T_BOPEN t_entry_list T_BCLOSE { gchar *name = g_strdup_printf("@media ( %s: %s )",$4, $9?"true":"false"); - ThemeWidget *widget = rofi_theme_find_or_create_name ( $1, name ); - widget->set = TRUE; - widget->media = g_slice_new0(ThemeMedia); - widget->media->type = rofi_theme_parse_media_type ( $4 ); - widget->media->boolv = $9; + ThemeWidget *wid = rofi_theme_find_or_create_name ( $1, name ); + wid->set = TRUE; + wid->media = g_slice_new0(ThemeMedia); + wid->media->type = rofi_theme_parse_media_type ( $4 ); + wid->media->boolv = $9; for ( unsigned int i = 0; i < $13->num_widgets; i++ ) { ThemeWidget *d = $13->widgets[i]; - rofi_theme_parse_merge_widgets(widget, d); + rofi_theme_parse_merge_widgets(wid, d); } g_free ( $4 ); g_free ( name ); @@ -487,10 +487,10 @@ t_config_property { for ( GList *iter = g_list_first( $1) ; iter; iter = g_list_next(iter)){ - ThemeWidget *widget = rofi_configuration; - widget = rofi_theme_find_or_create_name ( widget, iter->data ); - widget->set = TRUE; - rofi_theme_widget_add_properties ( widget, $3); + ThemeWidget *wid = rofi_configuration; + wid = rofi_theme_find_or_create_name ( wid, iter->data ); + wid->set = TRUE; + rofi_theme_widget_add_properties ( wid, $3); } if ( $3 ) { g_hash_table_destroy ( $3 ); diff --git a/meson.build b/meson.build index de80e7b36..e981b4608 100644 --- a/meson.build +++ b/meson.build @@ -25,7 +25,8 @@ flags = [ '-Wunreachable-code', '-Werror=missing-prototypes', '-Wno-overlength-strings', - '-Wno-inline' # A bit too noisy with Bison… + '-Wno-inline', # A bit too noisy with Bison… + '-Wshadow' ] foreach f : flags if c_compiler.has_argument(f) @@ -86,6 +87,7 @@ if xcb_enabled dependency('xcb-randr'), dependency('xcb-cursor'), dependency('xcb-xinerama'), + dependency('xcb-keysyms'), dependency('cairo-xcb'), dependency('libstartup-notification-1.0'), ] diff --git a/meson_options.txt b/meson_options.txt index 1f1208fd4..4e911a2d4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,6 @@ option('drun', type: 'boolean', value: true, description: 'Desktop file mode') option('window', type: 'boolean', value: true, description: 'Window switcher mode') option('check', type: 'feature', description: 'Build and run libcheck-based tests') +option('imdkit', type: 'boolean', value: true, description: 'IMDKit support') option('wayland', type: 'feature', value: 'enabled', description: 'Build with wayland support') option('xcb', type: 'feature', value: 'enabled', description: 'Build with X11/xcb support') -option('imdkit', type: 'boolean', value: false, description: 'IMDKit support') diff --git a/mkdocs/docs/1.7.3/rofi-dmenu.5.markdown b/mkdocs/docs/1.7.3/rofi-dmenu.5.markdown index ff2f0203a..2ecb682b5 100644 --- a/mkdocs/docs/1.7.3/rofi-dmenu.5.markdown +++ b/mkdocs/docs/1.7.3/rofi-dmenu.5.markdown @@ -158,6 +158,13 @@ Force **rofi** mode to first read all data from stdin before showing the selecti Note: the default asynchronous mode will also be automatically disabled if used with conflicting options, such as `-dump`, `-only-match` or `-auto-select`. +`-async-pre-read` *number* + +Reads the first *number* entries blocking, then switches to async mode. +This makes it feel more 'snappy'. + +*default*: 25 + `-window-title` *title* Set name used for the window title. Will be shown as Rofi - *title* @@ -170,37 +177,6 @@ Position **rofi** over the window with the given X11 window ID. Set ellipsize mode to start. So, the end of the string is visible. -`-display-columns` - -A comma seperated list of columns to show. - -`-display-column-separator` - -The column separator. This is a regex. - -*default*: '\t' - -`-ballot-selected-str` *string* - -When multi-select is enabled, prefix this string when element is selected. - -*default*: "☑ " - -`-ballot-unselected-str` *string* - -When multi-select is enabled, prefix this string when element is not selected. - -*default*: "☐ " - -`-ellipsize-mode` (start|middle|end) - -Set ellipsize mode on the listview. - -*default* "end" - -## PARSING ROW OPTIONS - -Extra options for individual rows can be also set. See the **rofi-script(5)** manpage for details; the syntax and supported features are identical. ## RETURN VALUE @@ -211,7 +187,7 @@ Extra options for individual rows can be also set. See the **rofi-script(5)** ma ## SEE ALSO -rofi(1), rofi-sensible-terminal(1), dmenu(1), rofi-theme(5), rofi-script(5), rofi-theme-selector(1), ascii(7) +rofi(1), rofi-sensible-terminal(1), dmenu(1), rofi-theme(5), rofi-script(5), rofi-theme-selector(1) ## AUTHOR diff --git a/mkdocs/docs/1.7.3/rofi-keys.5.markdown b/mkdocs/docs/1.7.3/rofi-keys.5.markdown index c23abb6d2..84cabcd77 100644 --- a/mkdocs/docs/1.7.3/rofi-keys.5.markdown +++ b/mkdocs/docs/1.7.3/rofi-keys.5.markdown @@ -52,15 +52,6 @@ configuration { } ``` -## Unsetting a binding - -To unset a binding, pass an empty string. - -```css -configuration { - kb-clear-line: ""; -} -``` ## Keyboard Bindings @@ -74,12 +65,6 @@ Paste clipboard **Default**: Control+v,Insert -### **kb-secondary-copy** - -Copy current selection to clipboard - -**Default**: Control+c - ### **kb-clear-line** Clear input line @@ -151,12 +136,12 @@ Accept entry **Default**: Control+j,Control+m,Return,KP_Enter ### **kb-accept-custom** -Use entered text as command (in ssh/run modes) +Use entered text as command (in ssh/run modi) **Default**: Control+Return ### **kb-accept-custom-alt** -Use entered text as command (in ssh/run modes) +Use entered text as command (in ssh/run modi) **Default**: Control+Shift+Return @@ -198,7 +183,7 @@ Go to the next column ### **kb-row-up** Select previous entry -**Default**: Up,Control+p +**Default**: Up,Control+p,ISO_Left_Tab ### **kb-row-down** Select next entry @@ -208,17 +193,7 @@ Select next entry ### **kb-row-tab** Go to next row, if one left, accept it, if no left next mode. -**Default**: - -### **kb-element-next** -Go to next row. - -**Default**: Tab - -### **kb-element-prev** -Go to previous row. - -**Default**: ISO_Left_Tab +**Default**: Tab ### **kb-page-prev** Go to the previous page diff --git a/mkdocs/docs/1.7.3/rofi-script.5.markdown b/mkdocs/docs/1.7.3/rofi-script.5.markdown index d021f7819..f9d5041bd 100644 --- a/mkdocs/docs/1.7.3/rofi-script.5.markdown +++ b/mkdocs/docs/1.7.3/rofi-script.5.markdown @@ -2,14 +2,13 @@ ## NAME -**rofi script mode** - Rofi format for scriptable mode. +**rofi script mode** - Rofi format for scriptable modi. ## DESCRIPTION -**rofi** supports modes that use simple scripts in the background to generate a -list and process the result from user actions. This provide a simple interface -to make simple extensions to rofi. +**rofi** supports modes that use simple scripts in the background to generate a list and process the result from user +actions. This provide a simple interface to make simple extensions to rofi. ## USAGE @@ -19,18 +18,17 @@ To specify a script mode, set a mode with the following syntax: "{name}:{executa For example: ``` -rofi -show fb -modes "fb:file_browser.sh" +rofi -show fb -modi "fb:file_browser.sh" ``` The name should be unique. ## API -Rofi calls the executable without arguments on startup. This should generate a -list of options, separated by a newline (`\n`) (This can be changed by the -script). If the user selects an option, rofi calls the executable with the text -of that option as the first argument. If the script returns no entries, rofi -quits. +Rofi calls the executable without arguments on startup. This should generate a list of options, separated by a newline +(`\n`) (This can be changed by the script). +If the user selects an option, rofi calls the executable with the text of that option as the first argument. +If the script returns no entries, rofi quits. A simple script would be: @@ -65,10 +63,6 @@ An integer number with the current state: Environment get set when selected entry get set with the property value of the 'info' row option, if set. -### `ROFI_DATA` - -Environment get set when script sets `data` option in header. - ## Passing mode options Extra options, like setting the prompt, can be set by the script. @@ -90,10 +84,6 @@ The following extra options exists: * **delim**: Set the delimiter for for next rows. Default is '\n' and this option should finish with this. Only call this on first call of script, it is remembered for consecutive calls. * **no-custom**: If set to 'true'; only accept listed entries, ignore custom input. * **use-hot-keys**: If set to true, it enabled the Custom keybindings for script. Warning this breaks the normal rofi flow. - * **keep-selection**: If set, the selection is not moved to the first entry, but the current position is maintained. The filter is cleared. - * **new-selection**: If `keep-selection` is set, this allows you to override the selected entry (absolute position). - * **data**: Passed data to the next execution of the script via **ROFI_DATA**. - * **theme**: Small theme snippet to f.e. change the background color of a widget. ## Parsing row options diff --git a/mkdocs/docs/1.7.3/rofi-theme.5.markdown b/mkdocs/docs/1.7.3/rofi-theme.5.markdown index 24388f58f..11b0d4246 100644 --- a/mkdocs/docs/1.7.3/rofi-theme.5.markdown +++ b/mkdocs/docs/1.7.3/rofi-theme.5.markdown @@ -4,165 +4,19 @@ **rofi-theme** - Rofi theme format files -## GETTING STARTED WITH THEMING - -The easiest way to get started theming rofi is by modifying your existing theme. - -Themes can be modified/tweaked by adding theming elements to the end of the -config file. The default location of this file is `~/.config/rofi/config.rasi`, -if the file does not exists, you can create it. - -A basic config: - -```css -configuration { - modes: [ combi ]; - combi-modes: [ window, drun, run ]; -} - -@theme "gruvbox-light" - -/* Insert theme modifications after this */ -``` - - -For example if we want to change the `Type to filter` text in the entry box we -append the following: - -```css -entry { - placeholder: "Type here"; -} -``` - -In the above section, `entry` indicates the widget, `placeholder` is the -property we want to modify and we set it to the string `"Type here"`. -To find the commonly available widgets in rofi, see the 'Basic structure' section. - -To change the mouse over cursor to a pointer, add: - -```css -entry { - placeholder: "Type here"; - cursor: pointer; -} -``` - -For the next modification, we want to add the icon after each text element and -increase the size. First we start by modifying the `element` widget: - -```css - -element { - orientation: horizontal; - children: [ element-text, element-icon ]; - spacing: 5px; -} - -``` - -Resulting in the following packing: - -``` -┌─────────────────────────────────────────────────────────────────────┐ -│ element │ -│ ┌─────────────────────────────────────────────┐ ┌─────────────────┐ │ -│ │element─text │ │ element─icon │ │ -│ └─────────────────────────────────────────────┘ └─────────────────┘ │ -└─────────────────────────────────────────────────────────────────────┘ -``` - -The `element` (container) widget hold each entry in the `listview`, we add the -two pre-defined children in the order we want to show. We also specify the -packing direction (`orientation`) and the spacing between the children -(`spacing`). We specify the space between the two children in absolute pixels -(`px`). - -To increase the icon-size, we need to modify the `element-icon` widget. - -```css -element-icon { - size: 2.5em; -} -``` - -``` -┌─────────────────────────────────────────────────────────────────────┐ -│ element │ -│ ┌─────────────────────────────────────────────┐ ┌─────────────────┐ │ -│ │element─text │ │ element │ │ -│ │ │ │ ─ │ │ -│ │ │ │ icon │ │ -│ └─────────────────────────────────────────────┘ └─────────────────┘ │ -└─────────────────────────────────────────────────────────────────────┘ -``` - -In this example we specify the size in the [em](https://www.w3.org/Style/LieBos3e/em) unit. - -Now lets change the text color of both the `entry` and the `element-text` widget to red and background to blue. - -```css -entry, element-text { - text-color: red; - background-color: rgb(0,0,255); -} -``` - -Here we use two different methods of writing down the color, for `text-color` -we used a named color, for `background-color` we specify it in `rgb`. -We also specify the property for multiple widgets by passing a comma separated -list of widget names. - -If you want to center the text relative to the icon, we can set this: - -```css -element-text { - vertical-align: 0.5; -} -``` - -``` -┌─────────────────────────────────────────────────────────────────────┐ -│ element │ -│ ┌─────────────────────────────────────────────┐ ┌─────────────────┐ │ -│ │ │ │ element │ │ -│ │element-text │ │ ─ │ │ -│ │ │ │ icon │ │ -│ └─────────────────────────────────────────────┘ └─────────────────┘ │ -└─────────────────────────────────────────────────────────────────────┘ -``` - -We can also specify the color and width of the cursor. You could, for example, -create a crimson block cursor like this: - -```css -entry { - cursor-color: rgb(220,20,60); - cursor-width: 8px; -} -``` - -By default, the `cursor-color` will be the same as the `text-color`. The `cursor-width` will always default to 2 pixels. - -If you want to see the complete theme, including the modification you can run: - -```bash -rofi -dump-theme -``` - ## DEFAULT THEME LOADING By default, rofi loads the default theme. This theme is **always** loaded. -The default configuration contains: +In the default (always loaded) configuration it does: ```css @theme "default" ``` -To unload the default theme, and load another theme, add the `@theme` statement -to your `config.rasi` file. +To unload the default theme, and load another theme, add `@theme` to your +`config.rasi` file. -If you have a theme loaded via `@theme` or use the default theme, you can tweak +If you have a theme loaded by `@theme` or use the default theme, you can tweak it by adding overriding elements at the end of your `config.rasi` file. For the difference between `@import` and `@theme` see the `Multiple file @@ -185,7 +39,7 @@ user-friendly way. Therefore, a new file format has been created, replacing the ## Encoding -The encoding of the file is UTF-8. Both unix (`\n`) and windows (`\r\n`) newlines format are supported. But unix is +The encoding of the file is utf-8. Both unix (`\n`) and windows (`\r\n`) newlines format are supported. But unix is preferred. ## Comments @@ -193,7 +47,7 @@ preferred. C and C++ file comments are supported. * Anything after `// ` and before a newline is considered a comment. -* Everything between `/*` and `*/` is a comment, this comment can span multiple lines. +* Everything between `/*` and `*/` is a comment. Comments can be nested and the C comments can be inline. @@ -237,7 +91,7 @@ abbreviation for **r**ofi **a**dvanced **s**tyle **i**nformation. ## Basic Structure Each element has a section with defined properties. Global properties can be defined in section `* { }`. -Sub-section names begin with an optional hash symbol `#`. +Sub-section names begin with a hash symbol `#`. It is advised to define the *global properties section* on top of the file to make inheritance of properties clearer. @@ -277,8 +131,8 @@ A theme can have multiple element theme sections. The element path can consist of multiple names separated by whitespace or dots. Each element may contain any number of letters, numbers and `-`'s. -The first element in the element path can optionally start with a `#` (for -historic reasons). Multiple elements can be specified by a `,`. +The first element in the element path should always start with a `#`. +Multiple elements can be specified by a `,`. This is a valid element name: @@ -299,8 +153,8 @@ element normal normal, button { } ``` -Each section inherits the global properties. Properties can be explicitly -inherited from their parent with the `inherit` keyword. +Each section inherits the global properties. Properties can be explicitly inherited from their parent with the +`inherit` keyword. In the following example: ```css @@ -316,8 +170,7 @@ mainbox { } ``` -The element `mainbox` will have the following set of properties (if `mainbox` -is a child of `window`): +The element `mainbox` will have the following set of properties (if `mainbox` is a child of `window`): ```css a: 1; @@ -381,15 +234,7 @@ For example: font: "Awasome 12"; ``` -The string must be valid UTF-8, special characters can be escaped: - -```css -text { - content: "Line one\n\tIndented line two"; -} -``` - -The following special characters can be escaped: `\b`, `\f`, `\n`, `\r`, `\t`, `\v`, `\` and `"`. +The string must be valid UTF-8. ## Integer @@ -510,18 +355,8 @@ should be applied. * `bold`: make the text thicker then the surrounding text. * `italic`: put the highlighted text in script type (slanted). - * `underline`: put a line under the text. - * `strikethrough`: put a line through the text. - -The following options are available on pango 1.50.0 and up: - - * `uppercase`: Uppercase the text. - * `lowercase`: Lowercase the text. - - The following option is disabled as pango crashes on this if there is eel - upsizing or wrapping. This will be re-enabled once fixed: - - * `capitalize`: Capitalize the text. + * `underline`: put a line under the highlighted text. + * `strikethrough`: put a line through the highlighted text. ## Line style @@ -566,21 +401,17 @@ Rofi supports some maths in calculating sizes. For this it uses the CSS syntax: width: calc( 100% - 37px ); ``` -```css -width: calc( 20% min 512 ); -``` - It supports the following operations: -* `+` : Add -* `-` : Subtract -* `/` : Divide -* `*` : Multiply -* `%` : Modulo -* `min` : Minimum of lvalue or rvalue; -* `max` : Maximum of lvalue or rvalue; +* `+` : Add +* `-` : Subtract +* `/` : Divide +* `*` : Multiply +* `%` : Multiply +* `min` : Minimum of l or rvalue; +* `max` : Maximum of l or rvalue; * `floor` : Round down lvalue to the next multiple of rvalue -* `ceil` : Round up lvalue to the next multiple of rvalue +* `ceil` : Round up lvalue to the next multiple of rvalue * `round` : Round lvalue to the next multiple of rvalue It uses the C precedence ordering. @@ -625,28 +456,24 @@ style property. Indicate a place on the window/monitor. -``` -┌─────────────┬─────────────┬─────────────┐ -│ north west │ north │ north east │ -├─────────────┼─────────────┼─────────────┤ -│ west │ center │ east │ -├─────────────┼─────────────┼─────────────┤ -│ south west │ south │ south east │ -└─────────────┴─────────────┴─────────────┘ +* Format: `(center|east|north|west|south|north east|north west|south west|south east)` + ``` -* Format: `(center|east|north|west|south|north east|north west|south west|south east)` +north west | north | north east +-------------|-------------|------------ + west | center | east +-------------|-------------|------------ +south west | south | south east +``` ## Visibility It is possible to hide widgets: -```css inputbar { enabled: false; } -``` - ## Reference @@ -795,8 +622,6 @@ The current widgets available in **rofi**: * `entry`: the main entry @textbox * `num-rows`: Shows the total number of rows. * `num-filtered-rows`: Shows the total number of rows after filtering. - * `textbox-current-entry`: Shows the text of the currently selected entry. - * `icon-current-entry`: Shows the icon of the currently selected entry. * `listview`: The listview. * `scrollbar`: the listview scrollbar * `element`: a box in the listview holding the entries @@ -868,22 +693,22 @@ The following properties are currently supported: ### all widgets: -* **enabled**: enable/disable rendering of the widget -* **padding**: padding +* **enabled**: enable/disable the widget +* **padding**: padding Padding on the inside of the widget -* **margin**: padding +* **margin**: padding Margin on the outside of the widget -* **border**: border +* **border**: border Border around the widget (between padding and margin)/ -* **border-radius**: padding +* **border-radius**: padding Sets a radius on the corners of the borders. -* **background-color**: color +* **background-color**: color Background color -* **background-image**: image +* **background-image**: image Background image * **border-color**: color Color of the border -* **cursor**: cursor +* **cursor**: cursor Type of mouse cursor that is set when the mouse pointer is hovered over the widget. ### window: @@ -906,8 +731,8 @@ The following properties are currently supported: Window is fullscreen. * **width**: distance The width of the window -* **x-offset**: distance -* **y-offset**: distance +* **x-offset**: distance +* **y-offset**: distance The offset of the window to the anchor point, allowing you to push the window left/right/up/down @@ -922,7 +747,7 @@ The following properties are currently supported: * **orientation**: orientation Set the direction the elements are packed. -* **spacing**: distance +* **spacing**: distance Distance between the packed elements. ### textbox: @@ -930,18 +755,16 @@ The following properties are currently supported: * **background-color**: color * **border-color**: the color used for the border around the widget. * **font**: the font used by this textbox (string). -* **str**/**content**: the string to display by this textbox (string). +* **str**: the string to display by this textbox (string). * **vertical-align**: Vertical alignment of the text. A number between 0 (top) and 1 (bottom). * **horizontal-align**: Horizontal alignment of the text. A number between 0 (left) and 1 (right). * **text-color**: the text color to use. -* **text-transform**: text style {color} for the whole text. * **highlight**: text style {color}. color is optional, multiple highlight styles can be added like: bold underline italic #000000; This option is only available on the `element-text` widget. * **width**: override the desired width for the textbox. * **content**: Set the displayed text (String). * **placeholder**: Set the displayed text (String) when nothing is entered. -* **placeholder-markup**: If true, placeholder text supports pango markup for stylizing. * **placeholder-color**: Color of the placeholder text. * **blink**: Enable/Disable blinking on an input textbox (Boolean). * **markup**: Force markup on, beware that only valid pango markup strings are shown. @@ -949,14 +772,6 @@ The following properties are currently supported: Set the location of tab stops by their distance from the beginning of the line. Each distance should be greater than the previous one. The text appears to the right of the tab stop position (other alignments are not supported yet). -* **cursor-width**: The width of the cursor. -* **cursor-color**: The color used to draw the cursor. -* **cursor-outline**: Enable a border (outline) around the cursor. (Boolean) -* **cursor-outline-width**: The width of the border around the cursor. (Double) -* **cursor-outline-color**: The color to use for the cursor outline. (Color) -* **text-outline**: Enable a border (outline) around the text. (Boolean) -* **text-outline-width**: The width of the border around the text. (Double) -* **text-outline-color**: The color to use for the text outline. (Color) ### listview: * **columns**: integer @@ -979,13 +794,8 @@ The following properties are currently supported: Indicate how elements are stacked. Horizontal implements the dmenu style. * **reverse**: boolean Reverse the ordering (top down to bottom up). -* **flow**: orientation - The order the elements are layed out. Vertical is the original 'column' view. * **fixed-columns**: boolean Do not reduce the number of columns shown when number of visible elements is not enough to fill them all. -* **require-input**: boolean - Listview requires user input to be unhidden. The list is still present and - hitting accept will activate the first entry. Each element is a `box` called `element`. Each `element` can contain an `element-icon` and `element-text`. @@ -1026,42 +836,42 @@ The box can be vertical or horizontal. This is loosely inspired by [GTK](http:// The current layout of **rofi** is structured as follows: ``` -┌────────────────────────────────────────────────────────────────────────────────────┐ -│ window {BOX:vertical} │ -│ ┌───────────────────────────────────────────────────────────────────────────────┐ │ -│ │ mainbox {BOX:vertical} │ │ -│ │ ┌───────────────────────────────────────────────────────────────────────────┐ │ │ -│ │ │ inputbar {BOX:horizontal} │ │ │ -│ │ │ ┌─────────┐ ┌─┐ ┌───────────────────────────────┐ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ │ │ -│ │ │ │ prompt │ │:│ │ entry │ │#fr│ │ / │ │#ns│ │ci │ │ │ │ -│ │ │ └─────────┘ └─┘ └───────────────────────────────┘ └───┘ └───┘ └───┘ └───┘ │ │ │ -│ │ └───────────────────────────────────────────────────────────────────────────┘ │ │ -│ │ │ │ -│ │ ┌───────────────────────────────────────────────────────────────────────────┐ │ │ -│ │ │ message │ │ │ -│ │ │ ┌───────────────────────────────────────────────────────────────────────┐ │ │ │ -│ │ │ │ textbox │ │ │ │ -│ │ │ └───────────────────────────────────────────────────────────────────────┘ │ │ │ -│ │ └───────────────────────────────────────────────────────────────────────────┘ │ │ -│ │ │ │ -│ │ ┌───────────────────────────────────────────────────────────────────────────┐ │ │ -│ │ │ listview │ │ │ -│ │ │ ┌─────────────────────────────────────────────────────────────────────┐ │ │ │ -│ │ │ │ element │ │ │ │ -│ │ │ │ ┌─────────────────┐ ┌─────────────────────────────────────────────┐ │ │ │ │ -│ │ │ │ │element─icon │ │element─text │ │ │ │ │ -│ │ │ │ └─────────────────┘ └─────────────────────────────────────────────┘ │ │ │ │ -│ │ │ └─────────────────────────────────────────────────────────────────────┘ │ │ │ -│ │ └───────────────────────────────────────────────────────────────────────────┘ │ │ -│ │ │ │ -│ │ ┌───────────────────────────────────────────────────────────────────────────┐ │ │ -│ │ │ mode─switcher {BOX:horizontal} │ │ │ -│ │ │ ┌───────────────┐ ┌───────────────┐ ┌──────────────┐ ┌───────────────┐ │ │ │ -│ │ │ │ Button │ │ Button │ │ Button │ │ Button │ │ │ │ -│ │ │ └───────────────┘ └───────────────┘ └──────────────┘ └───────────────┘ │ │ │ -│ │ └───────────────────────────────────────────────────────────────────────────┘ │ │ -│ └───────────────────────────────────────────────────────────────────────────────┘ │ -└────────────────────────────────────────────────────────────────────────────────────┘ +|------------------------------------------------------------------------------------| +| window {BOX:vertical} | +| |-------------------------------------------------------------------------------| | +| | mainbox {BOX:vertical} | | +| | |---------------------------------------------------------------------------| | | +| | | inputbar {BOX:horizontal} | | | +| | | |---------| |-| |---------------------------------|---| |---| |---| |---| | | | +| | | | prompt | |:| | entry |#fr| | / | |#ns| |ci | | | | +| | | |---------| |_| |---------------------------------|---| |---| |---| |---| | | | +| | |---------------------------------------------------------------------------| | | +| | | | +| | |---------------------------------------------------------------------------| | | +| | | message | | | +| | | |-----------------------------------------------------------------------| | | | +| | | | textbox | | | | +| | | |-----------------------------------------------------------------------| | | | +| | |---------------------------------------------------------------------------| | | +| | | | +| | |-----------------------------------------------------------------------------| | +| | | listview | | +| | | |------------------------------------------------------------------------] | | +| | | | element | | | +| | | | |-----------------| |------------------------------------------------] | | | +| | | | |element-icon | |element-text | | | | +| | | | |-----------------| |------------------------------------------------| | | | +| | | |------------------------------------------------------------------------] | | +| | |-----------------------------------------------------------------------------| | +| | | | +| | |---------------------------------------------------------------------------| | | +| | | mode-switcher {BOX:horizontal} | | | +| | | |---------------| |---------------| |--------------| |---------------| | | | +| | | | Button | | Button | | Button | | Button | | | | +| | | |---------------| |---------------| |--------------| |---------------| | | | +| | |---------------------------------------------------------------------------| | | +| |-------------------------------------------------------------------------------| | +|------------------------------------------------------------------------------------| ``` @@ -1072,15 +882,16 @@ The current layout of **rofi** is structured as follows: ### Error message structure ``` -┌──────────────────────────────────────────────────────────────────────────────────┐ -│ window {BOX:vertical} │ -│ ┌─────────────────────────────────────────────────────────────────────────────┐ │ -│ │ error─message {BOX:vertical} │ │ -│ │ ┌────────────────────────────────────────────────────────────────────────┐ │ │ -│ │ │ textbox │ │ │ -│ │ └────────────────────────────────────────────────────────────────────────┘ │ │ -│ └─────────────────────────────────────────────────────────────────────────────┘ │ -└──────────────────────────────────────────────────────────────────────────────────┘ +|-----------------------------------------------------------------------------------| +| window {BOX:vertical} | +| |------------------------------------------------------------------------------| | +| | error-message {BOX:vertical} | | +| | |-------------------------------------------------------------------------| | | +| | | textbox | | | +| | |-------------------------------------------------------------------------| | | +| |------------------------------------------------------------------------------| | +|-----------------------------------------------------------------------------------| + ``` @@ -1224,18 +1035,18 @@ element selected { Just like CSS, **rofi** uses the box model for each widget. ``` -┌──────────────────────────────────────────────────────────────────┐ -│ margin │ -│ ┌────────────────────────────────────────────────────────────┐ │ -│ │ border │ │ -│ │ ┌────────────────────────────────────────────────────────┐ │ │ -│ │ │ padding │ │ │ -│ │ │ ┌────────────────────────────────────────────────────┐ │ │ │ -│ │ │ │ content │ │ │ │ -│ │ │ └────────────────────────────────────────────────────┘ │ │ │ -│ │ └────────────────────────────────────────────────────────┘ │ │ -│ └────────────────────────────────────────────────────────────┘ │ -└──────────────────────────────────────────────────────────────────┘ +|-------------------------------------------------------------------| +| margin | +| |-------------------------------------------------------------| | +| | border | | +| | |---------------------------------------------------------| | | +| | | padding | | | +| | | |-----------------------------------------------------| | | | +| | | | content | | | | +| | | |-----------------------------------------------------| | | | +| | |---------------------------------------------------------| | | +| |-------------------------------------------------------------| | +|-------------------------------------------------------------------| ``` Explanation of the different parts: @@ -1259,15 +1070,15 @@ Widgets that can pack more then one child widget (currently box and listview) ha This property sets the distance between the packed widgets (both horizontally and vertically). ``` -┌───────────────────────────────────────┐ -│ ┌────────┐ s ┌────────┐ s ┌────────┐ │ -│ │ child │ p │ child │ p │ child │ │ -│ │ │ a │ │ a │ │ │ -│ │ │ c │ │ c │ │ │ -│ │ │ i │ │ i │ │ │ -│ │ │ n │ │ n │ │ │ -│ └────────┘ g └────────┘ g └────────┘ │ -└───────────────────────────────────────┘ +|---------------------------------------| +| |--------| s |--------| s |-------| | +| | child | p | child | p | child | | +| | | a | | a | | | +| | | c | | c | | | +| | | i | | i | | | +| | | n | | n | | | +| |--------| g |--------| g |-------| | +|---------------------------------------| ``` ### Advanced box packing @@ -1275,15 +1086,15 @@ This property sets the distance between the packed widgets (both horizontally an More dynamic spacing can be achieved by adding dummy widgets, for example to make one widget centered: ``` -┌────────────────────────────────────────────────────┐ -│ ┌───────────────┐ ┌────────┐ ┌───────────────┐ │ -│ │ dummy │ │ child │ │ dummy │ │ -│ │ expand: true; │ │ │ │ expand: true; │ │ -│ │ │ │ │ │ │ │ -│ │ │ │ │ │ │ │ -│ │ │ │ │ │ │ │ -│ └───────────────┘ └────────┘ └───────────────┘ │ -└────────────────────────────────────────────────────┘ +|----------------------------------------------------| +| |---------------| |--------| |---------------| | +| | dummy | | child | | dummy | | +| | expand: true; | | | | expand: true; | | +| | | | | | | | +| | | | | | | | +| | | | | | | | +| |---------------| |--------| |---------------| | +|----------------------------------------------------| ``` If both dummy widgets are set to expand, `child` will be centered. Depending on the `expand` flag of child the @@ -1343,7 +1154,6 @@ It supports the following keys as constraint: * `min-aspect-ratio` load when aspect ratio is over value. * `max-aspect-ratio`: load when aspect ratio is under value. * `monitor-id`: The monitor id, see rofi -help for id's. - * `enabled`: Boolean option to enable. Supports environment variable. @media takes an integer number or a fraction, for integer number `px` can be added. @@ -1354,12 +1164,6 @@ It supports the following keys as constraint: } ``` -``` -@media ( enabled: env(DO_LIGHT, false ) { - -} -``` - ## Font Parsing @@ -1377,34 +1181,6 @@ Or FontAwesome 22 ``` -## Icon Handling - -Rofi supports 3 ways of specifying an icon: - -* Filename -* icon-name, this is looked up via the icon-theme. -* Markup String. It renders a string as an icon. - - -For the first two options, GdkPixbuf is used to open and render the icons. -This in general gives support for most required image formats. -For the string option it uses Pango to render the string. The string needs to -start with a `⏻" | ./rofi -dmenu -``` - -Getting supported icon formats: - -```bash -G_MESSAGES_DEBUG=Helpers.IconFetcher rofi -``` -This uses the debug framework and prints out a list of supported image file -extensions. - ## Multiple file handling The rasi file format offers two methods of including other files. diff --git a/mkdocs/docs/1.7.3/rofi.1.markdown b/mkdocs/docs/1.7.3/rofi.1.markdown index 73d94af6a..ba2a402d3 100644 --- a/mkdocs/docs/1.7.3/rofi.1.markdown +++ b/mkdocs/docs/1.7.3/rofi.1.markdown @@ -11,45 +11,30 @@ ## DESCRIPTION -**rofi** is an X11 pop-up window switcher, run dialog, dmenu replacement, and -more. It focuses on being fast to use and have minimal distraction. It supports -keyboard and mouse navigation, type to filter, tokenized search and more. +**rofi** is an X11 pop-up window switcher, run dialog, dmenu replacement, and more. It focuses on +being fast to use and have minimal distraction. It supports keyboard and mouse navigation, type to +filter, tokenized search and more. ## USAGE -**rofi**'s main functionality is to assist in your workflow, allowing you to -quickly switch between windows, start applications or log into a remote machine -via `ssh`. There are different *modes* for different types of actions. **rofi** -is a standalone application and should not be integrated into scripts. For -integration into scripts it has a special mode that functions as a (drop-in) -replacement for **dmenu(1)**. See emulating dmenu below. +**rofi**'s main functionality is to assist in your workflow, allowing you to quickly switch +between windows, start applications or log into a remote machine via `ssh`. +There are different *modi* for different types of actions. +**rofi** is a standalone application and should not be integrated into scripts. +For integration into scripts it has a special mode that functions as a +(drop-in) replacement for **dmenu(1)**. See emulating dmenu below. ### Running rofi To launch **rofi** directly in a certain mode, specify a mode with `rofi -show `. -To show the `drun` dialog: - -```bash - rofi -show drun -``` - -A very useful setup in minimalistic window managers is to combine `drun`, `run` -with `window` mode: - -```bash - rofi -show combi -modes combi -combi-modes "window,drun,run" -``` - -In this setup it first list all open applications, then all installed -applications. So if you type firefox and hit return, it will switch to the -running firefox, or launch it when it is not running. +To show the `run` dialog: + rofi -show run ### Emulating dmenu -**rofi** can emulate **dmenu(1)** (a dynamic menu for X11) when launched with -the `-dmenu` flag. +**rofi** can emulate **dmenu(1)** (a dynamic menu for X11) when launched with the `-dmenu` flag. For more information see **rofi-dmenu(5)**. @@ -75,29 +60,6 @@ To get a template config file, run: `rofi -dump-config > config.rasi` This will contain (commented) all current configuration options, modified options are uncommented. -To get a template config file that sets the icon-theme run: `rofi -icon-theme hicolor -dump-config`. - -It is **strongly** recommended to use this as a starting point for your configuration. - -An empty configuration section in the config file looks like: - -```css -configuration { - // set config options here -} -``` - -Most of the configuration options mentioned below (beside options like `-show`, -`-dump-config` that apply to a single run) can be set here. - -For example to set the dpi value to 72: - -```css -configuration { - dpi: 72; -} -``` - The configuration system supports the following types: * string @@ -123,8 +85,8 @@ Below is a list of the most important options: `-help` -The help option shows the full list of command-line options and the current set -values. These include dynamic (run-time generated) options. +The help option shows the full list of command-line options and the current set values. +These include dynamic (run-time generated) options. `-version` @@ -143,11 +105,6 @@ Dump the current active theme, in rasi format, to stdout and exit. Try to parse the file and return 0 when successful, non-zero when failed. -`-list-keybindings` - -List all known keybindings without trying to parse them. This can be used to -look for duplicate bindings. - `-threads` *num* Specify the number of threads **rofi** should use: @@ -174,45 +131,41 @@ Or get the options from a script: ~/my_script.sh | rofi -dmenu -See the **rofi-dmenu(5)** manpage for more information. - `-show` *mode* -Open **rofi** in a certain mode. Available modes are `window`, `run`, `drun`, -`ssh`, `combi`. The special argument `keys` can be used to open a searchable -list of supported key bindings -(see the **rofi-keys(5)** manpage) +Open **rofi** in a certain mode. Available modes are `window`, `run`, `drun`, `ssh`, `combi`. +The special argument `keys` can be used to open a searchable list of supported key bindings +(see *KEY BINDINGS*) To show the run-dialog: rofi -show run -If `-show` is the last option passed to rofi, the first enabled modes is shown. +If `-show` is the last option passed to rofi, the first enabled modi is shown. -`-modes` *mode1,mode2* +`-modi` *mode1,mode2* Specify an ordered, comma-separated list of modes to enable. Enabled modes can be changed at runtime. Default key is `Ctrl+Tab`. If no modes are specified, all configured modes will be enabled. To only show the `run` and `ssh` launcher: - rofi -modes "run,ssh" -show run + rofi -modi "run,ssh" -show run -Custom modes can be added using the internal `script` mode. Each such mode has -two parameters: +Custom modes can be added using the internal `script` mode. Each such mode has two parameters: :