Compare commits
2 commits
42ac8bee8c
...
f698f2614e
Author | SHA1 | Date | |
---|---|---|---|
f698f2614e | |||
05b641bc97 |
7 changed files with 24 additions and 32 deletions
11
cmd/eww.go
11
cmd/eww.go
|
@ -5,12 +5,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var ewwCmd = &cobra.Command{
|
var ewwCmd = &cobra.Command{
|
||||||
Use:"eww" ,
|
Use: "eww",
|
||||||
Short: "eww integration",
|
Short: "eww integration",
|
||||||
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||||
|
hm.LoadConfig(configPath)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(ewwCmd)
|
rootCmd.AddCommand(ewwCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ var startCmd = &cobra.Command{
|
||||||
Use: "start",
|
Use: "start",
|
||||||
Short: "Launch eww",
|
Short: "Launch eww",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
hm.LaunchEww()
|
hm.LaunchEww()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ var watchCmd = &cobra.Command{
|
||||||
Use: "watch",
|
Use: "watch",
|
||||||
Short: "Watch hyprland events and propagate to eww",
|
Short: "Watch hyprland events and propagate to eww",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
hm.Watch()
|
hm.Watch()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
14
cmd/mako.go
14
cmd/mako.go
|
@ -8,15 +8,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var makoCmd = &cobra.Command{
|
var makoCmd = &cobra.Command{
|
||||||
Use:"mako" ,
|
Use: "mako",
|
||||||
Short: "mako integration",
|
Short: "mako integration",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println("hahah mako baby")
|
fmt.Println("hahah mako baby")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(makoCmd)
|
rootCmd.AddCommand(makoCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
21
cmd/root.go
21
cmd/root.go
|
@ -2,12 +2,12 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"git.dayl.in/daylin/hyprman/internal"
|
||||||
cc "github.com/ivanpirog/coloredcobra"
|
cc "github.com/ivanpirog/coloredcobra"
|
||||||
"git.dayl.in/daylin/hyprman/internal"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func Execute() {
|
func Execute() {
|
||||||
cc.Init(&cc.Config{
|
cc.Init(&cc.Config{
|
||||||
RootCmd: rootCmd,
|
RootCmd: rootCmd,
|
||||||
|
@ -25,22 +25,17 @@ func Execute() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var configPath string
|
var (
|
||||||
var hm = &hyprman.Hyprman{}
|
configPath string
|
||||||
|
hm = &hyprman.Hyprman{}
|
||||||
|
)
|
||||||
|
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "hyprman",
|
Use: "hyprman",
|
||||||
Short: "hyprland companion app",
|
Short: "hyprland companion app",
|
||||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
||||||
hm.LoadConfig(configPath)
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
rootCmd.CompletionOptions.HiddenDefaultCmd = true
|
rootCmd.CompletionOptions.HiddenDefaultCmd = true
|
||||||
rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", hyprman.DefaultConfigPath(), "path to config file")
|
rootCmd.PersistentFlags().StringVarP(&configPath, "config", "c", hyprman.DefaultConfigPath(), "path to config file")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ func (hm *Hyprman) generateEwwClasses() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ewwBar1(cmd string) {
|
func ewwBar1(cmd string) {
|
||||||
time.Sleep(200 * time.Second)
|
time.Sleep(200 * time.Second)
|
||||||
if err := exec.Command("eww", cmd, "bar1").Run(); err != nil {
|
if err := exec.Command("eww", cmd, "bar1").Run(); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ func (hm *Hyprman) Watch() {
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
hm.generateEwwClasses()
|
hm.generateEwwClasses()
|
||||||
for {
|
for {
|
||||||
line, err := reader.ReadString('\n')
|
line, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -277,4 +277,3 @@ func (hm *Hyprman) Watch() {
|
||||||
hm.handleHyprEvent(line)
|
hm.handleHyprEvent(line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,4 +33,3 @@ package hyprman
|
||||||
// log.Fatal(err)
|
// log.Fatal(err)
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue