/*
* rofi
*
* MIT/X11 License
* Copyright © 2012 Sean Pringle <sean.pringle@gmail.com>
* Copyright © 2013-2023 Qball Cow <qball@gmpclient.org>
*
* 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.
*
*/
/** Log domain */
#define G_LOG_DOMAIN "Rofi"
#include "config.h"
#include <errno.h>
#include <gmodule.h>
#include <locale.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sysexits.h>
#include <time.h>
#include <unistd.h>
#include <xcb/xcb.h>
#include <glib-unix.h>
#include <libgwater-xcb.h>
#ifdef USE_NK_GIT_VERSION
#include "nkutils-git-version.h"
#ifdef NK_GIT_VERSION
#define GIT_VERSION NK_GIT_VERSION
#endif
#endif
#include "resources.h"
#include "display.h"
#include "rofi.h"
#include "settings.h"
#include "helper.h"
#include "mode.h"
#include "modes/modes.h"
#include "widgets/textbox.h"
#include "xrmoptions.h"
#include "view-internal.h"
#include "view.h"
#include "rofi-icon-fetcher.h"
#include "theme.h"
#include "timings.h"
// Plugin abi version.
// TODO: move this check to mode.c
#include "mode-private.h"
/** Location of pidfile for this instance. */
char *pidfile = NULL;
/** Location of Cache directory. */
const char *cache_dir = NULL;
/** List of error messages.*/
GList *list_of_error_msgs = NULL;
/** List of warning messages for the user.*/
GList *list_of_warning_msgs = NULL;
static void rofi_collectmodes_destroy(void);
void rofi_add_error_message(GString *str) {
list_of_error_msgs = g_list_append(list_of_error_msgs, str);
}
void rofi_clear_error_messages(void) {
if (list_of_error_msgs) {
for (GList *iter = g_list_first(list_of_error_msgs); iter != NULL;
iter = g_list_next(iter)) {
g_string_free((GString *)iter->data, TRUE);
}
g_list_free(list_of_error_msgs);
list_of_error_msgs = NULL;
}
}
void rofi_add_warning_message(GString *str) {
list_of_warning_msgs = g_list_append(list_of_warning_msgs, str);
}
void rofi_clear_warning_messages(void) {
if (list_of_warning_msgs) {
for (GList *iter = g_list_first(list_of_warning_msgs); iter != NULL;
iter = g_list_next(iter)) {
g_string_free((GString *)iter->data, TRUE);
}
g_list_free(list_of_warning_msgs);
list_of_warning_msgs = NULL;
}
}
/** Path to the configuration file */
G_MODULE_EXPORT char *config_path = NULL;
/** Path to the configuration file in the new format */
/** Array holding all activated modes. */
Mode **modes = NULL;
/** List of (possibly uninitialized) modes */
Mode **available_modes = NULL;
/** Length of #num_avail