33 lines
		
	
	
		
			858 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			858 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { App, Astal, Gtk, Gdk } from "astal/gtk4"
 | 
						|
import { Variable } from "astal"
 | 
						|
 | 
						|
function hide() {
 | 
						|
    App.get_window("launcher")!.hide()
 | 
						|
}
 | 
						|
 | 
						|
export default function Launcher(monitor: Gdk.Monitor) {
 | 
						|
    const { CENTER } = Gtk.Align
 | 
						|
    const width = Variable(1000)
 | 
						|
 | 
						|
    const text = Variable("")
 | 
						|
 | 
						|
    return <window
 | 
						|
        name="launcher"
 | 
						|
        anchor={Astal.WindowAnchor.TOP | Astal.WindowAnchor.BOTTOM}
 | 
						|
        exclusivity={Astal.Exclusivity.IGNORE}
 | 
						|
        keymode={Astal.Keymode.ON_DEMAND}
 | 
						|
        application={App}
 | 
						|
        onShow={(self) => {
 | 
						|
            text.set("")
 | 
						|
            width.set(self.get_current_monitor().get_width_mm())
 | 
						|
        }}
 | 
						|
        onKeyPressed={(self, keyval, keycode) => {
 | 
						|
            print( 'key pressed: ' + keyval + ' which has code ' + keycode );
 | 
						|
        }}>
 | 
						|
        <box>
 | 
						|
            
 | 
						|
        </box>
 | 
						|
 | 
						|
        </window>
 | 
						|
}
 |