[AGS] Brightness: Fix, add CLI
This commit is contained in:
		| @@ -3,8 +3,7 @@ import style from "./style.scss" | ||||
| import Bar from "./components/bar/Bar"; | ||||
| import AstalHyprland from "gi://AstalHyprland?version=0.1"; | ||||
| import { hyprToGdk } from "./util/hyprland"; | ||||
| import { writeFile } from "astal"; | ||||
| import Launcher from "./components/launcher/Launcher"; | ||||
| import Brightness from "./util/brightness"; | ||||
|  | ||||
| App.start({ | ||||
|     instanceName: "runner", | ||||
| @@ -58,6 +57,32 @@ App.start({ | ||||
|             // res( notifications.cliHandler( args ) ); | ||||
|         } else if ( args[ 0 ] === 'bar' ) { | ||||
|             res( Bar.cliHandler( args ) ); | ||||
|         } else if ( args[ 0 ] === 'brightness' ) { | ||||
|             try { | ||||
|                 const brightness = Brightness.get_default(); | ||||
|                 if ( brightness.screenAvailable ) { | ||||
|                     if ( args[ 1 ] === 'increase' ) { | ||||
|                         brightness.screen += args.length > 1 ? parseInt( args[ 2 ] ) / 100 : 1; | ||||
|                     } else if ( args[ 1 ] === 'decrease' ) { | ||||
|                         brightness.screen -= args.length > 1 ? parseInt( args[ 2 ] ) / 100 : 1; | ||||
|                     } else if ( args[ 1 ] === 'set' ) { | ||||
|                         if ( args.length > 1 ) { | ||||
|                             brightness.screen = parseInt( args[ 2 ] ) / 100; | ||||
|                         } else { | ||||
|                             res( 'Argument <brightness> unspecified' ); | ||||
|                             return; | ||||
|                         } | ||||
|                     } else { | ||||
|                         res( 'Unknown command ' + args[ 1 ] ); | ||||
|                         return; | ||||
|                     } | ||||
|                     res( 'Ok' ); | ||||
|                 } else { | ||||
|                     res( 'No controllable screen available' ); | ||||
|                 } | ||||
|             } catch ( e ) { | ||||
|                 res( 'Error running brightness change' ); | ||||
|             } | ||||
|         } | ||||
|         // } else if ( args[ 0 ] === 'launcher' ) { | ||||
|         //     if ( args[ 1 ] === 'show' ) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user