This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
4,113 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
# VirtualDesktopNameDeskband | ||
Deskband for Taskbar to show the name of current Virtual Desktop | ||
|
||
This is a deskband to show the name of current virtual desktop. It based on the great projects [CSDeskBand](https://github.com/dsafa/CSDeskBand) by dsafa and [VirtualDesktop](https://github.com/MScholtes/VirtualDesktop) by MScholtes. | ||
|
||
## Installation | ||
|
||
Clone the repository and generate an `*.pfx` file for a strong name signed assembly. After building you can use the small scripts (you can edit the `*.bat` files for fix the correct path to the _regasm_ tool) to register the assembly. Restart the **Explorer.exe** and add the deskband via contextmenu. | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT](LICENSE) License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.30128.74 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualDesktopNameDeskband", "VirtualDesktopNameDeskband\VirtualDesktopNameDeskband.csproj", "{2FE3E039-AB45-408D-94AD-45D7B05DA1AB}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2FE3E039-AB45-408D-94AD-45D7B05DA1AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{2FE3E039-AB45-408D-94AD-45D7B05DA1AB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{2FE3E039-AB45-408D-94AD-45D7B05DA1AB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{2FE3E039-AB45-408D-94AD-45D7B05DA1AB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {739765EB-64E9-4465-A882-259F44A97DEC} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<UserControl x:Class="VirtualDesktopNameDeskband.DeskbandView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:VirtualDesktopNameDeskband" | ||
mc:Ignorable="d" | ||
Height="28" Width="70" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Stretch"> | ||
<Grid> | ||
<TextBlock x:Name="txtBlock" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Desktop 1" TextWrapping="Wrap"/> | ||
</Grid> | ||
</UserControl> |
62 changes: 62 additions & 0 deletions
62
src/VirtualDesktopNameDeskband/Controls/DeskbandView.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using VirtualDesktop; | ||
using FormsKeys = System.Windows.Forms.Keys; | ||
|
||
namespace VirtualDesktopNameDeskband | ||
{ | ||
/// <summary> | ||
/// Interaktionslogik für UserControl1.xaml | ||
/// </summary> | ||
public partial class DeskbandView : UserControl | ||
{ | ||
readonly GlobalKeyboardHook globalKeyboardHook; | ||
|
||
public DeskbandView() | ||
{ | ||
InitializeComponent(); | ||
|
||
globalKeyboardHook = new GlobalKeyboardHook(new FormsKeys[] { FormsKeys.D, FormsKeys.Left, FormsKeys.Right, FormsKeys.F4 }); | ||
globalKeyboardHook.KeyboardPressed += GlobalKeyboardHook_KeyboardPressed; | ||
|
||
txtBlock.Text = Desktop.Current.Name; | ||
} | ||
|
||
private void GlobalKeyboardHook_KeyboardPressed(object sender, GlobalKeyboardHookEventArgs e) | ||
{ | ||
if (e.KeyboardState == GlobalKeyboardHook.KeyboardState.KeyUp && Keyboard.IsKeyDown(FormsKeys.LControlKey) && Keyboard.IsKeyDown(FormsKeys.LWin)) | ||
{ | ||
switch (e.KeyboardData.Key) | ||
{ | ||
case FormsKeys.D: | ||
case FormsKeys.F4: | ||
case FormsKeys.Left: | ||
case FormsKeys.Right: | ||
txtBlock.Text = Desktop.Current.Name; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
internal void Close() | ||
{ | ||
globalKeyboardHook.KeyboardPressed -= GlobalKeyboardHook_KeyboardPressed; | ||
globalKeyboardHook.Dispose(); | ||
} | ||
|
||
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) | ||
{ | ||
base.OnRenderSizeChanged(sizeInfo); | ||
SetHeightTo100Percent(); | ||
} | ||
|
||
protected override void OnInitialized(EventArgs e) | ||
{ | ||
base.OnInitialized(e); | ||
SetHeightTo100Percent(); | ||
} | ||
|
||
private void SetHeightTo100Percent() => Height = SystemParameters.PrimaryScreenHeight - SystemParameters.WorkArea.Height; | ||
} | ||
} |
Oops, something went wrong.