Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions fish/functions/herdr-screens.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Open the extra Herdr Desktop screens (one per monitor). Usage: herdr-screens [count]
# Screen 1 is the default home (~/.config/herdr-app); screens 2..count use
# ~/.config/herdr-app-N. Every screen shares the same herdr-core terminals.
# Theme, layout and mods are symlinked to the repo, so one edit reaches all
# screens; settings.json is copied once, because Herdr rewrites it (zoom,
# theme picker). Screens that already run are left alone.
function herdr-screens --description 'Open extra Herdr Desktop screens for multiple monitors'
set -l count 4
if test (count $argv) -gt 0
set count $argv[1]
end
if not string match -qr '^[1-9][0-9]*$' -- $count
printf 'herdr-screens: count must be a positive integer\n' >&2
return 1
end
if not test -d /Applications/Herdr.app
printf 'herdr-screens: /Applications/Herdr.app not found\n' >&2
return 127
end

# The repo root, from this function's real location (fish/functions/).
set -l repo (path resolve (status filename) | path dirname | path dirname | path dirname)
set -l desktop "$repo/herdr/desktop"
set -l shared themes/refactoria.json layouts/refactoria.json \
mods/refactoria-spaces/main.js mods/refactoria-spaces/mod.json \
mods/refactoria-agents/main.js mods/refactoria-agents/mod.json

for n in (seq 2 $count)
set -l home "$HOME/.config/herdr-app-$n"
for f in $shared
mkdir -p (path dirname "$home/$f")
ln -sfn "$desktop/$f" "$home/$f"
end
if not test -e "$home/settings.json"
cp "$desktop/settings.json" "$home/settings.json"
end

if env HERDR_APP_HOME="$home" herdr-app status >/dev/null 2>&1
printf 'herdr-screens: screen %s already running\n' $n
else
open -n -a Herdr --env HERDR_APP_HOME="$home"
printf 'herdr-screens: opened screen %s (%s)\n' $n "$home"
# A new home starts on the main layout: switch it once it answers.
for attempt in (seq 20)
if env HERDR_APP_HOME="$home" herdr-app status >/dev/null 2>&1
env HERDR_APP_HOME="$home" herdr-app do layout.switch '{"name":"refactoria"}' >/dev/null 2>&1
break
end
sleep 0.5
end
end
end
end
187 changes: 187 additions & 0 deletions herdr/desktop/layouts/refactoria.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
{
"id": "root",
"cloned_from": {
"name": "main",
"version": "0.1.9"
},
"type": "row",
"children": [
{
"id": "sidebar",
"type": "column",
"children": [
{
"id": "brand",
"type": "block",
"content": {
"mod": "workspace-chrome"
},
"size": {
"px": 46
},
"window_drag": true
},
{
"id": "sidebar-lists",
"type": "column",
"children": [
{
"id": "spaces",
"type": "block",
"content": {
"mod": "refactoria-spaces"
},
"size": {
"weight": 1
},
"min": 90
},
{
"id": "agents",
"type": "block",
"content": {
"mod": "refactoria-agents"
},
"size": {
"weight": 1
},
"min": 90
}
]
},
{
"id": "sidebar-footer",
"type": "block",
"content": {
"mod": "workspace-chrome",
"props": {
"footer": true
}
},
"size": {
"px": 69
}
}
],
"size": {
"px": 268
},
"min": 44,
"max": 480,
"background": "chrome",
"resizable": false
},
{
"id": "work",
"type": "column",
"children": [
{
"id": "tabs",
"type": "block",
"content": {
"mod": "tabs"
},
"size": {
"px": 42
},
"window_drag": true
},
{
"id": "work-body",
"type": "row",
"children": [
{
"id": "main",
"type": "block",
"content": {
"tab": "active",
"pane": {
"header": {
"content": {
"mod": "pane"
},
"reveal": "always",
"height": 30,
"position": "top"
},
"background": "background",
"border": {
"width": 1,
"color": "border"
},
"focus": {
"width": 1,
"color": "accent"
},
"radius": 10,
"gap": 8,
"lone": true
}
}
},
{
"id": "panel",
"type": "column",
"children": [
{
"id": "panel-body",
"type": "stack",
"children": [
{
"id": "files",
"type": "block",
"content": {
"mod": "files"
}
},
{
"id": "changes",
"type": "block",
"content": {
"mod": "changes"
}
}
],
"active": "files"
}
],
"size": {
"px": 368
},
"min": 280,
"max": 900,
"hidden": true
}
],
"padding": 8,
"gap": 8
},
{
"id": "status",
"type": "block",
"content": {
"mod": "workspace-status"
},
"size": {
"px": 28
}
}
],
"resizable": false
}
],
"background": "canvas",
"terminal_padding": [
14,
12
],
"divider": {
"width": 1,
"color": "border"
},
"titlebar": "none",
"traffic_lights": [
12,
16
]
}
Loading
Loading