mirror of
https://github.com/lbonn/rofi
synced 2024-11-23 04:13:03 +00:00
Indent code.
This commit is contained in:
parent
8ee37012d1
commit
3f4d58ef53
16 changed files with 89 additions and 91 deletions
|
@ -219,7 +219,6 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st
|
|||
*/
|
||||
int utf8_strncmp ( const char *a, const char* b, size_t n );
|
||||
|
||||
|
||||
/**
|
||||
* @param wd The work directory (optional)
|
||||
* @param cmd The cmd to execute
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define ROFI_MODE_PRIVATE_H
|
||||
|
||||
#include <gmodule.h>
|
||||
#define ABI_VERSION 0x00000003
|
||||
#define ABI_VERSION 0x00000003
|
||||
|
||||
/**
|
||||
* @param data Pointer to #Mode object.
|
||||
|
@ -113,9 +113,9 @@ struct rofi_mode
|
|||
/** Used for external plugins. */
|
||||
unsigned int abi_version;
|
||||
/** Name (max 31 char long) */
|
||||
char name[32];
|
||||
char cfg_name_key[128];
|
||||
char *display_name;
|
||||
char name[32];
|
||||
char cfg_name_key[128];
|
||||
char *display_name;
|
||||
|
||||
/**
|
||||
* A switcher normally consists of the following parts:
|
||||
|
@ -137,7 +137,7 @@ struct rofi_mode
|
|||
|
||||
_mode_preprocess_input _preprocess_input;
|
||||
|
||||
_mode_get_message _get_message;
|
||||
_mode_get_message _get_message;
|
||||
|
||||
/** Pointer to private data. */
|
||||
void *private_data;
|
||||
|
@ -152,6 +152,6 @@ struct rofi_mode
|
|||
void *ed;
|
||||
|
||||
/** Module */
|
||||
GModule *module;
|
||||
GModule *module;
|
||||
};
|
||||
#endif // ROFI_MODE_PRIVATE_H
|
||||
|
|
|
@ -46,16 +46,16 @@ typedef struct
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
TB_AUTOHEIGHT = 1 << 0,
|
||||
TB_AUTOWIDTH = 1 << 1,
|
||||
TB_LEFT = 1 << 16,
|
||||
TB_RIGHT = 1 << 17,
|
||||
TB_CENTER = 1 << 18,
|
||||
TB_EDITABLE = 1 << 19,
|
||||
TB_MARKUP = 1 << 20,
|
||||
TB_WRAP = 1 << 21,
|
||||
TB_PASSWORD = 1 << 22,
|
||||
TB_INDICATOR = 1 << 23,
|
||||
TB_AUTOHEIGHT = 1 << 0,
|
||||
TB_AUTOWIDTH = 1 << 1,
|
||||
TB_LEFT = 1 << 16,
|
||||
TB_RIGHT = 1 << 17,
|
||||
TB_CENTER = 1 << 18,
|
||||
TB_EDITABLE = 1 << 19,
|
||||
TB_MARKUP = 1 << 20,
|
||||
TB_WRAP = 1 << 21,
|
||||
TB_PASSWORD = 1 << 22,
|
||||
TB_INDICATOR = 1 << 23,
|
||||
} TextboxFlags;
|
||||
/**
|
||||
* Flags indicating current state of the textbox.
|
||||
|
|
|
@ -262,16 +262,16 @@ int x11_modifier_active ( unsigned int mask, int key );
|
|||
*/
|
||||
void x11_disable_decoration ( xcb_window_t window );
|
||||
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
/** Default EWHM compatible window manager */
|
||||
WM_EWHM = 0,
|
||||
WM_EWHM = 0,
|
||||
/** I3 Window manager */
|
||||
WM_I3 = 1,
|
||||
WM_I3 = 1,
|
||||
/** Awesome window manager */
|
||||
WM_AWESOME = 2,
|
||||
WM_AWESOME = 2,
|
||||
/** Openbox window manager */
|
||||
WM_OPENBOX = 4
|
||||
WM_OPENBOX = 4
|
||||
} WindowManager;
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,16 +69,18 @@ static void combi_mode_parse_switchers ( Mode *sw )
|
|||
sizeof ( CombiMode ) * ( pd->num_switchers + 1 ) );
|
||||
|
||||
Mode *mode = rofi_collect_modi_search ( token );
|
||||
if ( mode ){
|
||||
if ( mode ) {
|
||||
pd->switchers[pd->num_switchers].disable = FALSE;
|
||||
pd->switchers[pd->num_switchers++].mode = mode;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// If not build in, use custom switchers.
|
||||
Mode *sw = script_switcher_parse_setup ( token );
|
||||
if ( sw != NULL ) {
|
||||
pd->switchers[pd->num_switchers].disable = FALSE;
|
||||
pd->switchers[pd->num_switchers++].mode = sw;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Report error, don't continue.
|
||||
fprintf ( stderr, "Invalid script switcher: %s\n", token );
|
||||
token = NULL;
|
||||
|
|
|
@ -473,10 +473,10 @@ static int dmenu_token_match ( const Mode *sw, GRegex **tokens, unsigned int ind
|
|||
static char *dmenu_get_message ( const Mode *sw )
|
||||
{
|
||||
DmenuModePrivateData *pd = (DmenuModePrivateData *) mode_get_private_data ( sw );
|
||||
if ( pd->message ){
|
||||
if ( pd->message ) {
|
||||
return g_strdup ( pd->message );
|
||||
}
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#include "mode-private.h"
|
||||
|
|
|
@ -70,7 +70,6 @@ typedef struct
|
|||
unsigned int cmd_list_length;
|
||||
} RunModePrivateData;
|
||||
|
||||
|
||||
/**
|
||||
* @param cmd The cmd to execute
|
||||
* @param run_in_term Indicate if command should be run in a terminal
|
||||
|
|
|
@ -76,11 +76,9 @@ static char **get_script_output ( const char *command, unsigned int *length )
|
|||
|
||||
static char **execute_executor ( Mode *sw, const char *result, unsigned int *length )
|
||||
{
|
||||
char **retv = NULL;
|
||||
|
||||
char *arg = g_shell_quote ( result );
|
||||
char *command = g_strdup_printf ( "%s %s", (const char *) sw->ed, arg );
|
||||
retv = get_script_output ( command, length );
|
||||
char **retv = get_script_output ( command, length );
|
||||
g_free ( command );
|
||||
g_free ( arg );
|
||||
return retv;
|
||||
|
|
|
@ -199,7 +199,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
|
|||
// Reading one line per time.
|
||||
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
|
||||
// Evaluate one line.
|
||||
unsigned int index = 0, ti = 0;
|
||||
unsigned int index = 0, ti = 0;
|
||||
char *token = buffer;
|
||||
|
||||
// Tokenize it.
|
||||
|
@ -284,10 +284,9 @@ static char ** get_ssh ( unsigned int *length )
|
|||
retv = read_hosts_file ( retv, length );
|
||||
}
|
||||
|
||||
FILE *fd = NULL;
|
||||
const char *hd = g_get_home_dir ();
|
||||
path = g_build_filename ( hd, ".ssh", "config", NULL );
|
||||
fd = fopen ( path, "r" );
|
||||
FILE *fd = fopen ( path, "r" );
|
||||
|
||||
if ( fd != NULL ) {
|
||||
char *buffer = NULL;
|
||||
|
|
|
@ -338,7 +338,7 @@ static int window_match ( const Mode *sw, GRegex **tokens, unsigned int index )
|
|||
// If hack not in place it would not match queries spanning multiple fields.
|
||||
// e.g. when searching 'title element' and 'class element'
|
||||
GRegex *ftokens[2] = { tokens[j], NULL };
|
||||
if ( !test && c->title != NULL && c->title[0] != '\0' ) {
|
||||
if ( c->title != NULL && c->title[0] != '\0' ) {
|
||||
test = helper_token_match ( ftokens, c->title );
|
||||
}
|
||||
|
||||
|
@ -578,21 +578,20 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
|
|||
}
|
||||
else {
|
||||
rofi_view_hide ();
|
||||
if ( (current_window_manager&(WM_AWESOME|WM_OPENBOX)) != 0 )
|
||||
{
|
||||
if ( ( current_window_manager & ( WM_AWESOME | WM_OPENBOX ) ) != 0 ) {
|
||||
// Get the desktop of the client to switch to
|
||||
uint32_t wmdesktop = 0;
|
||||
xcb_get_property_cookie_t cookie;
|
||||
xcb_get_property_reply_t *r;
|
||||
// Get the current desktop.
|
||||
unsigned int current_desktop = 0;
|
||||
xcb_get_property_cookie_t c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr );
|
||||
unsigned int current_desktop = 0;
|
||||
xcb_get_property_cookie_t c = xcb_ewmh_get_current_desktop ( &xcb->ewmh, xcb->screen_nbr );
|
||||
if ( !xcb_ewmh_get_current_desktop_reply ( &xcb->ewmh, c, ¤t_desktop, NULL ) ) {
|
||||
current_desktop = 0;
|
||||
}
|
||||
|
||||
cookie = xcb_get_property ( xcb->connection, 0, rmpd->ids->array[selected_line],
|
||||
xcb->ewmh._NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 0, 1 );
|
||||
xcb->ewmh._NET_WM_DESKTOP, XCB_ATOM_CARDINAL, 0, 1 );
|
||||
r = xcb_get_property_reply ( xcb->connection, cookie, NULL );
|
||||
if ( r && r->type == XCB_ATOM_CARDINAL ) {
|
||||
wmdesktop = *( (uint32_t *) xcb_get_property_value ( r ) );
|
||||
|
@ -606,7 +605,7 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i
|
|||
// If we have to switch the desktop, do
|
||||
if ( wmdesktop != current_desktop ) {
|
||||
xcb_ewmh_request_change_current_desktop ( &xcb->ewmh,
|
||||
xcb->screen_nbr, wmdesktop, XCB_CURRENT_TIME );
|
||||
xcb->screen_nbr, wmdesktop, XCB_CURRENT_TIME );
|
||||
}
|
||||
}
|
||||
// Activate the window
|
||||
|
|
|
@ -252,7 +252,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
|
|||
}
|
||||
|
||||
char *saveptr = NULL, *token;
|
||||
GRegex **retv = NULL;
|
||||
GRegex **retv = NULL;
|
||||
if ( !config.tokenize ) {
|
||||
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
|
||||
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
|
||||
|
@ -863,8 +863,8 @@ int rofi_scorer_fuzzy_evaluate ( const char *pattern, glong plen, const char *st
|
|||
// uleft: value of the upper left cell; ulefts: maximum value of uleft and cells on the left. The arbitrary initial
|
||||
// values suppress warnings.
|
||||
int uleft = 0, ulefts = 0, left, lefts;
|
||||
const gchar *pit = pattern, *sit;
|
||||
enum CharClass prev = NON_WORD, cur;
|
||||
const gchar *pit = pattern, *sit;
|
||||
enum CharClass prev = NON_WORD, cur;
|
||||
for ( si = 0, sit = str; si < slen; si++, sit = g_utf8_next_char ( sit ) ) {
|
||||
cur = rofi_scorer_get_character_class ( g_utf8_get_char ( sit ) );
|
||||
score[si] = rofi_scorer_get_score_for ( prev, cur );
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
|
||||
#include <libgwater-xcb.h>
|
||||
|
||||
|
||||
#include "xcb-internal.h"
|
||||
#include "xkb-internal.h"
|
||||
|
||||
|
@ -405,7 +404,7 @@ static void cleanup ()
|
|||
* Collected modi
|
||||
*/
|
||||
// List of (possibly uninitialized) modi's
|
||||
Mode ** available_modi = NULL;
|
||||
Mode ** available_modi = NULL;
|
||||
unsigned int num_available_modi = 0;
|
||||
|
||||
/**
|
||||
|
@ -415,7 +414,7 @@ unsigned int num_available_modi = 0;
|
|||
*/
|
||||
Mode * rofi_collect_modi_search ( const char *name )
|
||||
{
|
||||
for ( unsigned int i = 0; i < num_available_modi; i++ ){
|
||||
for ( unsigned int i = 0; i < num_available_modi; i++ ) {
|
||||
if ( g_strcmp0 ( name, available_modi[i]->name ) == 0 ) {
|
||||
return available_modi[i];
|
||||
}
|
||||
|
@ -431,7 +430,7 @@ static gboolean rofi_collect_modi_add ( Mode *mode )
|
|||
{
|
||||
Mode *m = rofi_collect_modi_search ( mode->name );
|
||||
if ( m == NULL ) {
|
||||
available_modi = g_realloc ( available_modi, sizeof(Mode *)*(num_available_modi+1));
|
||||
available_modi = g_realloc ( available_modi, sizeof ( Mode * ) * ( num_available_modi + 1 ) );
|
||||
// Set mode.
|
||||
available_modi[num_available_modi] = mode;
|
||||
num_available_modi++;
|
||||
|
@ -445,27 +444,28 @@ static void rofi_collect_modi_dir ( const char *base_dir )
|
|||
GDir *dir = g_dir_open ( base_dir, 0, NULL );
|
||||
if ( dir ) {
|
||||
const char *dn = NULL;
|
||||
while ( ( dn = g_dir_read_name ( dir ) ) )
|
||||
{
|
||||
while ( ( dn = g_dir_read_name ( dir ) ) ) {
|
||||
if ( !g_str_has_suffix ( dn, G_MODULE_SUFFIX ) ) {
|
||||
continue;
|
||||
}
|
||||
char *fn = g_build_filename ( PLUGIN_PATH, dn, NULL );
|
||||
GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL );
|
||||
char *fn = g_build_filename ( PLUGIN_PATH, dn, NULL );
|
||||
GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
|
||||
if ( mod ) {
|
||||
Mode *m = NULL;
|
||||
if ( g_module_symbol ( mod, "mode", (gpointer *)&m) ){
|
||||
if ( g_module_symbol ( mod, "mode", (gpointer *) &m ) ) {
|
||||
if ( m->abi_version != ABI_VERSION ) {
|
||||
fprintf(stderr, "ABI version of plugin does not match: %08X expecting: %08X\n", m->abi_version, ABI_VERSION);
|
||||
fprintf ( stderr, "ABI version of plugin does not match: %08X expecting: %08X\n", m->abi_version, ABI_VERSION );
|
||||
g_module_close ( mod );
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
m->module = mod;
|
||||
if ( ! rofi_collect_modi_add ( m ) ) {
|
||||
if ( !rofi_collect_modi_add ( m ) ) {
|
||||
g_module_close ( mod );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "Symbol 'mode' not found in module: %s\n", fn);
|
||||
}
|
||||
else {
|
||||
fprintf ( stderr, "Symbol 'mode' not found in module: %s\n", fn );
|
||||
g_module_close ( mod );
|
||||
}
|
||||
}
|
||||
|
@ -500,19 +500,19 @@ static void rofi_collect_modi ( void )
|
|||
*/
|
||||
static void rofi_collect_modi_setup ( void )
|
||||
{
|
||||
for ( unsigned int i = 0; i < num_available_modi ; i++ ) {
|
||||
mode_set_config ( available_modi[i] );
|
||||
for ( unsigned int i = 0; i < num_available_modi; i++ ) {
|
||||
mode_set_config ( available_modi[i] );
|
||||
}
|
||||
}
|
||||
static void rofi_collect_modi_destroy ( void )
|
||||
{
|
||||
for ( unsigned int i = 0; i < num_available_modi ; i++ ) {
|
||||
for ( unsigned int i = 0; i < num_available_modi; i++ ) {
|
||||
if ( available_modi[i]->module ) {
|
||||
g_module_close ( available_modi[i]->module );
|
||||
}
|
||||
}
|
||||
g_free ( available_modi );
|
||||
available_modi = NULL;
|
||||
available_modi = NULL;
|
||||
num_available_modi = 0;
|
||||
}
|
||||
|
||||
|
@ -533,14 +533,16 @@ static int add_mode ( const char * token )
|
|||
if ( mode ) {
|
||||
modi[num_modi] = mode;
|
||||
num_modi++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// If not build in, use custom modi.
|
||||
Mode *sw = script_switcher_parse_setup ( token );
|
||||
if ( sw != NULL ) {
|
||||
modi[num_modi] = sw;
|
||||
mode_set_config ( sw );
|
||||
num_modi++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Report error, don't continue.
|
||||
fprintf ( stderr, "Invalid script switcher: %s\n", token );
|
||||
}
|
||||
|
@ -922,7 +924,7 @@ int main ( int argc, char *argv[] )
|
|||
|
||||
// Get DISPLAY, first env, then argument.
|
||||
// We never modify display_str content.
|
||||
char *display_str = ( char *)g_getenv ( "DISPLAY" );
|
||||
char *display_str = ( char *) g_getenv ( "DISPLAY" );
|
||||
find_arg_str ( "-display", &display_str );
|
||||
|
||||
xcb->connection = xcb_connect ( display_str, &xcb->screen_nbr );
|
||||
|
@ -947,7 +949,7 @@ int main ( int argc, char *argv[] )
|
|||
free ( errors );
|
||||
}
|
||||
// Discover the current active window manager.
|
||||
x11_helper_discover_window_manager();
|
||||
x11_helper_discover_window_manager ();
|
||||
TICK_N ( "Setup XCB" );
|
||||
|
||||
if ( xkb_x11_setup_xkb_extension ( xcb->connection, XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION,
|
||||
|
|
|
@ -374,19 +374,19 @@ static void rofi_view_window_update_size ( RofiViewState * state )
|
|||
widget_resize ( WIDGET ( state->main_window ), state->width, state->height );
|
||||
}
|
||||
|
||||
|
||||
static void rofi_view_reload_message_bar ( RofiViewState *state )
|
||||
{
|
||||
if ( state->mesg_box == NULL ){
|
||||
return ;
|
||||
if ( state->mesg_box == NULL ) {
|
||||
return;
|
||||
}
|
||||
char *msg = mode_get_message ( state->sw );
|
||||
if ( msg ) {
|
||||
textbox_text ( state->mesg_tb, msg );
|
||||
widget_enable ( WIDGET (state->mesg_box ) );
|
||||
widget_enable ( WIDGET ( state->mesg_box ) );
|
||||
g_free ( msg );
|
||||
} else {
|
||||
widget_disable ( WIDGET (state->mesg_box ) );
|
||||
}
|
||||
else {
|
||||
widget_disable ( WIDGET ( state->mesg_box ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ int rofi_view_error_dialog ( const char *msg, int markup )
|
|||
// Need to resize otherwise calculated desired height is wrong.
|
||||
widget_resize ( WIDGET ( state->main_window ), state->width, 100 );
|
||||
// resize window vertically to suit
|
||||
state->height = widget_get_desired_height ( WIDGET (state->main_window));
|
||||
state->height = widget_get_desired_height ( WIDGET ( state->main_window ) );
|
||||
|
||||
// Calculte window position.
|
||||
rofi_view_calculate_window_position ( state );
|
||||
|
|
|
@ -51,11 +51,11 @@ static void box_update ( widget *wid );
|
|||
|
||||
static int box_get_desired_height ( widget *wid )
|
||||
{
|
||||
box *b = (box *) wid;
|
||||
int spacing = distance_get_pixel ( b->spacing, b->type == BOX_VERTICAL ? ORIENTATION_VERTICAL : ORIENTATION_HORIZONTAL );
|
||||
int active_widgets = 0;
|
||||
int height = 0;
|
||||
box *b = (box *) wid;
|
||||
int spacing = distance_get_pixel ( b->spacing, b->type == BOX_VERTICAL ? ORIENTATION_VERTICAL : ORIENTATION_HORIZONTAL );
|
||||
int height = 0;
|
||||
if ( b->type == BOX_VERTICAL ) {
|
||||
int active_widgets = 0;
|
||||
for ( GList *iter = g_list_first ( b->children ); iter != NULL; iter = g_list_next ( iter ) ) {
|
||||
widget * child = (widget *) iter->data;
|
||||
if ( !child->enabled ) {
|
||||
|
|
|
@ -336,7 +336,6 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
|
||||
int cursor_x = 0;
|
||||
int cursor_y = 0;
|
||||
int cursor_width = 2; //MAX ( 2, font_height / 10 );
|
||||
int cursor_height = font_height;
|
||||
|
||||
if ( tb->changed ) {
|
||||
|
@ -372,7 +371,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
x = ( ( tb->widget.w - tw - widget_padding_get_padding_width ( WIDGET ( tb ) ) - offset ) ) / 2;
|
||||
}
|
||||
|
||||
int top = widget_padding_get_top ( WIDGET (tb) );
|
||||
int top = widget_padding_get_top ( WIDGET ( tb ) );
|
||||
y = top + ( pango_font_metrics_get_ascent ( tb->metrics ) - pango_layout_get_baseline ( tb->layout ) ) / PANGO_SCALE;
|
||||
|
||||
rofi_theme_get_color ( WIDGET ( tb ), "foreground", draw );
|
||||
|
@ -380,6 +379,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
|
|||
rofi_theme_get_color ( WIDGET ( tb ), "text", draw );
|
||||
// draw the cursor
|
||||
if ( tb->flags & TB_EDITABLE && tb->blink ) {
|
||||
int cursor_width = 2; //MAX ( 2, font_height / 10 );
|
||||
cairo_rectangle ( draw, x + cursor_x, y + cursor_y, cursor_width, cursor_height );
|
||||
cairo_fill ( draw );
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@
|
|||
/** Log domain for this module */
|
||||
#define LOG_DOMAIN "X11Helper"
|
||||
|
||||
|
||||
WindowManager current_window_manager = WM_EWHM;
|
||||
|
||||
/**
|
||||
|
@ -926,26 +925,27 @@ void x11_disable_decoration ( xcb_window_t window )
|
|||
|
||||
void x11_helper_discover_window_manager ( void )
|
||||
{
|
||||
xcb_window_t wm_win = 0;
|
||||
xcb_window_t wm_win = 0;
|
||||
xcb_get_property_cookie_t cc = xcb_ewmh_get_supporting_wm_check_unchecked ( &xcb->ewmh,
|
||||
xcb_stuff_get_root_window ( xcb ) );
|
||||
xcb_stuff_get_root_window ( xcb ) );
|
||||
|
||||
if ( xcb_ewmh_get_supporting_wm_check_reply ( &xcb->ewmh, cc, &wm_win, NULL ) ) {
|
||||
xcb_ewmh_get_utf8_strings_reply_t wtitle;
|
||||
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&(xcb->ewmh), wm_win );
|
||||
if ( xcb_ewmh_get_wm_name_reply(&(xcb->ewmh), cookie, &wtitle, (void *)0))
|
||||
{
|
||||
if ( wtitle.strings_len > 0 ){
|
||||
xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked ( &( xcb->ewmh ), wm_win );
|
||||
if ( xcb_ewmh_get_wm_name_reply ( &( xcb->ewmh ), cookie, &wtitle, (void *) 0 ) ) {
|
||||
if ( wtitle.strings_len > 0 ) {
|
||||
g_log ( LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Found window manager: %s", wtitle.strings );
|
||||
if ( g_strcmp0(wtitle.strings, "i3") == 0 ){
|
||||
if ( g_strcmp0 ( wtitle.strings, "i3" ) == 0 ) {
|
||||
current_window_manager = WM_I3;
|
||||
} else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ){
|
||||
}
|
||||
else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ) {
|
||||
current_window_manager = WM_AWESOME;
|
||||
} else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ){
|
||||
}
|
||||
else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ) {
|
||||
current_window_manager = WM_OPENBOX;
|
||||
}
|
||||
}
|
||||
xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
|
||||
xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue