Skip to content

Commit 9857c74

Browse files
committed
Remove macOS check from isInProc(). Reorder if statements.
1 parent d1ae3d9 commit 9857c74

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/main/scala/introprog/Swing.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ object Swing {
3535

3636
/** Check whether `/proc/version` on this filesystem contains the argument `s`. */
3737
def isInProc(s: String): Boolean = {
38-
val cmd = isOS("mac") match {
39-
case true => Seq("grep", "-qs", s, "/proc/version")
40-
case _ => Seq("grep", "-q", s, "/proc/version")
41-
}
42-
38+
val cmd = Seq("grep", "-s", "-q", s, "/proc/version")
4339
val p = sys.process.Process(cmd)
4440
util.Try(p.! == 0).getOrElse(false)
4541
}
@@ -54,8 +50,8 @@ object Swing {
5450

5551
private def setPlatformSpecificLookAndFeel(): Unit = {
5652
import javax.swing.UIManager.setLookAndFeel
57-
if (isOS("linux")) findLookAndFeel("gtk").foreach(setLookAndFeel)
58-
else if (isOS("win") || isInProc("WSL")) findLookAndFeel("win").foreach(setLookAndFeel)
53+
if (isOS("win") || isInProc("windows") || isInProc("WSL")) findLookAndFeel("win").foreach(setLookAndFeel)
54+
else if (isOS("linux")) findLookAndFeel("gtk").foreach(setLookAndFeel)
5955
else if (isOS("mac")) findLookAndFeel("apple").foreach(setLookAndFeel)
6056
else javax.swing.UIManager.setLookAndFeel(
6157
javax.swing.UIManager.getSystemLookAndFeelClassName()

0 commit comments

Comments
 (0)