[Launcher] fzf, cmd processing, args

This commit is contained in:
Admin 2025-03-30 08:00:10 +02:00
parent c0e9062230
commit 666a047814
3 changed files with 40 additions and 1 deletions

View File

@ -7,4 +7,13 @@ App.start({
main() {
App.get_monitors().map(Bar)
},
requestHandler(request, res) {
if ( request === 'open' ) {
res( 'ok' );
} else if ( request === 'close' ) {
res( 'ok' );
} else if ( request === 'toggle' ) {
res( 'ok' );
}
}
})

View File

@ -0,0 +1,22 @@
/*
* dotfiles - fzf.ts
*
* Created by Janis Hutz 03/30/2025, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
*/
import AstalApps from "gi://AstalApps?version=0.1"
// TODO: For all astal apps, read a global colours config file
const fzfApplication = ( query: string ) => {
const apps = new AstalApps.Apps()
return apps.fuzzy_query( query );
}
const fzfCmd = ( query: string ) => {}
export default {
fzfApplication
}

View File

@ -8,6 +8,7 @@
*/
import subprocessRunner from "./subprocessRunner";
import fzf from "./fzf";
const preprocess = ( input: string ) => {
// Find out what kind of instruction to process
@ -19,8 +20,11 @@ const preprocess = ( input: string ) => {
// Determine if entered string is calculation or not
// We can easily do that by asking qalc (qalculate cli) if this is fine
subprocessRunner.executeCommand( 'qalc "' + input + '"' ).then( out => {
// we get a calculation result here
print( out );
processCalculation( out );
} ).catch( err => {
processSearch( input );
print( err );
} );
}
@ -30,7 +34,7 @@ const processSearch = ( input: string ) => {
}
const processCalculation = ( input: string ) => {
const processCalculation = ( output: string ) => {
}
@ -41,3 +45,7 @@ const processCommand = ( cmd: string, args: string[] ) => {
const processBang = ( bang: string, input: string ) => {
}
export default {
preprocess
}