From 8f3c8fc0895613cb01acb1a0280dfeddc1e20cfb Mon Sep 17 00:00:00 2001 From: Almarhoon Ibraheem Date: Fri, 27 Sep 2024 08:12:19 +0300 Subject: [PATCH] add example for workspace groups --- examples/workspace-groups/init.scm | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 examples/workspace-groups/init.scm diff --git a/examples/workspace-groups/init.scm b/examples/workspace-groups/init.scm new file mode 100755 index 0000000..cd51a4f --- /dev/null +++ b/examples/workspace-groups/init.scm @@ -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)