mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Small i3 fix
This commit is contained in:
parent
a86e2415f4
commit
5d5779ad1d
3 changed files with 16 additions and 23 deletions
|
@ -22,13 +22,6 @@ AM_PROG_CC_C_O
|
||||||
AC_CHECK_HEADERS([i3/ipc.h],
|
AC_CHECK_HEADERS([i3/ipc.h],
|
||||||
[i3_header=yes; break;])
|
[i3_header=yes; break;])
|
||||||
|
|
||||||
AS_IF([test "x$i3_header" != xno],
|
|
||||||
[
|
|
||||||
AM_CONDITIONAL(I3, true)
|
|
||||||
AC_DEFINE(I3, [1], [Support for I3])
|
|
||||||
], [
|
|
||||||
AM_CONDITIONAL(I3, false)
|
|
||||||
])
|
|
||||||
##
|
##
|
||||||
# Check dependencies
|
# Check dependencies
|
||||||
##
|
##
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#define INTERSECT(x,y,w,h,x1,y1,w1,h1) (OVERLAP((x),(w),(x1),(w1)) && OVERLAP((y),(h),(y1),(h1)))
|
#define INTERSECT(x,y,w,h,x1,y1,w1,h1) (OVERLAP((x),(w),(x1),(w1)) && OVERLAP((y),(h),(y1),(h1)))
|
||||||
|
|
||||||
extern const char *cache_dir;
|
extern const char *cache_dir;
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
extern char *i3_socket_path;
|
extern char *i3_socket_path;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ typedef struct _Settings {
|
||||||
// Behavior
|
// Behavior
|
||||||
unsigned int zeltak_mode;
|
unsigned int zeltak_mode;
|
||||||
char * terminal_emulator;
|
char * terminal_emulator;
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
unsigned int i3_mode;
|
unsigned int i3_mode;
|
||||||
#endif
|
#endif
|
||||||
// Key bindings
|
// Key bindings
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#include <X11/Xresource.h>
|
#include <X11/Xresource.h>
|
||||||
#include <X11/extensions/Xinerama.h>
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/un.h>
|
#include <linux/un.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -175,10 +175,10 @@ static inline void tokenize_free( char **ip )
|
||||||
free( ip );
|
free( ip );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
// Path to I3 socket.
|
// Path to HAVE_I3_IPC_H socket.
|
||||||
char *i3_socket_path = NULL;
|
char *i3_socket_path = NULL;
|
||||||
// Focus window on I3 window manager.
|
// Focus window on HAVE_I3_IPC_H window manager.
|
||||||
static void focus_window_i3( const char *socket_path, int id )
|
static void focus_window_i3( const char *socket_path, int id )
|
||||||
{
|
{
|
||||||
i3_ipc_header_t head;
|
i3_ipc_header_t head;
|
||||||
|
@ -1199,7 +1199,7 @@ SwitcherMode run_switcher_window ( char **input )
|
||||||
|
|
||||||
classfield = MAX( classfield, strlen( c->class ) );
|
classfield = MAX( classfield, strlen( c->class ) );
|
||||||
|
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
|
|
||||||
// In i3 mode, skip the i3bar completely.
|
// In i3 mode, skip the i3bar completely.
|
||||||
if ( config.i3_mode && strstr( c->class, "i3bar" ) != NULL ) continue;
|
if ( config.i3_mode && strstr( c->class, "i3bar" ) != NULL ) continue;
|
||||||
|
@ -1213,13 +1213,13 @@ SwitcherMode run_switcher_window ( char **input )
|
||||||
// Create pattern for printing the line.
|
// Create pattern for printing the line.
|
||||||
if (!window_get_cardinal_prop(root, netatoms[_NET_NUMBER_OF_DESKTOPS], &desktops, 1))
|
if (!window_get_cardinal_prop(root, netatoms[_NET_NUMBER_OF_DESKTOPS], &desktops, 1))
|
||||||
desktops = 1;
|
desktops = 1;
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
if(config.i3_mode) {
|
if(config.i3_mode) {
|
||||||
sprintf(pattern, "%%-%ds %%s", MAX(5, classfield));
|
sprintf(pattern, "%%-%ds %%s", MAX(5, classfield));
|
||||||
}else {
|
}else {
|
||||||
#endif
|
#endif
|
||||||
sprintf(pattern, "%%-%ds %%-%ds %%s", desktops < 10 ? 1 : 2, MAX(5, classfield));
|
sprintf(pattern, "%%-%ds %%-%ds %%s", desktops < 10 ? 1 : 2, MAX(5, classfield));
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
char **list = allocate_clear( sizeof( char* ) * ( ids->len+1 ) );
|
char **list = allocate_clear( sizeof( char* ) * ( ids->len+1 ) );
|
||||||
|
@ -1236,7 +1236,7 @@ SwitcherMode run_switcher_window ( char **input )
|
||||||
char desktop[5];
|
char desktop[5];
|
||||||
desktop[0] = 0;
|
desktop[0] = 0;
|
||||||
char *line = allocate( strlen( c->title ) + strlen( c->class ) + classfield + 50 );
|
char *line = allocate( strlen( c->title ) + strlen( c->class ) + classfield + 50 );
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
if(!config.i3_mode) {
|
if(!config.i3_mode) {
|
||||||
#endif
|
#endif
|
||||||
// find client's desktop. this is zero-based, so we adjust by since most
|
// find client's desktop. this is zero-based, so we adjust by since most
|
||||||
|
@ -1248,7 +1248,7 @@ SwitcherMode run_switcher_window ( char **input )
|
||||||
sprintf(desktop, "%d", (int)wmdesktop+1);
|
sprintf(desktop, "%d", (int)wmdesktop+1);
|
||||||
|
|
||||||
sprintf(line, pattern, desktop, c->class, c->title);
|
sprintf(line, pattern, desktop, c->class, c->title);
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
}else{
|
}else{
|
||||||
sprintf(line, pattern, c->class, c->title);
|
sprintf(line, pattern, c->class, c->title);
|
||||||
}
|
}
|
||||||
|
@ -1264,7 +1264,7 @@ SwitcherMode run_switcher_window ( char **input )
|
||||||
if ( mretv == MENU_NEXT ) {
|
if ( mretv == MENU_NEXT ) {
|
||||||
retv = NEXT_DIALOG;
|
retv = NEXT_DIALOG;
|
||||||
} else if ( mretv == MENU_OK && list[selected_line] ) {
|
} else if ( mretv == MENU_OK && list[selected_line] ) {
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
|
|
||||||
if ( config.i3_mode ) {
|
if ( config.i3_mode ) {
|
||||||
// Hack for i3.
|
// Hack for i3.
|
||||||
|
@ -1423,7 +1423,7 @@ void grab_key( unsigned int modmask, KeySym key )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
static inline void display_get_i3_path( Display *display )
|
static inline void display_get_i3_path( Display *display )
|
||||||
{
|
{
|
||||||
config.i3_mode = 0;
|
config.i3_mode = 0;
|
||||||
|
@ -1437,7 +1437,7 @@ static inline void display_get_i3_path( Display *display )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //I3
|
#endif //HAVE_I3_IPC_H
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1538,7 +1538,7 @@ int main( int argc, char *argv[] )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
// Check for i3
|
// Check for i3
|
||||||
display_get_i3_path( display );
|
display_get_i3_path( display );
|
||||||
#endif
|
#endif
|
||||||
|
@ -1596,7 +1596,7 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
winlist_free( cache_xattr );
|
winlist_free( cache_xattr );
|
||||||
winlist_free( cache_client );
|
winlist_free( cache_client );
|
||||||
#ifdef I3
|
#ifdef HAVE_I3_IPC_H
|
||||||
|
|
||||||
if ( i3_socket_path != NULL ) free( i3_socket_path );
|
if ( i3_socket_path != NULL ) free( i3_socket_path );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue