Skip to content

Commit 0af8b4d

Browse files
committed
fixed transparancy problems on Linux (probably)
1 parent bf2e4f3 commit 0af8b4d

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

src/main/java/de/doubleslash/keeptime/view/SettingsController.java

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
import de.doubleslash.keeptime.common.ConfigParser;
99
import de.doubleslash.keeptime.controller.Controller;
1010
import de.doubleslash.keeptime.model.Model;
11-
import javafx.event.ActionEvent;
12-
import javafx.event.EventHandler;
1311
import javafx.fxml.FXML;
1412
import javafx.scene.control.Button;
1513
import javafx.scene.control.CheckBox;
1614
import javafx.scene.control.ColorPicker;
15+
import javafx.scene.paint.Color;
1716
import javafx.stage.Stage;
1817

1918
public class SettingsController {
@@ -64,9 +63,22 @@ public class SettingsController {
6463

6564
@FXML
6665
private void initialize() {
67-
6866
saveButton.setOnAction(ae -> {
6967
LOG.info("Save clicked");
68+
69+
if (System.getProperty("os.name").contains("Linux")) {
70+
if (hoverBackgroundColor.getValue().getOpacity() < 0.5) {
71+
hoverBackgroundColor.setValue(Color.rgb((int) hoverBackgroundColor.getValue().getRed() * 255,
72+
(int) hoverBackgroundColor.getValue().getGreen() * 255,
73+
(int) hoverBackgroundColor.getValue().getBlue() * 255, 0.5));
74+
}
75+
if (defaultBackgroundColor.getValue().getOpacity() < 0.5) {
76+
defaultBackgroundColor.setValue(Color.rgb((int) defaultBackgroundColor.getValue().getRed() * 255,
77+
(int) defaultBackgroundColor.getValue().getGreen() * 255,
78+
(int) defaultBackgroundColor.getValue().getBlue() * 255, 0.5));
79+
}
80+
}
81+
7082
controller.updateSettings(hoverBackgroundColor.getValue(), hoverFontColor.getValue(),
7183
defaultBackgroundColor.getValue(), defaultFontColor.getValue(), taskBarColor.getValue(),
7284
useHotkeyCheckBox.isSelected(), displayProjectsRightCheckBox.isSelected());
@@ -94,13 +106,10 @@ private void initialize() {
94106
taskBarColor.setValue(Model.originalTaskBarFontColor);
95107
});
96108

97-
parseConfigButton.setOnAction(new EventHandler<ActionEvent>() {
98-
@Override
99-
public void handle(final ActionEvent actionEvent) {
100-
if (ConfigParser.hasConfigFile(INPUT_FILE)) {
101-
final ConfigParser parser = new ConfigParser(model, controller);
102-
parser.parserConfig(new File(INPUT_FILE));
103-
}
109+
parseConfigButton.setOnAction(ae -> {
110+
if (ConfigParser.hasConfigFile(INPUT_FILE)) {
111+
final ConfigParser parser = new ConfigParser(model, controller);
112+
parser.parserConfig(new File(INPUT_FILE));
104113
}
105114
});
106115

0 commit comments

Comments
 (0)