From d59b22e557fa5d69ea6be725a7e5bcd829588225 Mon Sep 17 00:00:00 2001 From: Tommaso Negri Date: Sun, 9 Aug 2026 23:58:42 +0200 Subject: rename project and add documentation guides --- Sources/phbar/Views/BlockView.swift | 60 ------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 Sources/phbar/Views/BlockView.swift (limited to 'Sources/phbar/Views/BlockView.swift') diff --git a/Sources/phbar/Views/BlockView.swift b/Sources/phbar/Views/BlockView.swift deleted file mode 100644 index 85d6e6e..0000000 --- a/Sources/phbar/Views/BlockView.swift +++ /dev/null @@ -1,60 +0,0 @@ -import SwiftUI - -struct BlockView: View { - @ObservedObject var block: Block - - @State private var hovering = false - - var body: some View { - HStack(spacing: 0) { - ForEach(block.cells) { cell in - CellView(cell: cell) - } - } - .onHover { hovering = $0 } - .onAppear { - NSEvent.addLocalMonitorForEvents(matching: [ - .leftMouseDown, - .rightMouseDown, - .otherMouseDown, - .scrollWheel, - ]) { event in - handle(event: event) - } - } - } - - private func handle(event: NSEvent) -> NSEvent { - guard hovering else { return event } - - switch event.type { - case .leftMouseDown, .rightMouseDown, .otherMouseDown: - block.runScript(env: ["BUTTON": String(event.buttonNumber)]) - break - case .scrollWheel: - if event.scrollingDeltaY > 0 { - block.runScript(env: ["SCROLL": "UP"]) - break - } - - if event.scrollingDeltaY < 0 { - block.runScript(env: ["SCROLL": "DOWN"]) - break - } - - if event.scrollingDeltaX > 0 { - block.runScript(env: ["SCROLL": "RIGHT"]) - break - } - - if event.scrollingDeltaX < 0 { - block.runScript(env: ["SCROLL": "LEFT"]) - break - } - default: - break - } - - return event - } -} -- cgit v1.2.3