Skip to content
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
37 changes: 37 additions & 0 deletions commands/system/decrease-brightness-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env pwsh
# @raycast.schemaVersion 1
# @raycast.title Decrease Brightness
# @raycast.mode compact
Comment thread
muhammadrizo-y marked this conversation as resolved.
# @raycast.platform windows


# @raycast.icon ⬇️
# @raycast.packageName System
# @raycast.description Decrease screen brightness by a given percentage.
# @raycast.author muhammadrizo
# @raycast.authorURL https://raycast.com/muhammadrizo

# @raycast.argument1 { "type": "text", "placeholder": "Decrease by (%) – default 10", "optional": true }

param(
[Parameter(Mandatory = $false, Position = 0)]
[string]$Delta
)

if ([string]::IsNullOrWhiteSpace($Delta)) {
$Delta = "10"
}

[int]$DeltaInt = -[math]::Abs([int]$Delta)

$brightnessInfo = Get-WmiObject -Namespace root/wmi -Class WmiMonitorBrightness
$current = $brightnessInfo.CurrentBrightness

$new = $current + $DeltaInt
if ($new -lt 0) { $new = 0 }
if ($new -gt 100) { $new = 100 }

$methods = Get-WmiObject -Namespace root/wmi -Class WmiMonitorBrightnessMethods
$methods.WmiSetBrightness(1, [byte]$new)

Write-Output "Set to: $new"
37 changes: 37 additions & 0 deletions commands/system/increase-brightness-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env pwsh
# @raycast.schemaVersion 1
# @raycast.title Increase Brightness
# @raycast.mode compact
Comment thread
muhammadrizo-y marked this conversation as resolved.
# @raycast.platform windows


# @raycast.icon ⬆️
# @raycast.packageName System
# @raycast.description Increase screen brightness by a given percentage.
# @raycast.author muhammadrizo
# @raycast.authorURL https://raycast.com/muhammadrizo

# @raycast.argument1 { "type": "text", "placeholder": "Increase by (%) – default 10", "optional": true }

param(
[Parameter(Mandatory = $false, Position = 0)]
[string]$Delta
)

if ([string]::IsNullOrWhiteSpace($Delta)) {
$Delta = "10"
}

[int]$DeltaInt = $Delta

$brightnessInfo = Get-WmiObject -Namespace root/wmi -Class WmiMonitorBrightness
$current = $brightnessInfo.CurrentBrightness

$new = $current + $DeltaInt
if ($new -lt 0) { $new = 0 }
if ($new -gt 100) { $new = 100 }

$methods = Get-WmiObject -Namespace root/wmi -Class WmiMonitorBrightnessMethods
$methods.WmiSetBrightness(1, [byte]$new)

Write-Output "Set to: $new"