package Ġee . m cd imus . mate wp . service Ċ Ċ import Ġjava . io . BufferedReader Ċ import Ġjava . io . InputStream Reader Ċ import Ġjava . nio . file . Path Ċ import Ġjava . nio . file . Paths Ċ Ċ /** Ċ Ġ* Ġ@ author ĠD mit ri ĠM ak sim ov Ċ Ġ*/ Ċ class ĠLinux M ate Service Ġ: ĠOp Sys Service Ġ{ ĊĊĠ Ġprivate Ġenum Ġclass ĠPicture Options Ġ{ ĊĠĠĠ ĠW ALL P AP ER , ĠC ENTER ED , ĠSC AL ED , ĠST RET CH ED , ĠZ O OM , ĠSP AN N ED ; ĊĊĠĠĠ Ġoverride Ġfun ĠtoString () Ġ= Ġname . toLowerCase () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġset As Wall paper ( filePath : ĠPath ) Ġ{ ĊĠĠĠ Ġval Ġscript Body Ġ= Ġ"# !/ bin / bash \ n \ n " Ġ+ ĊĠĠĠĠĠĠĠ Ġ" PID =\ $( pg rep Ġm ate - panel )\ n " Ġ+ ĊĠĠĠĠĠĠĠ Ġ" export ĠD BUS _ SESSION _ BUS _ ADDRESS =\ $( grep Ġ- z ĠD BUS _ SESSION _ BUS _ ADDRESS Ġ/ proc /\ $ PID / environ | cut Ġ- d = Ġ- f 2 - )\ n \ n " Ġ+ ĊĠĠĠĠĠĠĠ Ġ" g settings Ġset Ġorg . mate . background Ġpicture - filename Ġ'${ filePath . to AbsolutePath () }' \ n " Ġ+ ĊĠĠĠĠĠĠĠ Ġ" g settings Ġset Ġorg . mate . background Ġpicture - options Ġ'${ Picture Options . ST RET CH ED }' \ n " ĊĊĠĠĠ ĠFileSystem Service (). do With Temp Script ( script Body ) Ġ{ ĊĠĠĠĠĠ Ġexec Command ("/ bin / sh ", Ġit . to AbsolutePath (). toString ()) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠgetCurrent Wall paper (): ĠPath Ġ{ ĊĠĠĠ Ġval Ġscript Body Ġ= Ġ"# !/ bin / bash \ n \ n " Ġ+ ĊĠĠĠĠĠĠĠ Ġ" PID =\ $( pg rep Ġm ate - panel )\ n " Ġ+ ĊĠĠĠĠĠĠĠ Ġ" export ĠD BUS _ SESSION _ BUS _ ADDRESS =\ $( grep Ġ- z ĠD BUS _ SESSION _ BUS _ ADDRESS Ġ/ proc /\ $ PID / environ | cut Ġ- d = Ġ- f 2 - )\ n \ n " Ġ+ ĊĠĠĠĠĠĠĠ Ġ" g settings Ġget Ġorg . mate . background Ġpicture - filename \ n " ĊĊĠĠĠ Ġreturn ĠFileSystem Service (). do With Temp Script ( script Body ) Ġ{ ĊĠĠĠĠĠ ĠPaths . get ( exec Command ("/ bin / sh ", Ġit . to AbsolutePath (). toString ()) ?. trim ('\ '' )). to AbsolutePath () ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġexec Command ( var arg Ġargs : ĠString ): ĠString ? Ġ{ ĊĠĠĠ Ġval Ġprocess Builder Ġ= ĠProcess Builder (* args ) ĊĠĠĠ Ġprocess Builder . redirect Error Stream ( true ) ĊĠĠĠ Ġval Ġprocess Ġ= Ġprocess Builder . start () ĊĠĠĠ Ġvar Ġvalue : ĠString ? ĊĠĠĠ ĠBufferedReader ( InputStream Reader ( process . inputStream )). use Ġ{ ĊĠĠĠĠĠ Ġvalue Ġ= Ġit . readLine () ĊĠĠĠ Ġ} ĊĠĠĠ Ġprocess . waitFor () ĊĠĠĠ Ġreturn Ġvalue ĊĠ Ġ} Ċ Ċ } Ċ