Skip to content

Commit

Permalink
Add hotkey to open LightBulb from tray (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz authored Jul 18, 2024
1 parent f1e041c commit d1d8de8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
7 changes: 7 additions & 0 deletions LightBulb/Services/SettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,13 @@ public IReadOnlyList<ExternalApplication>? WhitelistedApplications

// HotKeys

private HotKey _focusWindowHotKey;
public HotKey FocusWindowHotKey
{
get => _focusWindowHotKey;
set => SetProperty(ref _focusWindowHotKey, value);
}

private HotKey _toggleHotKey;
public HotKey ToggleHotKey
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ namespace LightBulb.ViewModels.Components.Settings;
public class HotKeySettingsTabViewModel(SettingsService settingsService)
: SettingsTabViewModelBase(settingsService, 4, "Hotkeys")
{
public HotKey FocusWindowHotKey
{
get => SettingsService.FocusWindowHotKey;
set => SettingsService.FocusWindowHotKey = value;
}

public HotKey ToggleHotKey
{
get => SettingsService.ToggleHotKey;
Expand Down
15 changes: 14 additions & 1 deletion LightBulb/Views/Components/Settings/HotKeySettingsTabView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,21 @@
xmlns:settings="clr-namespace:LightBulb.ViewModels.Components.Settings"
x:DataType="settings:HotKeySettingsTabViewModel">
<StackPanel Margin="16" Orientation="Vertical">
<!-- Toggle hotkey -->
<!-- Focus window hotkey -->
<DockPanel>
<TextBlock
DockPanel.Dock="Left"
Text="Open LightBulb"
ToolTip.Tip="Global hotkey to bring LightBulb's main window to the foreground" />
<controls:HotKeyTextBox
Width="120"
HorizontalAlignment="Right"
DockPanel.Dock="Right"
HotKey="{Binding FocusWindowHotKey}" />
</DockPanel>

<!-- Toggle hotkey -->
<DockPanel Margin="0,16,0,0">
<TextBlock
DockPanel.Dock="Left"
Text="Toggle LightBulb"
Expand Down

0 comments on commit d1d8de8

Please sign in to comment.