Skip to content

Commit

Permalink
Intial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMorc committed Apr 18, 2019
0 parents commit 234c18d
Show file tree
Hide file tree
Showing 33 changed files with 862 additions and 0 deletions.
Binary file added #124.ico
Binary file not shown.
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2011, 2012 NOVALISTIC
Copyright (c) 2019 Richard Gráčik - Morc

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Touchbar

A WPF application, written in C# that mimics the macOS Volume/Brightness HUD GUI interface.
It's based on the [WPFDraggableFrame sample application](https://github.com/NOVALISTIC/WPFDraggableFrame) by [@NOVALISTIC](https://github.com/NOVALISTIC).
It's verified working on Windows Vista, Windows 7, Windows 8 and 8.1. It also works on both 10 and 11 albeit with graphical bugs due to Aero being removed in these versions of Windows.

Don't judge the codebase. It's quite a bit sketchy and messy, basically done as best as my 15 year old mind could do back then.

## Screenshots

### Windows Vista
![volume control](https://cdn.discordapp.com/attachments/363965764987912194/1137849632727253032/image.png)

### Windows 8.1
![volume control](https://cdn.discordapp.com/attachments/363965764987912194/1137857268155678791/Snimka_obrazovky_8.png)
![brightness control](https://cdn.discordapp.com/attachments/363965764987912194/1137857268432515133/Snimka_obrazovky_7.png)

### Windows 11
![volume control](https://cdn.discordapp.com/attachments/363965764987912194/1137846928579764335/image.png)
![brightness control](https://cdn.discordapp.com/attachments/363965764987912194/1137847006879023244/image.png)

All code in this application is distributed under the original MIT license, which can be found
in [LICENSE.md](LICENSE.md).
31 changes: 31 additions & 0 deletions Touchbar.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.156
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Touchbar", "WPFDraggableFrame\Touchbar.csproj", "{9C4B28BF-26A7-4968-816A-17572F188611}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Documents", "Documents", "{278FEAC5-C803-4DD1-9D6E-7455C17DA045}"
ProjectSection(SolutionItems) = preProject
license.txt = license.txt
readme.txt = readme.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C4B28BF-26A7-4968-816A-17572F188611}.Debug|x86.ActiveCfg = Debug|x86
{9C4B28BF-26A7-4968-816A-17572F188611}.Debug|x86.Build.0 = Debug|x86
{9C4B28BF-26A7-4968-816A-17572F188611}.Release|x86.ActiveCfg = Release|x86
{9C4B28BF-26A7-4968-816A-17572F188611}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8AE9A7C9-9803-4E87-A5DE-269664DA52CF}
EndGlobalSection
EndGlobal
Binary file added WPFDraggableFrame/0.ico
Binary file not shown.
Binary file added WPFDraggableFrame/1.ico
Binary file not shown.
Binary file added WPFDraggableFrame/2.ico
Binary file not shown.
Binary file added WPFDraggableFrame/3.ico
Binary file not shown.
Binary file added WPFDraggableFrame/4.ico
Binary file not shown.
8 changes: 8 additions & 0 deletions WPFDraggableFrame/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application x:Class="WPFDraggableFrame.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
16 changes: 16 additions & 0 deletions WPFDraggableFrame/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace WPFDraggableFrame
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
44 changes: 44 additions & 0 deletions WPFDraggableFrame/DwmApiInterop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System;
using System.Runtime.InteropServices;
using System.Security;

namespace Touchbar
{
public struct DwmBlurbehind
{
public int dwFlags;
public bool fEnable;
public string hRgnBlur;
public bool fTransitionOnMaximized;
}
public static class DwmApiInterop
{
public const int DWM_BB_TRANSITIONMAXIMIZED = 0x00000004;
public const int DWM_BB_ENABLE = 0x00000001;
public const int DWM_BB_BLURREGION = 0x00000002;

public static bool IsCompositionEnabled()
{
bool isEnabled = false;
NativeMethods.DwmIsCompositionEnabled(ref isEnabled);
return isEnabled;
}

public static int ExtendFrameIntoClientArea(IntPtr hWnd, ref DwmBlurbehind blurBehind)
{
return NativeMethods.DwmEnableBlurBehindWindow(hWnd, ref blurBehind);
}

}

[SuppressUnmanagedCodeSecurity]
internal static class NativeMethods
{
[DllImport("dwmapi.dll")]
internal static extern void DwmIsCompositionEnabled(ref bool isEnabled);

[DllImport("dwmapi.dll")]
internal static extern int DwmEnableBlurBehindWindow(IntPtr hWnd, ref DwmBlurbehind blurBehind);

}
}
31 changes: 31 additions & 0 deletions WPFDraggableFrame/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Window x:Class="Touchbar.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Touchbar" Height="164" Width="164" MinHeight="164" MinWidth="164"
Loaded="Window_Loaded" SourceInitialized="Window_SourceInitialized" WindowStartupLocation="CenterScreen" HorizontalAlignment="Center" VerticalAlignment="Center" Topmost="True" ShowInTaskbar="False" WindowStyle="None">

<Grid x:Name="windowGrid" Width="150" Margin="1,-1,0,-3" HorizontalAlignment="Left">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="79*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="73*"/>
</Grid.ColumnDefinitions>
<ProgressBar HorizontalAlignment="Left" Height="20" VerticalAlignment="Top" Width="130" Margin="6,120.667,0,0" Grid.Column="1" Name="barLevel" Grid.Row="1" Foreground="#FF01D328"/>
<Image HorizontalAlignment="Left" Height="32" Margin="53,50,0,0" VerticalAlignment="Top" Width="32" Name="icon" Grid.Column="1" Grid.Row="1"/>
<Rectangle Grid.ColumnSpan="2" Fill="#FF3F3F46" HorizontalAlignment="Left" Height="9" Margin="-4,148,-8,0" Stroke="#00000000" VerticalAlignment="Top" Width="162" Grid.Row="1"/>
<Rectangle Fill="#FF3F3F46" HorizontalAlignment="Left" Height="161" Margin="145,-1,-8,0" Stroke="#00000000" VerticalAlignment="Top" Width="9" Grid.Column="1" RenderTransformOrigin="0.5,0.5" Grid.RowSpan="2">
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="0.289"/>
<TranslateTransform/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>

</Window>
Loading

0 comments on commit 234c18d

Please sign in to comment.