MCPcopy Create free account
hub / github.com/BobdaProgrammer/doWM / Run

Method Run

wm/window_manager.go:516–1191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

514}
515
516func (wm *WindowManager) Run() {
517 fmt.Println("window manager up and running")
518
519 // get autostart
520 user, err := user.Current()
521 if err == nil {
522 scriptPath := filepath.Join(user.HomeDir, ".config", "doWM", "autostart.sh")
523
524 if fileExists(scriptPath) {
525 fmt.Println("autostart exists..., running")
526 exec.Command(scriptPath).Start()
527 }
528 }
529
530 // basically asks the X server for WM access
531 err = xproto.ChangeWindowAttributesChecked(
532 wm.conn,
533 wm.root,
534 xproto.CwEventMask,
535 []uint32{
536 xproto.EventMaskSubstructureNotify |
537 xproto.EventMaskSubstructureRedirect,
538 },
539 ).Check()
540
541 if err != nil {
542 if err.Error() == "BadAccess" {
543 slog.Error("other window manager running on display")
544 return
545 }
546 }
547
548 //wm.cursor()
549
550 // retrieve config and set values
551 home, _ := os.UserHomeDir()
552 f := file.Provider(filepath.Join(home, ".config", "doWM", "doWM.yml"))
553 cfg := createConfig(f)
554 wm.config = cfg
555 if wm.config.StartTiling {
556 wm.toggleTiling()
557 wm.fitToLayout()
558 }
559 //TODO: make auto-reload
560
561 // for things like polybar, to show workspaces
562 wm.broadcastWorkspace(0)
563 wm.broadcastWorkspaceCount()
564
565 // grab the server whilst we manage pre-exisiting windows
566 err = xproto.GrabServerChecked(
567 wm.conn,
568 ).Check()
569
570 if err != nil {
571 slog.Error("Couldn't grab X server", "error:", err)
572 return
573 }

Callers 1

mainFunction · 0.80

Calls 15

toggleTilingMethod · 0.95
fitToLayoutMethod · 0.95
broadcastWorkspaceMethod · 0.95
FrameMethod · 0.95
createKeybindMethod · 0.95
declareSupportedAtomsMethod · 0.95
OnConfigureRequestMethod · 0.95
OnMapRequestMethod · 0.95
OnUnmapNotifyMethod · 0.95
UnFrameMethod · 0.95
OnEnterNotifyMethod · 0.95

Tested by

no test coverage detected