add example for workspace groups

This commit is contained in:
Almarhoon Ibraheem 2024-09-27 08:12:19 +03:00
parent a0cbbc20b9
commit 8f3c8fc089

View file

@ -0,0 +1,57 @@
#!/usr/bin/env guile
!#
;; assuming your are running from a path relative to swaypic & modules
;; you can hardcode the load path here if that assumption isn't valid.
;; you have to add to load path the directory the contains modules and guile-swayer
;; these 2 directories exist in the root directory of the repostiry and are
;; supposed to be 2 parent levels away from this init file.
(let ((path (dirname
(dirname
(dirname (current-filename))))))
(format #t "adding folder to load path ~a\n" path)
(add-to-load-path path))
;; you can simply uncomment the above section and hardcode the path as below
;; (add-to-load-path "/home/YOUR_USER_HERE/git/guile-swayer")
;; if you would like to be relative to home, do as below
;; (string-append (getenv "HOME") "/.config/sway/init.scm")
(use-modules (oop goops)
(srfi srfi-18)
(modules workspace-groups)
(modules workspace-grid)
(modules auto-reload)
(modules which-key)
(swayipc))
(sway-connect-sockets!)
;; subscribe to all events
(sway-subscribe-all)
;; configure workspace groups to sync groups
;; NOTE: change outputs according to your outputs
;; to get your output names, use:
;; swaymsg -t get_outputs -r | jq -r '.[].name'
(define OUTPUTS '("HDMI-A-2" "DP-1" "DP-2"))
;; number of workspaces per group must be equal to number of outputs
(define GROUPS
'(("11-browser" "21-browser" "31-browser")
("12-development" "22-development" "32-development")
("13-databases" "23-databases" "33-databases")
("14-communication" "24-communication" "34-communication")
("15-development" "25-development" "35-development")
("16-gaming" "26-gaming" "36-gaming")
("17-mail" "27-mail" "37-mail")
("18-development" "28-development" "38-development")
("19-media" "29-media" "39-media")))
(workspace-groups-configure #:groups GROUPS #:outputs OUTPUTS)
(workspace-groups-init)
;; start listening to sway events
(sway-start-event-listener-thread)
(thread-join! SWAY-LISTENER-THREAD)