Created
December 6, 2018 19:38
-
-
Save vRobM/bf158904fcbdcd45c94eceaaa58556ec to your computer and use it in GitHub Desktop.
Make Slack Desktop for Windows have dARK mode using powershell.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ark Labs presents - Slack dARK mode | |
$slackBaseDir = "$env:LocalAppData\Slack" | |
$installations = Get-ChildItem $slackBaseDir -Directory | Where-Object { $_.Name.StartsWith("app-") } | |
$version = $installations | Sort-Object { [version]$_.Name.Substring(4) } | Select-Object -Last 1 | |
Write-Output "Select highest intalled Slack version: $version"; | |
$modAdded = $false; | |
$customContent = @' | |
// slack-dARK-mode |-) | |
document.addEventListener('DOMContentLoaded', function() { | |
$.ajax({ | |
url: 'https://raw.githubusercontent.com/laCour/slack-night-mode/master/css/raw/black.css', | |
success: function(css) { | |
$("<style></style>").appendTo('head').html(css); | |
} | |
}); | |
}); | |
'@ | |
if ((Get-Content "$($version.FullName)\resources\app.asar.unpacked\src\static\index.js" | %{$_ -match "// laCour - slack-night-mode"}) -notcontains $true) { | |
Add-Content "$($version.FullName)\resources\app.asar.unpacked\src\static\index.js" $customContent | |
Write-Host "Mod Added To index.js"; | |
$modAdded = $true; | |
} else { | |
Write-Host "Mod Detected In index.js - Skipping"; | |
} | |
if ((Get-Content "$($version.FullName)\resources\app.asar.unpacked\src\static\ssb-interop.js" | %{$_ -match "// laCour - slack-night-mode"}) -notcontains $true) { | |
Add-Content "$($version.FullName)\resources\app.asar.unpacked\src\static\ssb-interop.js" $customContent | |
Write-Host "Mod Added To ssb-interop.js"; | |
$modAdded = $true; | |
} else { | |
Write-Host "Mod Detected In ssb-interop.js - Skipping"; | |
} | |
if ($modAdded -eq $true) { | |
if((Get-Process "slack" -ErrorAction SilentlyContinue) -ne $null) { | |
Write-Host "Mod Complete - Mod Will Take Effect After Slack Is Restarted"; | |
} else { | |
Write-Host "Mod Complete"; | |
} | |
} else { | |
Write-Host "Mod Already Active - No Further Action Is Needed."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TL;DR: use my fork
throw this into a
.bat
file and run this permission elevated in case you don't want to enable powershell scripts globally:i assume
%{$_ -match "// laCour - slack-night-mode"}
does not work either.i'm using this now:
i simply forked this now https://gist.github.com/GottZ/621f4b6994cfb2726e43e18e7a75e49a