mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Use XRandr to get monitor layout instead of xinerama.
* You can now specify monitor by name, or primary status.
This commit is contained in:
parent
26d1e64b22
commit
df7468b491
12 changed files with 345 additions and 236 deletions
|
@ -112,7 +112,7 @@ Settings config = {
|
||||||
.tokenize = TRUE,
|
.tokenize = TRUE,
|
||||||
.regex = FALSE,
|
.regex = FALSE,
|
||||||
/** Monitor */
|
/** Monitor */
|
||||||
.monitor = -1,
|
.monitor = "-1",
|
||||||
/** set line margin */
|
/** set line margin */
|
||||||
.line_margin = 2,
|
.line_margin = 2,
|
||||||
/** Set filter */
|
/** Set filter */
|
||||||
|
|
|
@ -86,7 +86,7 @@ dnl ---------------------------------------------------------------------
|
||||||
dnl PKG_CONFIG based dependencies
|
dnl PKG_CONFIG based dependencies
|
||||||
dnl ---------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------
|
||||||
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40])
|
PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40])
|
||||||
GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-xinerama xcb-icccm xcb-xrm])
|
GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-icccm xcb-xrm xcb-randr])
|
||||||
PKG_CHECK_MODULES([pango], [pango pangocairo])
|
PKG_CHECK_MODULES([pango], [pango pangocairo])
|
||||||
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
|
PKG_CHECK_MODULES([cairo], [cairo cairo-xcb])
|
||||||
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0])
|
PKG_CHECK_MODULES([libsn], [libstartup-notification-1.0])
|
||||||
|
|
|
@ -370,10 +370,16 @@ Default: *5000*
|
||||||
When one entry is left, automatically select it.
|
When one entry is left, automatically select it.
|
||||||
|
|
||||||
`-m` *num*
|
`-m` *num*
|
||||||
|
|
||||||
|
`-m` *name*
|
||||||
|
|
||||||
`-monitor` *num*
|
`-monitor` *num*
|
||||||
|
|
||||||
|
`-monitor` *name*
|
||||||
|
|
||||||
Select (Xinerama) monitor to display **rofi** on.
|
Select (Xinerama) monitor to display **rofi** on.
|
||||||
Negative numbers are handled differently:
|
As input it accepts: *primary* (if primary output is set), the *xrandr* output name or integer number (in order of
|
||||||
|
detection). Negative numbers are handled differently:
|
||||||
|
|
||||||
* **-1**: the currently focused monitor.
|
* **-1**: the currently focused monitor.
|
||||||
* **-2**: the currently focused window (i.e. rofi will be displayed on top of the focused window).
|
* **-2**: the currently focused window (i.e. rofi will be displayed on top of the focused window).
|
||||||
|
@ -384,6 +390,8 @@ Negative numbers are handled differently:
|
||||||
|
|
||||||
Default: *-1*
|
Default: *-1*
|
||||||
|
|
||||||
|
See `rofi -h` output for the detected monitors, their position and size.
|
||||||
|
|
||||||
### PATTERN setting
|
### PATTERN setting
|
||||||
|
|
||||||
`-terminal`
|
`-terminal`
|
||||||
|
|
18
doc/rofi.1
18
doc/rofi.1
|
@ -1,7 +1,7 @@
|
||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "ROFI\-MANPAGE" "" "July 2016" "" ""
|
.TH "ROFI\-MANPAGE" "" "2016-08-18" "" ""
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBrofi\fR \- A window switcher, run launcher, ssh dialog and dmenu replacement
|
\fBrofi\fR \- A window switcher, run launcher, ssh dialog and dmenu replacement
|
||||||
|
@ -621,10 +621,19 @@ Default: \fI5000\fR
|
||||||
When one entry is left, automatically select it\.
|
When one entry is left, automatically select it\.
|
||||||
.
|
.
|
||||||
.P
|
.P
|
||||||
\fB\-m\fR \fInum\fR \fB\-monitor\fR \fInum\fR
|
\fB\-m\fR \fInum\fR
|
||||||
.
|
.
|
||||||
.P
|
.P
|
||||||
Select (Xinerama) monitor to display \fBrofi\fR on\. Negative numbers are handled differently:
|
\fB\-m\fR \fIname\fR
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
\fB\-monitor\fR \fInum\fR
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
\fB\-monitor\fR \fIname\fR
|
||||||
|
.
|
||||||
|
.P
|
||||||
|
Select (Xinerama) monitor to display \fBrofi\fR on\. As input it accepts: \fIprimary\fR (if primary output is set), the \fIxrandr\fR output name or integer number (in order of detection)\. Negative numbers are handled differently:
|
||||||
.
|
.
|
||||||
.IP "\(bu" 4
|
.IP "\(bu" 4
|
||||||
\fB\-1\fR: the currently focused monitor\.
|
\fB\-1\fR: the currently focused monitor\.
|
||||||
|
@ -646,6 +655,9 @@ Default: \fI\-1\fR
|
||||||
.
|
.
|
||||||
.IP "" 0
|
.IP "" 0
|
||||||
.
|
.
|
||||||
|
.P
|
||||||
|
See \fBrofi \-h\fR output for the detected monitors, their position and size\.
|
||||||
|
.
|
||||||
.SS "PATTERN setting"
|
.SS "PATTERN setting"
|
||||||
\fB\-terminal\fR
|
\fB\-terminal\fR
|
||||||
.
|
.
|
||||||
|
|
|
@ -109,7 +109,7 @@ typedef struct
|
||||||
unsigned int tokenize;
|
unsigned int tokenize;
|
||||||
unsigned int regex;
|
unsigned int regex;
|
||||||
/** Monitors */
|
/** Monitors */
|
||||||
int monitor;
|
char *monitor;
|
||||||
/** Line margin */
|
/** Line margin */
|
||||||
unsigned int line_margin;
|
unsigned int line_margin;
|
||||||
/** filter */
|
/** filter */
|
||||||
|
|
|
@ -45,18 +45,21 @@ enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS };
|
||||||
|
|
||||||
extern const char *netatom_names[];
|
extern const char *netatom_names[];
|
||||||
extern xcb_atom_t netatoms[NUM_NETATOMS];
|
extern xcb_atom_t netatoms[NUM_NETATOMS];
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int x, y, w, h;
|
|
||||||
int l, r, t, b;
|
|
||||||
} workarea;
|
|
||||||
|
|
||||||
void monitor_active ( workarea *mon );
|
typedef struct _workarea
|
||||||
|
{
|
||||||
|
int monitor_id;
|
||||||
|
int primary;
|
||||||
|
int x, y, w, h;
|
||||||
|
char *name;
|
||||||
|
struct _workarea *next;
|
||||||
|
} workarea;
|
||||||
|
int monitor_active ( workarea *mon );
|
||||||
|
|
||||||
// find the dimensions of the monitor displaying point x,y
|
// find the dimensions of the monitor displaying point x,y
|
||||||
void monitor_dimensions ( int x, int y, workarea *mon );
|
void monitor_dimensions ( int x, int y, workarea *mon );
|
||||||
// Find the dimensions of the monitor specified by user.
|
// Find the dimensions of the monitor specified by user.
|
||||||
int monitor_get_dimension ( int monitor, workarea *mon );
|
int monitor_get_dimension ( int monitor_id, workarea *mon );
|
||||||
int monitor_get_smallest_size ( void );
|
int monitor_get_smallest_size ( void );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -145,5 +148,12 @@ void x11_helper_set_cairo_rgba ( cairo_t *d, Color col );
|
||||||
* @returns a cairo surface with the background image of the desktop.
|
* @returns a cairo surface with the background image of the desktop.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t * x11_helper_get_bg_surface ( void );
|
cairo_surface_t * x11_helper_get_bg_surface ( void );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an internal represenation of the available monitors.
|
||||||
|
* Used for positioning rofi.
|
||||||
|
*/
|
||||||
|
void x11_build_monitor_layout ( void );
|
||||||
|
void x11_dump_monitor_layout ( void );
|
||||||
/*@}*/
|
/*@}*/
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure to keep xcb stuff around.
|
* Structure to keep xcb stuff around.
|
||||||
*/
|
*/
|
||||||
|
@ -18,7 +19,7 @@ struct _xcb_stuff
|
||||||
int screen_nbr;
|
int screen_nbr;
|
||||||
SnDisplay *sndisplay;
|
SnDisplay *sndisplay;
|
||||||
SnLauncheeContext *sncontext;
|
SnLauncheeContext *sncontext;
|
||||||
gboolean has_xinerama;
|
struct _workarea *monitors;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -476,16 +476,14 @@ int config_sanity_check ( void )
|
||||||
|
|
||||||
// Check size
|
// Check size
|
||||||
{
|
{
|
||||||
int ssize = monitor_get_smallest_size ( );
|
int ssize = monitor_get_smallest_size ( );
|
||||||
if ( config.monitor >= 0 ) {
|
workarea mon;
|
||||||
workarea mon;
|
if ( monitor_active ( &mon ) ) {
|
||||||
if ( monitor_get_dimension ( config.monitor, &mon ) ) {
|
ssize = MIN ( mon.w, mon.h );
|
||||||
ssize = MIN ( mon.w, mon.h );
|
}
|
||||||
}
|
else{
|
||||||
else{
|
g_string_append_printf ( msg, "\t<b>config.monitor</b>=%s Could not find monitor.\n", config.monitor );
|
||||||
g_string_append_printf ( msg, "\t<b>config.monitor</b>=%d Could not find monitor.\n", config.monitor );
|
ssize = 0;
|
||||||
ssize = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Have todo an estimate here.
|
// Have todo an estimate here.
|
||||||
if ( ( 2 * ( config.padding + config.menu_bw ) ) > ( 0.9 * ssize ) ) {
|
if ( ( 2 * ( config.padding + config.menu_bw ) ) > ( 0.9 * ssize ) ) {
|
||||||
|
@ -511,7 +509,7 @@ int config_sanity_check ( void )
|
||||||
pango_font_description_free ( pfd );
|
pango_font_description_free ( pfd );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( config.monitor == -3 ) {
|
if ( g_strcmp0 ( config.monitor, "-3" ) == 0 ) {
|
||||||
// On -3, set to location 1.
|
// On -3, set to location 1.
|
||||||
config.location = 1;
|
config.location = 1;
|
||||||
config.fullscreen = 0;
|
config.fullscreen = 0;
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_aux.h>
|
#include <xcb/xcb_aux.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
#include <xcb/xinerama.h>
|
|
||||||
#include <xcb/xkb.h>
|
#include <xcb/xkb.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <xkbcommon/xkbcommon-compose.h>
|
#include <xkbcommon/xkbcommon-compose.h>
|
||||||
|
@ -261,6 +260,7 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
|
||||||
printf ( "Global options:\n" );
|
printf ( "Global options:\n" );
|
||||||
print_options ();
|
print_options ();
|
||||||
printf ( "\n" );
|
printf ( "\n" );
|
||||||
|
x11_dump_monitor_layout ();
|
||||||
printf ( "For more information see: man rofi\n" );
|
printf ( "For more information see: man rofi\n" );
|
||||||
#ifdef GIT_VERSION
|
#ifdef GIT_VERSION
|
||||||
printf ( "Version: "GIT_VERSION "\n" );
|
printf ( "Version: "GIT_VERSION "\n" );
|
||||||
|
@ -268,6 +268,7 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
|
||||||
printf ( "Version: "VERSION "\n" );
|
printf ( "Version: "VERSION "\n" );
|
||||||
#endif
|
#endif
|
||||||
printf ( "Bugreports: "PACKAGE_BUGREPORT "\n" );
|
printf ( "Bugreports: "PACKAGE_BUGREPORT "\n" );
|
||||||
|
printf ( "Support: #rofi @ freenode.net\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -663,6 +664,8 @@ int main ( int argc, char *argv[] )
|
||||||
|
|
||||||
xcb->screen = xcb_aux_get_screen ( xcb->connection, xcb->screen_nbr );
|
xcb->screen = xcb_aux_get_screen ( xcb->connection, xcb->screen_nbr );
|
||||||
|
|
||||||
|
x11_build_monitor_layout ();
|
||||||
|
|
||||||
xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms ( xcb->connection, &xcb->ewmh );
|
xcb_intern_atom_cookie_t *ac = xcb_ewmh_init_atoms ( xcb->connection, &xcb->ewmh );
|
||||||
xcb_generic_error_t *errors = NULL;
|
xcb_generic_error_t *errors = NULL;
|
||||||
xcb_ewmh_init_atoms_replies ( &xcb->ewmh, ac, &errors );
|
xcb_ewmh_init_atoms_replies ( &xcb->ewmh, ac, &errors );
|
||||||
|
@ -755,16 +758,6 @@ int main ( int argc, char *argv[] )
|
||||||
fprintf ( stderr, "Connection has error\n" );
|
fprintf ( stderr, "Connection has error\n" );
|
||||||
exit ( EXIT_FAILURE );
|
exit ( EXIT_FAILURE );
|
||||||
}
|
}
|
||||||
|
|
||||||
const xcb_query_extension_reply_t *er = xcb_get_extension_data ( xcb->connection, &xcb_xinerama_id );
|
|
||||||
if ( er ) {
|
|
||||||
if ( er->present ) {
|
|
||||||
xcb_xinerama_is_active_cookie_t is_active_req = xcb_xinerama_is_active ( xcb->connection );
|
|
||||||
xcb_xinerama_is_active_reply_t *is_active = xcb_xinerama_is_active_reply ( xcb->connection, is_active_req, NULL );
|
|
||||||
xcb->has_xinerama = is_active->state;
|
|
||||||
free ( is_active );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
main_loop = g_main_loop_new ( NULL, FALSE );
|
main_loop = g_main_loop_new ( NULL, FALSE );
|
||||||
|
|
||||||
TICK_N ( "Setup mainloop" );
|
TICK_N ( "Setup mainloop" );
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t
|
||||||
}
|
}
|
||||||
// Insert string move cursor.
|
// Insert string move cursor.
|
||||||
textbox_insert ( state->text, state->text->cursor, text, dl );
|
textbox_insert ( state->text, state->text->cursor, text, dl );
|
||||||
textbox_cursor ( state->text, state->text->cursor + g_utf8_strlen(text, -1) );
|
textbox_cursor ( state->text, state->text->cursor + g_utf8_strlen ( text, -1 ) );
|
||||||
// Force a redraw and refiltering of the text.
|
// Force a redraw and refiltering of the text.
|
||||||
state->update = TRUE;
|
state->update = TRUE;
|
||||||
state->refilter = TRUE;
|
state->refilter = TRUE;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include <cairo-xcb.h>
|
#include <cairo-xcb.h>
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xinerama.h>
|
#include <xcb/randr.h>
|
||||||
#include "xcb-internal.h"
|
#include "xcb-internal.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -54,12 +54,12 @@
|
||||||
#include "xkb-internal.h"
|
#include "xkb-internal.h"
|
||||||
|
|
||||||
struct _xcb_stuff xcb_int = {
|
struct _xcb_stuff xcb_int = {
|
||||||
.connection = NULL,
|
.connection = NULL,
|
||||||
.screen = NULL,
|
.screen = NULL,
|
||||||
.screen_nbr = -1,
|
.screen_nbr = -1,
|
||||||
.sndisplay = NULL,
|
.sndisplay = NULL,
|
||||||
.sncontext = NULL,
|
.sncontext = NULL,
|
||||||
.has_xinerama = FALSE,
|
.monitors = NULL
|
||||||
};
|
};
|
||||||
xcb_stuff *xcb = &xcb_int;
|
xcb_stuff *xcb = &xcb_int;
|
||||||
|
|
||||||
|
@ -154,102 +154,160 @@ void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms,
|
||||||
xcb_change_property ( xcb->connection, XCB_PROP_MODE_REPLACE, w, prop, XCB_ATOM_ATOM, 32, count, atoms );
|
xcb_change_property ( xcb->connection, XCB_PROP_MODE_REPLACE, w, prop, XCB_ATOM_ATOM, 32, count, atoms );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****
|
||||||
|
* Code used to get monitor layout.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free monitor structure.
|
||||||
|
*/
|
||||||
|
static void x11_monitor_free ( workarea *m )
|
||||||
|
{
|
||||||
|
g_free ( m->name );
|
||||||
|
g_free ( m );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void x11_monitors_free ( void )
|
||||||
|
{
|
||||||
|
while ( xcb->monitors != NULL ) {
|
||||||
|
workarea *m = xcb->monitors;
|
||||||
|
xcb->monitors = m->next;
|
||||||
|
x11_monitor_free ( m );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create monitor based on output id
|
||||||
|
*/
|
||||||
|
static workarea * x11_get_monitor_from_output ( xcb_randr_output_t out )
|
||||||
|
{
|
||||||
|
xcb_randr_get_output_info_reply_t *op_reply;
|
||||||
|
xcb_randr_get_crtc_info_reply_t *crtc_reply;
|
||||||
|
xcb_randr_get_output_info_cookie_t it = xcb_randr_get_output_info ( xcb->connection, out, XCB_CURRENT_TIME );
|
||||||
|
op_reply = xcb_randr_get_output_info_reply ( xcb->connection, it, NULL );
|
||||||
|
if ( op_reply->crtc == XCB_NONE ) {
|
||||||
|
free ( op_reply );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
xcb_randr_get_crtc_info_cookie_t ct = xcb_randr_get_crtc_info ( xcb->connection, op_reply->crtc, XCB_CURRENT_TIME );
|
||||||
|
crtc_reply = xcb_randr_get_crtc_info_reply ( xcb->connection, ct, NULL );
|
||||||
|
if ( !crtc_reply ) {
|
||||||
|
free ( op_reply );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
workarea *retv = g_malloc0 ( sizeof ( workarea ) );
|
||||||
|
retv->x = crtc_reply->x;
|
||||||
|
retv->y = crtc_reply->y;
|
||||||
|
retv->w = crtc_reply->width;
|
||||||
|
retv->h = crtc_reply->height;
|
||||||
|
|
||||||
|
char *tname = (char *) xcb_randr_get_output_info_name ( op_reply );
|
||||||
|
int tname_len = xcb_randr_get_output_info_name_length ( op_reply );
|
||||||
|
|
||||||
|
retv->name = g_malloc0 ( ( tname_len + 1 ) * sizeof ( char ) );
|
||||||
|
memcpy ( retv->name, tname, tname_len );
|
||||||
|
|
||||||
|
free ( crtc_reply );
|
||||||
|
free ( op_reply );
|
||||||
|
return retv;
|
||||||
|
}
|
||||||
|
|
||||||
|
void x11_build_monitor_layout ()
|
||||||
|
{
|
||||||
|
if ( xcb->monitors ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xcb_randr_get_screen_resources_current_reply_t *res_reply;
|
||||||
|
xcb_randr_get_screen_resources_current_cookie_t src;
|
||||||
|
src = xcb_randr_get_screen_resources_current ( xcb->connection, xcb->screen->root );
|
||||||
|
res_reply = xcb_randr_get_screen_resources_current_reply ( xcb->connection, src, NULL );
|
||||||
|
if ( !res_reply ) {
|
||||||
|
return; //just report error
|
||||||
|
}
|
||||||
|
int mon_num = xcb_randr_get_screen_resources_current_outputs_length ( res_reply );
|
||||||
|
xcb_randr_output_t *ops = xcb_randr_get_screen_resources_current_outputs ( res_reply );
|
||||||
|
|
||||||
|
// Get primary.
|
||||||
|
xcb_randr_get_output_primary_cookie_t pc = xcb_randr_get_output_primary ( xcb->connection, xcb->screen->root );
|
||||||
|
xcb_randr_get_output_primary_reply_t *pc_rep = xcb_randr_get_output_primary_reply ( xcb->connection, pc, NULL );
|
||||||
|
|
||||||
|
for ( int i = mon_num - 1; i >= 0; i-- ) {
|
||||||
|
workarea *w = x11_get_monitor_from_output ( ops[i] );
|
||||||
|
if ( w ) {
|
||||||
|
w->next = xcb->monitors;
|
||||||
|
xcb->monitors = w;
|
||||||
|
if ( pc_rep && pc_rep->output == ops[i] ) {
|
||||||
|
w->primary = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Number monitor
|
||||||
|
int index = 0;
|
||||||
|
for ( workarea *iter = xcb->monitors; iter; iter = iter->next ) {
|
||||||
|
iter->monitor_id = index++;
|
||||||
|
}
|
||||||
|
// If exists, free primary output reply.
|
||||||
|
if ( pc_rep ) {
|
||||||
|
free ( pc_rep );
|
||||||
|
}
|
||||||
|
free ( res_reply );
|
||||||
|
}
|
||||||
|
|
||||||
|
void x11_dump_monitor_layout ( void )
|
||||||
|
{
|
||||||
|
int is_term = isatty ( fileno ( stdout ) );
|
||||||
|
printf ( "Monitor layout:\n" );
|
||||||
|
for ( workarea *iter = xcb->monitors; iter; iter = iter->next ) {
|
||||||
|
printf ( "%s ID%s: %d", ( is_term ) ? color_bold : "", is_term ? color_reset : "", iter->monitor_id );
|
||||||
|
if ( iter->primary ) {
|
||||||
|
printf ( " (primary)" );
|
||||||
|
}
|
||||||
|
printf ( "\n" );
|
||||||
|
printf ( "%s name%s: %s\n", ( is_term ) ? color_bold : "", is_term ? color_reset : "", iter->name );
|
||||||
|
printf ( "%s position%s: %d,%d\n", ( is_term ) ? color_bold : "", is_term ? color_reset : "", iter->x, iter->y );
|
||||||
|
printf ( "%s size%s: %d,%d\n", ( is_term ) ? color_bold : "", is_term ? color_reset : "", iter->w, iter->h );
|
||||||
|
printf ( "\n" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int monitor_get_smallest_size ( void )
|
int monitor_get_smallest_size ( void )
|
||||||
{
|
{
|
||||||
xcb_generic_error_t *error;
|
int size = MIN ( xcb->screen->width_in_pixels, xcb->screen->height_in_pixels );
|
||||||
int size = MIN ( xcb->screen->width_in_pixels, xcb->screen->height_in_pixels );
|
for ( workarea *iter = xcb->monitors; iter; iter = iter->next ) {
|
||||||
|
size = MIN ( iter->w, size );
|
||||||
if ( !xcb->has_xinerama ) {
|
size = MIN ( iter->h, size );
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_xinerama_query_screens_cookie_t cookie_screen;
|
|
||||||
|
|
||||||
cookie_screen = xcb_xinerama_query_screens ( xcb->connection );
|
|
||||||
xcb_xinerama_query_screens_reply_t *query_screens;
|
|
||||||
query_screens = xcb_xinerama_query_screens_reply ( xcb->connection, cookie_screen, &error );
|
|
||||||
if ( error ) {
|
|
||||||
fprintf ( stderr, "Error getting screen info\n" );
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info ( query_screens );
|
|
||||||
int len = xcb_xinerama_query_screens_screen_info_length ( query_screens );
|
|
||||||
for ( int i = 0; i < len; i++ ) {
|
|
||||||
xcb_xinerama_screen_info_t *info = &screens[i];
|
|
||||||
size = MIN ( info->width, size );
|
|
||||||
size = MIN ( info->height, size );
|
|
||||||
}
|
|
||||||
free ( query_screens );
|
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
int monitor_get_dimension ( int monitor, workarea *mon )
|
int monitor_get_dimension ( int monitor_id, workarea *mon )
|
||||||
{
|
{
|
||||||
xcb_generic_error_t *error = NULL;
|
|
||||||
memset ( mon, 0, sizeof ( workarea ) );
|
memset ( mon, 0, sizeof ( workarea ) );
|
||||||
mon->w = xcb->screen->width_in_pixels;
|
mon->w = xcb->screen->width_in_pixels;
|
||||||
mon->h = xcb->screen->height_in_pixels;
|
mon->h = xcb->screen->height_in_pixels;
|
||||||
|
|
||||||
if ( !xcb->has_xinerama ) {
|
workarea *iter = NULL;
|
||||||
return FALSE;
|
for ( iter = xcb->monitors; iter; iter = iter->next ) {
|
||||||
|
if ( iter->monitor_id == monitor_id ) {
|
||||||
|
*mon = *iter;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_xinerama_query_screens_cookie_t cookie_screen;
|
|
||||||
cookie_screen = xcb_xinerama_query_screens ( xcb->connection );
|
|
||||||
xcb_xinerama_query_screens_reply_t *query_screens;
|
|
||||||
query_screens = xcb_xinerama_query_screens_reply ( xcb->connection, cookie_screen, &error );
|
|
||||||
if ( error ) {
|
|
||||||
fprintf ( stderr, "Error getting screen info\n" );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info ( query_screens );
|
|
||||||
int len = xcb_xinerama_query_screens_screen_info_length ( query_screens );
|
|
||||||
if ( monitor < len ) {
|
|
||||||
xcb_xinerama_screen_info_t *info = &screens[monitor];
|
|
||||||
mon->w = info->width;
|
|
||||||
mon->h = info->height;
|
|
||||||
mon->x = info->x_org;
|
|
||||||
mon->y = info->y_org;
|
|
||||||
free ( query_screens );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
free ( query_screens );
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// find the dimensions of the monitor displaying point x,y
|
// find the dimensions of the monitor displaying point x,y
|
||||||
void monitor_dimensions ( int x, int y, workarea *mon )
|
void monitor_dimensions ( int x, int y, workarea *mon )
|
||||||
{
|
{
|
||||||
xcb_generic_error_t *error = NULL;
|
|
||||||
memset ( mon, 0, sizeof ( workarea ) );
|
memset ( mon, 0, sizeof ( workarea ) );
|
||||||
mon->w = xcb->screen->width_in_pixels;
|
mon->w = xcb->screen->width_in_pixels;
|
||||||
mon->h = xcb->screen->height_in_pixels;
|
mon->h = xcb->screen->height_in_pixels;
|
||||||
|
|
||||||
if ( !xcb->has_xinerama ) {
|
for ( workarea *iter = xcb->monitors; iter; iter = iter->next ) {
|
||||||
return;
|
if ( INTERSECT ( x, y, 1, 1, iter->x, iter->y, iter->w, iter->h ) ) {
|
||||||
}
|
*mon = *iter;
|
||||||
|
|
||||||
xcb_xinerama_query_screens_cookie_t cookie_screen;
|
|
||||||
cookie_screen = xcb_xinerama_query_screens ( xcb->connection );
|
|
||||||
xcb_xinerama_query_screens_reply_t *query_screens;
|
|
||||||
query_screens = xcb_xinerama_query_screens_reply ( xcb->connection, cookie_screen, &error );
|
|
||||||
if ( error ) {
|
|
||||||
fprintf ( stderr, "Error getting screen info\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
xcb_xinerama_screen_info_t *screens = xcb_xinerama_query_screens_screen_info ( query_screens );
|
|
||||||
int len = xcb_xinerama_query_screens_screen_info_length ( query_screens );
|
|
||||||
for ( int i = 0; i < len; i++ ) {
|
|
||||||
xcb_xinerama_screen_info_t *info = &screens[i];
|
|
||||||
if ( INTERSECT ( x, y, 1, 1, info->x_org, info->y_org, info->width, info->height ) ) {
|
|
||||||
mon->w = info->width;
|
|
||||||
mon->h = info->height;
|
|
||||||
mon->x = info->x_org;
|
|
||||||
mon->y = info->y_org;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free ( query_screens );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -278,85 +336,113 @@ static int pointer_get ( xcb_window_t root, int *x, int *y )
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine which monitor holds the active window, or failing that the mouse pointer
|
// determine which monitor holds the active window, or failing that the mouse pointer
|
||||||
void monitor_active ( workarea *mon )
|
int monitor_active ( workarea *mon )
|
||||||
{
|
{
|
||||||
xcb_window_t root = xcb->screen->root;
|
xcb_window_t root = xcb->screen->root;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if ( config.monitor >= 0 ) {
|
if ( config.monitor != NULL ) {
|
||||||
if ( monitor_get_dimension ( config.monitor, mon ) ) {
|
for ( workarea *iter = xcb->monitors; iter; iter = iter->next ) {
|
||||||
return;
|
if ( g_strcmp0 ( config.monitor, iter->name ) == 0 ) {
|
||||||
}
|
*mon = *iter;
|
||||||
fprintf ( stderr, "Failed to find selected monitor.\n" );
|
return TRUE;
|
||||||
}
|
|
||||||
if ( config.monitor == -3 ) {
|
|
||||||
if ( pointer_get ( root, &x, &y ) ) {
|
|
||||||
monitor_dimensions ( x, y, mon );
|
|
||||||
mon->x = x;
|
|
||||||
mon->y = y;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Get the current desktop.
|
|
||||||
unsigned int current_desktop = 0;
|
|
||||||
if ( config.monitor == -1 && xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh,
|
|
||||||
xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr ),
|
|
||||||
¤t_desktop, NULL ) ) {
|
|
||||||
xcb_get_property_cookie_t c = xcb_ewmh_get_desktop_viewport ( &xcb->ewmh, xcb->screen_nbr );
|
|
||||||
xcb_ewmh_get_desktop_viewport_reply_t vp;
|
|
||||||
if ( xcb_ewmh_get_desktop_viewport_reply ( &xcb->ewmh, c, &vp, NULL ) ) {
|
|
||||||
if ( current_desktop < vp.desktop_viewport_len ) {
|
|
||||||
monitor_dimensions ( vp.desktop_viewport[current_desktop].x,
|
|
||||||
vp.desktop_viewport[current_desktop].y, mon );
|
|
||||||
xcb_ewmh_get_desktop_viewport_reply_wipe ( &vp );
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
xcb_ewmh_get_desktop_viewport_reply_wipe ( &vp );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Grab primary.
|
||||||
xcb_window_t active_window;
|
if ( g_strcmp0 ( config.monitor, "primary" ) == 0 ) {
|
||||||
if ( xcb_ewmh_get_active_window_reply ( &xcb->ewmh,
|
for ( workarea *iter = xcb->monitors; iter; iter = iter->next ) {
|
||||||
xcb_ewmh_get_active_window ( &xcb->ewmh, xcb->screen_nbr ), &active_window, NULL ) ) {
|
if ( iter->primary ) {
|
||||||
// get geometry.
|
*mon = *iter;
|
||||||
xcb_get_geometry_cookie_t c = xcb_get_geometry ( xcb->connection, active_window );
|
return TRUE;
|
||||||
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb->connection, c, NULL );
|
}
|
||||||
if ( r ) {
|
}
|
||||||
xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates ( xcb->connection, active_window, root, r->x, r->y );
|
}
|
||||||
xcb_translate_coordinates_reply_t *t = xcb_translate_coordinates_reply ( xcb->connection, ct, NULL );
|
// IF fail, fall back to classic mode.
|
||||||
if ( t ) {
|
char *end = NULL;
|
||||||
if ( config.monitor == -2 ) {
|
gint64 mon_id = g_ascii_strtoll ( config.monitor, &end, 0 );
|
||||||
// place the menu above the window
|
if ( end != config.monitor ) {
|
||||||
// if some window is focused, place menu above window, else fall
|
if ( mon_id >= 0 ) {
|
||||||
// back to selected monitor.
|
if ( monitor_get_dimension ( mon_id, mon ) ) {
|
||||||
mon->x = t->dst_x - r->x;
|
return TRUE;
|
||||||
mon->y = t->dst_y - r->y;
|
}
|
||||||
mon->w = r->width;
|
fprintf ( stderr, "Failed to find selected monitor.\n" );
|
||||||
mon->h = r->height;
|
}
|
||||||
mon->t = r->border_width;
|
// At mouse position.
|
||||||
mon->b = r->border_width;
|
else if ( mon_id == -3 ) {
|
||||||
mon->l = r->border_width;
|
if ( pointer_get ( root, &x, &y ) ) {
|
||||||
mon->r = r->border_width;
|
monitor_dimensions ( x, y, mon );
|
||||||
free ( r );
|
mon->x = x;
|
||||||
free ( t );
|
mon->y = y;
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if ( config.monitor == -4 ) {
|
}
|
||||||
monitor_dimensions ( t->dst_x, t->dst_y, mon );
|
// Focused monitor
|
||||||
free ( r );
|
else if ( mon_id == -1 ) {
|
||||||
free ( t );
|
// Get the current desktop.
|
||||||
return;
|
unsigned int current_desktop = 0;
|
||||||
|
xcb_get_property_cookie_t gcdc;
|
||||||
|
gcdc = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr );
|
||||||
|
if ( xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, gcdc, ¤t_desktop, NULL ) ) {
|
||||||
|
xcb_get_property_cookie_t c = xcb_ewmh_get_desktop_viewport ( &xcb->ewmh, xcb->screen_nbr );
|
||||||
|
xcb_ewmh_get_desktop_viewport_reply_t vp;
|
||||||
|
if ( xcb_ewmh_get_desktop_viewport_reply ( &xcb->ewmh, c, &vp, NULL ) ) {
|
||||||
|
if ( current_desktop < vp.desktop_viewport_len ) {
|
||||||
|
monitor_dimensions ( vp.desktop_viewport[current_desktop].x,
|
||||||
|
vp.desktop_viewport[current_desktop].y, mon );
|
||||||
|
xcb_ewmh_get_desktop_viewport_reply_wipe ( &vp );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
xcb_ewmh_get_desktop_viewport_reply_wipe ( &vp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free ( r );
|
}
|
||||||
|
else if ( mon_id == -2 || mon_id == -4 ) {
|
||||||
|
xcb_window_t active_window;
|
||||||
|
xcb_get_property_cookie_t awc;
|
||||||
|
awc = xcb_ewmh_get_active_window ( &xcb->ewmh, xcb->screen_nbr );
|
||||||
|
if ( xcb_ewmh_get_active_window_reply ( &xcb->ewmh, awc, &active_window, NULL ) ) {
|
||||||
|
// get geometry.
|
||||||
|
xcb_get_geometry_cookie_t c = xcb_get_geometry ( xcb->connection, active_window );
|
||||||
|
xcb_get_geometry_reply_t *r = xcb_get_geometry_reply ( xcb->connection, c, NULL );
|
||||||
|
if ( r ) {
|
||||||
|
xcb_translate_coordinates_cookie_t ct = xcb_translate_coordinates ( xcb->connection, active_window, root, r->x, r->y );
|
||||||
|
xcb_translate_coordinates_reply_t *t = xcb_translate_coordinates_reply ( xcb->connection, ct, NULL );
|
||||||
|
if ( t ) {
|
||||||
|
if ( mon_id == -2 ) {
|
||||||
|
// place the menu above the window
|
||||||
|
// if some window is focused, place menu above window, else fall
|
||||||
|
// back to selected monitor.
|
||||||
|
mon->x = t->dst_x - r->x;
|
||||||
|
mon->y = t->dst_y - r->y;
|
||||||
|
mon->w = r->width;
|
||||||
|
mon->h = r->height;
|
||||||
|
free ( r );
|
||||||
|
free ( t );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else if ( mon_id == -4 ) {
|
||||||
|
monitor_dimensions ( t->dst_x, t->dst_y, mon );
|
||||||
|
free ( r );
|
||||||
|
free ( t );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free ( r );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Monitor that has mouse pointer.
|
||||||
|
else if ( mon_id == -5 ) {
|
||||||
|
if ( pointer_get ( root, &x, &y ) ) {
|
||||||
|
monitor_dimensions ( x, y, mon );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( pointer_get ( root, &x, &y ) ) {
|
// Fallback.
|
||||||
monitor_dimensions ( x, y, mon );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor_dimensions ( 0, 0, mon );
|
monitor_dimensions ( 0, 0, mon );
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
int take_pointer ( xcb_window_t w )
|
int take_pointer ( xcb_window_t w )
|
||||||
{
|
{
|
||||||
|
@ -794,6 +880,7 @@ void xcb_stuff_wipe ( xcb_stuff *xcb )
|
||||||
sn_display_unref ( xcb->sndisplay );
|
sn_display_unref ( xcb->sndisplay );
|
||||||
xcb->sndisplay = NULL;
|
xcb->sndisplay = NULL;
|
||||||
}
|
}
|
||||||
|
x11_monitors_free ();
|
||||||
xcb_disconnect ( xcb->connection );
|
xcb_disconnect ( xcb->connection );
|
||||||
xcb->connection = NULL;
|
xcb->connection = NULL;
|
||||||
xcb->screen = NULL;
|
xcb->screen = NULL;
|
||||||
|
|
|
@ -79,116 +79,116 @@ typedef struct
|
||||||
* Currently supports string, boolean and number (signed and unsigned).
|
* Currently supports string, boolean and number (signed and unsigned).
|
||||||
*/
|
*/
|
||||||
static XrmOption xrmOptions[] = {
|
static XrmOption xrmOptions[] = {
|
||||||
{ xrm_String, "switchers", { .str = &config.modi }, NULL,
|
{ xrm_String, "switchers", { .str = &config.modi }, NULL,
|
||||||
"", CONFIG_DEFAULT },
|
"", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "modi", { .str = &config.modi }, NULL,
|
{ xrm_String, "modi", { .str = &config.modi }, NULL,
|
||||||
"Enabled modi", CONFIG_DEFAULT },
|
"Enabled modi", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "opacity", { .num = &config.window_opacity }, NULL,
|
{ xrm_Number, "opacity", { .num = &config.window_opacity }, NULL,
|
||||||
"Window opacity", CONFIG_DEFAULT },
|
"Window opacity", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
|
{ xrm_SNumber, "width", { .snum = &config.menu_width }, NULL,
|
||||||
"Window width", CONFIG_DEFAULT },
|
"Window width", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
|
{ xrm_Number, "lines", { .num = &config.menu_lines }, NULL,
|
||||||
"Number of lines", CONFIG_DEFAULT },
|
"Number of lines", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
|
{ xrm_Number, "columns", { .num = &config.menu_columns }, NULL,
|
||||||
"Number of columns", CONFIG_DEFAULT },
|
"Number of columns", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
{ xrm_String, "font", { .str = &config.menu_font }, NULL,
|
||||||
"Font to use", CONFIG_DEFAULT },
|
"Font to use", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
|
{ xrm_String, "color-normal", { .str = &config.color_normal }, NULL,
|
||||||
"Color scheme for normal row", CONFIG_DEFAULT },
|
"Color scheme for normal row", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
|
{ xrm_String, "color-urgent", { .str = &config.color_urgent }, NULL,
|
||||||
"Color scheme for urgent row", CONFIG_DEFAULT },
|
"Color scheme for urgent row", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
|
{ xrm_String, "color-active", { .str = &config.color_active }, NULL,
|
||||||
"Color scheme for active row", CONFIG_DEFAULT },
|
"Color scheme for active row", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
|
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
|
||||||
"Color scheme window", CONFIG_DEFAULT },
|
"Color scheme window", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
|
{ xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL,
|
||||||
"", CONFIG_DEFAULT },
|
"", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
|
{ xrm_Number, "bw", { .num = &config.menu_bw }, NULL,
|
||||||
"Border width", CONFIG_DEFAULT },
|
"Border width", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_Number, "location", { .num = &config.location }, NULL,
|
{ xrm_Number, "location", { .num = &config.location }, NULL,
|
||||||
"Location on screen", CONFIG_DEFAULT },
|
"Location on screen", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_Number, "padding", { .num = &config.padding }, NULL,
|
{ xrm_Number, "padding", { .num = &config.padding }, NULL,
|
||||||
"Padding", CONFIG_DEFAULT },
|
"Padding", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
|
{ xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL,
|
||||||
"Y-offset relative to location", CONFIG_DEFAULT },
|
"Y-offset relative to location", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
|
{ xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,
|
||||||
"X-offset relative to location", CONFIG_DEFAULT },
|
"X-offset relative to location", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
|
{ xrm_Boolean, "fixed-num-lines", { .num = &config.fixed_num_lines }, NULL,
|
||||||
"Always show number of lines", CONFIG_DEFAULT },
|
"Always show number of lines", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
|
{ xrm_String, "terminal", { .str = &config.terminal_emulator }, NULL,
|
||||||
"Terminal to use", CONFIG_DEFAULT },
|
"Terminal to use", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
|
{ xrm_String, "ssh-client", { .str = &config.ssh_client }, NULL,
|
||||||
"Ssh client to use", CONFIG_DEFAULT },
|
"Ssh client to use", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
|
{ xrm_String, "ssh-command", { .str = &config.ssh_command }, NULL,
|
||||||
"Ssh command to execute", CONFIG_DEFAULT },
|
"Ssh command to execute", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "run-command", { .str = &config.run_command }, NULL,
|
{ xrm_String, "run-command", { .str = &config.run_command }, NULL,
|
||||||
"Run command to execute", CONFIG_DEFAULT },
|
"Run command to execute", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
|
{ xrm_String, "run-list-command", { .str = &config.run_list_command }, NULL,
|
||||||
"Command to get extra run targets", CONFIG_DEFAULT },
|
"Command to get extra run targets", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
|
{ xrm_String, "run-shell-command", { .str = &config.run_shell_command }, NULL,
|
||||||
"Run command to execute that runs in shell", CONFIG_DEFAULT },
|
"Run command to execute that runs in shell", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
|
{ xrm_String, "window-command", { .str = &config.window_command }, NULL,
|
||||||
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
|
"Command executed on accep-entry-custom for window modus", CONFIG_DEFAULT },
|
||||||
|
|
||||||
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
|
{ xrm_Boolean, "disable-history", { .num = &config.disable_history }, NULL,
|
||||||
"Disable history in run/ssh", CONFIG_DEFAULT },
|
"Disable history in run/ssh", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
|
{ xrm_Boolean, "levenshtein-sort", { .num = &config.levenshtein_sort }, NULL,
|
||||||
"Use levenshtein sorting", CONFIG_DEFAULT },
|
"Use levenshtein sorting", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
|
{ xrm_Boolean, "case-sensitive", { .num = &config.case_sensitive }, NULL,
|
||||||
"Set case-sensitivity", CONFIG_DEFAULT },
|
"Set case-sensitivity", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
|
{ xrm_Boolean, "cycle", { .num = &config.cycle }, NULL,
|
||||||
"Cycle through the results list", CONFIG_DEFAULT },
|
"Cycle through the results list", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
|
{ xrm_Boolean, "sidebar-mode", { .num = &config.sidebar_mode }, NULL,
|
||||||
"Enable sidebar-mode", CONFIG_DEFAULT },
|
"Enable sidebar-mode", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
|
{ xrm_SNumber, "eh", { .snum = &config.element_height }, NULL,
|
||||||
"Row height (in chars)", CONFIG_DEFAULT },
|
"Row height (in chars)", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
|
{ xrm_Boolean, "auto-select", { .num = &config.auto_select }, NULL,
|
||||||
"Enable auto select mode", CONFIG_DEFAULT },
|
"Enable auto select mode", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
|
{ xrm_Boolean, "parse-hosts", { .num = &config.parse_hosts }, NULL,
|
||||||
"Parse hosts file for ssh mode", CONFIG_DEFAULT },
|
"Parse hosts file for ssh mode", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
|
{ xrm_Boolean, "parse-known-hosts", { .num = &config.parse_known_hosts }, NULL,
|
||||||
"Parse known_hosts file for ssh mode", CONFIG_DEFAULT },
|
"Parse known_hosts file for ssh mode", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
|
{ xrm_String, "combi-modi", { .str = &config.combi_modi }, NULL,
|
||||||
"Set the modi to combine in combi mode", CONFIG_DEFAULT },
|
"Set the modi to combine in combi mode", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "glob", { .num = &config.glob }, NULL,
|
{ xrm_Boolean, "glob", { .num = &config.glob }, NULL,
|
||||||
"Use glob matching", CONFIG_DEFAULT },
|
"Use glob matching", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "regex", { .num = &config.regex }, NULL,
|
{ xrm_Boolean, "regex", { .num = &config.regex }, NULL,
|
||||||
"Use regex matching", CONFIG_DEFAULT },
|
"Use regex matching", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
|
{ xrm_Boolean, "tokenize", { .num = &config.tokenize }, NULL,
|
||||||
"Tokenize input string", CONFIG_DEFAULT },
|
"Tokenize input string", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "monitor", { .snum = &config.monitor }, NULL,
|
{ xrm_String, "monitor", { .str = &config.monitor }, NULL,
|
||||||
"", CONFIG_DEFAULT },
|
"", CONFIG_DEFAULT },
|
||||||
/* Alias for dmenu compatibility. */
|
/* Alias for dmenu compatibility. */
|
||||||
{ xrm_SNumber, "m", { .snum = &config.monitor }, NULL,
|
{ xrm_String, "m", { .str = &config.monitor }, NULL,
|
||||||
"Monitor id to show on", CONFIG_DEFAULT },
|
"Monitor id to show on", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
|
{ xrm_Number, "line-margin", { .num = &config.line_margin }, NULL,
|
||||||
"Margin between rows", CONFIG_DEFAULT },
|
"Margin between rows", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
{ xrm_String, "filter", { .str = &config.filter }, NULL,
|
||||||
"Pre-set filter", CONFIG_DEFAULT },
|
"Pre-set filter", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
|
{ xrm_String, "separator-style", { .str = &config.separator_style }, NULL,
|
||||||
"Separator style (none, dash, solid)", CONFIG_DEFAULT },
|
"Separator style (none, dash, solid)", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
|
{ xrm_Boolean, "hide-scrollbar", { .num = &config.hide_scrollbar }, NULL,
|
||||||
"Hide scroll-bar", CONFIG_DEFAULT },
|
"Hide scroll-bar", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
{ xrm_Boolean, "fullscreen", { .num = &config.fullscreen }, NULL,
|
||||||
"Fullscreen", CONFIG_DEFAULT },
|
"Fullscreen", CONFIG_DEFAULT },
|
||||||
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
|
{ xrm_Boolean, "fake-transparency", { .num = &config.fake_transparency }, NULL,
|
||||||
"Fake transparency", CONFIG_DEFAULT },
|
"Fake transparency", CONFIG_DEFAULT },
|
||||||
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
|
{ xrm_SNumber, "dpi", { .snum = &config.dpi }, NULL,
|
||||||
"DPI", CONFIG_DEFAULT },
|
"DPI", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
{ xrm_Number, "threads", { .num = &config.threads }, NULL,
|
||||||
"Threads to use for string matching", CONFIG_DEFAULT },
|
"Threads to use for string matching", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
|
{ xrm_Number, "scrollbar-width", { .num = &config.scrollbar_width }, NULL,
|
||||||
"Scrollbar width", CONFIG_DEFAULT },
|
"Scrollbar width", CONFIG_DEFAULT },
|
||||||
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
{ xrm_Number, "scroll-method", { .num = &config.scroll_method }, NULL,
|
||||||
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
"Scrolling method. (0: Page, 1: Centered)", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
|
{ xrm_String, "fake-background", { .str = &config.fake_background }, NULL,
|
||||||
"Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT },
|
"Background to use for fake transparency. (background or screenshot)", CONFIG_DEFAULT },
|
||||||
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
{ xrm_String, "window-format", { .str = &config.window_format }, NULL,
|
||||||
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
|
"Window Format. w (desktop name), t (title), n (name), r (role), c (class)", CONFIG_DEFAULT },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue