aurora4aa7bd9
hypr: fetch split-monitor-workspaces when missing instead of emergency mode
+33 −8
2 files changed
- M .config/hypr/hyprland.lua +18 −5
- M .local/bin/hypr/hypr_update_plugins.sh +15 −3
| @@ -27,7 +27,6 @@ hl.on("hyprland.start", function() | |||
| 27 | 27 | hl.exec_cmd("gsettings set org.gnome.desktop.interface font-name 'JetBrainsMonoNL Nerd Font Mono 11'") -- Space fonts are aurora's only | |
| 28 | 28 | hl.exec_cmd("wl-paste --type text --watch cliphist store") | |
| 29 | 29 | hl.exec_cmd("wl-paste --type image --watch cliphist store") | |
| 30 | − | hl.exec_cmd("hyprpm reload -n") | |
| 31 | 30 | -- aurora is a systemd unit: hand it the login env (.zprofile: SUDO_ASKPASS, EDITOR, XDG dirs, ...) | |
| 32 | 31 | hl.exec_cmd("dbus-update-activation-environment --systemd --all && systemctl --user start aurora-shell") | |
| 33 | 32 | -- hl.exec_cmd("waybar") | |
| @@ -43,10 +42,24 @@ end) | |||
| 43 | 42 | -- Plugins | |
| 44 | 43 | -------------------------------------------------- | |
| 45 | 44 | package.path = package.path .. ";./?.lua;./?/init.lua" | |
| 46 | − | smw = require("plugins.split-monitor-workspaces") | |
| 47 | − | smw.setup({ | |
| 48 | − | workspace_count = 10, | |
| 49 | − | }) | |
| 45 | + | -- split-monitor-workspaces is a git checkout in ~/.config/hypr/plugins, not in this repo (hypr_update_plugins.sh). | |
| 46 | + | -- Missing (fresh install) = plain workspaces 1-10 with the same API for keybinds.lua, and fetch it + reload, | |
| 47 | + | -- instead of a require error that leaves Hyprland in emergency mode with no binds. | |
| 48 | + | local smw_ok, smw_mod = pcall(require, "plugins.split-monitor-workspaces") | |
| 49 | + | if smw_ok then | |
| 50 | + | smw = smw_mod | |
| 51 | + | smw.setup({ | |
| 52 | + | workspace_count = 10, | |
| 53 | + | }) | |
| 54 | + | else | |
| 55 | + | local function ws(n) return n == "0" and "10" or n end -- keybinds.lua binds workspace 10 to SUPER+0 | |
| 56 | + | smw = { | |
| 57 | + | get_amount_of_workspaces = function() return 10 end, | |
| 58 | + | workspace = function(n) return hl.dsp.focus({ workspace = ws(n) }) end, | |
| 59 | + | move_to_workspace_silent = function(n) return hl.dsp.window.move({ workspace = ws(n), follow = false }) end, | |
| 60 | + | } | |
| 61 | + | hl.exec_cmd(HOME .. "/.local/bin/hypr/hypr_update_plugins.sh && hyprctl reload") | |
| 62 | + | end | |
| 50 | 63 | ||
| 51 | 64 | -- ----------------------------------------------------- | |
| 52 | 65 | -- SOURCE FILES | |
| @@ -1,5 +1,17 @@ | |||
| 1 | 1 | #!/bin/env bash | |
| 2 | + | # Hyprland Lua plugins in ~/.config/hypr/plugins: clone the missing ones, update the rest. | |
| 3 | + | # hyprland.lua runs this by itself when split-monitor-workspaces is missing, install.sh after stowing. | |
| 2 | 4 | ||
| 3 | − | mkdir -p ~/.config/hypr/plugins | |
| 4 | − | cd ~/.config/hypr/plugins | |
| 5 | − | git clone https://github.com/zjeffer/split-monitor-workspaces | |
| 5 | + | dir="$HOME/.config/hypr/plugins" | |
| 6 | + | mkdir -p "$dir" || exit 1 | |
| 7 | + | ||
| 8 | + | status=0 | |
| 9 | + | for url in https://github.com/zjeffer/split-monitor-workspaces; do | |
| 10 | + | name="$(basename "$url")" | |
| 11 | + | if [ -d "$dir/$name/.git" ]; then | |
| 12 | + | git -C "$dir/$name" pull --ff-only --quiet || status=1 | |
| 13 | + | else | |
| 14 | + | git clone --quiet "$url" "$dir/$name" || status=1 | |
| 15 | + | fi | |
| 16 | + | done | |
| 17 | + | exit "$status" | |