2024-11-17 07:25:48 -05:00
|
|
|
#!/usr/bin/env bb
|
|
|
|
|
|
|
|
(require '[babashka.process :refer [shell process exec]])
|
|
|
|
|
|
|
|
;; setup screens
|
|
|
|
;; todo: check if file exists, get home dir
|
|
|
|
(shell "/home/schrofi/.screenlayout/default.sh")
|
|
|
|
|
|
|
|
;; bspwm configuration
|
|
|
|
(defn- bspc [& commands]
|
|
|
|
(apply shell (cons "bspc" commands)))
|
|
|
|
|
|
|
|
(defn- config [key value]
|
|
|
|
(apply bspc (vector "config" key value)))
|
|
|
|
|
|
|
|
;; setup desktops
|
|
|
|
;; todo: handle no external display gracefully
|
|
|
|
|
2024-11-24 07:51:06 -05:00
|
|
|
;; read workspace configuration from config
|
|
|
|
;; format should be like: eDP-1 1 2 3 4 .., HDMI-A-0 X
|
|
|
|
;; where each monitor is defined on a separate line (no commas)
|
|
|
|
(def workspace-config
|
|
|
|
(->> (slurp "/home/schrofi/.screenlayout/default-workspaces")
|
|
|
|
(str/split-lines)
|
|
|
|
(map #(str/split % #" "))))
|
|
|
|
|
|
|
|
(doseq [config workspace-config]
|
|
|
|
(let [[monitor & workspaces] config]
|
|
|
|
(->> workspaces
|
|
|
|
(map str)
|
|
|
|
(concat ["monitor" monitor "-d"])
|
|
|
|
(apply bspc))))
|
2024-11-17 07:25:48 -05:00
|
|
|
|
|
|
|
(config "border_width" "2")
|
|
|
|
(config "window_gap" "12")
|
|
|
|
|
|
|
|
(config "split_ratio" "0.52")
|
|
|
|
(config "borderless_monocle" "true")
|
|
|
|
|
|
|
|
(config "focus_follows_pointer" "true")
|
|
|
|
|
|
|
|
;; todo
|
|
|
|
(bspc "rule" "-a" "alacritty:scratchpad" "-o" "state=floating" "sticky=on" "layer=above")
|
|
|
|
|
|
|
|
;; autostart
|
|
|
|
(defn- if-not-running [service run-command]
|
|
|
|
(if (empty? (:out (shell {:out :string :continue true} "pgrep" "-x" service)))
|
|
|
|
(run-command)))
|
|
|
|
|
|
|
|
(shell "setxkbmap" "de")
|
2024-12-08 06:23:49 -05:00
|
|
|
;; this is needed for the gnome keyring to function properly
|
|
|
|
(shell "dbus-launch" "--exit-with-session")
|
|
|
|
(shell "dbus-update-activation-environment" "--all")
|
|
|
|
(shell "gnome-keyring-daemon" "--start" "--components=secrets")
|
|
|
|
|
2024-11-17 07:25:48 -05:00
|
|
|
(if-not-running "sxhkd" #(process "sxhkd"))
|
|
|
|
(if-not-running "nitrogen" #(process "nitrogen" "--restore"))
|
|
|
|
(if-not-running "picom" #(process "picom" "--config" "/home/schrofi/.config/picom/picom.conf"))
|
|
|
|
(if-not-running "polybar" #(process "polybar"))
|
|
|
|
(if-not-running "flameshot" #(process "flameshot"))
|
|
|
|
|
2024-12-08 06:23:49 -05:00
|
|
|
|
2024-11-17 07:25:48 -05:00
|
|
|
;; start pipewire
|
|
|
|
;;(process "pipewire")
|