1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

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 ; handle-width: 8px ;
padding: 0; padding: 0;
} }
sidebar { mode-switcher {
border: 2px dash 0px 0px ; border: 2px dash 0px 0px ;
border-color: var(separatorcolor); border-color: var(separatorcolor);
} }

View file

@ -103,7 +103,7 @@ scrollbar {
handle-width: 8px ; handle-width: 8px ;
padding: 0; padding: 0;
} }
sidebar { mode-switcher {
border: 2px 0px 0px ; border: 2px 0px 0px ;
border-color: var(separatorcolor); 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. * `listview`: The listview.
* `scrollbar`: the listview scrollbar * `scrollbar`: the listview scrollbar
* `element`: the entries in the listview * `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 * `button`: the buttons @textbox for each mode
* `message`: The container holding the textbox. * `message`: The container holding the textbox.
* `textbox`: the message 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 | | | | | | | | Button | | Button | | Button | | Button | | | |
| | | |---------------| |---------------| |--------------| |---------------| | | | | | | |---------------| |---------------| |--------------| |---------------| | | |
@ -739,13 +739,13 @@ The following widgets are fixed, as they provide core **rofi** functionality:
* case-indicator * case-indicator
* message * message
* listview * listview
* sidebar * mode-switcher
The following keywords are defined and can be used to automatically pack a subset of the widgets. 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. These are used in the default theme as depicted in the figure above.
* mainbox * mainbox
Packs: `inputbar, message, listview, sidebar` Packs: `inputbar, message, listview, mode-switcher`
* inputbar * inputbar
Packs: `prompt,entry,case-indicator` Packs: `prompt,entry,case-indicator`

View file

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

View file

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

View file

@ -897,7 +897,7 @@ void rofi_theme_convert_old ( void )
if ( g_strcmp0 ( config.separator_style, "none" ) == 0 ) { if ( g_strcmp0 ( config.separator_style, "none" ) == 0 ) {
const char *const str = "#listview { border: 0px; }"; const char *const str = "#listview { border: 0px; }";
rofi_theme_parse_string ( str ); 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 ); rofi_theme_parse_string ( str2 );
const char *const str3 = "#message { border: 0px; }"; const char *const str3 = "#message { border: 0px; }";
rofi_theme_parse_string ( str3 ); rofi_theme_parse_string ( str3 );
@ -905,7 +905,7 @@ void rofi_theme_convert_old ( void )
else if ( g_strcmp0 ( config.separator_style, "solid" ) == 0 ) { else if ( g_strcmp0 ( config.separator_style, "solid" ) == 0 ) {
const char *const str = "#listview { border: 2px solid 0px 0px 0px; }"; const char *const str = "#listview { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str ); 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 ); rofi_theme_parse_string ( str2 );
const char *const str3 = "#message { border: 2px solid 0px 0px 0px; }"; const char *const str3 = "#message { border: 2px solid 0px 0px 0px; }";
rofi_theme_parse_string ( str3 ); 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_LISTVIEW_ELEMENT:
case SCOPE_MOUSE_EDITBOX: case SCOPE_MOUSE_EDITBOX:
case SCOPE_MOUSE_SCROLLBAR: case SCOPE_MOUSE_SCROLLBAR:
case SCOPE_MOUSE_SIDEBAR_MODI: case SCOPE_MOUSE_MODE_SWITCHER:
{ {
gint x = state->mouse.x, y = state->mouse.y; gint x = state->mouse.x, y = state->mouse.y;
widget *target = widget_find_mouse_target ( WIDGET ( state->main_window ), scope, x, 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 ); wid = (widget *) box_create ( parent_widget, name, ROFI_ORIENTATION_VERTICAL );
box_add ( (box *) parent_widget, WIDGET ( wid ), TRUE ); box_add ( (box *) parent_widget, WIDGET ( wid ), TRUE );
if ( config.sidebar_mode ) { if ( config.sidebar_mode ) {
defaults = "inputbar,message,listview,sidebar"; defaults = "inputbar,message,listview,mode-switcher";
} else { } else {
defaults = "inputbar,message,listview"; 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 ); 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 ) { 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; return;
} }
state->sidebar_bar = box_create ( parent_widget, name, ROFI_ORIENTATION_HORIZONTAL ); 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 * ) ); state->modi = g_malloc0 ( state->num_modi * sizeof ( textbox * ) );
for ( unsigned int j = 0; j < state->num_modi; j++ ) { for ( unsigned int j = 0; j < state->num_modi; j++ ) {
const Mode * mode = rofi_get_mode ( 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 ); mode_get_display_name ( mode ), 0.5, 0.5 );
box_add ( state->sidebar_bar, WIDGET ( state->modi[j] ), TRUE ); 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 ); widget_set_trigger_action_handler ( WIDGET ( state->modi[j] ), textbox_sidebar_modi_trigger_action, state );

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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