Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0.1 #21

Merged
merged 4 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Module.Battery.P=1424
; vargen|Battery Anchor [0/1/2]|Battery|int|0:2
Module.Battery.A=2
Module.Battery.W=(2*#Body.Element#)
Module.Battery.W=(2*#Body.Element#)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Module.NowPlaying.W=(12*#Body.Element#)

Module.NowPlaying.DisplayW=(#Module.NowPlaying.W#-#Body.Element#*2-#Body.Padding#*2)
Module.NowPlaying.DisplayFormat=%1
Module.NowPlaying.MiniCoverSize=178
Module.NowPlaying.MiniCoverSize=178
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ Measure=Plugin
Plugin=PowershellRM
Param=214,85,113|255|178|6
Line=$Saved=$RmAPI.OptionStr("Param")
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"
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")}
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"
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")}

[Module.NowPlaying.MM.CoverMiniDefault]
Measure=Plugin
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function GenerateItemInc { # Only accepts .lnk files, all other file types are i
$Saved=$RmAPI.OptionStr("Param")
if($Saved -ne $Param) {
$RMAPI.Bang("!WriteKeyValue $($RmAPI.GetMeasureName()) `"`"`"Param`"`"`" `"`"`"$Param`"`"`" `"`"`"$($RmAPI.VariableStr("@") + "Modules\Shortcut\Shortcut.inc")`"`"`"")
$RMAPI.Bang("!WriteKeyValue Variables `"`"`"Module.Shortcut.GennedItemCount`"`"`" `"`"`"$($Count.length)`"`"`" `"`"`"$($RmAPI.VariableStr("RootConfigPath") + "PopUp\Shortcut_PopUp.ini")`"`"`"")
$RMAPI.Bang("!WriteKeyValue Variables `"`"`"Module.Shortcut.GennedItemCount`"`"`" `"`"`"$($Count.Count)`"`"`" `"`"`"$($RmAPI.VariableStr("RootConfigPath") + "PopUp\Shortcut_PopUp.ini")`"`"`"")
$Content=""
Get-ChildItem $Shortcuts -File | Where-Object Name -Match "lnk$" | ForEach-Object {
$Content += @"
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DynamicVariables=1
[Module.Shortcut.PSRM]
Measure=Plugin
Plugin=PowershellRM
Param=File Explorer|Internet Explorer|Notepad|Paint
Param=Explorer|Internet Explorer|Notepad|Paint
ScriptFile=#@#Modules\Shortcut\Include\Shortcut.ps1

[Module.Shortcut.Container]
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
$MeterPrefix="Module.Taskbar.Icon."
$DefaultIcon=".Default"
$RootConfig=$RmApi.VariableStr("RootConfig")
$RootConfigPath=$RmApi.VariableStr("RootConfigPath")
$DependenciesPath=$RmApi.VariableStr("Module.Taskbar.DependenciesPath")
$StockIconPath=$RmAPI.VariableStr("Module.Taskbar.StockIconPath")
$GenIconPath="$($DependenciesPath)\Icons"

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

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

function ReturnIsIconExist {
Param([String] $Name)

$File="$($GenIconPath)\$($Name).png"
$FileExist=[System.IO.File]::Exists($File)
return $FileExist
}

function RunGetIcons { # Runs the GetIcon.exe executable to get icon images of all currently running processes
$GetIconsPath="$($RMAPI.VariableStr("Module.Taskbar.DependenciesPath"))\getIcons.exe"
$GetIconsPath="$($DependenciesPath)\getIcons.exe"
$Pinned=$RmAPI.VariableStr("Module.Taskbar.AddDep")
& "$GetIconsPath" "$Pinned" | Out-Null
}

function SetProgramPin { # Toggle the pinned status of a particularp program
Param([int] $ID)
$IsPinned=ReturnIsProgramPinned($ID)
Expand All @@ -52,18 +65,23 @@ function SetProgramImage { # Set the icon image of a particular program

$ProgramName=ReturnProgramName($ID)
$StockIcons=ReturnStockIcons
$StockIconPath=$RmAPI.VariableStr("Module.Taskbar.StockIconPath")
$GenIconPath="$($RmAPI.VariableStr("Module.Taskbar.DependenciesPath"))\Icons"
$StockIconPath=$StockIconPath
$GenIconPath=$GenIconPath

If($ProgramName -Match "Empty") { # Note: having "" instead of `"`"`"`"`"`" breaks because of the lack of magic quotes (as expected)
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"`"`"`" ")
If($ProgramName -Match "Empty") { # ProgramOptions returns "Empty" string value if there is no program
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"`"`"`" ") # Clears image
}
Else {
If($StockIcons -clike $ProgramName){ # if there exist a stock icon, then use the stock icon instead, if not use the generated one
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$StockIconPath\$ProgramName.png`"`"`" ")
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$StockIconPath\$ProgramName.png`"`"`" ") # Using stock icon
}
Else{
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$GenIconPath\$ProgramName.png`"`"`" ")
if($(ReturnIsIconExist $(ReturnProgramName $ID))) {
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$GenIconPath\$ProgramName.png`"`"`" ") # Using retrieved icon
}
else {
$RmAPI.Bang("!SetOption $MeterPrefix$ID ImageName `"`"`"$GenIconPath\$DefaultIcon.png`"`"`" ") # Using retrieved icon
}
}
}
}
Expand Down Expand Up @@ -138,11 +156,12 @@ function MouseLeaveAction {

function GenerateBarItemInc { # Generates an .inc file containing the appropriate amount of meters in the module
$Count=ReturnMaxProgramCount
$CurrentCount=$RMAPI.Variable("Module.Taskbar.GennedItemCount",-1)
$CurrentCount=$RMAPI.Variable("Module.Taskbar.GennedItemCount")
If($Count -ne $CurrentCount){ # Generator only runs if necessary
$Destination=$RmAPI.VariableStr("@") + "Modules\Taskbar\Include\Item.inc"
$Content=@"
[Variables]
Module.Taskbar.GennedItemCount=$($Count)

"@
For($i=0; $i -lt $Count; $i++){
Expand Down
52 changes: 52 additions & 0 deletions @Resources/Modules/Taskbar/Taskbar.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[Variables]
@IncludeTaskbarVariables=#@#Modules\Taskbar\Include\Variables.inc
@IncludeTaskbarIcon=#@#Modules\Taskbar\Include\Item.inc

[Module.Taskbar.StyleIcon]
Group=Module.Taskbar.Icon
y=((#Body.Element#-#Module.Taskbar.IconSize#)/2)
w=#Module.Taskbar.IconSize#
ImageTint=#Module.Taskbar.DefaultShade#
DynamicVariables=1
AntiAlias=1
Container=Module.Taskbar.Container

[Module.Taskbar.ProgramOptions]
Measure=Plugin
Plugin=ProgramOptions
Indexes=#Module.Taskbar.ProgramCount#
AdditionalDependencies=#Module.Taskbar.AddDep#
WindowMirrorPath=#Module.Taskbar.WMPath#
UpdateDivider=(1000/#UpdateInterval#)

[Module.Taskbar.PSRM]
Measure=Plugin
Plugin=PowerShellRM
ScriptFile=#@#Modules\Taskbar\Include\Taskbar.ps1
UpdateDivider=(1000/#UpdateInterval#)

[Module.Taskbar.PSRM2]
Measure=Plugin
Plugin=PowershellRM
Param=214,85,113|255
Line=$Saved=$RmAPI.OptionStr("Param")
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"
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")}

[Module.Taskbar.MM.IconDefault]
Measure=Plugin
Plugin=MagickMeter
Image=File #@#Modules\Taskbar\Include\StockIcon\.Default.png | AdaptiveResize 64,64 | Colorize (#Colour.2.Alpha#*100/255);#Colour.2#
DynamicVariables=1
ExportTo=#@#Modules\Taskbar\Include\Dependencies\Icons\.Default.png
Disabled=1
OnFinishAction=[!DisableMeasure #CurrentSection#]

[Module.Taskbar.Container]
Meter=Image
x=(#Module.Taskbar.P#-(#Module.Taskbar.A#*0.5)*#Module.Taskbar.W#)
y=((#Body.Height#-#Body.Element#)/2)
w=#Module.Taskbar.W#
h=#Body.Element#
SolidColor=0,0,0
DynamicVariables=1
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Module.Time.P=1492
; vargen|Time Anchor [0/1/2]|Time|int|0:2
Module.Time.A=2
Module.Time.W=(2*#Body.Element#)
Module.Time.W=(2*#Body.Element#)
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
Module.Volume.P=1356
; vargen|Volume Anchor [0/1/2]|Volume|int|0:2
Module.Volume.A=2
Module.Volume.W=(2*#Body.Element#)
Module.Volume.W=(2*#Body.Element#)
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Functions for setting menu

# ==========================================================================
# Functions for setting menu navigation
# ==========================================================================

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

# ==========================================================================
# Functions for retrieving data from variables.inc and module info
# ==========================================================================

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

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

$ActiveModules=ActiveModules
$ActiveModules=GetActiveModules
if($ActiveModules){ # Check if any modules are active to prevent operation on null object
if($ActiveModules.Contains($Module)){
return $True
Expand All @@ -82,7 +87,7 @@ function IsModuleActive {
function AddModule {
Param($Module)

$ActiveModules=ActiveModules
$ActiveModules=GetActiveModules

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

$ActiveModules=ActiveModules
$ActiveModules=GetActiveModules

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

function GetTaskbarWidth {
$Data=GenerateInteractableData "General"

for ($i=0; $i -lt $Data.length; $i++) { # Iterate over all avaliable variables within file and returns the taskbar width variable
if($Data[$i]['Name'] -match "Body.Width") {
$TaskbarWidth=$Data[$i]['Value']
return $TaskbarWidth
}
}
}

function GetModulePosition {
Param([String] $Module)
$Data=GenerateInteractableData $Module

for ($i=0; $i -lt $Data.length; $i++) { # Iterate over all avaliable variables within file and returns the position variable
if($Data[$i]['Name'] -match "Module.$($Module).P") {
$Position=$Data[$i]['Value']
return $Position
}
}
}

function ValidateModulePositions {
$ActiveModules=GetActiveModules

# Retrieve taskbar length
$TaskbarWidth=GetTaskbarWidth

$ActiveModules | %{
$Position=GetModulePosition $_
# Write-Host $($TaskbarWidth), $($Position), $($TaskbarWidth - $Position), $($($TaskbarWidth - $Position) -lt 0)
if($($TaskbarWidth - $Position) -lt 0) { # Iterate over each active module and check if they are within bounds
$RmAPI.Bang("!WriteKeyValue Variables `"`"`"Module.$($_).P`"`"`" `"`"`"$TaskbarWidth`"`"`" `"`"`"$ModuleFolder\$_\Include\Variables.inc`"`"`" ") # Write new input to file
}
}
}

# ==========================================================================
# Initialisation of Setting menu
# ==========================================================================

# Initialise
function Initialise {
switch(($RmAPI.VariableStr("CurrentPage"))){
Expand All @@ -407,4 +455,4 @@ function Initialise {
}
}

Initialise
Initialise
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ Font.Icon=MaterialIcon
Font.IconS=(#Body.Element#*0.75)

; Do not adjust
Body.X=258
Body.X=210
Body.Y=0
Binary file modified Modular Taskbar.rmskin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
35 changes: 0 additions & 35 deletions Modular Taskbar/@Resources/Modules/Taskbar/Taskbar.inc

This file was deleted.

39 changes: 0 additions & 39 deletions Modular Taskbar/Modular Taskbar.ini

This file was deleted.

Loading