adds the "swaymsg" flag to launch a program with "swaymsg exec" and prevent potential involuntary closing with Jetbrains IDEs

This commit is contained in:
gouvinb
2023-11-01 00:44:50 +01:00
parent fd26bb39e8
commit 5a7dbefeb0
2 changed files with 19 additions and 3 deletions

View File

@@ -592,15 +592,20 @@ func launch(command string, terminal bool) {
cmd := exec.Command(elements[cmdIdx], elements[1+cmdIdx:]...)
var prefixCommand string
var args []string
if terminal {
var args []string
prefixCommand = *term
if *term != "foot" {
args = []string{"-e", elements[cmdIdx]}
} else {
args = []string{elements[cmdIdx]}
}
cmd = exec.Command(*term, args...)
cmd = exec.Command(prefixCommand, args...)
} else if *swaymsg {
prefixCommand = "swaymsg"
args = []string{"exec", elements[cmdIdx]}
cmd = exec.Command(prefixCommand, args...)
}
// set env variables