File tree 5 files changed +106
-0
lines changed
5 files changed +106
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "$schema" : " https://raw.githubusercontent.com/LGUG2Z/wpm/refs/heads/master/schema.unit.json" ,
3
+ "Unit" : {
4
+ "Name" : " komokana" ,
5
+ "Description" : " Automatic application-aware keyboard layer switching for Windows" ,
6
+ "Requires" : [
7
+ " komorebi" ,
8
+ " kanata"
9
+ ]
10
+ },
11
+ "Service" : {
12
+ "Kind" : " Simple" ,
13
+ "Autostart" : true ,
14
+ "ExecStart" : {
15
+ "Executable" : " komokana.exe" ,
16
+ "Arguments" : [
17
+ " --kanata-port" ,
18
+ " 9999" ,
19
+ " --configuration" ,
20
+ " $USERPROFILE/komokana.yaml" ,
21
+ " --default-layer" ,
22
+ " qwerty"
23
+ ]
24
+ },
25
+ "Healthcheck" : {
26
+ "Process" : {
27
+ "DelaySec" : 1
28
+ }
29
+ },
30
+ "Restart" : " OnFailure" ,
31
+ "RestartSec" : 2
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ [Unit ]
2
+ Name = " komokana"
3
+ Description = " Automatic application-aware keyboard layer switching for Windows"
4
+ Requires = [
5
+ " komorebi" ,
6
+ " kanata" ,
7
+ ]
8
+
9
+ [Service ]
10
+ Kind = " Simple"
11
+ Autostart = true
12
+ Restart = " OnFailure"
13
+ RestartSec = 2
14
+
15
+ [Service .ExecStart ]
16
+ Executable = " komokana.exe"
17
+ Arguments = [
18
+ " --kanata-port" ,
19
+ " 9999" ,
20
+ " --configuration" ,
21
+ " $USERPROFILE/komokana.yaml" ,
22
+ " --default-layer" ,
23
+ " qwerty" ,
24
+ ]
25
+
26
+ [Service .Healthcheck .Process ]
27
+ DelaySec = 1
Original file line number Diff line number Diff line change @@ -227,6 +227,39 @@ impl Definition {
227
227
exec_start_post: None ,
228
228
} ,
229
229
} ,
230
+ Self {
231
+ schema: None ,
232
+ unit: Unit {
233
+ name: "komokana" . to_string( ) ,
234
+ description: Some ( "Automatic application-aware keyboard layer switching for Windows" . to_string( ) ) ,
235
+ requires: Some ( vec![ "komorebi" . to_string( ) , "kanata" . to_string( ) ] ) ,
236
+ } ,
237
+ service: Service {
238
+ kind: ServiceKind :: Simple ,
239
+ exec_start: ServiceCommand {
240
+ executable: Executable :: Local ( PathBuf :: from( "komokana.exe" ) ) ,
241
+ arguments: Some ( vec![
242
+ "--kanata-port" . to_string( ) ,
243
+ "9999" . to_string( ) ,
244
+ "--configuration" . to_string( ) ,
245
+ "$USERPROFILE/komokana.yaml" . to_string( ) ,
246
+ "--default-layer" . to_string( ) ,
247
+ "qwerty" . to_string( )
248
+ ] ) ,
249
+ environment: None ,
250
+ } ,
251
+ environment: None ,
252
+ working_directory: None ,
253
+ healthcheck: Some ( Healthcheck :: default ( ) ) ,
254
+ restart: RestartStrategy :: OnFailure ,
255
+ restart_sec: Some ( 2 ) ,
256
+ exec_stop: None ,
257
+ exec_stop_post: None ,
258
+ autostart: true ,
259
+ exec_start_pre: None ,
260
+ exec_start_post: None ,
261
+ } ,
262
+ } ,
230
263
Self {
231
264
schema: None ,
232
265
unit: Unit {
Original file line number Diff line number Diff line change @@ -57,6 +57,13 @@ pub fn wpm_log_dir() -> PathBuf {
57
57
wpm_data_dir ( ) . join ( "logs" )
58
58
}
59
59
60
+ pub fn wpm_units_dir ( ) -> PathBuf {
61
+ dirs:: home_dir ( )
62
+ . expect ( "could not find home dir" )
63
+ . join ( ".config" )
64
+ . join ( "wpm" )
65
+ }
66
+
60
67
#[ derive( Debug , Serialize , Deserialize ) ]
61
68
pub enum SocketMessage {
62
69
Start ( Vec < String > ) ,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ use wpm::unit::Definition;
17
17
use wpm:: unit:: Executable ;
18
18
use wpm:: unit:: ScoopExecutable ;
19
19
use wpm:: wpm_data_dir;
20
+ use wpm:: wpm_units_dir;
20
21
use wpm:: SocketMessage ;
21
22
22
23
#[ derive( Parser ) ]
@@ -89,6 +90,8 @@ enum SubCommand {
89
90
Log ( Log ) ,
90
91
/// Ensure all remote dependencies are downloaded and built
91
92
Rebuild ,
93
+ /// Print the path to the wpm global unit definition directory
94
+ Units ,
92
95
}
93
96
94
97
fn listen_for_response ( ) -> Result < String , Box < dyn std:: error:: Error > > {
@@ -198,6 +201,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
198
201
}
199
202
}
200
203
}
204
+ SubCommand :: Units => {
205
+ println ! ( "{}" , wpm_units_dir( ) . display( ) ) ;
206
+ }
201
207
}
202
208
203
209
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments