Change WMQuirk logic

- Default is switch to desktop then select window.
- 2 quirks:
  - pango names.
  - do not switch.
This commit is contained in:
Dave Davenport 2017-09-17 21:40:36 +02:00
parent ff4946edaf
commit 852d80fee3
3 changed files with 10 additions and 23 deletions

View File

@ -168,21 +168,17 @@ void x11_disable_decoration ( xcb_window_t window );
typedef enum
{
/** Default EWHM compatible window manager */
WM_EWHM = 0,
WM_EWHM = 0,
/** I3 Window manager */
WM_I3 = 1,
/** Awesome window manager */
WM_AWESOME = 2,
/** Openbox window manager */
WM_OPENBOX = 4,
/** Xfwm4 */
WM_XFWM4 = 8,
} WindowManager;
WM_DO_NOT_CHANGE_CURRENT_DESKTOP = 1,
/** PANGO WORKSPACE NAMES */
WM_PANGO_WORKSPACE_NAMES = 2,
} WindowManagerQuirk;
/**
* Indicates the current window manager.
* This is used for work-arounds.
*/
extern WindowManager current_window_manager;
extern WindowManagerQuirk current_window_manager;
#endif

View File

@ -482,7 +482,7 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd )
}
if ( c->wmdesktop != 0xFFFFFFFF ) {
if ( has_names ) {
if ( current_window_manager == WM_I3 ) {
if ( (current_window_manager&WM_PANGO_WORKSPACE_NAMES) == WM_PANGO_WORKSPACE_NAMES ) {
char *output = NULL;
if ( pango_parse_markup ( _window_name_list_entry ( names.strings, names.strings_len,
c->wmdesktop ), -1, 0, NULL, &output, NULL, NULL ) ) {
@ -584,7 +584,7 @@ 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 | WM_XFWM4 ) ) != 0 ) {
if ( ( current_window_manager&WM_DO_NOT_CHANGE_CURRENT_DESKTOP ) == 0 ) {
// Get the desktop of the client to switch to
uint32_t wmdesktop = 0;
xcb_get_property_cookie_t cookie;

View File

@ -64,7 +64,7 @@
#include <rofi.h>
/** Checks if the if x and y is inside rectangle. */
#define INTERSECT( x, y, x1, y1, w1, h1 ) ( ( ( ( x ) >= ( x1 ) ) && ( ( x ) < ( x1 + w1 ) ) ) && ( ( ( y ) >= ( y1 ) ) && ( ( y ) < ( y1 + h1 ) ) ) )
WindowManager current_window_manager = WM_EWHM;
WindowManagerQuirk current_window_manager = WM_EWHM;
/**
* Structure holding xcb objects needed to function.
@ -912,16 +912,7 @@ static void x11_helper_discover_window_manager ( void )
if ( wtitle.strings_len > 0 ) {
g_debug ( "Found window manager: %s", wtitle.strings );
if ( g_strcmp0 ( wtitle.strings, "i3" ) == 0 ) {
current_window_manager = WM_I3;
}
else if ( g_strcmp0 ( wtitle.strings, "awesome" ) == 0 ) {
current_window_manager = WM_AWESOME;
}
else if ( g_strcmp0 ( wtitle.strings, "Openbox" ) == 0 ) {
current_window_manager = WM_OPENBOX;
}
else if ( g_strcmp0 ( wtitle.strings, "Xfwm4" ) == 0 ) {
current_window_manager = WM_XFWM4;
current_window_manager = WM_DO_NOT_CHANGE_CURRENT_DESKTOP|WM_PANGO_WORKSPACE_NAMES;
}
}
xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle );