-
-
Notifications
You must be signed in to change notification settings - Fork 954
/
Copy pathconstants.swift
86 lines (77 loc) · 2.1 KB
/
constants.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// constants.swift
// Kit
//
// Created by Serhiy Mytrovtsiy on 15/04/2020.
// Using Swift 5.0.
// Running on macOS 10.15.
//
// Copyright © 2020 Serhiy Mytrovtsiy. All rights reserved.
//
import Cocoa
public struct Popup_c_s {
public let width: CGFloat = 264
public let height: CGFloat = 300
public let margins: CGFloat = 8
public let spacing: CGFloat = 2
public let headerHeight: CGFloat = 42
public let separatorHeight: CGFloat = 30
public let portalHeight: CGFloat = 120
}
public struct Settings_c_s {
public let width: CGFloat = 540
public let height: CGFloat = 480
public let margin: CGFloat = 10
public let row: CGFloat = 30
}
public struct Widget_c_s {
public let width: CGFloat = 32
public var height: CGFloat {
get {
let systemHeight = NSApplication.shared.mainMenu?.menuBarHeight
return (systemHeight == 0 ? 22 : systemHeight) ?? 22
}
}
public var margin: CGPoint {
get {
var point: CGPoint = CGPoint(x: 2, y: 2)
if #available(macOS 11.0, *) {
point.x = 0
}
return point
}
}
public let spacing: CGFloat = 2
}
public struct Constants {
public static let Popup: Popup_c_s = Popup_c_s()
public static let Settings: Settings_c_s = Settings_c_s()
public static let Widget: Widget_c_s = Widget_c_s()
public static let defaultProcessIcon = NSWorkspace.shared.icon(forFile: "/bin/bash")
}
public enum ModuleType: Int {
case CPU
case RAM
case GPU
case disk
case sensors
case network
case battery
case bluetooth
case clock
case combined
public var rawValue: String {
switch self {
case .CPU: return "CPU"
case .RAM: return "RAM"
case .GPU: return "GPU"
case .disk: return "Disk"
case .sensors: return "Sensors"
case .network: return "Network"
case .battery: return "Battery"
case .bluetooth: return "Bluetooth"
case .clock: return "Clock"
case .combined: return ""
}
}
}