Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
lutz committed Jun 14, 2020
1 parent 2feca78 commit 64b5857
Show file tree
Hide file tree
Showing 21 changed files with 4,113 additions and 84 deletions.
104 changes: 21 additions & 83 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
Expand All @@ -13,68 +12,50 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/

# Visual Studio 2015/2017 cache/options directory
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio 2017 auto generated files
Generated\ Files/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUnit
# NUNIT
*.VisualState.xml
TestResult.xml
nunit-*.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

# Benchmark Results
BenchmarkDotNet.Artifacts/

# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*_i.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
Expand All @@ -84,7 +65,6 @@ StyleCopReport.xml
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
Expand Down Expand Up @@ -113,9 +93,6 @@ ipch/
*.vspx
*.sap

# Visual Studio Trace Files
*.e2e

# TFS 2012 Local Workspace
$tf/

Expand All @@ -127,16 +104,15 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json

# Visual Studio code coverage results
*.coverage
*.coveragexml
Expand Down Expand Up @@ -172,7 +148,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand All @@ -184,14 +160,12 @@ PublishScripts/

# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
**/packages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
Expand All @@ -209,15 +183,12 @@ AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
!*.[Cc]ache/

# Others
ClientBin/
Expand All @@ -230,10 +201,6 @@ ClientBin/
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
Expand All @@ -248,8 +215,6 @@ _UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak

# SQL Server files
*.mdf
Expand All @@ -260,10 +225,6 @@ ServiceFabricBackup/
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes
FakesAssemblies/
Expand All @@ -275,6 +236,9 @@ FakesAssemblies/
.ntvs_analysis.dat
node_modules/

# Typescript v1 declaration files
typings/

# Visual Studio 6 build log
*.plg

Expand All @@ -299,8 +263,12 @@ paket-files/
# FAKE - F# Make
.fake/

# CodeRush personal settings
.cr/personal
# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/

# Python Tools for Visual Studio (PTVS)
__pycache__/
Expand All @@ -310,9 +278,6 @@ __pycache__/
# tools/**
# !tools/packages.config

# Tabs Studio
*.tss

# Telerik's JustMock configuration file
*.jmconfig

Expand All @@ -321,30 +286,3 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs

# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# BeatPulse healthcheck temp database
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
11 changes: 10 additions & 1 deletion README.md
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
25 changes: 25 additions & 0 deletions src/VirtualDesktopNameDeskband.sln
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
12 changes: 12 additions & 0 deletions src/VirtualDesktopNameDeskband/Controls/DeskbandView.xaml
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 src/VirtualDesktopNameDeskband/Controls/DeskbandView.xaml.cs
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;
}
}
Loading

0 comments on commit 64b5857

Please sign in to comment.