Skip to content

Commit 3c25f6d

Browse files
authored
Merge pull request #21 from C0rvust/2.0.1
2.0.1
2 parents cacefcc + fe15c32 commit 3c25f6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+143
-1426
lines changed
File renamed without changes.
File renamed without changes.
Binary file not shown.

Modular Taskbar/@Resources/Modules/Battery/Include/Variables.inc renamed to @Resources/Modules/Battery/Include/Variables.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
Module.Battery.P=1424
44
; vargen|Battery Anchor [0/1/2]|Battery|int|0:2
55
Module.Battery.A=2
6-
Module.Battery.W=(2*#Body.Element#)
6+
Module.Battery.W=(2*#Body.Element#)

Modular Taskbar/@Resources/Modules/NowPlaying/Include/Variables.inc renamed to @Resources/Modules/NowPlaying/Include/Variables.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Module.NowPlaying.W=(12*#Body.Element#)
77
88
Module.NowPlaying.DisplayW=(#Module.NowPlaying.W#-#Body.Element#*2-#Body.Padding#*2)
99
Module.NowPlaying.DisplayFormat=%1
10-
Module.NowPlaying.MiniCoverSize=178
10+
Module.NowPlaying.MiniCoverSize=178

Modular Taskbar/@Resources/Modules/NowPlaying/NowPlaying.inc renamed to @Resources/Modules/NowPlaying/NowPlaying.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ Measure=Plugin
9797
Plugin=PowershellRM
9898
Param=214,85,113|255|178|6
9999
Line=$Saved=$RmAPI.OptionStr("Param")
100-
Line2=$Var0=$RmAPI.VariableStr("Colour.2"); $Var1=$RmAPI.VariableStr("Colour.2.Alpha"); $Var2=$RmAPI.VariableStr("Module.NowPlaying.MiniCoverSize"); $Var3=$RmAPI.VariableStr("Body.Corner"); $Var="$Var0|$Var1|$Var2|$Var3"
101-
Line3=if($Saved -ne $Var) {$RmAPI.Bang("!WriteKeyValue $($RmAPI.GetMeasureName()) Param `"`"`"$Var`"`"`" `"`"`"$($RmAPI.VariableStr("@") + "Modules\NowPlaying\NowPlaying.inc")`"`"`" "); $RmAPI.Bang("!EnableMeasure Module.NowPlaying.MM.CoverMiniDefault"); $RmAPI.Bang("!CommandMeasure Module.NowPlaying.MM.CoverMiniDefault Update")}
100+
Line2=$Var0=$RmAPI.VariableStr("Colour.2"); $Var1=$RmAPI.VariableStr("Colour.2.Alpha"); $Var2=$RmAPI.VariableStr("Module.NowPlaying.MiniCoverSize"); $Var3=$RmAPI.VariableStr("Body.Corner"); $Exist=[System.IO.File]::Exists("#@#Modules\NowPlaying\Include\CoverMM.png"); $Var="$Var0|$Var1|$Var2|$Var3"
101+
Line3=if(($Saved -ne $Var) -or ($Exist -eq $False)) {$RmAPI.Bang("!WriteKeyValue $($RmAPI.GetMeasureName()) Param `"`"`"$Var`"`"`" `"`"`"$($RmAPI.VariableStr("@") + "Modules\NowPlaying\NowPlaying.inc")`"`"`" "); $RmAPI.Bang("!EnableMeasure Module.NowPlaying.MM.CoverMiniDefault"); $RmAPI.Bang("!CommandMeasure Module.NowPlaying.MM.CoverMiniDefault Update")}
102102
103103
[Module.NowPlaying.MM.CoverMiniDefault]
104104
Measure=Plugin

Modular Taskbar/@Resources/Modules/Shortcut/Include/Shortcut.ps1 renamed to @Resources/Modules/Shortcut/Include/Shortcut.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function GenerateItemInc { # Only accepts .lnk files, all other file types are i
88
$Saved=$RmAPI.OptionStr("Param")
99
if($Saved -ne $Param) {
1010
$RMAPI.Bang("!WriteKeyValue $($RmAPI.GetMeasureName()) `"`"`"Param`"`"`" `"`"`"$Param`"`"`" `"`"`"$($RmAPI.VariableStr("@") + "Modules\Shortcut\Shortcut.inc")`"`"`"")
11-
$RMAPI.Bang("!WriteKeyValue Variables `"`"`"Module.Shortcut.GennedItemCount`"`"`" `"`"`"$($Count.length)`"`"`" `"`"`"$($RmAPI.VariableStr("RootConfigPath") + "PopUp\Shortcut_PopUp.ini")`"`"`"")
11+
$RMAPI.Bang("!WriteKeyValue Variables `"`"`"Module.Shortcut.GennedItemCount`"`"`" `"`"`"$($Count.Count)`"`"`" `"`"`"$($RmAPI.VariableStr("RootConfigPath") + "PopUp\Shortcut_PopUp.ini")`"`"`"")
1212
$Content=""
1313
Get-ChildItem $Shortcuts -File | Where-Object Name -Match "lnk$" | ForEach-Object {
1414
$Content += @"

Modular Taskbar/@Resources/Modules/Shortcut/Shortcut.inc renamed to @Resources/Modules/Shortcut/Shortcut.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ DynamicVariables=1
1717
[Module.Shortcut.PSRM]
1818
Measure=Plugin
1919
Plugin=PowershellRM
20-
Param=File Explorer|Internet Explorer|Notepad|Paint
20+
Param=Explorer|Internet Explorer|Notepad|Paint
2121
ScriptFile=#@#Modules\Shortcut\Include\Shortcut.ps1
2222

2323
[Module.Shortcut.Container]
Binary file not shown.
Binary file not shown.

Modular Taskbar/@Resources/Modules/Taskbar/Include/Taskbar.ps1 renamed to @Resources/Modules/Taskbar/Include/Taskbar.ps1

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
$MeterPrefix="Module.Taskbar.Icon."
2+
$DefaultIcon=".Default"
23
$RootConfig=$RmApi.VariableStr("RootConfig")
34
$RootConfigPath=$RmApi.VariableStr("RootConfigPath")
5+
$DependenciesPath=$RmApi.VariableStr("Module.Taskbar.DependenciesPath")
6+
$StockIconPath=$RmAPI.VariableStr("Module.Taskbar.StockIconPath")
7+
$GenIconPath="$($DependenciesPath)\Icons"
48

59
function ReturnMaxProgramCount { # Retrieves the #ProgramCount# Variable
610
return ($RmAPI.Variable("Module.Taskbar.ProgramCount",0))
711
}
812

913
function ReturnStockIcons { # Retrieves an array of the avaliable image files in the path specified by #StockIconPath#
10-
$Path=$RMAPI.VariableStr("Module.Taskbar.StockIconPath")
14+
$Path=$StockIconPath
1115
$List=@()
1216
Get-ChildItem $Path -File | Where-Object Name -Match "png$|jpg$" | ForEach-Object {
1317
$List+=$_.BaseName
@@ -31,11 +35,20 @@ function ReturnIsProgramPinned { # Returns the pinned status of a particular pro
3135
Return $IsPinned
3236
}
3337

38+
function ReturnIsIconExist {
39+
Param([String] $Name)
40+
41+
$File="$($GenIconPath)\$($Name).png"
42+
$FileExist=[System.IO.File]::Exists($File)
43+
return $FileExist
44+
}
45+
3446
function RunGetIcons { # Runs the GetIcon.exe executable to get icon images of all currently running processes
35-
$GetIconsPath="$($RMAPI.VariableStr("Module.Taskbar.DependenciesPath"))\getIcons.exe"
47+
$GetIconsPath="$($DependenciesPath)\getIcons.exe"
3648
$Pinned=$RmAPI.VariableStr("Module.Taskbar.AddDep")
3749
& "$GetIconsPath" "$Pinned" | Out-Null
3850
}
51+
3952
function SetProgramPin { # Toggle the pinned status of a particularp program
4053
Param([int] $ID)
4154
$IsPinned=ReturnIsProgramPinned($ID)
@@ -52,18 +65,23 @@ function SetProgramImage { # Set the icon image of a particular program
5265

5366
$ProgramName=ReturnProgramName($ID)
5467
$StockIcons=ReturnStockIcons
55-
$StockIconPath=$RmAPI.VariableStr("Module.Taskbar.StockIconPath")
56-
$GenIconPath="$($RmAPI.VariableStr("Module.Taskbar.DependenciesPath"))\Icons"
68+
$StockIconPath=$StockIconPath
69+
$GenIconPath=$GenIconPath
5770

58-
If($ProgramName -Match "Empty") { # Note: having "" instead of `"`"`"`"`"`" breaks because of the lack of magic quotes (as expected)
59-
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"`"`"`" ")
71+
If($ProgramName -Match "Empty") { # ProgramOptions returns "Empty" string value if there is no program
72+
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"`"`"`" ") # Clears image
6073
}
6174
Else {
6275
If($StockIcons -clike $ProgramName){ # if there exist a stock icon, then use the stock icon instead, if not use the generated one
63-
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$StockIconPath\$ProgramName.png`"`"`" ")
76+
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$StockIconPath\$ProgramName.png`"`"`" ") # Using stock icon
6477
}
6578
Else{
66-
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$GenIconPath\$ProgramName.png`"`"`" ")
79+
if($(ReturnIsIconExist $(ReturnProgramName $ID))) {
80+
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$GenIconPath\$ProgramName.png`"`"`" ") # Using retrieved icon
81+
}
82+
else {
83+
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$GenIconPath\$DefaultIcon.png`"`"`" ") # Using retrieved icon
84+
}
6785
}
6886
}
6987
}
@@ -138,11 +156,12 @@ function MouseLeaveAction {
138156

139157
function GenerateBarItemInc { # Generates an .inc file containing the appropriate amount of meters in the module
140158
$Count=ReturnMaxProgramCount
141-
$CurrentCount=$RMAPI.Variable("Module.Taskbar.GennedItemCount",-1)
159+
$CurrentCount=$RMAPI.Variable("Module.Taskbar.GennedItemCount")
142160
If($Count -ne $CurrentCount){ # Generator only runs if necessary
143161
$Destination=$RmAPI.VariableStr("@") + "Modules\Taskbar\Include\Item.inc"
144162
$Content=@"
145163
[Variables]
164+
Module.Taskbar.GennedItemCount=$($Count)
146165
147166
"@
148167
For($i=0; $i -lt $Count; $i++){
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[Variables]
2+
@IncludeTaskbarVariables=#@#Modules\Taskbar\Include\Variables.inc
3+
@IncludeTaskbarIcon=#@#Modules\Taskbar\Include\Item.inc
4+
5+
[Module.Taskbar.StyleIcon]
6+
Group=Module.Taskbar.Icon
7+
y=((#Body.Element#-#Module.Taskbar.IconSize#)/2)
8+
w=#Module.Taskbar.IconSize#
9+
ImageTint=#Module.Taskbar.DefaultShade#
10+
DynamicVariables=1
11+
AntiAlias=1
12+
Container=Module.Taskbar.Container
13+
14+
[Module.Taskbar.ProgramOptions]
15+
Measure=Plugin
16+
Plugin=ProgramOptions
17+
Indexes=#Module.Taskbar.ProgramCount#
18+
AdditionalDependencies=#Module.Taskbar.AddDep#
19+
WindowMirrorPath=#Module.Taskbar.WMPath#
20+
UpdateDivider=(1000/#UpdateInterval#)
21+
22+
[Module.Taskbar.PSRM]
23+
Measure=Plugin
24+
Plugin=PowerShellRM
25+
ScriptFile=#@#Modules\Taskbar\Include\Taskbar.ps1
26+
UpdateDivider=(1000/#UpdateInterval#)
27+
28+
[Module.Taskbar.PSRM2]
29+
Measure=Plugin
30+
Plugin=PowershellRM
31+
Param=214,85,113|255
32+
Line=$Saved=$RmAPI.OptionStr("Param")
33+
Line2=$Var0=$RmAPI.VariableStr("Colour.2"); $Var1=$RmAPI.VariableStr("Colour.2.Alpha"); $Exist=[System.IO.File]::Exists("#@#Modules\Taskbar\Include\Dependencies\Icons\.Default.png"); $Var="$Var0|$Var1"
34+
Line3=if(($Saved -ne $Var) -or ($Exist -eq $False)) {$RmAPI.Bang("!WriteKeyValue $($RmAPI.GetMeasureName()) Param `"`"`"$Var`"`"`" `"`"`"$($RmAPI.VariableStr("@") + "Modules\Taskbar\Taskbar.inc")`"`"`" "); $RmAPI.Bang("!EnableMeasure Module.Taskbar.MM.IconDefault"); $RmAPI.Bang("!CommandMeasure Module.Taskbar.MM.IconDefault Update")}
35+
36+
[Module.Taskbar.MM.IconDefault]
37+
Measure=Plugin
38+
Plugin=MagickMeter
39+
Image=File #@#Modules\Taskbar\Include\StockIcon\.Default.png | AdaptiveResize 64,64 | Colorize (#Colour.2.Alpha#*100/255);#Colour.2#
40+
DynamicVariables=1
41+
ExportTo=#@#Modules\Taskbar\Include\Dependencies\Icons\.Default.png
42+
Disabled=1
43+
OnFinishAction=[!DisableMeasure #CurrentSection#]
44+
45+
[Module.Taskbar.Container]
46+
Meter=Image
47+
x=(#Module.Taskbar.P#-(#Module.Taskbar.A#*0.5)*#Module.Taskbar.W#)
48+
y=((#Body.Height#-#Body.Element#)/2)
49+
w=#Module.Taskbar.W#
50+
h=#Body.Element#
51+
SolidColor=0,0,0
52+
DynamicVariables=1

Modular Taskbar/@Resources/Modules/Time/Include/Variables.inc renamed to @Resources/Modules/Time/Include/Variables.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
Module.Time.P=1492
44
; vargen|Time Anchor [0/1/2]|Time|int|0:2
55
Module.Time.A=2
6-
Module.Time.W=(2*#Body.Element#)
6+
Module.Time.W=(2*#Body.Element#)

Modular Taskbar/@Resources/Modules/Volume/Include/Variables.inc renamed to @Resources/Modules/Volume/Include/Variables.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
Module.Volume.P=1356
44
; vargen|Volume Anchor [0/1/2]|Volume|int|0:2
55
Module.Volume.A=2
6-
Module.Volume.W=(2*#Body.Element#)
6+
Module.Volume.W=(2*#Body.Element#)

Modular Taskbar/@Resources/Settings/Settings.ps1 renamed to @Resources/Settings/Settings.ps1

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# Functions for setting menu
1+
2+
# ==========================================================================
3+
# Functions for setting menu navigation
4+
# ==========================================================================
25

36
function MoveLabel { # Moves sidebar button label with appropriate text and location
47
Param([int] $Location,
@@ -27,7 +30,9 @@ function HideLabel { # Hides sidebar button label
2730
$RmAPI.Bang("!HideMeter `"`"`"Setting.LabelBackground`"`"`" ")
2831
}
2932

33+
# ==========================================================================
3034
# Functions for retrieving data from variables.inc and module info
35+
# ==========================================================================
3136

3237
$RootConfig=$RmAPI.VariableStr("RootConfig")
3338
$VariablesFile=$RmAPI.VariableStr("@") + "Variables.inc"
@@ -51,7 +56,7 @@ function AvaliableModules {
5156

5257
# Lists currently active modules
5358
# https://stackoverflow.com/questions/50843357/returning-arraylist-from-function-script
54-
function ActiveModules {
59+
function GetActiveModules {
5560
$Dest=$ModuleListFile
5661
$Content = [System.Collections.Arraylist]((Get-Content $Dest -Raw) -split [Environment]::NewLine)
5762
try {$Content.RemoveAt(0)} catch {}
@@ -69,7 +74,7 @@ function ActiveModules {
6974
function IsModuleActive {
7075
Param($Module)
7176

72-
$ActiveModules=ActiveModules
77+
$ActiveModules=GetActiveModules
7378
if($ActiveModules){ # Check if any modules are active to prevent operation on null object
7479
if($ActiveModules.Contains($Module)){
7580
return $True
@@ -82,7 +87,7 @@ function IsModuleActive {
8287
function AddModule {
8388
Param($Module)
8489

85-
$ActiveModules=ActiveModules
90+
$ActiveModules=GetActiveModules
8691

8792
if((AvaliableModules).Contains($Module)){
8893
if($ActiveModules){ # Check if at least one modules are active to prevent operation on null object
@@ -101,7 +106,7 @@ function AddModule {
101106
function RemoveModule {
102107
Param($Module)
103108

104-
$ActiveModules=ActiveModules
109+
$ActiveModules=GetActiveModules
105110

106111
if($ActiveModules) { # Check if at least one modules are active to prevent operation on null object
107112
if($ActiveModules.Contains($Module)){ # Check if module is activated
@@ -392,9 +397,52 @@ function ValidateVariableInput {
392397
}
393398
$RmAPI.Bang("!WriteKeyValue Variables `"`"`"$($Data[$VariableID]['Name'])`"`"`" `"`"`"$NewInput`"`"`" `"`"`"$File`"`"`" ") # Write new input to file
394399
$RmAPI.Bang("!Refresh `"`"`"$RootConfig`"`"`" ") # Refresh taskbar
400+
ValidateModulePositions
395401
SetInteractableData $Page # Refresh settings
396402
}
397403

404+
function GetTaskbarWidth {
405+
$Data=GenerateInteractableData "General"
406+
407+
for ($i=0; $i -lt $Data.length; $i++) { # Iterate over all avaliable variables within file and returns the taskbar width variable
408+
if($Data[$i]['Name'] -match "Body.Width") {
409+
$TaskbarWidth=$Data[$i]['Value']
410+
return $TaskbarWidth
411+
}
412+
}
413+
}
414+
415+
function GetModulePosition {
416+
Param([String] $Module)
417+
$Data=GenerateInteractableData $Module
418+
419+
for ($i=0; $i -lt $Data.length; $i++) { # Iterate over all avaliable variables within file and returns the position variable
420+
if($Data[$i]['Name'] -match "Module.$($Module).P") {
421+
$Position=$Data[$i]['Value']
422+
return $Position
423+
}
424+
}
425+
}
426+
427+
function ValidateModulePositions {
428+
$ActiveModules=GetActiveModules
429+
430+
# Retrieve taskbar length
431+
$TaskbarWidth=GetTaskbarWidth
432+
433+
$ActiveModules | %{
434+
$Position=GetModulePosition $_
435+
# Write-Host $($TaskbarWidth), $($Position), $($TaskbarWidth - $Position), $($($TaskbarWidth - $Position) -lt 0)
436+
if($($TaskbarWidth - $Position) -lt 0) { # Iterate over each active module and check if they are within bounds
437+
$RmAPI.Bang("!WriteKeyValue Variables `"`"`"Module.$($_).P`"`"`" `"`"`"$TaskbarWidth`"`"`" `"`"`"$ModuleFolder\$_\Include\Variables.inc`"`"`" ") # Write new input to file
438+
}
439+
}
440+
}
441+
442+
# ==========================================================================
443+
# Initialisation of Setting menu
444+
# ==========================================================================
445+
398446
# Initialise
399447
function Initialise {
400448
switch(($RmAPI.VariableStr("CurrentPage"))){
@@ -407,4 +455,4 @@ function Initialise {
407455
}
408456
}
409457

410-
Initialise
458+
Initialise

Modular Taskbar/@Resources/Variables.inc renamed to @Resources/Variables.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ Font.Icon=MaterialIcon
3939
Font.IconS=(#Body.Element#*0.75)
4040

4141
; Do not adjust
42-
Body.X=258
42+
Body.X=210
4343
Body.Y=0

Modular Taskbar.rmskin

-3.41 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Modular Taskbar/@Resources/Modules/Taskbar/Taskbar.inc

Lines changed: 0 additions & 35 deletions
This file was deleted.

Modular Taskbar/Modular Taskbar.ini

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)