diff --git a/dot_config/powershell/modules/alias.ps1 b/dot_config/powershell/Async/alias.ps1 similarity index 100% rename from dot_config/powershell/modules/alias.ps1 rename to dot_config/powershell/Async/alias.ps1 diff --git a/dot_config/powershell/Async/catppuccin.ps1 b/dot_config/powershell/Async/catppuccin.ps1 new file mode 100644 index 0000000..193b78b --- /dev/null +++ b/dot_config/powershell/Async/catppuccin.ps1 @@ -0,0 +1,46 @@ +Import-Module Catppuccin -Global +$global:Flavor = $catppuccin['Mocha'] + +$Colors = @{ + # Largely based on the Code Editor style guide + # Emphasis, ListPrediction and ListPredictionSelected are inspired by the Catppuccin fzf theme + + # Powershell colours + ContinuationPrompt = $Flavor.Teal.Foreground() + Emphasis = $Flavor.Red.Foreground() + Selection = $Flavor.Surface0.Background() + + # PSReadLine prediction colours + InlinePrediction = $Flavor.Overlay0.Foreground() + ListPrediction = $Flavor.Mauve.Foreground() + ListPredictionSelected = $Flavor.Surface0.Background() + + # Syntax highlighting + Command = $Flavor.Blue.Foreground() + Comment = $Flavor.Overlay0.Foreground() + Default = $Flavor.Text.Foreground() + Error = $Flavor.Red.Foreground() + Keyword = $Flavor.Mauve.Foreground() + Member = $Flavor.Rosewater.Foreground() + Number = $Flavor.Peach.Foreground() + Operator = $Flavor.Sky.Foreground() + Parameter = $Flavor.Pink.Foreground() + String = $Flavor.Green.Foreground() + Type = $Flavor.Yellow.Foreground() + Variable = $Flavor.Lavender.Foreground() +} + +# Set the colours +Set-PSReadLineOption -Colors $Colors + + +# The following colors are used by PowerShell's formatting +# Again PS 7.2+ only +$global:PSStyle.Formatting.Debug = $Flavor.Sky.Foreground() +$global:PSStyle.Formatting.Error = $Flavor.Red.Foreground() +$global:PSStyle.Formatting.ErrorAccent = $Flavor.Blue.Foreground() +$global:PSStyle.Formatting.FormatAccent = $Flavor.Teal.Foreground() +$global:PSStyle.Formatting.TableHeader = $Flavor.Rosewater.Foreground() +$global:PSStyle.Formatting.Verbose = $Flavor.Yellow.Foreground() +$global:PSStyle.Formatting.Warning = $Flavor.Peach.Foreground() + diff --git a/dot_config/powershell/modules/chezmoi.ps1 b/dot_config/powershell/Async/chezmoi.ps1 similarity index 100% rename from dot_config/powershell/modules/chezmoi.ps1 rename to dot_config/powershell/Async/chezmoi.ps1 diff --git a/dot_config/powershell/modules/completion.ps1 b/dot_config/powershell/Async/completion.ps1 similarity index 100% rename from dot_config/powershell/modules/completion.ps1 rename to dot_config/powershell/Async/completion.ps1 diff --git a/dot_config/powershell/modules/core.ps1 b/dot_config/powershell/Async/core.ps1 similarity index 93% rename from dot_config/powershell/modules/core.ps1 rename to dot_config/powershell/Async/core.ps1 index 518143d..7757bdf 100644 --- a/dot_config/powershell/modules/core.ps1 +++ b/dot_config/powershell/Async/core.ps1 @@ -22,6 +22,16 @@ function Get-Profile-Async { } } +function Get-Color-String { + param ( + [Parameter(Mandatory)] + [string] $in + ) + # Ceck if catppucin is loaded + +} + + # Schedules module/script loading to occur asynchronously during idle time. # Each queued script is executed one-at-a-time on each idle event, which keeps # the initial prompt responsive. @@ -72,7 +82,7 @@ function Start-AsyncModuleInitialization { # Re-render the prompt as soon as possible try { - [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt() + # [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt() } catch { # PSReadLine not available; ignore diff --git a/dot_config/powershell/Async/oh-my-posh.ps1 b/dot_config/powershell/Async/oh-my-posh.ps1 new file mode 100644 index 0000000..60a5a81 --- /dev/null +++ b/dot_config/powershell/Async/oh-my-posh.ps1 @@ -0,0 +1,12 @@ +### Oh My Posh init +$configPath = Resolve-Path (Join-Path $HOME ".config/oh-my-posh.yaml") +oh-my-posh init --config $configPath pwsh | Invoke-Expression + + +# Re-render the prompt as soon as possible +try { + [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt() +} +catch { + # PSReadLine not available; ignore +} \ No newline at end of file diff --git a/dot_config/powershell/modules/psprofiler.ps1 b/dot_config/powershell/Async/psprofiler.ps1 similarity index 100% rename from dot_config/powershell/modules/psprofiler.ps1 rename to dot_config/powershell/Async/psprofiler.ps1 diff --git a/dot_config/powershell/modules/zoxide.ps1 b/dot_config/powershell/Async/zoxide.ps1 similarity index 100% rename from dot_config/powershell/modules/zoxide.ps1 rename to dot_config/powershell/Async/zoxide.ps1 diff --git a/dot_config/powershell/Modules/Catppuccin/Catppuccin.psd1 b/dot_config/powershell/Modules/Catppuccin/Catppuccin.psd1 new file mode 100644 index 0000000..d071ec0 --- /dev/null +++ b/dot_config/powershell/Modules/Catppuccin/Catppuccin.psd1 @@ -0,0 +1,154 @@ +# +# Module manifest for module 'Catppuccin' +# +# Generated by: Stuart Miller +# +# Generated on: 17/05/2023 +# + +@{ + +# Script module or binary module file associated with this manifest. +RootModule = 'Catppuccin.psm1' + +# Version number of this module. +ModuleVersion = '0.2.0' + +# Supported PSEditions +CompatiblePSEditions = @('Desktop', 'Core') + +# ID used to uniquely identify this module +GUID = '681715b8-9e32-404a-bf63-514f89225de0' + +# Author of this module +Author = 'Stuart Miller' + +# Company or vendor of this module +# CompanyName = '' + +# Copyright statement for this module +Copyright = @' +MIT License + +Copyright (c) 2021 Catppuccin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +'@ + +# Description of the functionality provided by this module +# Description = '' + +# Minimum version of the PowerShell engine required by this module +PowerShellVersion = '5.1' + +# Name of the PowerShell host required by this module +# PowerShellHostName = '' + +# Minimum version of the PowerShell host required by this module +# PowerShellHostVersion = '' + +# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# DotNetFrameworkVersion = '' + +# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. +# ClrVersion = '' + +# Processor architecture (None, X86, Amd64) required by this module +# ProcessorArchitecture = '' + +# Modules that must be imported into the global environment prior to importing this module +# RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +# RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module. +# ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +# TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +# FormatsToProcess = @() + +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess +# NestedModules = @() + +# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. +FunctionsToExport = @() + +# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. +CmdletsToExport = @() + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. +AliasesToExport = @() + +# DSC resources to export from this module +# DscResourcesToExport = @() + +# List of all modules packaged with this module +# ModuleList = @() + +# List of all files packaged with this module +# FileList = @() + +# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. +PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + # Tags = @() + + # A URL to the license for this module. + LicenseUri = 'https://github.com/catppuccin/powershell/blob/main/LICENSE' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/catppuccin/powershell' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + # Prerelease string of this module + # Prerelease = '' + + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + # ExternalModuleDependencies = @() + + } # End of PSData hashtable + +} # End of PrivateData hashtable + +# HelpInfo URI of this module +# HelpInfoURI = '' + +# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. +# DefaultCommandPrefix = '' + +} + diff --git a/dot_config/powershell/Modules/Catppuccin/Catppuccin.psm1 b/dot_config/powershell/Modules/Catppuccin/Catppuccin.psm1 new file mode 100644 index 0000000..61d7f11 --- /dev/null +++ b/dot_config/powershell/Modules/Catppuccin/Catppuccin.psm1 @@ -0,0 +1,422 @@ +class Colour { + <# + .SYNOPSIS + A class to represent a colour + .DESCRIPTION + A class to represent a colour, with methods to return the RGB values, HSL values, hex code, + and ANSI escape sequences for foreground and background colours + #> + + # Required Values + [byte]$Red + [byte]$Green + [byte]$Blue + + # Calculated Values + hidden [double]$Hue + hidden [double]$Saturation + hidden [double]$Lightness + + # Flags + hidden [bool]$HasHSL = $false + + Colour([byte]$Red, [byte]$Green, [byte]$Blue) { + <# + .SYNOPSIS + Creates a new colour object + .PARAMETER Red + The red value of the colour + .PARAMETER Green + The green value of the colour + .PARAMETER Blue + The blue value of the colour + #> + $this.Red = $Red + $this.Green = $Green + $this.Blue = $Blue + } + + [byte[]]RGB() { + <# + .SYNOPSIS + Returns the seperate RGB values for the colour + #> + return @($this.Red, $this.Green, $this.Blue) + } + + [string]RGBString() { + <# + .SYNOPSIS + Returns the RGB values for the colour as a string + #> + return "$($this.Red), $($this.Green), $($this.Blue)" + } + + [double[]]HSL() { + <# + .SYNOPSIS + Returns the seperate HSL values for the colour + + .DESCRIPTION + Returns the seperate HSL values for the colour + HSL values are returned as an array of doubles, in the order of Hue, Saturation, and Lightness + Hue is returned in degrees, from 0 to 360 + Saturation and Lightness are returned as a value in the range of 0 to 1 + + .NOTES + This method is based on the algorithm found at: + https://www.had2know.org/technology/hsl-rgb-color-converter.html + #> + + # Return the values if they have already been calculated + if ($this.HasHSL) { + return @($this.Hue, $this.Saturation, $this.Lightness) + } + + # Convert to a value from 0 to 1 + $local:R = $this.Red / 255 + $local:G = $this.Green / 255 + $local:B = $this.Blue / 255 + + # Calculate Max and Min values - Nested because Math.Min/Max only take 2 arguments + $local:Max = [Math]::Max([Math]::Max($R, $G), $B) + $local:Min = [Math]::Min([Math]::Min($R, $G), $B) + + # Calculate Lightness + $local:L = ($Max + $Min) / 2 + + # Calculate Saturation - if/else to avoid divide by 0 + $local:S = if ($L -gt 0) { ($Max - $Min) / (1 - [Math]::Abs(2 * $L - 1)) } else { 0 } + + # Calculate Hue -> Convert to degrees - if/else to avoid NaN + $local:H = if ($G -ne $B ) { + [Math]::Acos(($R - $G / 2 - $B / 2) / + [Math]::Sqrt([Math]::Pow($R, 2) + [Math]::Pow($G, 2) + [Math]::Pow($B, 2) - + $R * $G - $R * $B - $G * $B)) * 180 / [Math]::PI + } else { + 0 + } + + # Value above is only correct for H < 180, so we need to correct it for the blue half of the colour wheel + if ($B -gt $G) { + $H = 360 - $H + } + + # Set flag + $this.HasHSL = $true + + # Cache values + $this.Hue = $H + $this.Saturation = $S + $this.Lightness = $L + + return @($H, $S, $L) + } + + [string]HSLString() { + <# + .SYNOPSIS + Returns the HSL values for the colour as a formatted string + + .DESCRIPTION + Returns the HSL values for the colour as a formatted string + Hue is returned in degrees, from 0 to 360 + Saturation and Lightness are returned as a percentage, from 0 to 100 + All values are rounded to the nearest integer + #> + $local:HSL = $this.HSL() + return "$([Math]::Round($HSL[0])), $([Math]::Round($HSL[1] * 100))%, $([Math]::Round($HSL[2] * 100))%" + } + + [double[]]HSV() { + <# + .SYNOPSIS + Returns the seperate HSV values for the colour + + .DESCRIPTION + Returns the seperate HSV values for the colour + HSV values are returned as an array of doubles, in the order of Hue, Saturation, and Value + Hue is returned in degrees, from 0 to 360 + Saturation and Value are returned as a value in the range of 0 to 1 + #> + + # Derived from the HSL values + $local:H, $local:S, $local:L = $this.HSL() + + # H = H + $local:V = $L + $S * [Math]::Min($L, 1 - $L) + $local:S = if ($V -ne 0) { 2 * (1 - $L / $V) } else { 0 } + + return @($H, $S, $V) + } + + [string]HSVString() { + <# + .SYNOPSIS + Returns the HSV values for the colour as a formatted string + + .DESCRIPTION + Returns the HSV values for the colour as a formatted string + Hue is returned in degrees, from 0 to 360 + Saturation and Value are returned as a percentage, from 0 to 100 + All values are rounded to the nearest integer + #> + $local:HSV = $this.HSV() + return "$([Math]::Round($HSV[0])), $([Math]::Round($HSV[1] * 100))%, $([Math]::Round($HSV[2] * 100))%" + } + + [double[]]CMYK() { + <# + .SYNOPSIS + Returns the CMYK values for the colour + + .DESCRIPTION + Returns the CMYK values for the colour + CMYK values are returned as value from 0 to 1 + #> + $local:R = $this.Red / 255 + $local:G = $this.Green / 255 + $local:B = $this.Blue / 255 + + $local:K = 1 - [Math]::Max([Math]::Max($R, $G), $B) + $local:C = if ($K -ne 1) { (1 - $R - $K) / (1 - $K) } else { 0 } + $local:M = if ($K -ne 1) { (1 - $G - $K) / (1 - $K) } else { 0 } + $local:Y = if ($K -ne 1) { (1 - $B - $K) / (1 - $K) } else { 0 } + + return @($C, $M, $Y, $K) + } + + [string]Hex() { + <# + .SYNOPSIS + Returns the hex code for the colour + #> + return "#$($this.Red.ToString('X2'))$($this.Green.ToString('X2'))$($this.Blue.ToString('X2'))" + } + + [string]Foreground() { + <# + .SYNOPSIS + Returns the ANSI Foreground escape sequence for the colour + #> + return "$([char]27)[38;2;$($this.Red);$($this.Green);$($this.Blue)m" + } + + [string]Background() { + <# + .SYNOPSIS + Returns the ANSI Background escape sequence for the colour + #> + return "$([char]27)[48;2;$($this.Red);$($this.Green);$($this.Blue)m" + } + + [string]ToString() { + <# + .SYNOPSIS + Returns the hex code for the colour + #> + return $this.Hex() + } +} + +class Flavour { + <# + .SYNOPSIS + A class to represent a flavour of Catppuccin + #> + [Colour]$Rosewater + [Colour]$Flamingo + [Colour]$Pink + [Colour]$Mauve + [Colour]$Red + [Colour]$Maroon + [Colour]$Peach + [Colour]$Yellow + [Colour]$Green + [Colour]$Teal + [Colour]$Sky + [Colour]$Sapphire + [Colour]$Blue + [Colour]$Lavender + [Colour]$Text + [Colour]$Subtext1 + [Colour]$Subtext0 + [Colour]$Overlay2 + [Colour]$Overlay1 + [Colour]$Overlay0 + [Colour]$Surface2 + [Colour]$Surface1 + [Colour]$Surface0 + [Colour]$Base + [Colour]$Mantle + [Colour]$Crust + + [string]Blocks() { + <# + .SYNOPSIS + Prints a block for each colour in the flavour + #> + + return $($this.psobject.Properties | Select-Object -ExpandProperty Name | ForEach-Object { + "$($this.$_.Background()) " + }) -Join '' + "$([char]27)[0m" + } + + Table() { + <# + .SYNOPSIS + Prints a table of the colours in the flavour + + .DESCRIPTION + Prints a table of the colours in the flavour, with the colour name, hex code, RGB values, and HSL + values. It also prints a circle of the colour so you can see what it looks like + + The output is intended to mimic the tables in the README.md of the Catppuccin/Catppuccin repo + #> + + $this.psobject.Properties | Select-Object -ExpandProperty Name | + Select-Object -Property ` + @{Name = ' '; Expression = { "$($this.$_.Foreground())$([char]0x2B24)$([char]27)[0m" } }, + @{Name = 'Name'; Expression = { $_.ToString() } }, + @{Name = 'Hex'; Expression = { $this.$_.Hex() } }, + @{Name = 'RGB'; Expression = { "rgb($($this.$_.RGBString()))" } }, + @{Name = 'HSL'; Expression = { "hsl($($this.$_.HSLString()))" } } | + Format-Table -AutoSize | Out-Host + } +} + +[Diagnostics.CodeAnalysis.SuppressMessageAttribute( + 'PSUseDeclaredVarsMoreThanAssignments', '', + Justification = 'Variable is exported')] +$Catppuccin = @{ + 'Latte' = [Flavour]@{ + <# Latte Flavoured Catppuccin #> + # Colours + Rosewater = [Colour]::new(220, 138, 120) + Flamingo = [Colour]::new(221, 120, 120) + Pink = [Colour]::new(234, 118, 203) + Mauve = [Colour]::new(136, 57, 239) + Red = [Colour]::new(210, 15, 57) + Maroon = [Colour]::new(230, 69, 83) + Peach = [Colour]::new(254, 100, 11) + Yellow = [Colour]::new(223, 142, 29) + Green = [Colour]::new(64, 160, 43) + Teal = [Colour]::new(23, 146, 153) + Sky = [Colour]::new(4, 165, 229) + Sapphire = [Colour]::new(32, 159, 181) + Blue = [Colour]::new(30, 102, 245) + Lavender = [Colour]::new(114, 135, 253) + + # Greys + Text = [Colour]::new(76, 79, 105) + Subtext1 = [Colour]::new(92, 95, 119) + Subtext0 = [Colour]::new(108, 111, 133) + Overlay2 = [Colour]::new(124, 127, 147) + Overlay1 = [Colour]::new(140, 143, 161) + Overlay0 = [Colour]::new(156, 160, 176) + Surface2 = [Colour]::new(172, 176, 190) + Surface1 = [Colour]::new(188, 192, 204) + Surface0 = [Colour]::new(204, 208, 218) + Base = [Colour]::new(239, 241, 245) + Mantle = [Colour]::new(230, 233, 239) + Crust = [Colour]::new(220, 224, 232) + } + 'Frappe' = [Flavour]@{ + <# Frappe flavoured Catppuccin #> + # Colours + Rosewater = [Colour]::new(242, 213, 207) + Flamingo = [Colour]::new(238, 190, 190) + Pink = [Colour]::new(244, 184, 228) + Mauve = [Colour]::new(202, 158, 230) + Red = [Colour]::new(231, 130, 132) + Maroon = [Colour]::new(234, 153, 156) + Peach = [Colour]::new(239, 159, 118) + Yellow = [Colour]::new(229, 200, 144) + Green = [Colour]::new(166, 209, 137) + Teal = [Colour]::new(129, 200, 190) + Sky = [Colour]::new(153, 209, 219) + Sapphire = [Colour]::new(133, 193, 220) + Blue = [Colour]::new(140, 170, 238) + Lavender = [Colour]::new(186, 187, 241) + + # Greys + Text = [Colour]::new(198, 208, 245) + Subtext1 = [Colour]::new(181, 191, 226) + Subtext0 = [Colour]::new(165, 173, 206) + Overlay2 = [Colour]::new(148, 156, 187) + Overlay1 = [Colour]::new(131, 139, 167) + Overlay0 = [Colour]::new(115, 121, 148) + Surface2 = [Colour]::new(98, 104, 128) + Surface1 = [Colour]::new(81, 87, 109) + Surface0 = [Colour]::new(65, 69, 89) + Base = [Colour]::new(48, 52, 70) + Mantle = [Colour]::new(41, 44, 60) + Crust = [Colour]::new(35, 38, 52) + } + 'Macchiato' = [Flavour]@{ + <# Macchiato Flavoured Catppuccin #> + # Colours + Rosewater = [Colour]::new(244, 219, 214) + Flamingo = [Colour]::new(240, 198, 198) + Pink = [Colour]::new(245, 189, 230) + Mauve = [Colour]::new(198, 160, 246) + Red = [Colour]::new(237, 135, 150) + Maroon = [Colour]::new(238, 153, 160) + Peach = [Colour]::new(245, 169, 127) + Yellow = [Colour]::new(238, 212, 159) + Green = [Colour]::new(166, 218, 149) + Teal = [Colour]::new(139, 213, 202) + Sky = [Colour]::new(145, 215, 227) + Sapphire = [Colour]::new(125, 196, 228) + Blue = [Colour]::new(138, 173, 244) + Lavender = [Colour]::new(183, 189, 248) + + # Greys + Text = [Colour]::new(202, 211, 245) + Subtext1 = [Colour]::new(184, 192, 224) + Subtext0 = [Colour]::new(165, 173, 203) + Overlay2 = [Colour]::new(147, 154, 183) + Overlay1 = [Colour]::new(128, 135, 162) + Overlay0 = [Colour]::new(110, 115, 141) + Surface2 = [Colour]::new(91, 96, 120) + Surface1 = [Colour]::new(73, 77, 100) + Surface0 = [Colour]::new(54, 58, 79) + Base = [Colour]::new(36, 39, 58) + Mantle = [Colour]::new(30, 32, 48) + Crust = [Colour]::new(24, 25, 38) + } + 'Mocha' = [Flavour]@{ + <# Mocha Flavoured Catppuccin #> + # Colours + Rosewater = [Colour]::new(245, 224, 220) + Flamingo = [Colour]::new(242, 205, 205) + Pink = [Colour]::new(245, 194, 231) + Mauve = [Colour]::new(203, 166, 247) + Red = [Colour]::new(243, 139, 168) + Maroon = [Colour]::new(235, 160, 172) + Peach = [Colour]::new(250, 179, 135) + Yellow = [Colour]::new(249, 226, 175) + Green = [Colour]::new(166, 227, 161) + Teal = [Colour]::new(148, 226, 213) + Sky = [Colour]::new(137, 220, 235) + Sapphire = [Colour]::new(116, 199, 236) + Blue = [Colour]::new(137, 180, 250) + Lavender = [Colour]::new(180, 190, 254) + + # Greys + Text = [Colour]::new(205, 214, 244) + Subtext1 = [Colour]::new(186, 194, 222) + Subtext0 = [Colour]::new(166, 173, 200) + Overlay2 = [Colour]::new(147, 153, 178) + Overlay1 = [Colour]::new(127, 132, 156) + Overlay0 = [Colour]::new(108, 112, 134) + Surface2 = [Colour]::new(88, 91, 112) + Surface1 = [Colour]::new(69, 71, 90) + Surface0 = [Colour]::new(49, 50, 68) + Base = [Colour]::new(30, 30, 46) + Mantle = [Colour]::new(24, 24, 37) + Crust = [Colour]::new(17, 17, 27) + } +} + +Export-ModuleMember -Variable Catppuccin \ No newline at end of file diff --git a/dot_config/powershell/main.ps1 b/dot_config/powershell/main.ps1 index 0fa95b2..771d5ab 100644 --- a/dot_config/powershell/main.ps1 +++ b/dot_config/powershell/main.ps1 @@ -11,19 +11,21 @@ $global:ProfileLoadedAsync = @() # Related Files $powershellDir = Join-Path $HOME ".config/powershell/" -$powershellModules = Join-Path $powershellDir "/modules/" +$powershellAsync = Join-Path $powershellDir "/Async/" +$powershellModules = Join-Path $powershellDir "/Modules/" $myFiles = @{ completionHelper = Join-Path $powershellDir "bash_complete.sh" apiKeys = Join-Path $powershellDir "api_keys.ps1" - core = Join-Path $powershellModules "core.ps1" + core = Join-Path $powershellAsync "core.ps1" } -$myModules = [ordered]@{ - zoxide = Join-Path $powershellModules "zoxide.ps1" - completion = Join-Path $powershellModules "completion.ps1" - alias = Join-Path $powershellModules "alias.ps1" - chezmoi = Join-Path $powershellModules "chezmoi.ps1" - psprofiler = Join-Path $powershellModules "psprofiler.ps1" - ohMyPosh = Join-Path $powershellModules "oh-my-posh.ps1" +$myAsync = [ordered]@{ + zoxide = Join-Path $powershellAsync "zoxide.ps1" + completion = Join-Path $powershellAsync "completion.ps1" + alias = Join-Path $powershellAsync "alias.ps1" + chezmoi = Join-Path $powershellAsync "chezmoi.ps1" + psprofiler = Join-Path $powershellAsync "psprofiler.ps1" + ohMyPosh = Join-Path $powershellAsync "oh-my-posh.ps1" + catppuccin = Join-Path $powershellAsync "catppuccin.ps1" } # Load Core @@ -34,8 +36,16 @@ else { Write-Error "Cant find core module of cutom profile" } +# Add Modules to PS Module load list +if (Get-Os -eq "windows") { + $env:PSModulePath += ";$powershellModules" +} +else { + $env:PSModulePath += ":$powershellModules" +} + # Ensure all files exist -$myFilesAndModules = $myFiles + $myModules +$myFilesAndModules = $myFiles + $myAsync foreach ($key in $myFilesAndModules.Keys) { if (-Not (Test-Path $myFilesAndModules[$key])) { $global:ProfileIssues += @("Missing File: $key → $($myFilesAndModules[$key])") @@ -44,8 +54,12 @@ foreach ($key in $myFilesAndModules.Keys) { ### Setup Temporary promt function prompt { - # We will override this prompt, however because it is loading async we want to communicate that the real prompt is still loading. - "$([char]0x1b)[93m[Loading]$([char]0x1b)[0m $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "; + if ($global:Flavor) { + "$($global:Flavor.Peach.Foreground())[Loading] $($global:Flavor.Text.Foreground())$($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "; + } + else { + "$([char]0x1b)[93m[Loading]$([char]0x1b)[0m $($executionContext.SessionState.Path.CurrentLocation)$('>' * ($nestedPromptLevel + 1)) "; + } } ### Setup-PSReadline @@ -59,7 +73,7 @@ Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete # Defer module/script loading asynchronously during idle -Start-AsyncModuleInitialization $myModules +Start-AsyncModuleInitialization $myAsync # Print timing info $time.Stop() diff --git a/dot_config/powershell/modules/oh-my-posh.ps1 b/dot_config/powershell/modules/oh-my-posh.ps1 deleted file mode 100644 index 1496645..0000000 --- a/dot_config/powershell/modules/oh-my-posh.ps1 +++ /dev/null @@ -1,3 +0,0 @@ -### Oh My Posh init -$configPath = Resolve-Path (Join-Path $HOME ".config/oh-my-posh.yaml") -oh-my-posh init --config $configPath pwsh | Invoke-Expression \ No newline at end of file