summaryrefslogtreecommitdiff
path: root/sync_terminals.go
diff options
context:
space:
mode:
Diffstat (limited to 'sync_terminals.go')
-rw-r--r--sync_terminals.go34
1 files changed, 2 insertions, 32 deletions
diff --git a/sync_terminals.go b/sync_terminals.go
index 2c557ba..b115d8f 100644
--- a/sync_terminals.go
+++ b/sync_terminals.go
@@ -26,9 +26,8 @@ type CurrentState struct {
Path string
}
-func main() {
+func doSync() {
// 1. Read the desired state from the config file.
- configFile := "/home/jcarr/go/src/gemini/xstartplacement.out"
desiredStates, err := parseDesiredState(configFile)
if err != nil {
fmt.Printf("Error parsing config file: %v\n", err)
@@ -105,7 +104,7 @@ func launchTerminal(state DesiredState) {
fmt.Printf("Successfully launched terminal for %s\n", state.Path)
}
-// parseDesiredState reads the xstartplacement.out file.
+// parseDesiredState reads the startxplacement.out file.
func parseDesiredState(filePath string) ([]DesiredState, error) {
file, err := os.Open(filePath)
if err != nil {
@@ -197,32 +196,3 @@ func getCurrentState() ([]CurrentState, error) {
}
return states, nil
}
-
-// Helper functions
-func getWindowList() (map[string]string, error) {
- cmd := exec.Command("wmctrl", "-l")
- var out bytes.Buffer
- cmd.Stdout = &out
- if err := cmd.Run(); err != nil {
- return nil, err
- }
- windows := make(map[string]string)
- scanner := bufio.NewScanner(&out)
- for scanner.Scan() {
- line := scanner.Text()
- fields := strings.Fields(line)
- if len(fields) > 0 {
- windows[fields[0]] = strings.Join(fields[3:], " ")
- }
- }
- return windows, nil
-}
-
-func findNewWindow(before, after map[string]string) string {
- for id := range after {
- if _, ok := before[id]; !ok {
- return id
- }
- }
- return ""
-} \ No newline at end of file