Make things behave nice again in i3.

This commit is contained in:
Dave Davenport 2014-03-02 12:53:06 +01:00
parent 1834e25ef3
commit 8a3daf3194
3 changed files with 28 additions and 9 deletions

View File

@ -53,8 +53,10 @@ Settings config = {
.zeltak_mode = 0,
// Terminal to use. (for ssh and open in terminal)
.terminal_emulator = "x-terminal-emulator",
#ifdef I3
// Auto-detected. no longer used.
.i3_mode = 0,
#endif
// Key binding
.window_key = "F12",
.run_key = "mod1+F2",

View File

@ -90,7 +90,9 @@ typedef struct _Settings {
// Behavior
unsigned int zeltak_mode;
char * terminal_emulator;
#ifdef I3
unsigned int i3_mode;
#endif
// Key bindings
char * window_key;
char * run_key;

View File

@ -1201,7 +1201,15 @@ SwitcherMode run_switcher_window ( char **input )
// Create pattern for printing the line.
if (!window_get_cardinal_prop(root, netatoms[_NET_NUMBER_OF_DESKTOPS], &desktops, 1))
desktops = 1;
sprintf(pattern, "%%-%ds %%-%ds %%s", desktops < 10 ? 1 : 2, MAX(5, classfield));
#ifdef I3
if(config.i3_mode) {
sprintf(pattern, "%%-%ds %%s", MAX(5, classfield));
}else {
#endif
sprintf(pattern, "%%-%ds %%-%ds %%s", desktops < 10 ? 1 : 2, MAX(5, classfield));
#ifdef I3
}
#endif
char **list = allocate_clear( sizeof( char* ) * ( ids->len+1 ) );
int lines = 0;
@ -1216,16 +1224,23 @@ SwitcherMode run_switcher_window ( char **input )
char desktop[5];
desktop[0] = 0;
char *line = allocate( strlen( c->title ) + strlen( c->class ) + classfield + 50 );
#ifdef I3
if(!config.i3_mode) {
#endif
// find client's desktop. this is zero-based, so we adjust by since most
// normal people don't think like this :-)
if (!window_get_cardinal_prop(c->window, netatoms[_NET_WM_DESKTOP], &wmdesktop, 1))
wmdesktop = 0xFFFFFFFF;
// find client's desktop. this is zero-based, so we adjust by since most
// normal people don't think like this :-)
if (!window_get_cardinal_prop(c->window, netatoms[_NET_WM_DESKTOP], &wmdesktop, 1))
wmdesktop = 0xFFFFFFFF;
if (wmdesktop < 0xFFFFFFFF)
sprintf(desktop, "%d", (int)wmdesktop+1);
if (wmdesktop < 0xFFFFFFFF)
sprintf(desktop, "%d", (int)wmdesktop+1);
sprintf(line, pattern, desktop, c->class, c->title);
sprintf(line, pattern, desktop, c->class, c->title);
#ifdef I3
}else{
sprintf(line, pattern, c->class, c->title);
}
#endif
list[lines++] = line;
}