Skip to content

Set Default Monitor #730

Answered by halildurmus
dasaintgray asked this question in Q&A
Jun 21, 2023 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

Here is an example that enumerates all displays and prints their information. Additionally, you can set a specific display as the primary display by calling its setAsPrimary() method or change the resolution of a display by using its resolution setter.

Hope this helps!

// ignore_for_file: camel_case_types, constant_identifier_names

import 'dart:ffi';

import 'package:ffi/ffi.dart';
import 'package:win32/win32.dart';

void main() {
  // Enumerate all displays and print their information
  for (final display in Display.findAll()) {
    print('Display name: ${display.name}');
    print('Is connected: ${display.isConnected}');
    print('Is primary: ${display.isPrimary}');

    if (display.i…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dasaintgray
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by dasaintgray
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants