1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00
rofi/config/config.c

167 lines
5.2 KiB
C
Raw Normal View History

/*
2014-03-01 11:27:52 -05:00
* rofi
*
* MIT/X11 License
2023-01-14 07:02:35 -05:00
* 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.
*
*/
#include "config.h"
2017-08-18 05:38:54 -04:00
#include "rofi-types.h"
2016-01-07 10:01:56 -05:00
#include "settings.h"
2022-02-07 17:16:46 -05:00
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
Settings config = {
2022-02-23 16:42:56 -05:00
/** List of enabled modes. */
/** -modes */
#ifdef WINDOW_MODE
.modes = "window,drun,run,ssh",
#else
.modes = "drun,run,ssh",
#endif
2014-11-25 02:27:08 -05:00
/** Font */
2022-02-07 17:16:46 -05:00
.menu_font = "mono 12",
2015-04-06 11:13:26 -04:00
/** Whether to load and show icons */
2022-02-07 17:16:46 -05:00
.show_icons = FALSE,
[WIP] xdg thumbnails fetching with fallback on mimetype icons (#1939) * implemented xdg thumbnails fetching with fallback on mimetype icons for menu entries in filebrowser mode * included original license text * added md5 header and source file * implemented xdg compatible thumbnail's creation * added -preview-cmd string option to program settings * support custom command to create images for entries with thumbnail:// prefix * fix custom thumbnailer command crash caused by null uri when entry is not a valid filename * check entry_name is not NULL or empty when generating thumbnails; use snprintf to avoid static analyzer complains * avoid using gstrvbuilder to build thumbnailer command args * fixed static analyzer complain about always wrong condition * use g_spawn_check_exit_status to avoid bump to glib 2.70 * removed md5-c dependency and use glib checksum implementation * fixed meson build after md5-c library removal * support thumbnail generation in recursivebrowser mode * restored check rofi_icon_fetcher_file_is_image * create thumbnail directories if not existing * use g_malloc0, g_strdup and g_strdup_printf * fixed formatting with clang-format * don't wait for jobs in execution when finalizing the icon fetcher worker threadpool * destroy and rebuild the icon fetcher worker threadpool when the current page is changed * added query_started boolean member to IconFetcherEntry; check if an icon fetcher query was started on an IconFetcherEntry and submit the query again otherwise * force icon cache lookup even if the item has a valid icon_fetch_uid (the fetching job could have been discarded before starting) * search binaries in PATH when executing thumbnailer command * mark icon query as not started in threadpool item free_func * added listview page_changed_callback; rebuild icon fetcher threadpool in page_changed_callback * [listview] Add missing code documentation param * Create rofi-thumbnails.5.markdown * Updated documentation with apparmor issues and workaround * [Doc] Ship rofi-thumbnails.5 With some formatting fixes * use a more compact thumbnailer example --------- Co-authored-by: giomatfois62 <giomatfois62@yahoo.it> Co-authored-by: Dave Davenport <DaveDavenport@users.noreply.github.com> Co-authored-by: lbonn <github@lbonnans.net>
2024-06-21 12:47:38 -04:00
/** Custom command to generate preview icons */
.preview_cmd = NULL,
2014-11-25 02:27:08 -05:00
/** Terminal to use. (for ssh and open in terminal) */
2015-08-03 14:40:01 -04:00
.terminal_emulator = "rofi-sensible-terminal",
2022-02-07 17:16:46 -05:00
.ssh_client = "ssh",
2014-11-25 02:27:08 -05:00
/** Command when executing ssh. */
.ssh_command = "{terminal} -e {ssh-client} {host} [-p {port}]",
2014-11-25 02:27:08 -05:00
/** Command when running */
.run_command = "{cmd}",
2015-01-05 15:53:50 -05:00
/** Command used to list executable commands. empty -> internal */
2022-02-07 17:16:46 -05:00
.run_list_command = "",
2014-11-25 02:27:08 -05:00
/** Command executed when running application in terminal */
.run_shell_command = "{terminal} -e {cmd}",
/** Command executed on accep-entry-custom for window modus */
2022-02-07 17:16:46 -05:00
.window_command = "wmctrl -i -R {window}",
/** No default icon theme, we search Adwaita and gnome as fallback */
2022-02-07 17:16:46 -05:00
.icon_theme = NULL,
/**
2014-11-25 02:27:08 -05:00
* Location of the window.
* Enumeration indicating location or gravity of window.
*
* WL_NORTH_WEST WL_NORTH WL_NORTH_EAST
*
* WL_EAST WL_CENTER WL_EAST
*
* WL_SOUTH_WEST WL_SOUTH WL_SOUTH_EAST
*
*/
2022-02-07 17:16:46 -05:00
.location = WL_CENTER,
2014-11-25 02:27:08 -05:00
/** Y offset */
2022-02-07 17:16:46 -05:00
.y_offset = 0,
2014-11-25 02:27:08 -05:00
/** X offset */
2022-02-07 17:16:46 -05:00
.x_offset = 0,
/** Always show config.menu_lines lines, even if less lines are available */
2022-02-07 17:16:46 -05:00
.fixed_num_lines = TRUE,
2014-11-25 02:27:08 -05:00
/** Do not use history */
2022-02-07 17:16:46 -05:00
.disable_history = FALSE,
2018-12-30 18:35:00 -05:00
/** Programs ignored for history */
2022-02-07 17:16:46 -05:00
.ignored_prefixes = "",
/** Sort the displayed list */
2022-02-07 17:16:46 -05:00
.sort = FALSE,
/** Use levenshtein sorting when matching */
2022-02-07 17:16:46 -05:00
.sorting_method = "normal",
2015-01-12 08:13:46 -05:00
/** Case sensitivity of the search */
2022-02-07 17:16:46 -05:00
.case_sensitive = FALSE,
/** Cycle through in the element list */
2022-02-07 17:16:46 -05:00
.cycle = TRUE,
2014-11-25 02:27:08 -05:00
/** Height of an element in #chars */
2022-02-07 17:16:46 -05:00
.element_height = 1,
2022-02-23 16:42:56 -05:00
/** Sidebar mode, show the modes */
2022-02-07 17:16:46 -05:00
.sidebar_mode = FALSE,
2015-02-24 11:34:25 -05:00
/** auto select */
2022-02-07 17:16:46 -05:00
.auto_select = FALSE,
/** Parse /etc/hosts file in ssh view. */
2022-02-07 17:16:46 -05:00
.parse_hosts = FALSE,
/** Parse ~/.ssh/known_hosts file in ssh view. */
2022-02-07 17:16:46 -05:00
.parse_known_hosts = TRUE,
2022-02-23 16:42:56 -05:00
/** Modes to combine into one view. */
.combi_modes = "window,run",
2022-02-07 17:16:46 -05:00
.tokenize = TRUE,
.matching = "normal",
.matching_method = MM_NORMAL,
Follow Type=Link standard desktop entries with drun (#1168) * [DRun] Introduce data structure changes for Link desktop entries From the [freedesktop spec][1]: > This specification defines 3 types of desktop entries: > Application (type 1), Link (type 2) and Directory (type 3). To allow > the addition of new types in the future, implementations should > ignore desktop entries with an unknown type. This commit adds an enum to capture these types, and adds `type` to DRunModeEntry. [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html part of #1166 * [DRun] Sanity check Link entries and capture the URL Note that we're introducing some logic that will differ depending on the Desktop entry type (Application or Link). The logic is: - if entry is Application type, - then Exec is required - and the value is saved in .exec - and drun_mode_result calls exec_cmd_entry - if entry is Link type, - then URL is required (but is not saved in the DRunModeEntry) - and drun_mode_result calls new function launch_link_entry part of #1166 * [DRun] Launch desktop links via xdg-open Note that this introduces a new dependency on xdg-open, which may not be installed. In that case, rofi will display an error dialog with something like: "Failed to execute child process xdg-open (No such file or directory)" which hopefully is explanatory enough for folks. part of #1166 * Make drun options comments consistent and add a bit of whitespace * [DRun] new config option drun-url-launcher for opening links In previous commit, this was a hard-coded string. part of #1166
2020-08-26 15:10:04 -04:00
/** Desktop entries to match in drun */
2022-02-07 17:16:46 -05:00
.drun_match_fields = "name,generic,exec,categories,keywords",
Follow Type=Link standard desktop entries with drun (#1168) * [DRun] Introduce data structure changes for Link desktop entries From the [freedesktop spec][1]: > This specification defines 3 types of desktop entries: > Application (type 1), Link (type 2) and Directory (type 3). To allow > the addition of new types in the future, implementations should > ignore desktop entries with an unknown type. This commit adds an enum to capture these types, and adds `type` to DRunModeEntry. [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html part of #1166 * [DRun] Sanity check Link entries and capture the URL Note that we're introducing some logic that will differ depending on the Desktop entry type (Application or Link). The logic is: - if entry is Application type, - then Exec is required - and the value is saved in .exec - and drun_mode_result calls exec_cmd_entry - if entry is Link type, - then URL is required (but is not saved in the DRunModeEntry) - and drun_mode_result calls new function launch_link_entry part of #1166 * [DRun] Launch desktop links via xdg-open Note that this introduces a new dependency on xdg-open, which may not be installed. In that case, rofi will display an error dialog with something like: "Failed to execute child process xdg-open (No such file or directory)" which hopefully is explanatory enough for folks. part of #1166 * Make drun options comments consistent and add a bit of whitespace * [DRun] new config option drun-url-launcher for opening links In previous commit, this was a hard-coded string. part of #1166
2020-08-26 15:10:04 -04:00
/** Only show entries in this category */
2022-02-07 17:16:46 -05:00
.drun_categories = NULL,
/** Desktop entry show actions */
2022-02-07 17:16:46 -05:00
.drun_show_actions = FALSE,
Follow Type=Link standard desktop entries with drun (#1168) * [DRun] Introduce data structure changes for Link desktop entries From the [freedesktop spec][1]: > This specification defines 3 types of desktop entries: > Application (type 1), Link (type 2) and Directory (type 3). To allow > the addition of new types in the future, implementations should > ignore desktop entries with an unknown type. This commit adds an enum to capture these types, and adds `type` to DRunModeEntry. [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html part of #1166 * [DRun] Sanity check Link entries and capture the URL Note that we're introducing some logic that will differ depending on the Desktop entry type (Application or Link). The logic is: - if entry is Application type, - then Exec is required - and the value is saved in .exec - and drun_mode_result calls exec_cmd_entry - if entry is Link type, - then URL is required (but is not saved in the DRunModeEntry) - and drun_mode_result calls new function launch_link_entry part of #1166 * [DRun] Launch desktop links via xdg-open Note that this introduces a new dependency on xdg-open, which may not be installed. In that case, rofi will display an error dialog with something like: "Failed to execute child process xdg-open (No such file or directory)" which hopefully is explanatory enough for folks. part of #1166 * Make drun options comments consistent and add a bit of whitespace * [DRun] new config option drun-url-launcher for opening links In previous commit, this was a hard-coded string. part of #1166
2020-08-26 15:10:04 -04:00
/** Desktop format display */
2022-02-07 17:16:46 -05:00
.drun_display_format =
"{name} [<span weight='light' size='small'><i>({generic})</i></span>]",
Follow Type=Link standard desktop entries with drun (#1168) * [DRun] Introduce data structure changes for Link desktop entries From the [freedesktop spec][1]: > This specification defines 3 types of desktop entries: > Application (type 1), Link (type 2) and Directory (type 3). To allow > the addition of new types in the future, implementations should > ignore desktop entries with an unknown type. This commit adds an enum to capture these types, and adds `type` to DRunModeEntry. [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html part of #1166 * [DRun] Sanity check Link entries and capture the URL Note that we're introducing some logic that will differ depending on the Desktop entry type (Application or Link). The logic is: - if entry is Application type, - then Exec is required - and the value is saved in .exec - and drun_mode_result calls exec_cmd_entry - if entry is Link type, - then URL is required (but is not saved in the DRunModeEntry) - and drun_mode_result calls new function launch_link_entry part of #1166 * [DRun] Launch desktop links via xdg-open Note that this introduces a new dependency on xdg-open, which may not be installed. In that case, rofi will display an error dialog with something like: "Failed to execute child process xdg-open (No such file or directory)" which hopefully is explanatory enough for folks. part of #1166 * Make drun options comments consistent and add a bit of whitespace * [DRun] new config option drun-url-launcher for opening links In previous commit, this was a hard-coded string. part of #1166
2020-08-26 15:10:04 -04:00
/** Desktop Link launch command */
2022-02-07 17:16:46 -05:00
.drun_url_launcher = "xdg-open",
Follow Type=Link standard desktop entries with drun (#1168) * [DRun] Introduce data structure changes for Link desktop entries From the [freedesktop spec][1]: > This specification defines 3 types of desktop entries: > Application (type 1), Link (type 2) and Directory (type 3). To allow > the addition of new types in the future, implementations should > ignore desktop entries with an unknown type. This commit adds an enum to capture these types, and adds `type` to DRunModeEntry. [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html part of #1166 * [DRun] Sanity check Link entries and capture the URL Note that we're introducing some logic that will differ depending on the Desktop entry type (Application or Link). The logic is: - if entry is Application type, - then Exec is required - and the value is saved in .exec - and drun_mode_result calls exec_cmd_entry - if entry is Link type, - then URL is required (but is not saved in the DRunModeEntry) - and drun_mode_result calls new function launch_link_entry part of #1166 * [DRun] Launch desktop links via xdg-open Note that this introduces a new dependency on xdg-open, which may not be installed. In that case, rofi will display an error dialog with something like: "Failed to execute child process xdg-open (No such file or directory)" which hopefully is explanatory enough for folks. part of #1166 * Make drun options comments consistent and add a bit of whitespace * [DRun] new config option drun-url-launcher for opening links In previous commit, this was a hard-coded string. part of #1166
2020-08-26 15:10:04 -04:00
/** Window fields to match in window mode*/
2022-02-07 17:16:46 -05:00
.window_match_fields = "all",
2015-08-02 09:45:52 -04:00
/** Monitor */
2022-02-07 17:16:46 -05:00
.monitor = "-5",
2015-09-04 15:08:23 -04:00
/** Set filter */
2022-02-07 17:16:46 -05:00
.filter = NULL,
.dpi = -1,
.threads = 0,
.scroll_method = 0,
.window_format = "{w} {c} {t}",
.click_to_exit = TRUE,
.theme = NULL,
.plugin_path = PLUGIN_PATH,
.max_history_size = 25,
.combi_hide_mode_prefix = FALSE,
.combi_display_format = "{mode} {text}",
2022-02-07 17:16:46 -05:00
.matching_negate_char = '-',
2022-02-07 17:16:46 -05:00
.cache_dir = NULL,
.window_thumbnail = FALSE,
Follow Type=Link standard desktop entries with drun (#1168) * [DRun] Introduce data structure changes for Link desktop entries From the [freedesktop spec][1]: > This specification defines 3 types of desktop entries: > Application (type 1), Link (type 2) and Directory (type 3). To allow > the addition of new types in the future, implementations should > ignore desktop entries with an unknown type. This commit adds an enum to capture these types, and adds `type` to DRunModeEntry. [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html part of #1166 * [DRun] Sanity check Link entries and capture the URL Note that we're introducing some logic that will differ depending on the Desktop entry type (Application or Link). The logic is: - if entry is Application type, - then Exec is required - and the value is saved in .exec - and drun_mode_result calls exec_cmd_entry - if entry is Link type, - then URL is required (but is not saved in the DRunModeEntry) - and drun_mode_result calls new function launch_link_entry part of #1166 * [DRun] Launch desktop links via xdg-open Note that this introduces a new dependency on xdg-open, which may not be installed. In that case, rofi will display an error dialog with something like: "Failed to execute child process xdg-open (No such file or directory)" which hopefully is explanatory enough for folks. part of #1166 * Make drun options comments consistent and add a bit of whitespace * [DRun] new config option drun-url-launcher for opening links In previous commit, this was a hard-coded string. part of #1166
2020-08-26 15:10:04 -04:00
/** drun cache */
2022-02-07 17:16:46 -05:00
.drun_use_desktop_cache = FALSE,
2020-05-12 04:34:04 -04:00
.drun_reload_desktop_cache = FALSE,
Follow Type=Link standard desktop entries with drun (#1168) * [DRun] Introduce data structure changes for Link desktop entries From the [freedesktop spec][1]: > This specification defines 3 types of desktop entries: > Application (type 1), Link (type 2) and Directory (type 3). To allow > the addition of new types in the future, implementations should > ignore desktop entries with an unknown type. This commit adds an enum to capture these types, and adds `type` to DRunModeEntry. [1]: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html part of #1166 * [DRun] Sanity check Link entries and capture the URL Note that we're introducing some logic that will differ depending on the Desktop entry type (Application or Link). The logic is: - if entry is Application type, - then Exec is required - and the value is saved in .exec - and drun_mode_result calls exec_cmd_entry - if entry is Link type, - then URL is required (but is not saved in the DRunModeEntry) - and drun_mode_result calls new function launch_link_entry part of #1166 * [DRun] Launch desktop links via xdg-open Note that this introduces a new dependency on xdg-open, which may not be installed. In that case, rofi will display an error dialog with something like: "Failed to execute child process xdg-open (No such file or directory)" which hopefully is explanatory enough for folks. part of #1166 * Make drun options comments consistent and add a bit of whitespace * [DRun] new config option drun-url-launcher for opening links In previous commit, this was a hard-coded string. part of #1166
2020-08-26 15:10:04 -04:00
2020-05-12 04:34:04 -04:00
/** Benchmarks */
2022-02-07 17:16:46 -05:00
.benchmark_ui = FALSE,
/** normalize match */
2022-02-07 17:16:46 -05:00
.normalize_match = FALSE,
/** steal focus */
2022-02-07 17:16:46 -05:00
.steal_focus = FALSE,
2021-06-08 14:21:28 -04:00
/** fallback icon */
.application_fallback_icon = NULL,
/** refilter limit in ms*/
.refilter_timeout_limit = 300,
/** workaround for broken xserver (#300 on xserver, #611) */
.xserver_i300_workaround = FALSE,
Merging in the Recursive file browser. Squashed commit of the following: commit 92e730076d461622dc81e44e87ec456317514904 Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 11 18:17:12 2023 +0200 [Doc] Add regex filtering to recursivebrowser. commit ee80c8487f9765b1e6e8ab8219a6baea089cf5af Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 11 17:49:29 2023 +0200 [recursivebrowser] Update manpage. commit a24b68f52362aaf1461935c2340e3bf5e31da59d Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 11 17:37:56 2023 +0200 [Mode] Add some extra validating of the mode selected to complete. commit cf497e8685e806521c0f61922827687adce268c9 Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 4 15:12:31 2023 +0200 [Recursive browser] Make completer selectable. commit 722f07a803c28a406d8a610f31a24b3f7247b9ba Author: Dave Davenport <qball@gmpclient.org> Date: Sun Jun 4 14:36:14 2023 +0200 Add methods for completer to modes. commit 7972420c30275514751802d1ed517a45bbd83da1 Author: Qball Cow <qball@blame.services> Date: Thu Jun 1 21:56:06 2023 +0200 Prepare updates for new APIs. commit dd3035a1a61f8196d394f6867701a0e1b3af30ac Author: Dave Davenport <qball@gmpclient.org> Date: Wed May 10 19:24:48 2023 +0200 [RB] Fix regex and cleanups commit 4d2941caf32dfb946aee54c467c1319c7a89804a Author: Dave Davenport <qball@blame.services> Date: Wed May 10 18:09:54 2023 +0200 [RB] Add (unfinished regex test) commit 848277001fc8cf9afc538067f2afa24a174f8c7f Author: Dave Davenport <qball@blame.services> Date: Wed May 10 17:49:16 2023 +0200 [RB] Pull the scanning into a separate thread. commit f369a7f63f618bbcad10c18e73f7e2b117c515f1 Author: Dave Davenport <qball@gmpclient.org> Date: Wed May 3 18:35:15 2023 +0200 [Recursive File Browser] First test version.
2023-06-12 13:07:00 -04:00
/** What browser to use for completion */
.completer_mode = "filebrowser",
};