Restructure, prepare launcher
This commit is contained in:
		
							
								
								
									
										2
									
								
								config/ags/launcher/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								config/ags/launcher/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| node_modules/ | ||||
| @girs/ | ||||
							
								
								
									
										10
									
								
								config/ags/launcher/app.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								config/ags/launcher/app.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| import { App } from "astal/gtk3" | ||||
| import style from "./style.scss" | ||||
| import Bar from "./widget/Bar" | ||||
|  | ||||
| App.start({ | ||||
|     css: style, | ||||
|     main() { | ||||
|         App.get_monitors().map(Bar) | ||||
|     }, | ||||
| }) | ||||
							
								
								
									
										62
									
								
								config/ags/launcher/definitions/components.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								config/ags/launcher/definitions/components.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | ||||
| /* | ||||
| *               dotfiles - components.d.ts | ||||
| * | ||||
| *   Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License | ||||
| *           https://janishutz.com, development@janishutz.com | ||||
| * | ||||
| * | ||||
| */ | ||||
|  | ||||
| import type { UIComponent, ResultElement } from "./rendering"; | ||||
|  | ||||
|  | ||||
| export interface App extends ResultElement { | ||||
|     /** | ||||
|      * The app start command that will be executed | ||||
|      */ | ||||
|     command: string; | ||||
| } | ||||
|  | ||||
| // TODO: Finish | ||||
| export interface DictionaryEntry extends ResultElement { | ||||
|  | ||||
| } | ||||
|  | ||||
| // TODO: Finish | ||||
| export interface CMDOutput extends ResultElement { | ||||
|  | ||||
| } | ||||
|  | ||||
| // TODO: Finish | ||||
| export interface Calculation extends ResultElement { | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
| /* ************* * | ||||
|  * UI Components * | ||||
|  * ************* */ | ||||
|   | ||||
| export interface LargeUIComponent extends UIComponent { | ||||
|     /** | ||||
|      * The number of items to display per line. Image size will automatically be scaled | ||||
|      * based on width | ||||
|      */ | ||||
|     itemsPerLine: number; | ||||
| } | ||||
|  | ||||
| export interface MediumUIComponent extends UIComponent {} | ||||
|  | ||||
| export interface ListUIComponent extends UIComponent {} | ||||
|  | ||||
| export interface DictionaryUIComponent extends UIComponent { | ||||
|     elements: DictionaryEntry[]; | ||||
| } | ||||
|  | ||||
| export interface CMDOutputUIComponent extends UIComponent { | ||||
|     elements: CMDOutput[]; | ||||
| } | ||||
|  | ||||
| export interface CalculationUIComponent extends UIComponent { | ||||
|     elements: Calculation[]; | ||||
| } | ||||
							
								
								
									
										0
									
								
								config/ags/launcher/definitions/job.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/definitions/job.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
								
								
									
										60
									
								
								config/ags/launcher/definitions/rendering.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								config/ags/launcher/definitions/rendering.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,60 @@ | ||||
| /* | ||||
| *               dotfiles - rendering.d.ts | ||||
| * | ||||
| *   Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License | ||||
| *           https://janishutz.com, development@janishutz.com | ||||
| * | ||||
| * | ||||
| */ | ||||
|  | ||||
| export interface UIComponent { | ||||
|     /** | ||||
|      * The title of the component (like a category name), shown above small divider line | ||||
|      */ | ||||
|     title: string; | ||||
|  | ||||
|     /** | ||||
|      * ResultElement list, made up of all elements that should be shown | ||||
|      */ | ||||
|     elements: ResultElement[]; | ||||
|  | ||||
|     /** | ||||
|      * Choose how many elements to show before truncating (will expand when command is run) | ||||
|      */ | ||||
|     truncate: number; | ||||
|  | ||||
|     /** | ||||
|      * The weight of the element (determines order) | ||||
|      */ | ||||
|     weight: number; | ||||
| } | ||||
|  | ||||
|  | ||||
| export interface ResultElement { | ||||
|     /** | ||||
|      * The name of the result element | ||||
|      */ | ||||
|     name: string; | ||||
|  | ||||
|     /** | ||||
|      * Path to the image to be displayed in the UI | ||||
|      */ | ||||
|     img: string; | ||||
|  | ||||
|     /** | ||||
|      * The weight of the element (determines order) | ||||
|      */ | ||||
|     weight: number; | ||||
|  | ||||
|     /** | ||||
|      * The action to be executed | ||||
|      */ | ||||
|     action: Action; | ||||
|  | ||||
|     /** | ||||
|      * The font size of the text (optional) | ||||
|      */ | ||||
|     fontSize: number | undefined; | ||||
| } | ||||
|  | ||||
| type Action = ''; | ||||
							
								
								
									
										21
									
								
								config/ags/launcher/env.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								config/ags/launcher/env.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | ||||
| declare const SRC: string | ||||
|  | ||||
| declare module "inline:*" { | ||||
|     const content: string | ||||
|     export default content | ||||
| } | ||||
|  | ||||
| declare module "*.scss" { | ||||
|     const content: string | ||||
|     export default content | ||||
| } | ||||
|  | ||||
| declare module "*.blp" { | ||||
|     const content: string | ||||
|     export default content | ||||
| } | ||||
|  | ||||
| declare module "*.css" { | ||||
|     const content: string | ||||
|     export default content | ||||
| } | ||||
							
								
								
									
										6
									
								
								config/ags/launcher/package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								config/ags/launcher/package.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| { | ||||
|     "name": "astal-shell", | ||||
|     "dependencies": { | ||||
|         "astal": "/usr/share/astal/gjs" | ||||
|     } | ||||
| } | ||||
							
								
								
									
										20
									
								
								config/ags/launcher/style.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								config/ags/launcher/style.scss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| // https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/theme/Adwaita/_colors-public.scss | ||||
| $fg-color: #{"@theme_fg_color"}; | ||||
| $bg-color: #{"@theme_bg_color"}; | ||||
|  | ||||
| window.Bar { | ||||
|     background: transparent; | ||||
|     color: $fg-color; | ||||
|     font-weight: bold; | ||||
|  | ||||
|     >centerbox { | ||||
|         background: $bg-color; | ||||
|         border-radius: 10px; | ||||
|         margin: 8px; | ||||
|     } | ||||
|  | ||||
|     button { | ||||
|         border-radius: 8px; | ||||
|         margin: 2px; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										14
									
								
								config/ags/launcher/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								config/ags/launcher/tsconfig.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| { | ||||
|     "$schema": "https://json.schemastore.org/tsconfig", | ||||
|     "compilerOptions": { | ||||
|         "experimentalDecorators": true, | ||||
|         "strict": true, | ||||
|         "target": "ES2022", | ||||
|         "module": "ES2022", | ||||
|         "moduleResolution": "Bundler", | ||||
|         // "checkJs": true, | ||||
|         // "allowJs": true, | ||||
|         "jsx": "react-jsx", | ||||
|         "jsxImportSource": "astal/gtk3", | ||||
|     } | ||||
| } | ||||
							
								
								
									
										0
									
								
								config/ags/launcher/ui/AppLauncher.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/ui/AppLauncher.tsx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								config/ags/launcher/ui/components/calc.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/ui/components/calc.tsx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								config/ags/launcher/ui/components/cmd.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/ui/components/cmd.tsx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								config/ags/launcher/ui/components/dict.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/ui/components/dict.tsx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								config/ags/launcher/ui/components/large.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/ui/components/large.tsx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								config/ags/launcher/ui/components/list.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/ui/components/list.tsx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								config/ags/launcher/ui/components/medium.tsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/ui/components/medium.tsx
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										10
									
								
								config/ags/launcher/util/file.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								config/ags/launcher/util/file.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| /* | ||||
| *               dotfiles - file.ts | ||||
| * | ||||
| *   Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License | ||||
| *           https://janishutz.com, development@janishutz.com | ||||
| * | ||||
| * | ||||
| */ | ||||
|  | ||||
| import { readFileAsync, writeFileAsync, monitorFile } from "astal"; | ||||
							
								
								
									
										0
									
								
								config/ags/launcher/util/fzf.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/util/fzf.ts
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										0
									
								
								config/ags/launcher/util/search.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								config/ags/launcher/util/search.ts
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										43
									
								
								config/ags/launcher/util/subprocessRunner.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								config/ags/launcher/util/subprocessRunner.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| /* | ||||
|  *               dotfiles - subprocessRunner.ts | ||||
|  * | ||||
|  *   Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License | ||||
|  *           https://janishutz.com, development@janishutz.com | ||||
|  * | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| import { subprocess, execAsync, Process } from "astal/process"; | ||||
|  | ||||
| // TODO: Get cwd and the likes to then use that to run JavaScript files with node / python with python, etc | ||||
|  | ||||
| /** | ||||
|  * Run a subprocess. If you simply want to run a command that doesn't need continuous updates | ||||
|  * run executeCommand instead. | ||||
|  * @param cmd - The command to be run | ||||
|  * @param onOut - Calback function for stdout of the subprocess | ||||
|  * @param onErr - [TODO:description] | ||||
|  * @returns [TODO:return] | ||||
|  */ | ||||
| const startSubProcess = ( | ||||
|   cmd: string | string[], | ||||
|   onOut: (stdout: string) => void, | ||||
|   onErr: (stderr: string) => void | undefined, | ||||
| ): Process => { | ||||
|     return subprocess( cmd, onOut, onErr ); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * Run a command. If you need continuous updates, run startSubProcess instead  | ||||
|  * @param cmd - The command to be run. Either a string or an array of strings | ||||
|  * @returns A Promise resolving to stdout of the command | ||||
|  */ | ||||
| const executeCommand = (cmd: string | string[]): Promise<string> => { | ||||
|     return execAsync( cmd ); | ||||
| }; | ||||
|  | ||||
|  | ||||
| export default { | ||||
|     startSubProcess, | ||||
|     executeCommand | ||||
| } | ||||
		Reference in New Issue
	
	Block a user