├── .gitattributes
├── .gitignore
├── LICENSE
├── README.md
├── TaskbarCustomizer.sln
└── TaskbarCustomizer
├── App.config
├── App.xaml
├── App.xaml.cs
├── Helpers
├── DebugLogger.cs
└── Utility.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Properties
├── AssemblyInfo.cs
├── Resources.Designer.cs
├── Resources.resx
├── Settings.Designer.cs
└── Settings.settings
├── Resources
└── icon.ico
├── TaskSettings
└── Settings.cs
├── TaskbarCustomizer.csproj
└── Taskbars
├── Elements
└── TaskbarElement.cs
└── Taskbar.cs
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 JustIntroverted
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## What is this?
2 | This is an application that allows you to manipulate certain aspects of the Taskbar on Windows 10. You can change if the Start button is visible, and you can change whether the Show Desktop button is visible. Along with those nifty features, you can also change the positioning of all pinned Taskbar items, and the position of the IconTray and Clock.
3 |
4 | 
5 | 
--------------------------------------------------------------------------------
/TaskbarCustomizer.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskbarCustomizer", "TaskbarCustomizer\TaskbarCustomizer.csproj", "{29CB6913-DAAA-4ABA-B25A-B2D58521ED42}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {29CB6913-DAAA-4ABA-B25A-B2D58521ED42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {29CB6913-DAAA-4ABA-B25A-B2D58521ED42}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {29CB6913-DAAA-4ABA-B25A-B2D58521ED42}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {29CB6913-DAAA-4ABA-B25A-B2D58521ED42}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {F0F07470-945D-452D-83DB-FC5A75B1B725}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 |
3 | namespace TaskbarCustomizer {
4 |
5 | ///
6 | /// Interaction logic for App.xaml
7 | ///
8 | public partial class App : Application {
9 | }
10 | }
--------------------------------------------------------------------------------
/TaskbarCustomizer/Helpers/DebugLogger.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace TaskbarCustomizer.Helpers
5 | {
6 | public class DebugLogger
7 | {
8 | private const string FILE_NAME = "debug.log";
9 | private bool LogExists => File.Exists(FILE_NAME);
10 |
11 | public void AppendLog(Exception exception)
12 | {
13 | if (LogExists)
14 | {
15 | using (StreamWriter sw = new StreamWriter(FILE_NAME))
16 | {
17 | sw.WriteLine(exception);
18 | }
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/Helpers/Utility.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace TaskbarCustomizer.Helpers
5 | {
6 |
7 | public class Utility
8 | {
9 | public delegate void WinEventDelegate(IntPtr hWinEventHook, uint eventType,
10 | IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime);
11 |
12 | public enum ABM : uint
13 | {
14 | New = 0x00000000,
15 | Remove = 0x00000001,
16 | QueryPos = 0x00000002,
17 | SetPos = 0x00000003,
18 | GetState = 0x00000004,
19 | GetTaskbarPos = 0x00000005,
20 | Activate = 0x00000006,
21 | GetAutoHideBar = 0x00000007,
22 | SetAutoHideBar = 0x00000008,
23 | WindowPosChanged = 0x00000009,
24 | SetState = 0x0000000A,
25 | }
26 |
27 | public const int WM_SIZE = 0x0005;
28 |
29 | public enum ABE : uint
30 | {
31 | Left = 0,
32 | Top = 1,
33 | Right = 2,
34 | Bottom = 3
35 | }
36 |
37 | public static class ABS
38 | {
39 | public const int Autohide = 0x0000001;
40 | public const int AlwaysOnTop = 0x0000002;
41 | }
42 |
43 | public const short SWP_NOMOVE = 0X2;
44 | public const short SWP_NOSIZE = 1;
45 | public const short SWP_NOZORDER = 0X4;
46 | public const short SWP_SHOWWINDOW = 0x0040;
47 | public const short SWP_NOACTIVATE = 0x0010;
48 |
49 | public const int SW_HIDE = 0;
50 | public const int SW_SHOW = 1;
51 |
52 | [DllImport("shell32.dll", SetLastError = true)]
53 | public static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData);
54 |
55 | [DllImport("user32.dll", SetLastError = true)]
56 | public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
57 |
58 | [DllImport("user32.dll", CharSet = CharSet.Unicode)]
59 | public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);
60 |
61 | [DllImport("user32.dll", SetLastError = true)]
62 | public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
63 |
64 | [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
65 | public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags);
66 |
67 | [DllImport("user32.dll")]
68 | public static extern int ShowWindow(IntPtr hwnd, int command);
69 |
70 | [DllImport("user32.dll", SetLastError = true)]
71 | public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
72 |
73 | [DllImport("user32.dll")]
74 | public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);
75 |
76 | [DllImport("user32.dll")]
77 | [return: MarshalAs(UnmanagedType.Bool)]
78 | public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
79 |
80 | [DllImport("user32.dll")]
81 | [return: MarshalAs(UnmanagedType.Bool)]
82 | public static extern bool IsWindowVisible(IntPtr hWnd);
83 |
84 | [DllImport("user32.dll")]
85 | public static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
86 |
87 | [DllImport("user32.dll")]
88 | public static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr
89 | hmodWinEventProc, WinEventDelegate lpfnWinEventProc, uint idProcess,
90 | uint idThread, uint dwFlags);
91 |
92 | [DllImport("user32.dll")]
93 | public static extern bool UnhookWinEvent(IntPtr hWinEventHook);
94 |
95 | public const uint EVENT_MIN = 0x00000001;
96 | public const uint EVENT_MAX = 0x7FFFFFFF;
97 | public const uint WINEVENT_OUTOFCONTEXT = 0;
98 | public const uint WINEVENT_SKIPOWNPROCESS = 0x0002;
99 | public const uint EVENT_OBJECT_LOCATIONCHANGE = 0x800B;
100 |
101 | public const uint WM_DWMCOLORIZATIONCOLORCHANGED = 0x0320;
102 | public const uint WM_WINDOWPOSCHANGED = 0x47;
103 | public const uint WM_PAINT = 0x000F;
104 | public const uint WM_CHANGEUISTATE = 0x127;
105 | public const uint WM_STYLECHANGED = 0x007D;
106 |
107 | [StructLayout(LayoutKind.Sequential)]
108 | public struct RECT
109 | {
110 | public int Left; // x position of upper-left corner
111 | public int Top; // y position of upper-left corner
112 | public int Right; // x position of lower-right corner
113 | public int Bottom; // y position of lower-right corner
114 | }
115 |
116 | [StructLayout(LayoutKind.Sequential)]
117 | public struct APPBARDATA
118 | {
119 | public uint cbSize;
120 | public IntPtr hWnd;
121 | public uint uCallbackMessage;
122 | public ABE uEdge;
123 | public RECT rc;
124 | public int lParam;
125 | }
126 |
127 | [StructLayout(LayoutKind.Sequential)]
128 | public struct WindowCompositionAttributeData
129 | {
130 | public WindowCompositionAttribute Attribute;
131 | public IntPtr Data;
132 | public int SizeOfData;
133 | }
134 |
135 | public enum WindowCompositionAttribute
136 | {
137 |
138 | // ...
139 | WCA_ACCENT_POLICY = 19
140 |
141 | // ...
142 | }
143 |
144 | public enum AccentState
145 | {
146 | ACCENT_DISABLED = 0,
147 | ACCENT_ENABLE_GRADIENT = 1,
148 | ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
149 | ACCENT_ENABLE_BLURBEHIND = 3,
150 | ACCENT_INVALID_STATE = 4
151 | }
152 |
153 | [StructLayout(LayoutKind.Sequential)]
154 | public struct AccentPolicy
155 | {
156 | public AccentState AccentState;
157 | public int AccentFlags;
158 | public int GradientColor;
159 | public int AnimationId;
160 | }
161 |
162 | public static IntPtr FindWindowByIndex(IntPtr hWndParent, string className, int index)
163 | {
164 | if (index == 0)
165 | return hWndParent;
166 | else
167 | {
168 | int ct = 0;
169 | IntPtr result = IntPtr.Zero;
170 | do
171 | {
172 | result = Utility.FindWindowEx(hWndParent, result, className, null);
173 | if (result != IntPtr.Zero)
174 | ++ct;
175 | }
176 | while (ct < index && result != IntPtr.Zero);
177 | return result;
178 | }
179 | }
180 | }
181 | }
--------------------------------------------------------------------------------
/TaskbarCustomizer/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.IO;
4 | using System.Windows;
5 | using System.Windows.Media;
6 | using System.Windows.Threading;
7 | using TaskbarCustomizer.Helpers;
8 | using TaskbarCustomizer.Taskbars.Elements;
9 | using TaskbarCustomizer.TaskSettings;
10 |
11 | namespace TaskbarCustomizer {
12 |
13 | ///
14 | /// Interaction logic for MainWindow.xaml
15 | ///
16 | public partial class MainWindow : Window {
17 | private bool _running = false;
18 | private BackgroundWorker _bgWorker;
19 | private System.Windows.Forms.NotifyIcon _trayIcon;
20 |
21 | private TaskbarElement _taskbar;
22 | private TaskbarElement _startButton;
23 | private TaskbarElement _startMenu;
24 | private TaskbarElement[] _taskbarButtons = new TaskbarElement[3];
25 | private TaskbarElement _cortanaButton;
26 | private TaskbarElement _cortanaSearchMenu;
27 | private TaskbarElement _mainAppContainer;
28 | private TaskbarElement _trayIconContainer;
29 |
30 | //private TaskbarElement _volumeContainer;
31 | private TaskbarElement _showDesktopButton;
32 |
33 | private Window _dummyTaskbar;
34 |
35 | private int _taskBarWidth => (int)SliderTaskWidth.Value;
36 |
37 | private Settings _settings = new Settings();
38 |
39 | public MainWindow()
40 | {
41 | InitializeComponent();
42 | }
43 |
44 | private void _bgWorker_DoWork(object sender, DoWorkEventArgs e)
45 | {
46 | while (_running)
47 | {
48 | Dispatcher.Invoke(() =>
49 | {
50 | if (_running && _taskbar.GetHandle() != IntPtr.Zero)
51 | try
52 | {
53 | ApplyStyle();
54 | //Utility.SetWindowPos((IntPtr)0x00001e24, 100, 100, 0, 0, 0, Utility.SWP_NOSIZE | Utility.SWP_NOACTIVATE);
55 | }
56 | catch (Exception ex)
57 | {
58 | using (StreamWriter sw = new StreamWriter("debug.txt"))
59 | {
60 | sw.WriteLine(ex);
61 | }
62 | }
63 | });
64 |
65 | System.Threading.Thread.Sleep(100);
66 | }
67 |
68 | Dispatcher.Invoke(() =>
69 | {
70 | ResetStyle();
71 | });
72 | }
73 |
74 | public void CreateSettings()
75 | {
76 | Setting setting = new Setting
77 | {
78 | SettingName = "width",
79 | SettingValue = _taskbar.GetWidth().ToString()
80 | };
81 | _settings.AddSetting(setting);
82 |
83 | setting = new Setting
84 | {
85 | SettingName = "red",
86 | SettingValue = SliderDummyTaskRed.Value.ToString()
87 | };
88 | _settings.AddSetting(setting);
89 |
90 | setting = new Setting
91 | {
92 | SettingName = "green",
93 | SettingValue = SliderDummyTaskGreen.Value.ToString()
94 | };
95 | _settings.AddSetting(setting);
96 |
97 | setting = new Setting
98 | {
99 | SettingName = "blue",
100 | SettingValue = SliderDummyTaskBlue.Value.ToString()
101 | };
102 | _settings.AddSetting(setting);
103 |
104 | setting = new Setting
105 | {
106 | SettingName = "opacity",
107 | SettingValue = SliderDummyTaskOpacity.Value.ToString()
108 | };
109 | _settings.AddSetting(setting);
110 |
111 | setting = new Setting
112 | {
113 | SettingName = "showtaskbar",
114 | SettingValue = CheckTaskbarVisible.IsChecked.ToString()
115 | };
116 | _settings.AddSetting(setting);
117 |
118 | setting = new Setting
119 | {
120 | SettingName = "hidestartbutton",
121 | SettingValue = CheckHideStart.IsChecked.ToString()
122 | };
123 | _settings.AddSetting(setting);
124 |
125 | setting = new Setting
126 | {
127 | SettingName = "hideshowdesktopbutton",
128 | SettingValue = CheckHideShowDesk.IsChecked.ToString()
129 | };
130 | _settings.AddSetting(setting);
131 |
132 | setting = new Setting
133 | {
134 | SettingName = "autostart",
135 | SettingValue = CheckAutoStart.IsChecked.ToString()
136 | };
137 | _settings.AddSetting(setting);
138 |
139 | setting = new Setting
140 | {
141 | SettingName = "launchwithwindows",
142 | SettingValue = CheckLaunchWithWindows.IsChecked.ToString()
143 | };
144 | _settings.AddSetting(setting);
145 |
146 | _settings.SaveSettings();
147 | }
148 |
149 | private void ApplyStyle()
150 | {
151 | // make taskbar transparent
152 | if (CheckTaskbarVisible.IsChecked == true)
153 | {
154 | // show the taskbar
155 | _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_DISABLED;
156 | _taskbar.ApplyAccentPolicy();
157 | }
158 | else
159 | {
160 | // hide the taskbar
161 | _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_INVALID_STATE;
162 | _taskbar.ApplyAccentPolicy();
163 | }
164 |
165 | // make sure the dummy taskbar maintains position
166 | _dummyTaskbar.Top = _taskbar.GetTop();
167 | _dummyTaskbar.Width = _taskBarWidth;
168 | _dummyTaskbar.Left = (_taskbar.GetWidth() / 2) - _dummyTaskbar.Width / 2;
169 | _dummyTaskbar.Height = _taskbar.GetHeight();
170 | //_dummyTaskbar.Background = new SolidColorBrush(Color.FromArgb((byte)SliderDummyTaskOpacity.Value, 0, 0, 0));
171 | UpdateDummySliders();
172 |
173 | // get the offsets of buttons that may or may not be visible
174 | int offset = 0; // (_startButton.IsElementVisible() ? _startButton.GetWidth() : 0);
175 |
176 | for (int i = 0; i < 3; i++)
177 | {
178 | offset += _taskbarButtons[i].IsElementVisible() ? _taskbarButtons[i].GetWidth() : 0;
179 | }
180 |
181 | // resize the app container and then move it into position
182 | _mainAppContainer.ResizeElement((int)_dummyTaskbar.Width - _trayIconContainer.GetWidth() - offset - 32);
183 | _mainAppContainer.MoveElement((int)_dummyTaskbar.Left + offset + 32);
184 |
185 | // move the start button into position
186 | if (_startButton.IsElementVisible())
187 | _startButton.MoveElement((int)_dummyTaskbar.Left);
188 |
189 | // show or hide the show desktopbutton
190 | if (CheckHideShowDesk.IsChecked == true)
191 | _showDesktopButton.HideElement();
192 | else
193 | _showDesktopButton.ShowElement();
194 |
195 | // move taskbar buttons into position
196 | for (int i = 0; i < 3; i++)
197 | {
198 | if (_taskbarButtons[i].IsElementVisible())
199 | _taskbarButtons[i].MoveElement((int)_dummyTaskbar.Left + offset - (_taskbarButtons[i].GetWidth() * i));
200 | }
201 |
202 | // move the start menu into the correct position
203 | if (_dummyTaskbar.Top == 0)
204 | {
205 | _startMenu.MoveElement((int)_dummyTaskbar.Left, (int)_dummyTaskbar.Height);
206 | _cortanaSearchMenu.MoveElement((int)_dummyTaskbar.Left, (int)_dummyTaskbar.Height);
207 | }
208 | else
209 | {
210 | _startMenu.MoveElement((int)_dummyTaskbar.Left);
211 | _cortanaSearchMenu.MoveElement((int)_dummyTaskbar.Left, (int)_dummyTaskbar.Top - (_cortanaSearchMenu.GetHeight()));
212 | }
213 |
214 | // move the tray icon container into position
215 | _trayIconContainer.MoveElement((int)_dummyTaskbar.Left + (int)_dummyTaskbar.Width - _trayIconContainer.GetWidth());
216 | }
217 |
218 | private void ResetStyle()
219 | {
220 | // get the offsets of buttons that may or may not be visible
221 | int offset = (_startButton.IsElementVisible() ? _startButton.GetWidth() : 0) +
222 | (_cortanaButton.IsElementVisible() ? _cortanaButton.GetWidth() : 0);
223 |
224 | // fix the taskbar opacity
225 | //TODO (justin): get accent state before application is activated, then set it back to what it was
226 | _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_DISABLED;
227 | _taskbar.ApplyAccentPolicy();
228 |
229 | // return things back to normal
230 | _startButton.ShowElement();
231 | _startButton.MoveElement(0);
232 |
233 | // move the start menu into the correct position
234 | if (_taskbar.GetTop() == 0)
235 | {
236 | _startMenu.MoveElement(0);
237 | _cortanaSearchMenu.MoveElement(0, (int)_dummyTaskbar.Height);
238 | }
239 | else
240 | {
241 | _startMenu.MoveElement(0);
242 | _cortanaSearchMenu.MoveElement(0, (int)_taskbar.GetTop() - (_cortanaSearchMenu.GetHeight()));
243 | }
244 |
245 | if (_cortanaButton.IsElementVisible())
246 | _cortanaButton.MoveElement(offset - _cortanaButton.GetWidth());
247 |
248 | _showDesktopButton.ShowElement();
249 | _mainAppContainer.MoveElement(offset);
250 | _mainAppContainer.ResizeElement(_taskbar.GetWidth() - _trayIconContainer.GetWidth() - offset);
251 | _trayIconContainer.MoveElement(_taskbar.GetWidth() - _trayIconContainer.GetWidth());
252 |
253 | // get rid of the system tray icon
254 | _trayIcon.Dispose();
255 | }
256 |
257 | #region window events
258 |
259 | private void Window_Loaded(object sender, RoutedEventArgs e)
260 | {
261 | try
262 | {
263 | // set up the tray icon
264 | System.Windows.Forms.NotifyIcon notifyIcon = _trayIcon = new System.Windows.Forms.NotifyIcon
265 | {
266 | Icon = new System.Drawing.Icon("Resources\\icon.ico"),
267 | Text = Title,
268 | Visible = true
269 | };
270 | _trayIcon.DoubleClick +=
271 | delegate (object sender2, EventArgs args)
272 | {
273 | Show();
274 | WindowState = WindowState.Normal;
275 | };
276 |
277 | // grab the handles of everything we'll be tweaking
278 | _taskbar = new TaskbarElement("Shell_TrayWnd");
279 | _startButton = new TaskbarElement(_taskbar, "Start", 1);
280 | _startMenu = new TaskbarElement("Windows.UI.Core.CoreWindow", "Start");
281 |
282 | // get the buttons on the taskbar that directly have the taskbar as a parent
283 | for (int i = 0; i < 3; i++)
284 | _taskbarButtons[i] = new TaskbarElement(_taskbar, "TrayButton", (i + 1));
285 |
286 | _cortanaButton = new TaskbarElement(_taskbar, "TrayButton", 1);
287 | _cortanaSearchMenu = new TaskbarElement("Windows.UI.Core.CoreWindow", "Cortana");
288 | _mainAppContainer = new TaskbarElement(_taskbar, "ReBarWindow32", 1);
289 | _trayIconContainer = new TaskbarElement(_taskbar, "TrayNotifyWnd", 1);
290 | //_volumeContainer = new TaskbarElement(_taskbar, "")
291 | _showDesktopButton = new TaskbarElement(_trayIconContainer, "TrayShowDesktopButtonWClass", 1);
292 |
293 | // set up sliders
294 | SliderTaskWidth.Maximum = _taskbar.GetWidth();
295 |
296 | //if (CheckAutoStart.IsChecked == true) {
297 | // create an instance of a dummy taskbar with some settings
298 | _dummyTaskbar = new Window();
299 | _dummyTaskbar.WindowState = WindowState.Normal;
300 | _dummyTaskbar.WindowStyle = WindowStyle.None;
301 | _dummyTaskbar.ResizeMode = ResizeMode.NoResize;
302 | _dummyTaskbar.Width = _taskBarWidth;
303 | _dummyTaskbar.Height = _taskbar.GetHeight();
304 | _dummyTaskbar.Top = _taskbar.GetTop();
305 | _dummyTaskbar.Left = (_taskbar.GetWidth() / 2) - _dummyTaskbar.Width / 2;
306 | _dummyTaskbar.AllowsTransparency = true;
307 | UpdateDummySliders();
308 | _dummyTaskbar.ShowInTaskbar = false;
309 | _dummyTaskbar.Hide();
310 | //}
311 | }
312 | catch (Exception ex)
313 | {
314 | using (StreamWriter sw = new StreamWriter("debug.txt"))
315 | {
316 | sw.WriteLine(ex);
317 | }
318 | }
319 |
320 | if (!File.Exists("settings.json"))
321 | {
322 | CreateSettings();
323 | _settings.LoadSettings();
324 | }
325 | else
326 | {
327 | _settings.LoadSettings();
328 |
329 | //TODO (justin): add some error checking here
330 | SliderTaskWidth.Value = Convert.ToInt16(_settings.FindSetting("width").SettingValue);
331 | SliderDummyTaskRed.Value = Convert.ToByte(_settings.FindSetting("red").SettingValue);
332 | SliderDummyTaskGreen.Value = Convert.ToByte(_settings.FindSetting("green").SettingValue);
333 | SliderDummyTaskBlue.Value = Convert.ToByte(_settings.FindSetting("blue").SettingValue);
334 | SliderDummyTaskOpacity.Value = Convert.ToByte(_settings.FindSetting("opacity").SettingValue);
335 | CheckTaskbarVisible.IsChecked = Convert.ToBoolean(_settings.FindSetting("showtaskbar").SettingValue);
336 | CheckHideStart.IsChecked = Convert.ToBoolean(_settings.FindSetting("hidestartbutton").SettingValue);
337 | CheckHideShowDesk.IsChecked = Convert.ToBoolean(_settings.FindSetting("hideshowdesktopbutton").SettingValue);
338 | CheckAutoStart.IsChecked = Convert.ToBoolean(_settings.FindSetting("autostart").SettingValue);
339 | CheckLaunchWithWindows.IsChecked = Convert.ToBoolean(_settings.FindSetting("launchwithwindows").SettingValue);
340 | }
341 |
342 | textBoxSettings.Text = File.ReadAllText("settings.json");
343 |
344 | _dummyTaskbar?.Show();
345 |
346 | Focus();
347 |
348 | // set up background worker
349 | _bgWorker = new BackgroundWorker
350 | {
351 | WorkerSupportsCancellation = true
352 | };
353 | _bgWorker.DoWork += _bgWorker_DoWork;
354 |
355 | // TODO: create method for the button click action
356 | // because this is stupid
357 | if (CheckAutoStart.IsChecked == true)
358 | ButtonStart_Click(null, null);
359 | }
360 |
361 | private void Window_StateChanged(object sender, EventArgs e)
362 | {
363 | if (WindowState == WindowState.Minimized)
364 | {
365 | Hide();
366 |
367 | return;
368 | }
369 | }
370 |
371 | private void Window_Closing(object sender, CancelEventArgs e)
372 | {
373 | // stop the background worker
374 | _running = false;
375 |
376 | _settings.UpdateSetting(new Setting("width", ((int)SliderTaskWidth.Value).ToString()));
377 | _settings.UpdateSetting(new Setting("red", ((int)SliderDummyTaskRed.Value).ToString()));
378 | _settings.UpdateSetting(new Setting("green", ((int)SliderDummyTaskGreen.Value).ToString()));
379 | _settings.UpdateSetting(new Setting("blue", ((int)SliderDummyTaskBlue.Value).ToString()));
380 | _settings.UpdateSetting(new Setting("opacity", ((int)SliderDummyTaskOpacity.Value).ToString()));
381 | _settings.UpdateSetting(new Setting("showtaskbar", CheckTaskbarVisible.IsChecked.ToString()));
382 | _settings.UpdateSetting(new Setting("hidestartbutton", CheckHideStart.IsChecked.ToString()));
383 | _settings.UpdateSetting(new Setting("hideshowdesktopbutton", CheckHideShowDesk.IsChecked.ToString()));
384 | _settings.UpdateSetting(new Setting("autostart", CheckAutoStart.IsChecked.ToString()));
385 | _settings.UpdateSetting(new Setting("launchwithwindows", CheckLaunchWithWindows.IsChecked.ToString()));
386 |
387 | _settings.SaveSettings();
388 |
389 | if (CheckLaunchWithWindows.IsChecked == true)
390 | {
391 | using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
392 | {
393 | key.SetValue("TaskbarCustomizer", "\"" + System.Reflection.Assembly.GetExecutingAssembly().Location + "\"");
394 | }
395 | }
396 | else
397 | {
398 | using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
399 | {
400 | key.DeleteValue("TaskbarCustomizer", false);
401 | }
402 | }
403 |
404 | // kill the dummy taskbar
405 | if (_dummyTaskbar != null)
406 | _dummyTaskbar.Close();
407 |
408 | ResetStyle();
409 | }
410 |
411 | #endregion window events
412 |
413 | #region control events
414 |
415 | private void CheckHideStart_Checked(object sender, RoutedEventArgs e)
416 | {
417 | if (_running)
418 | _startButton.HideElement();
419 | }
420 |
421 | private void CheckHideStart_Unchecked(object sender, RoutedEventArgs e)
422 | {
423 | if (_running)
424 | _startButton.ShowElement();
425 | }
426 |
427 | private void CheckHideShowDesk_Checked(object sender, RoutedEventArgs e)
428 | {
429 | if (_running)
430 | _showDesktopButton.HideElement();
431 | }
432 |
433 | private void CheckHideShowDesk_Unchecked(object sender, RoutedEventArgs e)
434 | {
435 | if (_running)
436 | _showDesktopButton.ShowElement();
437 | }
438 |
439 | private void SliderDummyTaskOpacity_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
440 | {
441 | UpdateDummySliders();
442 | }
443 |
444 | private void SliderDummyTaskRed_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
445 | {
446 | UpdateDummySliders();
447 | }
448 |
449 | private void SliderDummyTaskGreen_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
450 | {
451 | UpdateDummySliders();
452 | }
453 |
454 | private void SliderDummyTaskBlue_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
455 | {
456 | UpdateDummySliders();
457 | }
458 |
459 | private void UpdateDummySliders()
460 | {
461 | if (_running)
462 | _dummyTaskbar.Background = new SolidColorBrush(Color.FromArgb(
463 | (byte)SliderDummyTaskOpacity.Value,
464 | (byte)SliderDummyTaskRed.Value,
465 | (byte)SliderDummyTaskGreen.Value,
466 | (byte)SliderDummyTaskBlue.Value));
467 | }
468 |
469 | private void SliderTaskWidth_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
470 | {
471 | if (_running)
472 | ApplyStyle();
473 | }
474 |
475 | private void CheckTaskbarVisible_Click(object sender, RoutedEventArgs e)
476 | {
477 | if (!_running) return;
478 |
479 | if (CheckTaskbarVisible.IsChecked == true)
480 | {
481 | // show the taskbar
482 | _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_DISABLED;
483 | _taskbar.ApplyAccentPolicy();
484 | }
485 | else
486 | {
487 | // hide the taskbar
488 | _taskbar.AccentPolicy.AccentState = Utility.AccentState.ACCENT_INVALID_STATE;
489 | _taskbar.ApplyAccentPolicy();
490 | }
491 | }
492 |
493 | private void ButtonStart_Click(object sender, RoutedEventArgs e)
494 | {
495 | if (!_bgWorker.IsBusy && !_running)
496 | {
497 | _running = true;
498 | _bgWorker.RunWorkerAsync();
499 | ButtonStart.Content = "Stop";
500 | }
501 | else
502 | {
503 | _running = false;
504 | ButtonStart.Content = "Start";
505 | }
506 | }
507 |
508 | #endregion control events
509 |
510 | private void CheckLaunchWithWindows_Checked(object sender, RoutedEventArgs e)
511 | {
512 | using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
513 | {
514 | key.SetValue("TaskbarCustomizer", "\"" + System.Reflection.Assembly.GetExecutingAssembly().Location + "\"");
515 | }
516 | }
517 |
518 | private void CheckLaunchWithWindows_Unchecked(object sender, RoutedEventArgs e)
519 | {
520 | using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true))
521 | {
522 | key.DeleteValue("TaskbarCustomizer", false);
523 | }
524 | }
525 | }
526 | }
--------------------------------------------------------------------------------
/TaskbarCustomizer/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TaskbarCustomizer")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TaskbarCustomizer")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | //In order to begin building localizable applications, set
23 | //CultureYouAreCodingWith in your .csproj file
24 | //inside a . For example, if you are using US english
25 | //in your source files, set the to en-US. Then uncomment
26 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
27 | //the line below to match the UICulture setting in the project file.
28 |
29 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
30 |
31 | [assembly: ThemeInfo(
32 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
33 | //(used if a resource is not found in the page,
34 | // or application resource dictionaries)
35 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
36 | //(used if a resource is not found in the page,
37 | // app, or any theme specific resource dictionaries)
38 | )]
39 |
40 | // Version information for an assembly consists of the following four values:
41 | //
42 | // Major Version
43 | // Minor Version
44 | // Build Number
45 | // Revision
46 | //
47 | // You can specify all the values or you can default the Build and Revision Numbers
48 | // by using the '*' as shown below:
49 | // [assembly: AssemblyVersion("1.0.*")]
50 | [assembly: AssemblyVersion("0.0.0.0")]
51 | [assembly: AssemblyFileVersion("0.1.15.0")]
--------------------------------------------------------------------------------
/TaskbarCustomizer/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TaskbarCustomizer.Properties {
12 |
13 |
14 | ///
15 | /// A strongly-typed resource class, for looking up localized strings, etc.
16 | ///
17 | // This class was auto-generated by the StronglyTypedResourceBuilder
18 | // class via a tool like ResGen or Visual Studio.
19 | // To add or remove a member, edit your .ResX file then rerun ResGen
20 | // with the /str option, or rebuild your VS project.
21 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24 | internal class Resources {
25 |
26 | private static global::System.Resources.ResourceManager resourceMan;
27 |
28 | private static global::System.Globalization.CultureInfo resourceCulture;
29 |
30 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
31 | internal Resources() {
32 | }
33 |
34 | ///
35 | /// Returns the cached ResourceManager instance used by this class.
36 | ///
37 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
38 | internal static global::System.Resources.ResourceManager ResourceManager {
39 | get {
40 | if ((resourceMan == null)) {
41 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TaskbarCustomizer.Properties.Resources", typeof(Resources).Assembly);
42 | resourceMan = temp;
43 | }
44 | return resourceMan;
45 | }
46 | }
47 |
48 | ///
49 | /// Overrides the current thread's CurrentUICulture property for all
50 | /// resource lookups using this strongly typed resource class.
51 | ///
52 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
53 | internal static global::System.Globalization.CultureInfo Culture {
54 | get {
55 | return resourceCulture;
56 | }
57 | set {
58 | resourceCulture = value;
59 | }
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TaskbarCustomizer.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/Resources/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JustIntroverted/TaskbarCustomizer/684b349dbd9a45c11ace8d3a30cb239eaae06574/TaskbarCustomizer/Resources/icon.ico
--------------------------------------------------------------------------------
/TaskbarCustomizer/TaskSettings/Settings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 | using System.Linq;
4 | using Newtonsoft.Json;
5 |
6 | namespace TaskbarCustomizer.TaskSettings
7 | {
8 |
9 | public struct Setting
10 | {
11 | public string SettingName { get; set; }
12 | public string SettingValue { get; set; }
13 |
14 | public Setting(string SettingName, string SettingValue)
15 | {
16 | this.SettingName = SettingName;
17 | this.SettingValue = SettingValue;
18 | }
19 | }
20 |
21 | public class Settings
22 | {
23 | public List TBCustomizerSettings { get; set; } = new List();
24 |
25 | public Settings()
26 | {
27 | }
28 |
29 | public void SaveSettings()
30 | {
31 | if (TBCustomizerSettings.Count == 0) return;
32 |
33 | string jsonString = JsonConvert.SerializeObject(TBCustomizerSettings, Formatting.Indented);
34 | File.WriteAllText("settings.json", jsonString);
35 |
36 | #region old saving scope
37 | //using (StreamWriter sw = new StreamWriter("settings.txt"))
38 | //{
39 | // foreach (Setting s in _settingsList)
40 | // {
41 | // sw.WriteLine("{0}: {1}", s.SettingName.Trim(), s.SettingValue.Trim());
42 | // }
43 | //}
44 | #endregion
45 | }
46 |
47 | public void LoadSettings()
48 | {
49 | if (File.Exists("settings.json"))
50 | {
51 | string jsonString = File.ReadAllText("settings.json");
52 | TBCustomizerSettings = JsonConvert.DeserializeObject>(jsonString);
53 | }
54 |
55 | #region old loadings scope
56 | //if (File.Exists("settings.txt"))
57 | //{
58 | // using (StreamReader sr = new StreamReader("settings.txt"))
59 | // {
60 | // while (!sr.EndOfStream)
61 | // {
62 | // string[] temp = sr.ReadLine().Split(':');
63 |
64 | // Setting setting = new Setting
65 | // {
66 | // SettingName = temp[0].Trim(),
67 | // SettingValue = temp[1].Trim()
68 | // };
69 | // AddSetting(setting);
70 | // }
71 |
72 | // return true;
73 | // }
74 | //}
75 | //else
76 | //{
77 | // return false;
78 | //}
79 | #endregion
80 | }
81 |
82 | public void AddSetting(Setting Setting)
83 | {
84 | if (!FindSetting(Setting.SettingName).Equals(null))
85 | TBCustomizerSettings.Add(Setting);
86 | }
87 |
88 | public void RemoveSetting(Setting Setting)
89 | {
90 | Setting setting = FindSetting(Setting.SettingName);
91 |
92 | if (!setting.Equals(null))
93 | TBCustomizerSettings.Remove(Setting);
94 | }
95 |
96 | public void UpdateSetting(Setting Setting)
97 | {
98 | int index = TBCustomizerSettings.FindIndex(s => s.SettingName.ToLower() == Setting.SettingName.ToLower());
99 |
100 | if (index == -1) return;
101 |
102 | TBCustomizerSettings[index] = Setting;
103 | }
104 |
105 | public Setting FindSetting(string SettingName)
106 | {
107 | return TBCustomizerSettings.FirstOrDefault(s => s.SettingName.ToLower().Trim() == SettingName.ToLower().Trim());
108 | }
109 | }
110 | }
--------------------------------------------------------------------------------
/TaskbarCustomizer/TaskbarCustomizer.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {29CB6913-DAAA-4ABA-B25A-B2D58521ED42}
8 | WinExe
9 | TaskbarCustomizer
10 | TaskbarCustomizer
11 | v4.6.1
12 | 512
13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
14 | 4
15 | true
16 | false
17 | publish\
18 | true
19 | Disk
20 | false
21 | Foreground
22 | 7
23 | Days
24 | false
25 | false
26 | true
27 | 0
28 | 1.0.0.%2a
29 | false
30 | true
31 |
32 |
33 | AnyCPU
34 | true
35 | full
36 | false
37 | bin\Debug\
38 | DEBUG;TRACE
39 | prompt
40 | 4
41 |
42 |
43 | AnyCPU
44 | pdbonly
45 | true
46 | bin\Release\
47 | TRACE
48 | prompt
49 | 4
50 |
51 |
52 | Resources\icon.ico
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | 4.0
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 | MSBuild:Compile
76 | Designer
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | MSBuild:Compile
85 | Designer
86 |
87 |
88 | App.xaml
89 | Code
90 |
91 |
92 | MainWindow.xaml
93 | Code
94 |
95 |
96 |
97 |
98 | Code
99 |
100 |
101 | True
102 | True
103 | Resources.resx
104 |
105 |
106 | True
107 | Settings.settings
108 | True
109 |
110 |
111 | ResXFileCodeGenerator
112 | Resources.Designer.cs
113 |
114 |
115 | SettingsSingleFileGenerator
116 | Settings.Designer.cs
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 | False
126 | Microsoft .NET Framework 4.6.1 %28x86 and x64%29
127 | true
128 |
129 |
130 | False
131 | .NET Framework 3.5 SP1
132 | false
133 |
134 |
135 |
136 |
137 | Always
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/TaskbarCustomizer/Taskbars/Elements/TaskbarElement.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using TaskbarCustomizer.Helpers;
3 |
4 | namespace TaskbarCustomizer.Taskbars.Elements
5 | {
6 |
7 | public class TaskbarElement
8 | {
9 | private string _elementClassName = string.Empty;
10 |
11 | private IntPtr _handle { get; set; }
12 |
13 | private void SetHandle(IntPtr value)
14 | {
15 | _handle = value;
16 | }
17 |
18 | public IntPtr GetHandle()
19 | {
20 | return _handle;
21 | }
22 |
23 | public Utility.AccentPolicy AccentPolicy = new Utility.AccentPolicy();
24 |
25 |
26 | public int GetTop()
27 | {
28 | return GetRectangle().Top;
29 | }
30 |
31 | public int GetWidth()
32 | {
33 | return GetRectangle().Right - GetRectangle().Left;
34 | }
35 |
36 | public int GetHeight()
37 | {
38 | return GetRectangle().Bottom - GetRectangle().Top;
39 | }
40 |
41 | public TaskbarElement(string ClassName) : this(ClassName, null)
42 | {
43 | }
44 |
45 | public TaskbarElement(string ClassName, string WindowTitle)
46 | {
47 | SetHandle(Utility.FindWindow(ClassName, WindowTitle));
48 | }
49 |
50 | public TaskbarElement(TaskbarElement Parent, string ClassName, int ElementIndex)
51 | {
52 | _elementClassName = ClassName;
53 | SetHandle(Utility.FindWindowByIndex(Parent.GetHandle(), _elementClassName, ElementIndex));
54 | }
55 |
56 | public void ApplyAccentPolicy()
57 | {
58 | IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(System.Runtime.InteropServices.Marshal.SizeOf(AccentPolicy));
59 | System.Runtime.InteropServices.Marshal.StructureToPtr(AccentPolicy, ptr, false);
60 |
61 | Utility.WindowCompositionAttributeData data = new Utility.WindowCompositionAttributeData()
62 | {
63 | Attribute = Utility.WindowCompositionAttribute.WCA_ACCENT_POLICY,
64 | Data = ptr,
65 | SizeOfData = System.Runtime.InteropServices.Marshal.SizeOf(AccentPolicy)
66 | };
67 |
68 | Utility.SetWindowCompositionAttribute(GetHandle(), ref data);
69 |
70 | System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr);
71 | }
72 |
73 | public void ResizeElement(int width)
74 | {
75 | Utility.SetWindowPos(GetHandle(), 0, 0, 0, width, GetHeight(), Utility.SWP_NOMOVE | Utility.SWP_NOACTIVATE);
76 | }
77 |
78 | public void MoveElement(int x)
79 | {
80 | MoveElement(x, 0);
81 | }
82 |
83 | public void MoveElement(int x, int y)
84 | {
85 | Utility.SetWindowPos(GetHandle(), 0, x, y, 0, 0, Utility.SWP_NOSIZE | Utility.SWP_NOACTIVATE);
86 | }
87 |
88 | public bool IsElementVisible()
89 | {
90 | return Utility.IsWindowVisible(GetHandle());
91 | }
92 |
93 | public void ToggleElementVisibility()
94 | {
95 | if (Utility.IsWindowVisible(GetHandle()))
96 | Utility.ShowWindow(GetHandle(), Utility.SW_HIDE);
97 | else
98 | Utility.ShowWindow(GetHandle(), Utility.SW_SHOW);
99 | }
100 |
101 | public void HideElement()
102 | {
103 | Utility.ShowWindow(GetHandle(), Utility.SW_HIDE);
104 | }
105 |
106 | public void ShowElement()
107 | {
108 | Utility.ShowWindow(GetHandle(), Utility.SW_SHOW);
109 | }
110 |
111 | private Utility.RECT GetRectangle()
112 | {
113 | Utility.GetWindowRect(GetHandle(), out Utility.RECT _rect);
114 |
115 | return _rect;
116 | }
117 | }
118 | }
--------------------------------------------------------------------------------
/TaskbarCustomizer/Taskbars/Taskbar.cs:
--------------------------------------------------------------------------------
1 | namespace TaskbarCustomizer.Taskbars
2 | {
3 | public class Taskbar
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------