Merge branch 'master' into wip/wayland

This commit is contained in:
Quentin Glidic 2017-03-31 18:02:41 +02:00
commit 3a29d3ec7e
No known key found for this signature in database
GPG Key ID: AC203F96E2C34BB7
13 changed files with 261 additions and 202 deletions

View File

@ -34,11 +34,11 @@ Settings config = {
/** -modi */
.modi = "window,run,ssh",
/** The width of the switcher. (0100 in % > 100 in pixels) */
.menu_width = 50,
.menu_width = 50,
/** Maximum number of options to show. */
.menu_lines = 15,
.menu_lines = 15,
/** Number of columns */
.menu_columns = 1,
.menu_columns = 1,
/** Font */
.menu_font = "mono 12",
@ -69,7 +69,7 @@ Settings config = {
/** Cycle through in the element list */
.cycle = TRUE,
/** Height of an element in #chars */
.element_height = 1,
.element_height = 1,
/** Sidebar mode, show the modi */
.sidebar_mode = FALSE,
/** auto select */
@ -84,12 +84,12 @@ Settings config = {
.matching = "normal",
.matching_method = MM_NORMAL,
/** Set filter */
.filter = NULL,
.fullscreen = FALSE,
.threads = 0,
.scroll_method = 0,
.window_format = "{w} {c} {t}",
.click_to_exit = TRUE,
.show_match = TRUE,
.theme = NULL,
.filter = NULL,
.fullscreen = FALSE,
.threads = 0,
.scroll_method = 0,
.window_format = "{w} {c} {t}",
.click_to_exit = TRUE,
.show_match = TRUE,
.theme = NULL,
};

View File

@ -190,6 +190,9 @@ Example: Have a mode 'Workspaces' using the `i3_switch_workspaces.sh` script:
rofi -modi "window,run,ssh,Workspaces:i3_switch_workspaces.sh" -show Workspaces
Notes: The I3 Window manager does not like commas in the command when specifying an exec command.
For that case '/' can be used as an separator.
`-case-sensitive`
Start in case sensitive mode.
@ -463,6 +466,9 @@ To get one merge view, of window,run,ssh:
rofi -show combi -combi-modi "window,run,ssh" -modi combi
Notes: The I3 Window manager does not like commas in the command when specifying an exec command.
For that case '/' can be used as an separator.
### History and Sorting
`-disable-history`

View File

@ -1,5 +1,5 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ROFI\-THEME\-MANPAGE" "" "March 2017" "" ""
.TH "ROFI\-THEME\-MANPAGE" "" "2017-03-20" "" ""

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "ROFI\-MANPAGE" "" "March 2017" "" ""
.TH "ROFI\-MANPAGE" "" "2017-03-31" "" ""
.
.SH "NAME"
\fBrofi\fR \- A window switcher, application launcher, ssh dialog and dmenu replacement
@ -268,6 +268,9 @@ rofi \-modi "window,run,ssh,Workspaces:i3_switch_workspaces\.sh" \-show Workspac
.IP "" 0
.
.P
Notes: The I3 Window manager does not like commas in the command when specifying an exec command\. For that case \'/\' can be used as an separator\.
.
.P
\fB\-case\-sensitive\fR
.
.P
@ -708,6 +711,9 @@ rofi \-show combi \-combi\-modi "window,run,ssh" \-modi combi
.
.IP "" 0
.
.P
Notes: The I3 Window manager does not like commas in the command when specifying an exec command\. For that case \'/\' can be used as an separator\.
.
.SS "History and Sorting"
\fB\-disable\-history\fR \fB\-no\-disable\-history\fR (re\-enable history)
.

View File

@ -1,88 +1,87 @@
#ifndef ROFI_DEFAULT_THEME
#define ROFI_DEFAULT_THEME
#define ROFI_DEFAULT_THEME
const char *default_theme =
"* {"
" spacing: 2;"
" background: #00000000;"
"}"
"#window {"
" border: 1;"
" foreground: #FF002B36;"
" padding: 5;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox {"
" border: 0;"
" padding: 0;"
"}"
"#window.mainbox.message.box {"
" border: 1px dash 0px 0px ;"
" padding: 2px 0px 0px ;"
"}"
"#window.mainbox.message.normal {"
" foreground: #FF002B36;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox.listview {"
" fixed-height: 0;"
" border: 1px dash 0px 0px ;"
" columns: 1;"
" padding: 2px 0px 0px ;"
"}"
"#window.mainbox.listview.element {"
" border: 0;"
"}"
"#window.mainbox.listview.element.normal.normal {"
" foreground: #FF002B36;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox.listview.element.normal.urgent {"
" foreground: #FFDC322F;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox.listview.element.normal.active {"
" foreground: #FF268BD2;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox.listview.element.selected.normal {"
" foreground: #FFEEE8D5;"
" background: #FF586E75;"
"}"
"#window.mainbox.listview.element.selected.urgent {"
" foreground: #FFFDF6E3;"
" background: #FFDC322F;"
"}"
"#window.mainbox.listview.element.selected.active {"
" foreground: #FFFDF6E3;"
" background: #FF268BD2;"
"}"
"#window.mainbox.listview.element.alternate.normal {"
" foreground: #FF002B36;"
" background: #FFEEE8D5;"
"}"
"#window.mainbox.listview.element.alternate.urgent {"
" foreground: #FFDC322F;"
" background: #FFEEE8D5;"
"}"
"#window.mainbox.listview.element.alternate.active {"
" foreground: #FF268BD2;"
" background: #FFEEE8D5;"
"}"
"#window.mainbox.listview.scrollbar {"
" border: 0;"
" padding: 0;"
"}"
"#window.mainbox.sidebar.box {"
" border: 1px dash 0px 0px ;"
"}"
"#window.mainbox.inputbar {"
" spacing: 0;"
"}"
"#window.mainbox.inputbar.box {"
"}"
"#window.mainbox.inputbar.normal {"
" foreground: #FF002B36;"
" background: #FFFDF6E3;"
"}";
"* {"
" spacing: 2;"
" background: #FFFDF6E3;"
"}"
"#window {"
" border: 1;"
" foreground: #FF002B36;"
" padding: 5;"
" background: @background;"
"}"
"#window.mainbox {"
" border: 0;"
" padding: 0;"
"}"
"#window.mainbox.message.box {"
" border: 1px dash 0px 0px ;"
" padding: 2px 0px 0px ;"
"}"
"#window.mainbox.message.normal {"
" foreground: #FF002B36;"
"}"
"#window.mainbox.listview {"
" fixed-height: 0;"
" border: 1px dash 0px 0px ;"
" columns: 1;"
" padding: 2px 0px 0px ;"
"}"
"#window.mainbox.listview.element {"
" border: 0;"
"}"
"#window.mainbox.listview.element.normal.normal {"
" foreground: #FF002B36;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox.listview.element.normal.urgent {"
" foreground: #FFDC322F;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox.listview.element.normal.active {"
" foreground: #FF268BD2;"
" background: #FFFDF6E3;"
"}"
"#window.mainbox.listview.element.selected.normal {"
" foreground: #FFEEE8D5;"
" background: #FF586E75;"
"}"
"#window.mainbox.listview.element.selected.urgent {"
" foreground: #FFFDF6E3;"
" background: #FFDC322F;"
"}"
"#window.mainbox.listview.element.selected.active {"
" foreground: #FFFDF6E3;"
" background: #FF268BD2;"
"}"
"#window.mainbox.listview.element.alternate.normal {"
" foreground: #FF002B36;"
" background: #FFEEE8D5;"
"}"
"#window.mainbox.listview.element.alternate.urgent {"
" foreground: #FFDC322F;"
" background: #FFEEE8D5;"
"}"
"#window.mainbox.listview.element.alternate.active {"
" foreground: #FF268BD2;"
" background: #FFEEE8D5;"
"}"
"#window.mainbox.listview.scrollbar {"
" border: 0;"
" padding: 0;"
"}"
"#window.mainbox.sidebar.box {"
" border: 1px dash 0px 0px ;"
"}"
"#window.mainbox.inputbar {"
" spacing: 0;"
"}"
"#window.mainbox.inputbar.box {"
"}"
"#window.mainbox.inputbar.normal {"
" foreground: #FF002B36;"
" background: @background;"
"}";
#endif

View File

@ -104,7 +104,7 @@ typedef char* ( *_mode_preprocess_input )( Mode *sw, const char *input );
*
* @returns the (valid pango markup) message to display.
*/
typedef char * (*_mode_get_message )( const Mode *sw );
typedef char * ( *_mode_get_message )( const Mode *sw );
/**
* Structure defining a switcher.

View File

@ -45,16 +45,16 @@ typedef struct
*/
typedef enum
{
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
TB_INDICATOR = 1 << 23,
TB_AUTOHEIGHT = 1 << 0,
TB_AUTOWIDTH = 1 << 1,
TB_LEFT = 1 << 16,
TB_RIGHT = 1 << 17,
TB_CENTER = 1 << 18,
TB_EDITABLE = 1 << 19,
TB_MARKUP = 1 << 20,
TB_WRAP = 1 << 21,
TB_PASSWORD = 1 << 22,
TB_INDICATOR = 1 << 23,
} TextboxFlags;
/**
* Flags indicating current state of the textbox.

View File

@ -18,10 +18,5 @@
*/
gboolean x11_parse_key ( const char *combo, unsigned int *mod, xkb_keysym_t *key, gboolean *release, GString * );
/*@}*/
#endif

View File

@ -63,7 +63,7 @@ static void combi_mode_parse_switchers ( Mode *sw )
char *savept = NULL;
// Make a copy, as strtok will modify it.
char *switcher_str = g_strdup ( config.combi_modi );
const char * const sep = ",";
const char * const sep = ",/";
// Split token on ','. This modifies switcher_str.
for ( char *token = strtok_r ( switcher_str, sep, &savept ); token != NULL;
token = strtok_r ( NULL, sep, &savept ) ) {

View File

@ -206,7 +206,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
// Reading one line per time.
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
// Evaluate one line.
unsigned int index = 0, ti = 0;
unsigned int index = 0, ti = 0;
char *token = buffer;
// Tokenize it.

View File

@ -254,7 +254,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
}
char *saveptr = NULL, *token;
GRegex **retv = NULL;
GRegex **retv = NULL;
if ( !config.tokenize ) {
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
@ -837,8 +837,8 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st
// uleft: value of the upper left cell; ulefts: maximum value of uleft and cells on the left. The arbitrary initial
// values suppress warnings.
int uleft = 0, ulefts = 0, left, lefts;
const gchar *pit = pattern, *sit;
enum CharClass prev = NON_WORD, cur;
const gchar *pit = pattern, *sit;
enum CharClass prev = NON_WORD, cur;
for ( si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char ( sit ) ) {
cur = rofi_scorer_get_character_class ( g_utf8_get_char ( sit ) );
score[si] = rofi_scorer_get_score_for ( prev, cur );

View File

@ -37,70 +37,70 @@ ActionBindingEntry abe[NUM_ABE];
*/
DefaultBinding bindings[NUM_ABE] =
{
{ .id = PASTE_PRIMARY, .name = "kb-primary-paste", .keybinding = "Control+V,Shift+Insert", .comment = "Paste primary selection" },
{ .id = PASTE_SECONDARY, .name = "kb-secondary-paste", .keybinding = "Control+v,Insert", .comment = "Paste clipboard" },
{ .id = CLEAR_LINE, .name = "kb-clear-line", .keybinding = "Control+w", .comment = "Clear input line" },
{ .id = MOVE_FRONT, .name = "kb-move-front", .keybinding = "Control+a", .comment = "Beginning of line" },
{ .id = MOVE_END, .name = "kb-move-end", .keybinding = "Control+e", .comment = "End of line" },
{ .id = MOVE_WORD_BACK, .name = "kb-move-word-back", .keybinding = "Alt+b", .comment = "Move back one word" },
{ .id = MOVE_WORD_FORWARD, .name = "kb-move-word-forward", .keybinding = "Alt+f", .comment = "Move forward one word" },
{ .id = MOVE_CHAR_BACK, .name = "kb-move-char-back", .keybinding = "Left,Control+b", .comment = "Move back one char" },
{ .id = MOVE_CHAR_FORWARD, .name = "kb-move-char-forward", .keybinding = "Right,Control+f", .comment = "Move forward one char" },
{ .id = REMOVE_WORD_BACK, .name = "kb-remove-word-back", .keybinding = "Control+Alt+h,Control+BackSpace", .comment = "Delete previous word" },
{ .id = REMOVE_WORD_FORWARD, .name = "kb-remove-word-forward", .keybinding = "Control+Alt+d", .comment = "Delete next word" },
{ .id = REMOVE_CHAR_FORWARD, .name = "kb-remove-char-forward", .keybinding = "Delete,Control+d", .comment = "Delete next char" },
{ .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .keybinding = "BackSpace,Control+h", .comment = "Delete previous char" },
{ .id = REMOVE_TO_EOL, .name = "kb-remove-to-eol", .keybinding = "Control+k", .comment = "Delete till the end of line" },
{ .id = REMOVE_TO_SOL, .name = "kb-remove-to-sol", .keybinding = "Control+u", .comment = "Delete till the start of line" },
{ .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .keybinding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" },
{ .id = ACCEPT_CUSTOM, .name = "kb-accept-custom", .keybinding = "Control+Return", .comment = "Use entered text as command (in ssh/run modi)" },
{ .id = ACCEPT_ALT, .name = "kb-accept-alt", .keybinding = "Shift+Return", .comment = "Use alternate accept command." },
{ .id = DELETE_ENTRY, .name = "kb-delete-entry", .keybinding = "Shift+Delete", .comment = "Delete entry from history" },
{ .id = MODE_NEXT, .name = "kb-mode-next", .keybinding = "Shift+Right,Control+Tab", .comment = "Switch to the next mode." },
{ .id = MODE_PREVIOUS, .name = "kb-mode-previous", .keybinding = "Shift+Left,Control+ISO_Left_Tab", .comment = "Switch to the previous mode." },
{ .id = ROW_LEFT, .name = "kb-row-left", .keybinding = "Control+Page_Up", .comment = "Go to the previous column" },
{ .id = ROW_RIGHT, .name = "kb-row-right", .keybinding = "Control+Page_Down", .comment = "Go to the next column" },
{ .id = ROW_UP, .name = "kb-row-up", .keybinding = "Up,Control+p,ISO_Left_Tab", .comment = "Select previous entry" },
{ .id = ROW_DOWN, .name = "kb-row-down", .keybinding = "Down,Control+n", .comment = "Select next entry" },
{ .id = ROW_TAB, .name = "kb-row-tab", .keybinding = "Tab", .comment = "Go to next row, if one left, accept it, if no left next mode." },
{ .id = PAGE_PREV, .name = "kb-page-prev", .keybinding = "Page_Up", .comment = "Go to the previous page" },
{ .id = PAGE_NEXT, .name = "kb-page-next", .keybinding = "Page_Down", .comment = "Go to the next page" },
{ .id = ROW_FIRST, .name = "kb-row-first", .keybinding = "Home,KP_Home", .comment = "Go to the first entry" },
{ .id = ROW_LAST, .name = "kb-row-last", .keybinding = "End,KP_End", .comment = "Go to the last entry" },
{ .id = ROW_SELECT, .name = "kb-row-select", .keybinding = "Control+space", .comment = "Set selected item as input text" },
{ .id = SCREENSHOT, .name = "kb-screenshot", .keybinding = "Alt+S", .comment = "Take a screenshot of the rofi window" },
{ .id = TOGGLE_CASE_SENSITIVITY, .name = "kb-toggle-case-sensitivity", .keybinding = "grave,dead_grave", .comment = "Toggle case sensitivity" },
{ .id = TOGGLE_SORT, .name = "kb-toggle-sort", .keybinding = "Alt+grave", .comment = "Toggle sort" },
{ .id = CANCEL, .name = "kb-cancel", .keybinding = "Escape,Control+g,Control+bracketleft", .comment = "Quit rofi" },
{ .id = CUSTOM_1, .name = "kb-custom-1", .keybinding = "Alt+1", .comment = "Custom keybinding 1" },
{ .id = CUSTOM_2, .name = "kb-custom-2", .keybinding = "Alt+2", .comment = "Custom keybinding 2" },
{ .id = CUSTOM_3, .name = "kb-custom-3", .keybinding = "Alt+3", .comment = "Custom keybinding 3" },
{ .id = CUSTOM_4, .name = "kb-custom-4", .keybinding = "Alt+4", .comment = "Custom keybinding 4" },
{ .id = CUSTOM_5, .name = "kb-custom-5", .keybinding = "Alt+5", .comment = "Custom Keybinding 5" },
{ .id = CUSTOM_6, .name = "kb-custom-6", .keybinding = "Alt+6", .comment = "Custom keybinding 6" },
{ .id = CUSTOM_7, .name = "kb-custom-7", .keybinding = "Alt+7", .comment = "Custom Keybinding 7" },
{ .id = CUSTOM_8, .name = "kb-custom-8", .keybinding = "Alt+8", .comment = "Custom keybinding 8" },
{ .id = CUSTOM_9, .name = "kb-custom-9", .keybinding = "Alt+9", .comment = "Custom keybinding 9" },
{ .id = CUSTOM_10, .name = "kb-custom-10", .keybinding = "Alt+0", .comment = "Custom keybinding 10" },
{ .id = CUSTOM_11, .name = "kb-custom-11", .keybinding = "Alt+exclam", .comment = "Custom keybinding 11" },
{ .id = CUSTOM_12, .name = "kb-custom-12", .keybinding = "Alt+at", .comment = "Custom keybinding 12" },
{ .id = CUSTOM_13, .name = "kb-custom-13", .keybinding = "Alt+numbersign", .comment = "Csutom keybinding 13" },
{ .id = CUSTOM_14, .name = "kb-custom-14", .keybinding = "Alt+dollar", .comment = "Custom keybinding 14" },
{ .id = CUSTOM_15, .name = "kb-custom-15", .keybinding = "Alt+percent", .comment = "Custom keybinding 15" },
{ .id = CUSTOM_16, .name = "kb-custom-16", .keybinding = "Alt+dead_circumflex", .comment = "Custom keybinding 16" },
{ .id = CUSTOM_17, .name = "kb-custom-17", .keybinding = "Alt+ampersand", .comment = "Custom keybinding 17" },
{ .id = CUSTOM_18, .name = "kb-custom-18", .keybinding = "Alt+asterisk", .comment = "Custom keybinding 18" },
{ .id = CUSTOM_19, .name = "kb-custom-19", .keybinding = "Alt+parenleft", .comment = "Custom Keybinding 19" },
{ .id = SELECT_ELEMENT_1, .name = "kb-select-1", .keybinding = "Super+1", .comment = "Select row 1" },
{ .id = SELECT_ELEMENT_2, .name = "kb-select-2", .keybinding = "Super+2", .comment = "Select row 2" },
{ .id = SELECT_ELEMENT_3, .name = "kb-select-3", .keybinding = "Super+3", .comment = "Select row 3" },
{ .id = SELECT_ELEMENT_4, .name = "kb-select-4", .keybinding = "Super+4", .comment = "Select row 4" },
{ .id = SELECT_ELEMENT_5, .name = "kb-select-5", .keybinding = "Super+5", .comment = "Select row 5" },
{ .id = SELECT_ELEMENT_6, .name = "kb-select-6", .keybinding = "Super+6", .comment = "Select row 6" },
{ .id = SELECT_ELEMENT_7, .name = "kb-select-7", .keybinding = "Super+7", .comment = "Select row 7" },
{ .id = SELECT_ELEMENT_8, .name = "kb-select-8", .keybinding = "Super+8", .comment = "Select row 8" },
{ .id = SELECT_ELEMENT_9, .name = "kb-select-9", .keybinding = "Super+9", .comment = "Select row 9" },
{ .id = SELECT_ELEMENT_10, .name = "kb-select-10", .keybinding = "Super+0", .comment = "Select row 10" },
{ .id = PASTE_PRIMARY, .name = "kb-primary-paste", .keybinding = "Control+V,Shift+Insert", .comment = "Paste primary selection" },
{ .id = PASTE_SECONDARY, .name = "kb-secondary-paste", .keybinding = "Control+v,Insert", .comment = "Paste clipboard" },
{ .id = CLEAR_LINE, .name = "kb-clear-line", .keybinding = "Control+w", .comment = "Clear input line" },
{ .id = MOVE_FRONT, .name = "kb-move-front", .keybinding = "Control+a", .comment = "Beginning of line" },
{ .id = MOVE_END, .name = "kb-move-end", .keybinding = "Control+e", .comment = "End of line" },
{ .id = MOVE_WORD_BACK, .name = "kb-move-word-back", .keybinding = "Alt+b", .comment = "Move back one word" },
{ .id = MOVE_WORD_FORWARD, .name = "kb-move-word-forward", .keybinding = "Alt+f", .comment = "Move forward one word" },
{ .id = MOVE_CHAR_BACK, .name = "kb-move-char-back", .keybinding = "Left,Control+b", .comment = "Move back one char" },
{ .id = MOVE_CHAR_FORWARD, .name = "kb-move-char-forward", .keybinding = "Right,Control+f", .comment = "Move forward one char" },
{ .id = REMOVE_WORD_BACK, .name = "kb-remove-word-back", .keybinding = "Control+Alt+h,Control+BackSpace", .comment = "Delete previous word" },
{ .id = REMOVE_WORD_FORWARD, .name = "kb-remove-word-forward", .keybinding = "Control+Alt+d", .comment = "Delete next word" },
{ .id = REMOVE_CHAR_FORWARD, .name = "kb-remove-char-forward", .keybinding = "Delete,Control+d", .comment = "Delete next char" },
{ .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .keybinding = "BackSpace,Control+h", .comment = "Delete previous char" },
{ .id = REMOVE_TO_EOL, .name = "kb-remove-to-eol", .keybinding = "Control+k", .comment = "Delete till the end of line" },
{ .id = REMOVE_TO_SOL, .name = "kb-remove-to-sol", .keybinding = "Control+u", .comment = "Delete till the start of line" },
{ .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .keybinding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" },
{ .id = ACCEPT_CUSTOM, .name = "kb-accept-custom", .keybinding = "Control+Return", .comment = "Use entered text as command (in ssh/run modi)" },
{ .id = ACCEPT_ALT, .name = "kb-accept-alt", .keybinding = "Shift+Return", .comment = "Use alternate accept command." },
{ .id = DELETE_ENTRY, .name = "kb-delete-entry", .keybinding = "Shift+Delete", .comment = "Delete entry from history" },
{ .id = MODE_NEXT, .name = "kb-mode-next", .keybinding = "Shift+Right,Control+Tab", .comment = "Switch to the next mode." },
{ .id = MODE_PREVIOUS, .name = "kb-mode-previous", .keybinding = "Shift+Left,Control+ISO_Left_Tab", .comment = "Switch to the previous mode." },
{ .id = ROW_LEFT, .name = "kb-row-left", .keybinding = "Control+Page_Up", .comment = "Go to the previous column" },
{ .id = ROW_RIGHT, .name = "kb-row-right", .keybinding = "Control+Page_Down", .comment = "Go to the next column" },
{ .id = ROW_UP, .name = "kb-row-up", .keybinding = "Up,Control+p,ISO_Left_Tab", .comment = "Select previous entry" },
{ .id = ROW_DOWN, .name = "kb-row-down", .keybinding = "Down,Control+n", .comment = "Select next entry" },
{ .id = ROW_TAB, .name = "kb-row-tab", .keybinding = "Tab", .comment = "Go to next row, if one left, accept it, if no left next mode." },
{ .id = PAGE_PREV, .name = "kb-page-prev", .keybinding = "Page_Up", .comment = "Go to the previous page" },
{ .id = PAGE_NEXT, .name = "kb-page-next", .keybinding = "Page_Down", .comment = "Go to the next page" },
{ .id = ROW_FIRST, .name = "kb-row-first", .keybinding = "Home,KP_Home", .comment = "Go to the first entry" },
{ .id = ROW_LAST, .name = "kb-row-last", .keybinding = "End,KP_End", .comment = "Go to the last entry" },
{ .id = ROW_SELECT, .name = "kb-row-select", .keybinding = "Control+space", .comment = "Set selected item as input text" },
{ .id = SCREENSHOT, .name = "kb-screenshot", .keybinding = "Alt+S", .comment = "Take a screenshot of the rofi window" },
{ .id = TOGGLE_CASE_SENSITIVITY, .name = "kb-toggle-case-sensitivity", .keybinding = "grave,dead_grave", .comment = "Toggle case sensitivity" },
{ .id = TOGGLE_SORT, .name = "kb-toggle-sort", .keybinding = "Alt+grave", .comment = "Toggle sort" },
{ .id = CANCEL, .name = "kb-cancel", .keybinding = "Escape,Control+g,Control+bracketleft", .comment = "Quit rofi" },
{ .id = CUSTOM_1, .name = "kb-custom-1", .keybinding = "Alt+1", .comment = "Custom keybinding 1" },
{ .id = CUSTOM_2, .name = "kb-custom-2", .keybinding = "Alt+2", .comment = "Custom keybinding 2" },
{ .id = CUSTOM_3, .name = "kb-custom-3", .keybinding = "Alt+3", .comment = "Custom keybinding 3" },
{ .id = CUSTOM_4, .name = "kb-custom-4", .keybinding = "Alt+4", .comment = "Custom keybinding 4" },
{ .id = CUSTOM_5, .name = "kb-custom-5", .keybinding = "Alt+5", .comment = "Custom Keybinding 5" },
{ .id = CUSTOM_6, .name = "kb-custom-6", .keybinding = "Alt+6", .comment = "Custom keybinding 6" },
{ .id = CUSTOM_7, .name = "kb-custom-7", .keybinding = "Alt+7", .comment = "Custom Keybinding 7" },
{ .id = CUSTOM_8, .name = "kb-custom-8", .keybinding = "Alt+8", .comment = "Custom keybinding 8" },
{ .id = CUSTOM_9, .name = "kb-custom-9", .keybinding = "Alt+9", .comment = "Custom keybinding 9" },
{ .id = CUSTOM_10, .name = "kb-custom-10", .keybinding = "Alt+0", .comment = "Custom keybinding 10" },
{ .id = CUSTOM_11, .name = "kb-custom-11", .keybinding = "Alt+exclam", .comment = "Custom keybinding 11" },
{ .id = CUSTOM_12, .name = "kb-custom-12", .keybinding = "Alt+at", .comment = "Custom keybinding 12" },
{ .id = CUSTOM_13, .name = "kb-custom-13", .keybinding = "Alt+numbersign", .comment = "Csutom keybinding 13" },
{ .id = CUSTOM_14, .name = "kb-custom-14", .keybinding = "Alt+dollar", .comment = "Custom keybinding 14" },
{ .id = CUSTOM_15, .name = "kb-custom-15", .keybinding = "Alt+percent", .comment = "Custom keybinding 15" },
{ .id = CUSTOM_16, .name = "kb-custom-16", .keybinding = "Alt+dead_circumflex", .comment = "Custom keybinding 16" },
{ .id = CUSTOM_17, .name = "kb-custom-17", .keybinding = "Alt+ampersand", .comment = "Custom keybinding 17" },
{ .id = CUSTOM_18, .name = "kb-custom-18", .keybinding = "Alt+asterisk", .comment = "Custom keybinding 18" },
{ .id = CUSTOM_19, .name = "kb-custom-19", .keybinding = "Alt+parenleft", .comment = "Custom Keybinding 19" },
{ .id = SELECT_ELEMENT_1, .name = "kb-select-1", .keybinding = "Super+1", .comment = "Select row 1" },
{ .id = SELECT_ELEMENT_2, .name = "kb-select-2", .keybinding = "Super+2", .comment = "Select row 2" },
{ .id = SELECT_ELEMENT_3, .name = "kb-select-3", .keybinding = "Super+3", .comment = "Select row 3" },
{ .id = SELECT_ELEMENT_4, .name = "kb-select-4", .keybinding = "Super+4", .comment = "Select row 4" },
{ .id = SELECT_ELEMENT_5, .name = "kb-select-5", .keybinding = "Super+5", .comment = "Select row 5" },
{ .id = SELECT_ELEMENT_6, .name = "kb-select-6", .keybinding = "Super+6", .comment = "Select row 6" },
{ .id = SELECT_ELEMENT_7, .name = "kb-select-7", .keybinding = "Super+7", .comment = "Select row 7" },
{ .id = SELECT_ELEMENT_8, .name = "kb-select-8", .keybinding = "Super+8", .comment = "Select row 8" },
{ .id = SELECT_ELEMENT_9, .name = "kb-select-9", .keybinding = "Super+9", .comment = "Select row 9" },
{ .id = SELECT_ELEMENT_10, .name = "kb-select-10", .keybinding = "Super+0", .comment = "Select row 10" },
};
void setup_abe ( void )

View File

@ -83,9 +83,14 @@ void rofi_add_error_message ( GString *str )
}
/** Path to the configuration file */
char *config_path = NULL;
char *config_path = NULL;
/** Array holding all activated modi. */
Mode **modi = NULL;
Mode **modi = NULL;
/** List of (possibly uninitialized) modi's */
Mode ** available_modi = NULL;
/** Length of #num_available_modi */
unsigned int num_available_modi = 0;
/** Number of activated modi in #modi array */
unsigned int num_modi = 0;
/** Current selected mode */
@ -165,8 +170,13 @@ static void run_switcher ( ModeMode mode )
// Otherwise check if requested mode is enabled.
for ( unsigned int i = 0; i < num_modi; i++ ) {
if ( !mode_init ( modi[i] ) ) {
rofi_view_error_dialog ( ERROR_MSG ( "Failed to initialize all the modi." ), ERROR_MSG_MARKUP );
return;
GString *str= g_string_new ( "Failed to initialize the mode: ");
g_string_append ( str, modi[i]->name );
g_string_append ( str, "\n");
rofi_view_error_dialog ( str->str, ERROR_MSG_MARKUP );
g_string_free (str, FALSE);
break;
}
}
// Error dialog must have been created.
@ -306,6 +316,56 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
}
}
static void help_print_disabled_mode ( const char *mode )
{
int is_term = isatty ( fileno ( stdout ) );
// Only output to terminal
if ( is_term ) {
fprintf ( stderr, "Mode %s%s%s is not enabled. I have enabled it for now.\n",
color_red, mode, color_reset);
fprintf ( stderr, "Please consider adding %s%s%s to the list of enabled modi: %smodi: %s%s%s,%s%s.\n",
color_red, mode, color_reset,
color_green, config.modi,color_reset,
color_red, mode, color_reset
);
}
}
static void help_print_no_arguments ( void )
{
int is_term = isatty ( fileno ( stdout ) );
// Daemon mode
fprintf ( stderr, "Rofi is unsure what to show.\n" );
fprintf ( stderr, "Please specify the mode you want to show.\n\n" );
fprintf ( stderr, " %srofi%s -show %s{mode}%s\n\n",
is_term ? color_bold : "", is_term ? color_reset : "",
is_term ? color_green : "", is_term ? color_reset : "" );
fprintf ( stderr, "The following modi are enabled:\n" );
for ( unsigned int j = 0; j < num_modi; j++ ) {
fprintf ( stderr, " * %s%s%s\n",
is_term ? color_green : "",
modi[j]->name,
is_term ? color_reset : "" );
}
fprintf ( stderr, "\nThe following can be enabled:\n" );
for ( unsigned int i = 0; i < num_available_modi; i++ ) {
gboolean active = FALSE;
for ( unsigned int j = 0; j < num_modi; j++ ) {
if ( modi[j] == available_modi[i] ) {
active = TRUE;
break;
}
}
if ( !active ) {
fprintf ( stderr, " * %s%s%s\n",
is_term ? color_red : "",
available_modi[i]->name,
is_term ? color_reset : "" );
}
}
fprintf ( stderr, "\nTo activate a mode, add it to the list of modi in the %smodi%s setting.",
is_term?color_green:"",is_term?color_reset:"" );
}
/**
* Cleanup globally allocated memory.
*/
@ -354,10 +414,6 @@ static void cleanup ()
/**
* Collected modi
*/
/** List of (possibly uninitialized) modi's */
Mode ** available_modi = NULL;
/** Length of #num_available_modi */
unsigned int num_available_modi = 0;
/**
* @param name Search for mode with this name.
@ -495,14 +551,14 @@ static int add_mode ( const char * token )
}
else {
// Report error, don't continue.
fprintf ( stderr, "Invalid script switcher: %s\n", token );
fprintf ( stderr, "Invalid script mode: %s\n", token );
}
}
return ( index == num_modi ) ? -1 : (int) index;
}
static void setup_modi ( void )
{
const char *const sep = ",";
const char *const sep = ",/";
char *savept = NULL;
// Make a copy, as strtok will modify it.
char *switcher_str = g_strdup ( config.modi );
@ -667,9 +723,7 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
index = add_mode ( sname );
// Complain
if ( index >= 0 ) {
fprintf ( stdout, "Mode %s not enabled. Please add it to the list of enabled modi: %s\n",
sname, config.modi );
fprintf ( stdout, "Adding mode: %s\n", sname );
help_print_disabled_mode ( sname );
}
// Run it anyway if found.
}
@ -677,7 +731,7 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
run_switcher ( index );
}
else {
fprintf ( stderr, "The %s switcher has not been enabled\n", sname );
fprintf ( stderr, "The %s mode has not been enabled\n", sname );
g_main_loop_quit ( main_loop );
return G_SOURCE_REMOVE;
}
@ -686,9 +740,8 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
run_switcher ( 0 );
}
else{
// Daemon mode
fprintf ( stderr, "Rofi daemon mode is now removed.\n" );
fprintf ( stderr, "Please use your window manager binding functionality or xbindkeys to replace it.\n" );
help_print_no_arguments ( );
g_main_loop_quit ( main_loop );
}
@ -835,8 +888,8 @@ int main ( int argc, char *argv[] )
g_free ( theme_str );
}
if ( rofi_theme_is_empty ( ) ) {
if ( rofi_theme_parse_string ( default_theme ) ){
fprintf(stderr, "Failed to parse default theme. Giving up..\n");
if ( rofi_theme_parse_string ( default_theme ) ) {
fprintf ( stderr, "Failed to parse default theme. Giving up..\n" );
rofi_theme = NULL;
cleanup ();
return EXIT_FAILURE;