aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils/lumina-xconfig/ScreenSettings.h
blob: 4f042cb83565a5a124b769d50e54654b684914de (plain)
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
//===========================================
//  Lumina-DE source code
//  Copyright (c) 2016, Ken Moore
//  Available under the 3-clause BSD license
//  See the LICENSE file for full details
//===========================================
#ifndef _LUMINA_SCREEN_SETTINGS_BACKEND_H
#define _LUMINA_SCREEN_SETTINGS_BACKEND_H

#include <QString>
#include <QList>
#include <QRect>
#include <QStringList>

class ScreenInfo{
  public:
	QString ID;
	QRect geom; //screen geometry
        bool isprimary;
	bool isactive;
	bool isavailable;
	int applyChange; //[<=0: do nothing, 1: deactivate, 2: activate]
	QStringList resList;
	int rotation; //possible values: [-90, 0, 90, 180]


	//Initial Defaults
	ScreenInfo(){
	  applyChange = -1; //initial value is invalid
          isprimary = false;
          isactive = false;
	  isavailable = false;
	  rotation = 0; //no rotation by default
	}
	~ScreenInfo(){}
};

class RRSettings{
public:
	//Reset current screen config to match previously-saved settings
	static void ApplyPrevious();
	//Setup all the connected monitors as a single mirror
	static void MirrorAll();

	//Read the current screen config from xrandr
	static QList<ScreenInfo> CurrentScreens(); //reads xrandr information
	static QList<ScreenInfo> PreviousSettings(QString profile="");
	static QStringList savedProfiles();
	static void removeProfile(QString profile);

	//Save the screen config for later
	static bool SaveScreens(QList<ScreenInfo> screens, QString profile = "");

	//Apply screen configuration
	static void Apply(QList<ScreenInfo> screens);
};

#endif
bgstack15