Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fan sensors #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions SensorsUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
058B8EBE2994387900263FE9 /* SensorsKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 058B8E96299436D900263FE9 /* SensorsKit.framework */; };
058B8EBF2994387900263FE9 /* SensorsKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 058B8E96299436D900263FE9 /* SensorsKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
05BDE9EE29944B9D00B0B888 /* AmbiantLightTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 05BDE9EC29944B9D00B0B888 /* AmbiantLightTemplate.pdf */; };
38B72A892C53DAE100AD0B87 /* FanTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 38B72A882C53DAE100AD0B87 /* FanTemplate.pdf */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -115,6 +116,7 @@
05BDE9EC29944B9D00B0B888 /* AmbiantLightTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = AmbiantLightTemplate.pdf; sourceTree = "<group>"; };
05E0C31B268635C300D1D216 /* SensorItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SensorItem.swift; sourceTree = "<group>"; };
05E0C31E268635F200D1D216 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SensorItem.xib; sourceTree = "<group>"; };
38B72A882C53DAE100AD0B87 /* FanTemplate.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = FanTemplate.pdf; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -274,6 +276,7 @@
0566B9402686438E006EE45A /* CurrentTemplate.pdf */,
0566B9412686438E006EE45A /* ThermalTemplate.pdf */,
0566B93F2686438E006EE45A /* VoltageTemplate.pdf */,
38B72A882C53DAE100AD0B87 /* FanTemplate.pdf */,
);
path = Images;
sourceTree = "<group>";
Expand Down Expand Up @@ -397,6 +400,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
38B72A892C53DAE100AD0B87 /* FanTemplate.pdf in Resources */,
058B8EBC2994386E00263FE9 /* ThermalTemplate.pdf in Resources */,
058B8EBA2994386B00263FE9 /* SensorItem.xib in Resources */,
058B8EBD2994386E00263FE9 /* VoltageTemplate.pdf in Resources */,
Expand Down
28 changes: 20 additions & 8 deletions SensorsUI/Base.lproj/SensorsWindowController.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22689"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -19,7 +19,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="800" height="515"/>
<rect key="screenRect" x="0.0" y="0.0" width="1710" height="1069"/>
<rect key="screenRect" x="0.0" y="0.0" width="1496" height="933"/>
<value key="minSize" type="size" width="800" height="515"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="800" height="515"/>
Expand Down Expand Up @@ -84,7 +84,7 @@
</connections>
</searchField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CWx-dr-5aC">
<rect key="frame" x="18" y="51" width="103" height="18"/>
<rect key="frame" x="72" y="51" width="103" height="18"/>
<buttonCell key="cell" type="check" title="Temperature" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="lZo-Np-2Ev">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -94,7 +94,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YH9-KV-isM">
<rect key="frame" x="127" y="51" width="72" height="18"/>
<rect key="frame" x="181" y="51" width="72" height="18"/>
<buttonCell key="cell" type="check" title="Voltage" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="7Kn-WX-eN1">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -104,7 +104,7 @@
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DL0-ry-nBa">
<rect key="frame" x="205" y="51" width="72" height="18"/>
<rect key="frame" x="259" y="51" width="72" height="18"/>
<buttonCell key="cell" type="check" title="Current" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="WBA-tr-bDK">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Expand Down Expand Up @@ -184,7 +184,7 @@
</connections>
</popUpButton>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hrk-vg-auZ">
<rect key="frame" x="283" y="51" width="111" height="18"/>
<rect key="frame" x="337" y="51" width="111" height="18"/>
<buttonCell key="cell" type="check" title="Ambiant Light" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="bE7-Y7-akv">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -193,22 +193,33 @@
<binding destination="-2" name="value" keyPath="self.showAmbiantLight" id="ZS7-L0-tjW"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e11-jk-0ae">
<rect key="frame" x="18" y="51" width="48" height="18"/>
<buttonCell key="cell" type="check" title="Fan" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="HPT-Ka-ZPv">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="-2" name="value" keyPath="self.showFanSpeed" id="rqU-2d-YJl"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="Hrk-vg-auZ" firstAttribute="centerY" secondItem="wh8-P7-8p4" secondAttribute="centerY" id="2nG-aV-hNm"/>
<constraint firstAttribute="bottom" secondItem="YK3-dt-Gbg" secondAttribute="bottom" constant="20" symbolic="YES" id="5rr-n1-gE9"/>
<constraint firstItem="0b0-bM-ppa" firstAttribute="leading" secondItem="X4f-ON-Yh7" secondAttribute="leading" constant="20" symbolic="YES" id="7Hg-zM-lO0"/>
<constraint firstItem="YH9-KV-isM" firstAttribute="centerY" secondItem="CWx-dr-5aC" secondAttribute="centerY" id="DiY-62-WNM"/>
<constraint firstItem="e11-jk-0ae" firstAttribute="leading" secondItem="X4f-ON-Yh7" secondAttribute="leading" constant="20" symbolic="YES" id="J3U-t2-Tmn"/>
<constraint firstItem="Hrk-vg-auZ" firstAttribute="centerY" secondItem="DL0-ry-nBa" secondAttribute="centerY" id="KOd-wl-wFa"/>
<constraint firstItem="AZ7-l5-9da" firstAttribute="leading" secondItem="X4f-ON-Yh7" secondAttribute="leading" constant="20" symbolic="YES" id="Kg6-oj-ya0"/>
<constraint firstItem="CWx-dr-5aC" firstAttribute="leading" secondItem="e11-jk-0ae" secondAttribute="trailing" constant="8" symbolic="YES" id="KqD-gO-3M7"/>
<constraint firstItem="0b0-bM-ppa" firstAttribute="top" secondItem="X4f-ON-Yh7" secondAttribute="top" constant="20" symbolic="YES" id="MLt-9Q-NWw"/>
<constraint firstItem="wQZ-5m-sLD" firstAttribute="leading" secondItem="AZ7-l5-9da" secondAttribute="trailing" constant="8" symbolic="YES" id="TAj-3M-Ri4"/>
<constraint firstItem="DL0-ry-nBa" firstAttribute="centerY" secondItem="YH9-KV-isM" secondAttribute="centerY" id="UFB-Be-d69"/>
<constraint firstItem="b2Z-bC-lIL" firstAttribute="leading" secondItem="wh8-P7-8p4" secondAttribute="trailing" constant="8" symbolic="YES" id="V4o-Be-jIe"/>
<constraint firstItem="AW4-o1-MSW" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="wQZ-5m-sLD" secondAttribute="trailing" constant="8" symbolic="YES" id="YkP-QE-ySV"/>
<constraint firstItem="YK3-dt-Gbg" firstAttribute="leading" secondItem="AW4-o1-MSW" secondAttribute="trailing" constant="8" symbolic="YES" id="Yp3-Ns-Xe4"/>
<constraint firstItem="wQZ-5m-sLD" firstAttribute="centerY" secondItem="AW4-o1-MSW" secondAttribute="centerY" id="hsM-d4-60o"/>
<constraint firstItem="CWx-dr-5aC" firstAttribute="leading" secondItem="X4f-ON-Yh7" secondAttribute="leading" constant="20" symbolic="YES" id="kHN-fy-wU3"/>
<constraint firstItem="DL0-ry-nBa" firstAttribute="leading" secondItem="YH9-KV-isM" secondAttribute="trailing" constant="8" symbolic="YES" id="kXC-gz-rYd"/>
<constraint firstItem="YK3-dt-Gbg" firstAttribute="width" secondItem="b2Z-bC-lIL" secondAttribute="width" id="loy-q5-zWp"/>
<constraint firstAttribute="trailing" secondItem="YK3-dt-Gbg" secondAttribute="trailing" constant="20" symbolic="YES" id="m9H-b7-C5r"/>
Expand All @@ -217,6 +228,7 @@
<constraint firstItem="Hrk-vg-auZ" firstAttribute="leading" secondItem="DL0-ry-nBa" secondAttribute="trailing" constant="8" symbolic="YES" id="pMl-Xf-05h"/>
<constraint firstItem="AW4-o1-MSW" firstAttribute="centerY" secondItem="YK3-dt-Gbg" secondAttribute="centerY" id="rQy-7z-w4x"/>
<constraint firstItem="YH9-KV-isM" firstAttribute="leading" secondItem="CWx-dr-5aC" secondAttribute="trailing" constant="8" symbolic="YES" id="sOb-Yn-u3A"/>
<constraint firstItem="e11-jk-0ae" firstAttribute="centerY" secondItem="CWx-dr-5aC" secondAttribute="centerY" id="t0X-Oq-BFX"/>
<constraint firstAttribute="trailing" secondItem="0b0-bM-ppa" secondAttribute="trailing" constant="20" symbolic="YES" id="vhy-3U-orM"/>
<constraint firstAttribute="trailing" secondItem="b2Z-bC-lIL" secondAttribute="trailing" constant="20" symbolic="YES" id="vmq-Sh-oFu"/>
<constraint firstItem="b2Z-bC-lIL" firstAttribute="centerY" secondItem="wh8-P7-8p4" secondAttribute="centerY" id="wRu-AK-pi5"/>
Expand Down
1 change: 1 addition & 0 deletions SensorsUI/Colors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class Colors
switch kind
{
case .thermal: return NSColor.systemOrange
case .rpm: return NSColor.systemBlue
case .voltage: return NSColor.systemPurple
case .current: return NSColor.systemTeal
case .ambiantLight: return NSColor.systemYellow
Expand Down
Binary file added SensorsUI/Images/FanTemplate.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions SensorsUI/SensorIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class SensorIcon: ValueTransformer
switch data.kind
{
case .thermal: return self.image( named: "ThermalTemplate" )?.tinted( with: Colors.color( for: data.kind ) )
case .rpm: return self.image( named: "FanTemplate" )?.tinted(with: Colors.color(for: data.kind ) )
case .voltage: return self.image( named: "VoltageTemplate" )?.tinted( with: Colors.color( for: data.kind ) )
case .current: return self.image( named: "CurrentTemplate" )?.tinted( with: Colors.color( for: data.kind ) )
case .ambiantLight: return self.image( named: "AmbiantLightTemplate" )?.tinted( with: Colors.color( for: data.kind ) )
Expand Down
14 changes: 14 additions & 0 deletions SensorsUI/SensorsWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public class SensorsWindowController: NSWindowController
}
}

@objc private dynamic var showFanSpeed = UserDefaults.standard.object( forKey: "sensorsWindowShowFanSpeed" ) as? Bool ?? true
{
didSet
{
self.updateFilters()
UserDefaults.standard.set( self.showFanSpeed, forKey: "sensorsWindowShowFanSpeed" )
}
}

@objc private dynamic var showIOHID = UserDefaults.standard.object( forKey: "sensorsWindowShowIOHID" ) as? Bool ?? true
{
didSet
Expand Down Expand Up @@ -151,6 +160,11 @@ public class SensorsWindowController: NSWindowController
predicates.append( NSPredicate { o, i in ( o as? SensorHistoryData )?.kind != .ambiantLight } )
}

if self.showFanSpeed == false
{
predicates.append( NSPredicate { o, i in ( o as? SensorHistoryData )?.kind != .rpm } )
}

if self.showIOHID == false
{
predicates.append( NSPredicate { o, i in ( o as? SensorHistoryData )?.source != .hid } )
Expand Down