1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-01-27 15:25:24 -05:00

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

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

View file

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

View file

@ -64,7 +64,7 @@
#include <rofi.h> #include <rofi.h>
/** Checks if the if x and y is inside rectangle. */ /** 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 ) ) ) ) #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. * Structure holding xcb objects needed to function.
@ -912,16 +912,7 @@ static void x11_helper_discover_window_manager ( void )
if ( wtitle.strings_len > 0 ) { if ( wtitle.strings_len > 0 ) {
g_debug ( "Found window manager: %s", wtitle.strings ); g_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; current_window_manager = WM_DO_NOT_CHANGE_CURRENT_DESKTOP|WM_PANGO_WORKSPACE_NAMES;
}
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;
} }
} }
xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle ); xcb_ewmh_get_utf8_strings_reply_wipe ( &wtitle );