diff options
author | Aditya <bluenerd@protonmail.com> | 2023-02-26 16:56:21 +0530 |
---|---|---|
committer | Aditya <bluenerd@protonmail.com> | 2023-02-26 16:56:21 +0530 |
commit | 5e11af40c6b399a6739918970d734e7205d3eeca (patch) | |
tree | b43d8282f023457902ad3d8c743ad814bfba0c10 /kitty/kitty-themes/.tools/windowid.swift | |
parent | 9e49894d0503cfa2d619a5285783c71d500541d0 (diff) |
update kitty config
Diffstat (limited to 'kitty/kitty-themes/.tools/windowid.swift')
-rwxr-xr-x | kitty/kitty-themes/.tools/windowid.swift | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kitty/kitty-themes/.tools/windowid.swift b/kitty/kitty-themes/.tools/windowid.swift new file mode 100755 index 0000000..1dc95e6 --- /dev/null +++ b/kitty/kitty-themes/.tools/windowid.swift @@ -0,0 +1,20 @@ +#!/usr/bin/swift +import Foundation +import Cocoa +import CoreGraphics.CGWindow + +let windows : NSArray = CGWindowListCopyWindowInfo(CGWindowListOption.excludeDesktopElements, kCGNullWindowID)! as NSArray + +let search_for_app = CommandLine.arguments[1] +let search_for_win = CommandLine.arguments[2] + +for window in windows { + let window = window as! NSDictionary + + let app_name = window[kCGWindowOwnerName] as! String + let window_name = window[kCGWindowName] as? String + + if app_name == search_for_app && window_name == search_for_win { + print("\(window[kCGWindowNumber]!)") + } +} |