-
-
Notifications
You must be signed in to change notification settings - Fork 769
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added command line option for opening UGS in fullscreen (#2471)
- Loading branch information
Showing
3 changed files
with
86 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...gscore/src/main/java/com/willwinder/ugs/nbp/core/lifecycle/FullScreenOptionProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Copyright 2024 Will Winder | ||
This file is part of Universal Gcode Sender (UGS). | ||
UGS is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
UGS is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with UGS. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.willwinder.ugs.nbp.core.lifecycle; | ||
|
||
import java.util.logging.Logger; | ||
import javax.swing.Action; | ||
import org.openide.awt.Actions; | ||
import org.openide.windows.OnShowing; | ||
|
||
/** | ||
* Makes the application enter full screen if the {@link #setUseFullScreen(boolean)} was set to true | ||
* before the application was started | ||
* | ||
* @author Joacim Breiler | ||
*/ | ||
@OnShowing | ||
public class FullScreenOptionProcessor implements Runnable { | ||
private static final Logger LOGGER = Logger.getLogger(StartupOptionProcessor.class.getName()); | ||
|
||
private static boolean useFullScreen = false; | ||
|
||
@Override | ||
public void run() { | ||
if (useFullScreen) { | ||
Action action = Actions.forID("Window", "org.netbeans.core.windows.actions.ToggleFullScreenAction"); | ||
if (action == null) { | ||
LOGGER.info("Could not find the ToggleFullScreenAction to enter full screen"); | ||
return; | ||
} | ||
action.actionPerformed(null); | ||
} | ||
} | ||
|
||
public static void setUseFullScreen(boolean useFullscreen) { | ||
FullScreenOptionProcessor.useFullScreen = useFullscreen; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters