Improve launcher

This commit is contained in:
Janis Hutz 2025-03-23 14:11:02 +01:00
parent d387d02534
commit 840691ec67
3 changed files with 78 additions and 5 deletions

View File

@ -1,10 +1,9 @@
import { App } from "astal/gtk3"
import style from "./style.scss"
import Bar from "./widget/Bar"
import Applauncher from "./ui/AppLauncher"
App.start({
instanceName: "launcher",
css: style,
main() {
App.get_monitors().map(Bar)
},
})
main: Applauncher,
});

View File

@ -0,0 +1,31 @@
import { App, Astal, Gtk, Gdk } from "astal/gtk3"
import { Variable } from "astal"
const time = Variable("").poll(1000, "date")
export default function AppLauncher(gdkmonitor: Gdk.Monitor) {
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
return <window
className="Bar"
gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={TOP | LEFT | RIGHT}
application={App}>
<centerbox>
<button
onClicked="echo hello"
halign={Gtk.Align.CENTER}
>
Welcome to AGS!
</button>
<box />
<button
onClicked={() => print("hello")}
halign={Gtk.Align.CENTER}
>
<label label={time()} />
</button>
</centerbox>
</window>
}

View File

@ -0,0 +1,43 @@
/*
* dotfiles - search.ts
*
* Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License
* https://janishutz.com, development@janishutz.com
*
*
*/
import subprocessRunner from "./subprocessRunner";
const preprocess = ( input: string ) => {
// Find out what kind of instruction to process
if ( input.startsWith( ':' ) ) {
processCommand( input.substring( 1, input.indexOf( ' ' ) ), input.substring( input.indexOf( ' ' ) ).split( ' ' ) );
} else if ( input.startsWith( '!' ) ) {
processBang( input.substring( 1, input.indexOf( ' ' ) ), input.substring( input.indexOf( ' ' ) ) );
} else {
// 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 => {
print( out );
} ).catch( err => {
print( err );
} );
}
}
const processSearch = ( input: string ) => {
}
const processCalculation = ( input: string ) => {
}
const processCommand = ( cmd: string, args: string[] ) => {
}
const processBang = ( bang: string, input: string ) => {
}