Skip to content

Commit

Permalink
added support for multiple displays
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianChow94 committed Sep 5, 2017
1 parent 7372ba3 commit dee03b5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 6 deletions.
45 changes: 45 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File in Temporary Console",
"script": "${file}",
"args": [],
"cwd": "${file}",
"createTemporaryIntegratedConsole": true
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File w/Args Prompt",
"script": "${file}",
"args": [
"${command:SpecifyScriptArgs}"
],
"cwd": "${file}"
},
{
"type": "PowerShell",
"request": "attach",
"name": "PowerShell Attach to Host Process",
"processId": "${command:PickPSHostProcess}",
"runspaceId": 1
},
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Interactive Session",
"cwd": "${workspaceRoot}"
}
]
}
22 changes: 16 additions & 6 deletions screenfetch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,21 @@ Function Get-PrimaryResolution{ Param ($monitorArray)
}
}

####### Information Collection #########
Function Get-Displays
{ Param ($monitorArray)

foreach ($monitor in $monitorArray)
{
$resolution = [System.Tuple]::Create($monitor.Bounds.Width, $monitor.Bounds.Height);
$displayString = $resolution.Item1.ToString() + " x " + $resolution.Item2.ToString() + " ";
Write-Host $displayString -NoNewline;

}

## Resolution Information
$PrimaryResolution = Get-PrimaryResolution([System.Windows.Forms.Screen]::AllScreens);
$Horizontal = $PrimaryResolution.Item1;
$Vertical = $PrimaryResolution.Item2;
Write-Host ;
}

####### Information Collection #########

## Uptime Information
$uptime = ((gwmi Win32_OperatingSystem).ConvertToDateTime((gwmi Win32_OperatingSystem).LocalDateTime) -
Expand Down Expand Up @@ -95,7 +104,8 @@ Write-Host "PowerShell $($PSVersionTable.PSVersion.ToString())"
# Line 7 - Resolution (for primary monitor only)
Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline;
Write-Host "Resolution: " -f Red -NoNewline;
Write-Host $Horizontal "x" $Vertical;
#Write-Host $Horizontal "x" $Vertical;
Get-Displays([System.Windows.Forms.Screen]::AllScreens);

# Line 8 - Windows Manager (HARDCODED, sorry bbzero users)
Write-Host ":::::::::::::::: :::::::::::::::: " -f Cyan -NoNewline;
Expand Down

0 comments on commit dee03b5

Please sign in to comment.