Change sidebar in theme to mode-switcher.

Fixes: #930
This commit is contained in:
Dave Davenport 2019-03-19 22:45:10 +01:00
parent beeb9c8b27
commit 6fffe427c4
28 changed files with 201 additions and 676 deletions

View File

@ -103,7 +103,7 @@ scrollbar {
handle-width: 8px ;
padding: 0;
}
sidebar {
mode-switcher {
border: 2px dash 0px 0px ;
border-color: var(separatorcolor);
}

View File

@ -103,7 +103,7 @@ scrollbar {
handle-width: 8px ;
padding: 0;
}
sidebar {
mode-switcher {
border: 2px 0px 0px ;
border-color: var(separatorcolor);
}

File diff suppressed because it is too large Load Diff

View File

@ -512,7 +512,7 @@ The current widgets available in **rofi**:
* `listview`: The listview.
* `scrollbar`: the listview scrollbar
* `element`: the entries in the listview
* `sidebar`: the main horizontal @box packing the buttons.
* `mode-switcher`: the main horizontal @box packing the buttons.
* `button`: the buttons @textbox for each mode
* `message`: The container holding the textbox.
* `textbox`: the message textbox
@ -700,7 +700,7 @@ The current layout of **rofi** is structured as follows:
| | |-----------------------------------------------------------------------------| |
| | | |
| | |---------------------------------------------------------------------------| | |
| | | sidebar {BOX:horizontal} | | |
| | | mode-switcher {BOX:horizontal} | | |
| | | |---------------| |---------------| |--------------| |---------------| | | |
| | | | Button | | Button | | Button | | Button | | | |
| | | |---------------| |---------------| |--------------| |---------------| | | |
@ -739,13 +739,13 @@ The following widgets are fixed, as they provide core **rofi** functionality:
* case-indicator
* message
* listview
* sidebar
* mode-switcher
The following keywords are defined and can be used to automatically pack a subset of the widgets.
These are used in the default theme as depicted in the figure above.
* mainbox
Packs: `inputbar, message, listview, sidebar`
Packs: `inputbar, message, listview, mode-switcher`
* inputbar
Packs: `prompt,entry,case-indicator`

View File

@ -48,8 +48,8 @@ typedef enum
#define SCOPE_MIN_FIXED SCOPE_MOUSE_EDITBOX
SCOPE_MOUSE_EDITBOX,
SCOPE_MOUSE_SCROLLBAR,
SCOPE_MOUSE_SIDEBAR_MODI,
#define SCOPE_MAX_FIXED SCOPE_MOUSE_SIDEBAR_MODI
SCOPE_MOUSE_MODE_SWITCHER,
#define SCOPE_MAX_FIXED SCOPE_MOUSE_MODE_SWITCHER
} BindingsScope;
/**

View File

@ -65,8 +65,8 @@ typedef enum
WIDGET_TYPE_EDITBOX = SCOPE_MOUSE_EDITBOX,
/** The listview scrollbar */
WIDGET_TYPE_SCROLLBAR = SCOPE_MOUSE_SCROLLBAR,
/** A tab in the modi sidebar */
WIDGET_TYPE_SIDEBAR_MODI = SCOPE_MOUSE_SIDEBAR_MODI,
/** A widget allowing user to swithc between modi */
WIDGET_TYPE_MODE_SWITCHER = SCOPE_MOUSE_MODE_SWITCHER,
/** Text-only textbox */
WIDGET_TYPE_TEXTBOX_TEXT,
} WidgetType;

View File

@ -897,7 +897,7 @@ void rofi_theme_convert_old ( void )
if ( g_strcmp0 ( config.separator_style, "none" ) == 0 ) {
const char *const str = "#listview { border: 0px; }";
rofi_theme_parse_string ( str );
const char *const str2 = "#sidebar { border: 0px; }";
const char *const str2 = "#mode-switcher { border: 0px; }";
rofi_theme_parse_string ( str2 );
const char *const str3 = "#message { border: 0px; }";
rofi_theme_parse_string ( str3 );
@ -905,7 +905,7 @@ void rofi_theme_convert_old ( void )
else if ( g_strcmp0 ( config.separator_style, "solid" ) == 0 ) {
const char *const str = "#listview { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str );
const char *const str2 = "#sidebar { border: 2px solid 0px 0px 0px; }";
const char *const str2 = "#mode-switcher { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str2 );
const char *const str3 = "#message { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str3 );

View File

@ -1366,7 +1366,7 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, g
case SCOPE_MOUSE_LISTVIEW_ELEMENT:
case SCOPE_MOUSE_EDITBOX:
case SCOPE_MOUSE_SCROLLBAR:
case SCOPE_MOUSE_SIDEBAR_MODI:
case SCOPE_MOUSE_MODE_SWITCHER:
{
gint x = state->mouse.x, y = state->mouse.y;
widget *target = widget_find_mouse_target ( WIDGET ( state->main_window ), scope, x, y );
@ -1556,7 +1556,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
wid = (widget *) box_create ( parent_widget, name, ROFI_ORIENTATION_VERTICAL );
box_add ( (box *) parent_widget, WIDGET ( wid ), TRUE );
if ( config.sidebar_mode ) {
defaults = "inputbar,message,listview,sidebar";
defaults = "inputbar,message,listview,mode-switcher";
} else {
defaults = "inputbar,message,listview";
}
@ -1644,11 +1644,11 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
listview_set_max_lines ( state->list_view, state->num_lines );
}
/**
* SIDEBAR
* MODE SWITCHER
*/
else if ( strcmp ( name, "sidebar" ) == 0 ) {
else if ( strcmp ( name, "mode-switcher" ) == 0 ) {
if ( state->sidebar_bar != NULL ) {
g_error ( "Sidebar widget can only be added once to the layout." );
g_error ( "Mode-switcher can only be added once to the layout." );
return;
}
state->sidebar_bar = box_create ( parent_widget, name, ROFI_ORIENTATION_HORIZONTAL );
@ -1657,7 +1657,7 @@ static void rofi_view_add_widget ( RofiViewState *state, widget *parent_widget,
state->modi = g_malloc0 ( state->num_modi * sizeof ( textbox * ) );
for ( unsigned int j = 0; j < state->num_modi; j++ ) {
const Mode * mode = rofi_get_mode ( j );
state->modi[j] = textbox_create ( WIDGET ( state->sidebar_bar ), WIDGET_TYPE_SIDEBAR_MODI, "button", TB_AUTOHEIGHT, ( mode == state->sw ) ? HIGHLIGHT : NORMAL,
state->modi[j] = textbox_create ( WIDGET ( state->sidebar_bar ), WIDGET_TYPE_MODE_SWITCHER, "button", TB_AUTOHEIGHT, ( mode == state->sw ) ? HIGHLIGHT : NORMAL,
mode_get_display_name ( mode ), 0.5, 0.5 );
box_add ( state->sidebar_bar, WIDGET ( state->modi[j] ), TRUE );
widget_set_trigger_action_handler ( WIDGET ( state->modi[j] ), textbox_sidebar_modi_trigger_action, state );

View File

@ -107,7 +107,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -105,7 +105,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -96,7 +96,7 @@
text-color: @alternate-active-foreground;
background-color: @alternate-active-background;
}
#sidebar {
#mode-switcher {
border: 1px dash 0px 0px ;
}
#button selected {

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -149,13 +149,13 @@
#vertb {
expand: false;
children: [ dummy0, sidebar, dummy1 ];
children: [ dummy0, mode-switcher, dummy1 ];
}
#dummy0, dummy1 {
expand: true;
}
#sidebar {
#mode-switcher {
expand: false;
orientation: vertical;
spacing: 0px;

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -109,7 +109,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -105,7 +105,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -94,7 +94,7 @@ scrollbar {
padding: 0;
}
sidebar {
mode-switcher {
border: 2px 0 0;
border-color: @separatorcolor;
}

View File

@ -106,7 +106,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -106,7 +106,7 @@
background-color: #F5F5F500;
}
#sidebar {
#mode-switcher {
border: 2px;
padding: 0.5em 1em;
background-color: @grey;

View File

@ -105,7 +105,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -50,7 +50,7 @@
text-color: @lightwhite;
}
#sidebar {
#mode-switcher {
border: 2px 0px 0px 0px;
background-color: @lightblack;
padding: 4px;

View File

@ -105,7 +105,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}

View File

@ -105,7 +105,7 @@
handle-width: 8px ;
padding: 0;
}
#sidebar {
#mode-switcher {
border: 2px dash 0px 0px ;
border-color: @separatorcolor;
}