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

Configure amount of seconds to hide the icons after #104

Merged
merged 1 commit into from
Apr 6, 2020
Merged
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
2 changes: 1 addition & 1 deletion Dozer/DozerIcons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public final class DozerIcons {
timerToHideDozerIcons.invalidate()
}

private func resetTimer() {
func resetTimer() {
self.stopTimer()
self.startTimer()
}
Expand Down
9 changes: 8 additions & 1 deletion Dozer/ViewControllers/GeneralVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class General: NSViewController, PreferencePane {
@IBOutlet private var CheckForUpdatesCheckbox: NSButton!
@IBOutlet private var HideStatusBarIconsAtLaunchCheckbox: NSButton!
@IBOutlet private var HideStatusBarIconsAfterDelayCheckbox: NSButton!
@IBOutlet private var HideStatusBarIconsSecondsPopUpButton: NSPopUpButton!
@IBOutlet private var HideBothDozerIconsCheckbox: NSButton!
@IBOutlet private var EnableRemoveDozerIconCheckbox: NSButton!
@IBOutlet private var ToggleMenuItemsView: MASShortcutView!
Expand All @@ -42,6 +43,7 @@ final class General: NSViewController, PreferencePane {

HideStatusBarIconsAtLaunchCheckbox.isChecked = defaults[.hideAtLaunchEnabled]
HideStatusBarIconsAfterDelayCheckbox.isChecked = defaults[.hideAfterDelayEnabled]
HideStatusBarIconsSecondsPopUpButton.selectItem(withTag: Int(defaults[.hideAfterDelay]))
HideBothDozerIconsCheckbox.isChecked = defaults[.noIconMode]
EnableRemoveDozerIconCheckbox.isChecked = defaults[.removeDozerIconEnabled]

Expand Down Expand Up @@ -72,7 +74,12 @@ final class General: NSViewController, PreferencePane {
@IBAction private func hideStatusBarIconsAfterDelayClicked(_ sender: NSButton) {
DozerIcons.shared.hideStatusBarIconsAfterDelay = HideStatusBarIconsAfterDelayCheckbox.isChecked
}


@IBAction func hideStatusBarIconsSecondsUpdated(_ sender: NSPopUpButton) {
defaults[.hideAfterDelay] = TimeInterval(HideStatusBarIconsSecondsPopUpButton.selectedTag())
DozerIcons.shared.resetTimer()
}

@IBAction private func hideBothDozerIconsClicked(_ sender: NSButton) {
DozerIcons.shared.hideBothDozerIcons = HideBothDozerIconsCheckbox.isChecked
}
Expand Down
31 changes: 27 additions & 4 deletions Dozer/XIB/General.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16096" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16096"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -12,6 +13,7 @@
<outlet property="HideBothDozerIconsCheckbox" destination="w7z-Qa-kqw" id="L5J-6S-jtb"/>
<outlet property="HideStatusBarIconsAfterDelayCheckbox" destination="hOy-nu-Sy0" id="aNv-vt-dQL"/>
<outlet property="HideStatusBarIconsAtLaunchCheckbox" destination="phN-BY-WEC" id="zff-cm-aik"/>
<outlet property="HideStatusBarIconsSecondsPopUpButton" destination="Ziw-so-qpj" id="iWr-jc-Wbb"/>
<outlet property="LaunchAtLoginCheckbox" destination="29f-2D-VsY" id="X2Z-FE-7IA"/>
<outlet property="ToggleMenuItemsView" destination="4Dt-wS-aZ8" id="PAm-fa-zGy"/>
<outlet property="view" destination="c22-O7-iKe" id="buC-Sz-vlD"/>
Expand Down Expand Up @@ -52,9 +54,9 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hOy-nu-Sy0">
<rect key="frame" x="18" y="184" width="361" height="18"/>
<rect key="frame" x="18" y="184" width="183" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Hide status bar icons after 10 seconds" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="hS1-gl-Pc1">
<buttonCell key="cell" type="check" title="Hide status bar icons after" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="hS1-gl-Pc1">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
Expand Down Expand Up @@ -136,6 +138,27 @@
<action selector="automaticallyCheckForUpdatesClicked:" target="-2" id="TJa-HP-dNZ"/>
</connections>
</button>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ziw-so-qpj" userLabel="10 seconds">
<rect key="frame" x="205" y="179" width="114" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="10 seconds" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="10" imageScaling="proportionallyDown" inset="2" selectedItem="OdJ-mZ-u0T" id="JbX-Xw-iVE" userLabel="10 seconds">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<menu key="menu" id="fJp-Cl-42M">
<items>
<menuItem title="30 seconds" tag="30" id="dAj-2T-ECp"/>
<menuItem title="20 seconds" tag="20" id="tfP-VF-MG8"/>
<menuItem title="15 seconds" tag="15" id="EK8-vh-0H9"/>
<menuItem title="10 seconds" state="on" tag="10" id="OdJ-mZ-u0T"/>
<menuItem title="5 seconds" tag="5" id="Uqk-BC-hfK"/>
<menuItem title="3 seconds" tag="3" id="ven-uH-a0W"/>
</items>
</menu>
</popUpButtonCell>
<connections>
<action selector="hideStatusBarIconsSecondsUpdated:" target="-2" id="07d-zi-l5c"/>
</connections>
</popUpButton>
</subviews>
<constraints>
<constraint firstAttribute="width" constant="397" id="WEJ-WZ-mea"/>
Expand Down