File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,17 @@ object Swing {
3333 def isOS (partOfName : String ): Boolean =
3434 scala.sys.props(" os.name" ).toLowerCase.contains(partOfName.toLowerCase)
3535
36+ /** Check whether `/proc/version` on this filesystem contains the argument `s`. */
37+ 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+
43+ val p = sys.process.Process (cmd)
44+ util.Try (p.! == 0 ).getOrElse(false )
45+ }
46+
3647 private var isInit = false
3748
3849 /** Init the Swing GUI toolkit and set platform-specific look and feel.*/
@@ -46,6 +57,7 @@ object Swing {
4657 if (isOS(" linux" )) findLookAndFeel(" gtk" ).foreach(setLookAndFeel)
4758 else if (isOS(" win" )) findLookAndFeel(" win" ).foreach(setLookAndFeel)
4859 else if (isOS(" mac" )) findLookAndFeel(" apple" ).foreach(setLookAndFeel)
60+ else if (isInProc(" WSL" )) findLookAndFeel(" win" ).foreach(setLookAndFeel)
4961 else javax.swing.UIManager .setLookAndFeel(
5062 javax.swing.UIManager .getSystemLookAndFeelClassName()
5163 )
You can’t perform that action at this time.
0 commit comments