From 2c1dfcc71137c8e88d9beac8689e21c3590d9642 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 10 Jun 2024 22:05:29 +0700 Subject: [PATCH] change search feature user option (#587) --- .../ags/modules/.configuration/user_options.js | 18 ++++++++++++------ .config/ags/modules/overview/windowcontent.js | 12 ++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js index 751f6f15b..ab3d2a3e1 100644 --- a/.config/ags/modules/.configuration/user_options.js +++ b/.config/ags/modules/.configuration/user_options.js @@ -93,12 +93,14 @@ let configOptions = { }, 'search': { - 'enableActions': true, - 'enableCommands': true, - 'enableMathResults': true, - 'enableDirectorySearch': true, - 'enableAiSearch': true, - 'enableWebSearch': true, + 'enableFeatures': { + 'actions': true, + 'commands': true, + 'mathResults': true, + 'directorySearch': true, + 'aiSearch': true, + 'webSearch': true, + }, 'engineBaseUrl': "https://www.google.com/search?q=", 'excludedSites': ["quora.com"], }, @@ -191,6 +193,10 @@ let configOptions = { 'prevTab': "Ctrl+Page_Up", }, 'cheatsheet': { + 'keybinds': { + 'nextTab': "Page_Down", + 'prevTab': "Page_Up", + }, 'nextTab': "Ctrl+Page_Down", 'prevTab': "Ctrl+Page_Up", } diff --git a/.config/ags/modules/overview/windowcontent.js b/.config/ags/modules/overview/windowcontent.js index 95026f72b..5eb6bb568 100644 --- a/.config/ags/modules/overview/windowcontent.js +++ b/.config/ags/modules/overview/windowcontent.js @@ -119,7 +119,7 @@ export const SearchAndWindows = () => { _appSearchResults = Applications.query(text); // Calculate - if (userOptions.search.enableMathResults && couldBeMath(text)) { // Eval on typing is dangerous; this is a small workaround. + if (userOptions.search.enableFeatures.mathResults && couldBeMath(text)) { // Eval on typing is dangerous; this is a small workaround. try { const fullResult = eval(text.replace(/\^/g, "**")); resultsBox.add(CalculationResultButton({ result: fullResult, text: text })); @@ -127,14 +127,14 @@ export const SearchAndWindows = () => { // console.log(e); } } - if (userOptions.search.enableDirectorySearch && isDir) { + if (userOptions.search.enableFeatures.directorySearch && isDir) { var contents = []; contents = ls({ path: text, silent: true }); contents.forEach((item) => { resultsBox.add(DirectoryButton(item)); }) } - if (userOptions.search.enableActions && isAction) { // Eval on typing is dangerous, this is a workaround. + if (userOptions.search.enableFeatures.actions && isAction) { // Eval on typing is dangerous, this is a workaround. resultsBox.add(CustomCommandButton({ text: entry.text })); } // Add application entries @@ -147,14 +147,14 @@ export const SearchAndWindows = () => { // Fallbacks // if the first word is an actual command - if (userOptions.search.enableCommands && !isAction && !hasUnterminatedBackslash(text) && exec(`bash -c "command -v ${text.split(' ')[0]}"`) != '') { + if (userOptions.search.enableFeatures.commands && !isAction && !hasUnterminatedBackslash(text) && exec(`bash -c "command -v ${text.split(' ')[0]}"`) != '') { resultsBox.add(ExecuteCommandButton({ command: entry.text, terminal: entry.text.startsWith('sudo') })); } // Add fallback: search - if (userOptions.search.enableAiSearch) + if (userOptions.search.enableFeatures.aiSearch) resultsBox.add(AiButton({ text: entry.text })); - if (userOptions.search.enableWebSearch) + if (userOptions.search.enableFeatures.webSearch) resultsBox.add(SearchButton({ text: entry.text })); if (resultsBox.children.length == 0) resultsBox.add(NoResultButton()); resultsBox.show_all();