Add option to disable history.

This commit is contained in:
QC 2014-06-05 21:55:47 +02:00
parent a2bbc65ff8
commit f9149b5bdb
7 changed files with 30 additions and 9 deletions

View File

@ -74,6 +74,7 @@ Settings config = {
.ssh_set_title = TRUE,
.y_offset = 0,
.x_offset = 0,
.fixed_num_lines = FALSE
.fixed_num_lines = FALSE,
.disable_history = FALSE
};

View File

@ -14,6 +14,7 @@ SYNOPSIS
[ -terminal *terminal* ] [ -loc *position* ] [ -hmode ] [ -fixed-num-lines ] [ -padding *padding* ]
[ -opacity *opacity%* ] [ -display *display* ] [ -bc *color* ] [ -bw *width* ] [ -dmenu [ -p *prompt* ] ]
[ -ssh-set-title *true|false* ] [ -now ] [ -rnow ] [ -snow ] [ -version ] [ -help] [ -dump-xresources ]
[ -disable-history ]
DESCRIPTION
-----------
@ -210,6 +211,10 @@ OPTIONS
Not all terminals support this.
Default value is true.
`-disable-history`
Disable history
Switch between modi
-------------------

View File

@ -8,8 +8,8 @@ rofi \- A window switcher, run dialog and dmenu replacement
[ \-bg \fIcolor\fP ] [ \-hlfg \fIcolor\fP ] [ \-hlbg \fIcolor\fP ] [ \-key \fIcombo\fP ] [ \-dkey \fIcomdo\fP ] [ \-rkey \fIcomdo\fP ]
[ \-terminal \fIterminal\fP ] [ \-loc \fIposition\fP ] [ \-hmode ] [ \-fixed\-num\-lines ] [ \-padding \fIpadding\fP ]
[ \-opacity \fIopacity%\fP ] [ \-display \fIdisplay\fP ] [ \-bc \fIcolor\fP ] [ \-bw \fIwidth\fP ] [ \-dmenu [ \-p \fIprompt\fP ] ]
[ \-ssh\-set\-title \fItrue|false\fP ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ] [ \-help] [ \-dump ]
[ \-dump\-xresources ]
[ \-ssh\-set\-title \fItrue|false\fP ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ] [ \-help] [ \-dump\-xresources ]
[ \-disable\-history ]
.SH DESCRIPTION
.PP
\fB\fCrofi\fR is an X11 popup window switcher. A list is displayed center\-screen showing open window titles, WM_CLASS, and desktop number.
@ -245,10 +245,6 @@ To make rofi look like dmenu:
.IP
Run rofi in dmenu mode. Allowing it to be used for user interaction in scripts.
.PP
\fB\fC\-dump\fR
.IP
Dump the current active configuration to the command\-line.
.PP
\fB\fC\-dump\-xresources\fR
.IP
Dump the current active configuration in xresources format to the command\-line.
@ -258,6 +254,10 @@ Dump the current active configuration in xresources format to the command\-line.
SSH dialogs tries to set 'ssh hostname' of the spawned terminal.
Not all terminals support this.
Default value is true.
.PP
\fB\fC\-disable\-history\fR
.IP
Disable history
.SH Switch between modi
.PP
Type '?' \fIenter\fP to switch between window list, run and ssh mode.

View File

@ -133,6 +133,8 @@ typedef struct _Settings
unsigned int ssh_set_title;
unsigned int fixed_num_lines;
unsigned int disable_history;
} Settings;
extern Settings config;

View File

@ -113,6 +113,9 @@ static _element ** __history_get_element_list ( FILE *fd, unsigned int *length )
void history_set ( const char *filename, const char *entry )
{
if ( config.disable_history ) {
return;
}
int found = 0;
unsigned int curr = 0;
unsigned int length = 0;
@ -179,6 +182,9 @@ void history_set ( const char *filename, const char *entry )
void history_remove ( const char *filename, const char *entry )
{
if ( config.disable_history ) {
return;
}
_element ** list = NULL;
int found = 0;
unsigned int curr = 0;
@ -235,6 +241,9 @@ void history_remove ( const char *filename, const char *entry )
char ** history_get_list ( const char *filename, unsigned int *length )
{
if ( config.disable_history ) {
return NULL;
}
_element **list = NULL;
char **retv = NULL;
// Open file.

View File

@ -956,7 +956,7 @@ MenuReturn menu ( char **lines, char **input, char *prompt, Time *time, int *shi
XStoreName ( display, box, "rofi" );
// Hack to set window opacity.
unsigned int opacity_set = ( unsigned int ) ( ( config.window_opacity / 100.0 ) * UINT32_MAX);
unsigned int opacity_set = ( unsigned int ) ( ( config.window_opacity / 100.0 ) * UINT32_MAX );
XChangeProperty ( display, box, netatoms[_NET_WM_WINDOW_OPACITY],
XA_CARDINAL, 32, PropModeReplace,
( unsigned char * ) &opacity_set, 1L );
@ -1745,7 +1745,7 @@ static inline void display_get_i3_path ( Display *display )
Screen *screen = DefaultScreenOfDisplay ( display );
Window root = RootWindow ( display, XScreenNumberOfScreen ( screen ) );
i3_socket_path = window_get_text_prop ( root, netatoms[I3_SOCKET_PATH] );
config_i3_mode = (i3_socket_path != NULL)?TRUE:FALSE;
config_i3_mode = ( i3_socket_path != NULL ) ? TRUE : FALSE;
}
#endif //HAVE_I3_IPC_H
@ -1801,6 +1801,9 @@ static void parse_cmd_options ( int argc, char ** argv )
if ( find_arg ( argc, argv, "-fixed-num-lines" ) >= 0 ) {
config.fixed_num_lines = 1;
}
if ( find_arg ( argc, argv, "-disable-history" ) >= 0 ) {
config.disable_history = TRUE;
}
// Parse commandline arguments about behavior
find_arg_str ( argc, argv, "-terminal", &( config.terminal_emulator ) );

View File

@ -98,6 +98,7 @@ static XrmOption xrmOptions[] = {
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL },
{ xrm_Boolean, "ssh-set-title", { .num = &config.ssh_set_title }, NULL },
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL },
/* Key bindings */
{ xrm_String, "key", { .str = &config.window_key }, NULL },
{ xrm_String, "rkey", { .str = &config.run_key }, NULL },