mirror of
https://github.com/swiftbar/SwiftBar.git
synced 2024-09-11 16:05:33 +03:00
Add option to use bash\zsh from users’s env #307
This commit is contained in:
parent
b4ef58244b
commit
366695d594
@ -7,8 +7,14 @@ enum TerminalOptions: String, CaseIterable {
|
||||
}
|
||||
|
||||
enum ShellOptions: String, CaseIterable {
|
||||
case Bash
|
||||
case Zsh
|
||||
case Bash = "bash"
|
||||
case Zsh = "zsh"
|
||||
case BashEnv = "bash(env)"
|
||||
case ZshEnv = "zsh(env)"
|
||||
|
||||
var envPath: String {
|
||||
"/usr/bin/env"
|
||||
}
|
||||
|
||||
var path: String {
|
||||
switch self {
|
||||
@ -16,6 +22,10 @@ enum ShellOptions: String, CaseIterable {
|
||||
return "/bin/bash"
|
||||
case .Zsh:
|
||||
return "/bin/zsh"
|
||||
case .BashEnv:
|
||||
return "bash"
|
||||
case .ZshEnv:
|
||||
return "zsh"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,15 @@ private extension Process {
|
||||
executableURL = URL(fileURLWithPath: script)
|
||||
arguments = args
|
||||
} else {
|
||||
executableURL = URL(fileURLWithPath: delegate.prefs.shell.path)
|
||||
arguments = ["-c", "-l", "\(script.escaped()) \(args.joined(separator: " "))"]
|
||||
let shell = delegate.prefs.shell
|
||||
switch shell {
|
||||
case .Bash, .Zsh:
|
||||
executableURL = URL(fileURLWithPath: shell.path)
|
||||
arguments = ["-c", "-l", "\(script.escaped()) \(args.joined(separator: " "))"]
|
||||
case .BashEnv, .ZshEnv:
|
||||
executableURL = URL(fileURLWithPath: shell.envPath)
|
||||
arguments = [shell.path, "-c", "-l", "\(script.escaped()) \(args.joined(separator: " "))"]
|
||||
}
|
||||
}
|
||||
|
||||
guard let executableURL = executableURL, FileManager.default.fileExists(atPath: executableURL.path) else {
|
||||
|
Loading…
Reference in New Issue
Block a user