Skip to content

Commit

Permalink
Update virtual desktop Wine plugin (use Bean) (PhoenicisOrg#1073)
Browse files Browse the repository at this point in the history
- adds a new script to access the "screenManager" Java Bean
  • Loading branch information
Zemogiter authored and petermetz committed Jun 7, 2020
1 parent 3bec141 commit a24e1bc
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Engines/Wine/Plugins/virtual desktop/script.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
/* eslint-disable no-undef */
const Wine = include("engines.wine.engine.object");
const {getScreenWidth, getScreenHeight} = include("utils.functions.system.virtual_desktop");

include("engines.wine.plugins.regedit");

/**
* sets Virtual Desktop with window resolution
* Sets Virtual Desktop with window resolution
* @param {number} width width of virtual desktop (in px)
* @param {number} height height of virtual desktop (in px)
* @returns {Wine} Wine object
*/
Wine.prototype.setVirtualDesktop = function (width, height) {
var regeditFileContent =
if (!width)
{
width = getScreenWidth();
}
if (!height)
{
height = getScreenHeight();
}
const regeditFileContent =
"REGEDIT4\n" +
"\n" +
"[HKEY_CURRENT_USER\\Software\\Wine\\Explorer\\Desktops]\n" +
Expand All @@ -18,4 +28,4 @@ Wine.prototype.setVirtualDesktop = function (width, height) {
"\"Desktop\"=\"" + "Default" + "\"\n";
this.regedit().patch(regeditFileContent);
return this;
};
};
5 changes: 5 additions & 0 deletions Utils/Functions/System/application.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name" : "System Utils",
"id" : "utils.functions.system",
"description" : "Utils for system interaction."
}
20 changes: 20 additions & 0 deletions Utils/Functions/System/virtual desktop/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const screenManager = Bean("screenManager");

/**
* Obtains the width of user's screen
* @returns {number} width of user's screen in pixels
*/
function getScreenWidth() {
return screenManager.getScreenWidth();
}

/**
* Obtains the height of user's screen
* @returns {number} height of user's screen in pixels
*/
function getScreenHeight() {
return screenManager.getScreenHeight();
}

module.getScreenWidth = getScreenWidth;
module.getScreenHeight = getScreenHeight;
11 changes: 11 additions & 0 deletions Utils/Functions/System/virtual desktop/script.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scriptName" : "virtual desktop",
"id" : "utils.functions.system.virtual_desktop",
"compatibleOperatingSystems" : [
"MACOSX",
"LINUX"
],
"testingOperatingSystems" : [],
"free" : true,
"requiresPatch" : false
}

0 comments on commit a24e1bc

Please sign in to comment.