diff --git a/Changelog b/Changelog index 3754574f..2622a762 100644 --- a/Changelog +++ b/Changelog @@ -6,6 +6,7 @@ v1.unrelease - Fix Current Desktop window switcher. - Selection mode in dmenu with selection counter. - Fix launching in terminal. + - Remove i3 workaround as it no longer needed since I3 v4.9. (Feb. 2015) v1.1.0 New Features diff --git a/INSTALL.md b/INSTALL.md index ce680360..ee195aee 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -29,15 +29,6 @@ On debian based systems, the developer packages are in the form of: `-dev` on rpm based `-devel`. - -### Optional: - -* For i3 support, you need at least i3 version 4.5 or up. -Make sure that 'i3/ipc.h' is included. If it fails please check -config.log. - - - ## Install from a release Check dependencies and configure build system: @@ -134,14 +125,6 @@ or to install locally: ./configure --prefix=${HOME}/.local/ ``` -### I3 workaround - - If i3 is installed in a non-standard prefix, point it to the right location using: - -``` -CFLAGS="-I/weird/i3/path/include/" ../configure -CFLAGS="-I/weird/i3/path/include/" make -``` ## Options for make diff --git a/Makefile.am b/Makefile.am index 1a9619e3..f2dd0659 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,6 @@ rofi_SOURCES=\ source/timings.c\ source/history.c\ source/scrollbar.c\ - source/i3-support.c\ source/xrmoptions.c\ source/x11-helper.c\ source/dialogs/run.c\ @@ -55,7 +54,6 @@ rofi_SOURCES=\ include/textbox.h\ include/scrollbar.h\ include/xrmoptions.h\ - include/i3-support.h\ include/x11-helper.h\ include/dialogs/ssh.h\ include/dialogs/run.h\ diff --git a/README.md b/README.md index b4fbb1e2..26cca015 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,6 @@ It main features are: * Build in modes: - Window switcher mode. - EWMH compatible WM. - - Workaround for older I3 installations. - Run mode. - Desktop File Run mode. - SSH launcher mode. @@ -58,13 +57,6 @@ The window switcher shows the following informations in columns (can be customiz 2. Window class. 3. Window title. -If compiled with I3 support, it should autodetect if I3 window manager is running and switch into -I3 compatibility mode. This will disable Desktop numbers and hide the i3-bar, also it sends an IPC -message to I3 to change focus. - -> Note: With the latest I3 this is no longer needed as I3 obeys EWHM hints. -> The 'dedicated' support of I3 will be removed from future releases. - ## Run mode ![run mode](https://davedavenport.github.io/rofi/images/rofi/run-dialog.png) diff --git a/configure.ac b/configure.ac index 54deace0..f052eec5 100644 --- a/configure.ac +++ b/configure.ac @@ -64,13 +64,6 @@ dnl --------------------------------------------------------------------- AC_ARG_ENABLE([timings], AC_HELP_STRING([--enable-timings],[Enable timing output])) AS_IF( [ test "x$enable_timings" = "xyes"], [AC_DEFINE([TIMINGS],[1], [Enable timings output])]) -dnl --------------------------------------------------------------------- -dnl I3 check -dnl --------------------------------------------------------------------- -AC_ARG_ENABLE(i3support, [AS_HELP_STRING([--disable-i3support], [Disable check for i3 support])]) -AS_IF([test "x$enable_i3support" != xno && test "x$enable_windowmode" != "xno"],[AC_CHECK_HEADERS([i3/ipc.h], [i3_header=yes; break;])]) - - dnl --------------------------------------------------------------------- dnl Check for C functions. dnl --------------------------------------------------------------------- @@ -113,11 +106,6 @@ dnl ----------------------------------------------- echo "" echo "-------------------------------------" -if test x$i3_header = xyes; then -echo "I3 support: Enabled" -else -echo "I3 support: Disabled" -fi if test x$enable_timings = xyes; then echo "Timing output: Enabled" else diff --git a/include/i3-support.h b/include/i3-support.h deleted file mode 100644 index 1d003b72..00000000 --- a/include/i3-support.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef ROFI_I3_H -#define ROFI_I3_H - -/** - * @defgroup I3Support I3Support - * @ingroup HELPERS - * - * These functions are dummies when i3 support is not compiled in. - * - * @{ - */ - -/** - * @param id The window to focus on. - * - * If we want to switch windows in I3, we use I3 IPC mode. - * This works more better then sending messages via X11. - * Hopefully at some point, I3 gets fixed and this is not needed. - * This function takes the path to the i3 IPC socket, and the XID of the window. - */ -void i3_support_focus_window ( xcb_window_t id ); - -/** - * @param xcb The xcb to read the i3 property from. - * - * Get the i3 socket from the X root window. - * @returns TRUE when i3 is running, FALSE when not. - */ - -int i3_support_initialize ( xcb_stuff *xcb ); - -/** - * Cleanup. - */ -void i3_support_free_internals ( void ); -/*@}*/ -#endif // ROFI_I3_H diff --git a/source/dialogs/window.c b/source/dialogs/window.c index 5fda3561..737c5e52 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -49,7 +49,6 @@ #include "helper.h" #include "textbox.h" #include "x11-helper.h" -#include "i3-support.h" #include "dialogs/window.h" #define WINLIST 32 @@ -89,7 +88,6 @@ typedef struct { unsigned int id; winlist *ids; - int config_i3_mode; // Current window. unsigned int index; char *cache; @@ -366,7 +364,7 @@ static unsigned int window_mode_get_num_entries ( const Mode *sw ) { const ModeModePrivateData *pd = (const ModeModePrivateData *) mode_get_private_data ( sw ); - return pd->ids?pd->ids->len:0; + return pd->ids ? pd->ids->len : 0; } /** * Small helper function to find the right entry in the ewmh reply. @@ -394,8 +392,6 @@ static void _window_mode_load_data ( Mode *sw, unsigned int cd ) // Create cache x11_cache_create (); - // Check for i3 - pd->config_i3_mode = i3_support_initialize ( xcb ); xcb_get_property_cookie_t c = xcb_ewmh_get_active_window ( &( xcb->ewmh ), xcb->screen_nbr ); if ( !xcb_ewmh_get_active_window_reply ( &xcb->ewmh, c, &curr_win_id, NULL ) ) { curr_win_id = 0; @@ -559,10 +555,6 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i if ( mretv & MENU_CUSTOM_ACTION ) { act_on_window ( rmpd->ids->array[selected_line] ); } - else if ( rmpd->config_i3_mode ) { - // Hack for i3. - i3_support_focus_window ( rmpd->ids->array[selected_line] ); - } else { // Get the current desktop. unsigned int current_desktop = 0; @@ -609,7 +601,6 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i } } else if ( ( mretv & ( MENU_ENTRY_DELETE ) ) == MENU_ENTRY_DELETE ) { - /* TODO: WM_DELETE_WINDOW support, see i3 */ xcb_destroy_window ( xcb->connection, rmpd->ids->array[selected_line] ); xcb_flush ( xcb->connection ); } @@ -621,7 +612,6 @@ static void window_mode_destroy ( Mode *sw ) ModeModePrivateData *rmpd = (ModeModePrivateData *) mode_get_private_data ( sw ); if ( rmpd != NULL ) { winlist_free ( rmpd->ids ); - i3_support_free_internals (); x11_cache_free (); g_free ( rmpd->cache ); g_free ( rmpd ); diff --git a/source/i3-support.c b/source/i3-support.c deleted file mode 100644 index 6f1669b1..00000000 --- a/source/i3-support.c +++ /dev/null @@ -1,146 +0,0 @@ -/** - * rofi - * - * MIT/X11 License - * Copyright (c) 2013-2016 Qball Cow - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "xcb.h" -#include "rofi.h" -#include "x11-helper.h" -#include "i3-support.h" -#include "view.h" - -#ifdef HAVE_I3_IPC_H -#include -// Path to HAVE_I3_IPC_H socket. -char *i3_socket_path = NULL; -void i3_support_focus_window ( xcb_window_t id ) -{ - i3_ipc_header_t head; - int s; - ssize_t t; - struct sockaddr_un remote; - size_t upm = sizeof ( remote.sun_path ); - char command[upm]; - - if ( strlen ( i3_socket_path ) > upm ) { - fprintf ( stderr, "Socket path is too long. %zu > %zu\n", strlen ( i3_socket_path ), upm ); - return; - } - - if ( ( s = socket ( AF_UNIX, SOCK_STREAM, 0 ) ) == -1 ) { - fprintf ( stderr, "Failed to open connection to I3: %s\n", strerror ( errno ) ); - return; - } - - remote.sun_family = AF_UNIX; - g_strlcpy ( remote.sun_path, i3_socket_path, upm ); - - if ( connect ( s, ( struct sockaddr * ) &remote, sizeof ( struct sockaddr_un ) ) == -1 ) { - fprintf ( stderr, "Failed to connect to I3 (%s): %s\n", i3_socket_path, strerror ( errno ) ); - close ( s ); - return; - } - - // Formulate command - snprintf ( command, upm, "[id=\"%u\"] focus", id ); - // Prepare header. - memcpy ( head.magic, I3_IPC_MAGIC, 6 ); - head.size = strlen ( command ); - head.type = I3_IPC_MESSAGE_TYPE_COMMAND; - // Send header. - t = send ( s, &head, sizeof ( i3_ipc_header_t ), 0 ); - if ( t == -1 ) { - char *msg = g_strdup_printf ( "Failed to send message header to i3: %s\n", strerror ( errno ) ); - rofi_view_error_dialog ( msg, FALSE ); - g_free ( msg ); - close ( s ); - return; - } - // Send message - t = send ( s, command, strlen ( command ), 0 ); - if ( t == -1 ) { - char *msg = g_strdup_printf ( "Failed to send message body to i3: %s\n", strerror ( errno ) ); - rofi_view_error_dialog ( msg, FALSE ); - g_free ( msg ); - close ( s ); - return; - } - // Receive header. - t = recv ( s, &head, sizeof ( head ), 0 ); - - if ( t == sizeof ( head ) ) { - t = recv ( s, command, head.size, 0 ); - if ( t == head.size ) { - // Response. - } - } - - close ( s ); -} - -int i3_support_initialize ( xcb_stuff *xcb ) -{ - // If we where initialized, clean this first. - i3_support_free_internals (); - - // Get atom for I3_SOCKET_PATH - i3_socket_path = window_get_text_prop ( xcb_stuff_get_root_window ( xcb ), netatoms[I3_SOCKET_PATH] ); - // If we find it, go into i3 mode. - return ( i3_socket_path != NULL ) ? TRUE : FALSE; -} - -void i3_support_free_internals ( void ) -{ - g_free ( i3_socket_path ); - i3_socket_path = NULL; -} - -#else - -void i3_support_focus_window ( G_GNUC_UNUSED xcb_window_t id ) -{ - fprintf ( stderr, "Trying to control i3, when i3 support is not enabled.\n" ); - abort (); -} -void i3_support_free_internals ( void ) -{ -} - -int i3_support_initialize ( G_GNUC_UNUSED xcb_stuff *xcb ) -{ - return FALSE; -} -#endif // HAVE_I3_IPC_H