-
Notifications
You must be signed in to change notification settings - Fork 1
/
Restart-Firefox.ps1
78 lines (61 loc) · 1.31 KB
/
Restart-Firefox.ps1
1
2
3
4
5
6
7
8
9
10
11
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
75
76
77
78
<#
.SYNOPSIS
Stops currently running Firefox processes, stops them, and starts one.
#>
[CmdletBinding()]
param (
# Only affects Firefox developer edition (by checking whether "Developer" exists in path to the
# process binary.
[switch]
$Dev
)
function main {
$foxxos = Get-Process firefox -ErrorAction Ignore | Where-Object { $null -ne $_.Path }
if ($Dev) {
$foxxos = $foxxos | Where-Object { $_.Path.Contains('Developer') }
}
logMeh "Found $($foxxos.Count) foxxos"
if ($foxxos.Count -eq 0) {
kthxbai👋
}
$foxxo = ($foxxos | Select-Object Path -Unique).Path
if ($foxxo.Count -eq 1) {
logYay "Using foxxo at ``$foxxo`` :3"
} else {
logNay "Found $($foxxo.Count) unique foxxos; not sure which one to use :3"
kthxbai👋
}
logYay 'Stopping foxxos'
$foxxos | stoppppp😭
logYay 'Starting Firefox'
omghai❤️ $foxxo
}
function logYay($huh) {
Write-Host -NoNewline -ForegroundColor Green '^_^ '
Write-Host $huh
}
function logMeh($huh) {
Write-Host -NoNewline -ForegroundColor Blue '-_- '
Write-Host $huh
}
function logNay($huh) {
Write-Host -NoNewline -ForegroundColor Red '>_< '
Write-Host $huh
}
function stoppppp😭 {
param(
[Parameter(ValueFromPipeline)]
$fox
)
process {
$fox | Stop-Process
}
}
function omghai❤️ {
param($fox)
& $fox
}
function kthxbai👋 {
exit
}
main