百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

screenresolution

> 编程语言
开源

用于在 Mac OS X 10.6 及更高版本中获取、设置和列出显示分辨率的命令行工具

375 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

用于在 Mac OS X 10.6 及更高版本中获取、设置和列出显示分辨率的命令行工具

This is a tool that can be used to determine current resolution, list available resolutions and set resolutions for active displays on Mac OS 10.6, and possibly above. I have only tested 10.6.

I used clang for development, but the code seems to compile just fine with gcc. The code might not be as well layed out as it could be, feel free to send a pull request.

Build+Install

Running the following commands in Terminal.app will result in dmg with a pkg file being created if the system has Xcode 4.

bash
git clone github.com:jhford/screenresolution
cd screenresolution
make dmg

At this point, I'd recommend testing that things work! I have written a 'test' makefile target. Because this script expects two monitors that both use the same resolution, it mightn't work properly for you if you only have one

make test ORIG_RES=1920x1200x32

This will cause your screen to flicker as it changes the mode a couple times on each monitor.

The makefiles support the DESTDIR (alternate root) and PREFIX variables. If you don't know what those are, you probably don't want them.

This will create a DMG file and a PKG file. If you know or care about the differences, you probably know what to do at this point. If you want to install this program on the system you built it on, you can run

open screenresolution.pkg

If you want to put this program on another system, you can choose between the pkg file, the dmg file, the binaries or use the install make target with DESTDIR to specify an alternate root.

Running

There are three commands that this program supports: get, list and set. All three modes operate on active displays [1].

The get mode will show you the resolution of all active displays

$ screenresolution get
Display 0: 1920x1200x32
Display 1: 1920x1200x32

The list mode will show you to the available resolutions of all active displays, seperated by various whitespace.

Available Modes on Display 0
  1920x1200x8   1920x1200x16    1920x1200x32    960x600x8 
  960x600x16    960x600x32      1680x1050x8 	1680x1050x16 

Available Modes on Display 1

The set command takes a list of modes. It will apply the modes in the list of modes to the list of displays, starting with 0. Modes in excess of the number of active displays will be ignored. If you wish to set a monitor but not the lower numbered displays, there is a keyword 'skip' which can be subsituted for a resolution. This keyword will cause the first display to be skipped. If you specify more resolutions than you have active screens, the extra resolutions will be ignored.

Example 1: This example works with one or more screens $ screenresolution set 800x600x32 Result 1: The main display will change to 800x600x32, second screen will not be changed

Example 2: This example assumes two screens $ screenresolution set 800x600x32 800x600x32 Result 2: The first and second monitor on the system will be set to 800x600x32

Example 3: This example assumes two screens $ screenresolution set skip 800x600x32 This will not touch the first screen but will set the second screen to 800x600x32

[1]See discussion point for explanation of what active display means. http://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/c/func/CGGetActiveDisplayList

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言