mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Add option to dump xresources entries.
This commit is contained in:
parent
8ea7a7b5ab
commit
87958d4cad
5 changed files with 56 additions and 2 deletions
|
@ -13,7 +13,8 @@ SYNOPSIS
|
|||
[ -bg *color* ] [ -hlfg *color* ] [ -hlbg *color* ] [ -key *combo* ] [ -dkey *comdo* ] [ -rkey *comdo* ]
|
||||
[ -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 ]
|
||||
[ -ssh-set-title *true|false* ] [ -now ] [ -rnow ] [ -snow ] [ -version ] [ -help] [ -dump ]
|
||||
[ -dump-xresources ]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
@ -204,6 +205,10 @@ OPTIONS
|
|||
|
||||
Dump the current active configuration to the command-line.
|
||||
|
||||
`-dump-xresources`
|
||||
|
||||
Dump the current active configuration in xresources format to the command-line.
|
||||
|
||||
`-ssh-set-title` *true|false*
|
||||
|
||||
SSH dialogs tries to set 'ssh hostname' of the spawned terminal.
|
||||
|
|
|
@ -8,7 +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 ]
|
||||
[ \-ssh\-set\-title \fItrue|false\fP ] [ \-now ] [ \-rnow ] [ \-snow ] [ \-version ] [ \-help] [ \-dump ]
|
||||
[ \-dump\-xresources ]
|
||||
.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.
|
||||
|
@ -248,6 +249,10 @@ Run rofi in dmenu mode. Allowing it to be used for user interaction in scripts.
|
|||
.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.
|
||||
.PP
|
||||
\fB\fC\-ssh\-set\-title\fR \fItrue|false\fP
|
||||
.IP
|
||||
SSH dialogs tries to set 'ssh hostname' of the spawned terminal.
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef __XRMOPTIONS_H__
|
||||
#define __XRMOPTIONS_H__
|
||||
|
||||
void parse_xresource_options ( Display *display );
|
||||
|
||||
void parse_xresource_free ( void );
|
||||
|
||||
void xresource_dump ( void );
|
||||
#endif
|
||||
|
|
|
@ -1952,6 +1952,12 @@ static void parse_cmd_options ( int argc, char ** argv )
|
|||
config_print ();
|
||||
exit ( EXIT_SUCCESS );
|
||||
}
|
||||
|
||||
if ( find_arg ( argc, argv, "-dump-xresources" ) >= 0 )
|
||||
{
|
||||
xresource_dump ();
|
||||
exit ( EXIT_SUCCESS );
|
||||
}
|
||||
}
|
||||
|
||||
static void cleanup ()
|
||||
|
|
|
@ -182,3 +182,38 @@ void parse_xresource_free ( void )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void xresource_dump ( void )
|
||||
{
|
||||
const char * namePrefix = "rofi";
|
||||
const char * classPrefix = "rofi";
|
||||
unsigned int entries = sizeof ( xrmOptions ) / sizeof ( *xrmOptions );
|
||||
for ( unsigned int i = 0; i < entries; ++i )
|
||||
{
|
||||
// Skip duplicates.
|
||||
if ( ( i + 1 ) < entries )
|
||||
{
|
||||
if ( xrmOptions[i].str == xrmOptions[i + 1].str )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
printf ( "%s.%s: ", namePrefix, xrmOptions[i].name );
|
||||
switch ( xrmOptions[i].type )
|
||||
{
|
||||
case xrm_Number:
|
||||
printf ( "%i", *xrmOptions[i].num );
|
||||
break;
|
||||
case xrm_String:
|
||||
printf ( "%s", *xrmOptions[i].str );
|
||||
break;
|
||||
case xrm_Boolean:
|
||||
printf ( "%s", ( ( *xrmOptions[i].num ) == TRUE ) ? "true" : "false" );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
printf ( "\n" );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue