Skip to content

Commit

Permalink
move generateStatus to main for use later
Browse files Browse the repository at this point in the history
  • Loading branch information
geomat0101 committed Apr 14, 2023
1 parent 34c7edf commit 42de920
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
17 changes: 0 additions & 17 deletions keybinding.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package main

import (
"encoding/json"
"os"

"github.com/BurntSushi/xgbutil"
"github.com/BurntSushi/xgbutil/keybind"
"github.com/BurntSushi/xgbutil/xevent"
Expand All @@ -25,20 +22,6 @@ func (k keyMapper) bind(action string, f func()) {
}
}

func generateStatus(t *tracker) {
fname := Config.StatusFname
if fname == "" {
return
}

blob, _ := json.MarshalIndent(t.workspaces, "", " ")
os.Create(fname)
err := os.WriteFile(fname, blob, 0600)
if err != nil {
log.Fatal(err)
}
}

func bindKeys(t *tracker) {
workspaces := t.workspaces
keybind.Initialize(state.X)
Expand Down
16 changes: 16 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"encoding/json"
"flag"
"os"

"github.com/BurntSushi/xgbutil/xevent"
"github.com/blrsn/zentile/state"
Expand All @@ -19,6 +21,20 @@ func main() {
xevent.Main(state.X)
}

func generateStatus(t *tracker) {
fname := Config.StatusFname
if fname == "" {
return
}

blob, _ := json.MarshalIndent(t.workspaces, "", " ")
os.Create(fname)
err := os.WriteFile(fname, blob, 0600)
if err != nil {
log.Fatal(err)
}
}

func setLogLevel() {
var verbose bool
flag.BoolVar(&verbose, "v", false, "verbose mode")
Expand Down

0 comments on commit 42de920

Please sign in to comment.