@hnode/tidy 0.20.2 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,13 +31,14 @@ Tidy는 Ubuntu GNOME과 macOS에서 창을 배치합니다. GNOME에서는 Shell
31
31
  | --- | --- |
32
32
  | 상단 배치 선택기 | 창을 상단 중앙으로 끌어 원하는 칸에 놓습니다. 6가지 배치를 한 행으로 표시합니다. |
33
33
  | 최대화 버튼 선택기 | 최대화·복원 버튼에 마우스를 잠시 올리면 3열 × 2행 선택기가 열립니다. 설정에서 켜고 끌 수 있습니다. |
34
- | 가장자리 배치 | 중앙 외 상단은 최대화, 왼쪽·오른쪽 가장자리는 절반 배치로 동작합니다. |
34
+ | 가장자리 배치 | 배치 선택기 위쪽을 포함한 화면 맨 위 가장자리는 최대화, 왼쪽·오른쪽 가장자리는 절반 배치로 동작합니다. |
35
35
  | 창 보기 연동 | Super로 창 보기와 한 행 선택기를 함께 엽니다. 창 미리보기를 배치 칸에 끌어 놓습니다. Super+A 앱 목록에서는 선택기를 숨깁니다. |
36
36
  | 사용자 지정 단축키 | Super+Alt 조합으로 절반·¼·⅓·⅔ 배치를 지정하고 단축키를 바꿀 수 있습니다. |
37
37
  | 다중 모니터 | 같은 방향키를 반복하면 해당 방향의 모니터로 이동합니다. 선택기 크기도 모니터에 맞춰 조절합니다. |
38
38
  | 함께 크기 조절 | 타일 창의 공유 경계를 끌면 맞닿은 창을 함께 조절합니다. 기본값은 켬입니다. |
39
39
  | 남은 공간 채우기 | 빈 영역에 실제 창의 축소 미리보기와 제목을 표시합니다. 같은 앱의 여러 창도 각각 고를 수 있습니다. 기본값은 끔입니다. |
40
40
  | 크기와 간격 설정 | 일반 선택기와 창 보기 선택기의 크기, 창 사이 간격을 조절합니다. |
41
+ | 선택 기능 · 배치 구성 | 표시할 배치와 순서, 모니터별 자동·수동 개수를 고르고 격자로 직접 배치를 만듭니다. 기본값은 끔이며 기존 6개 구성은 유지합니다. |
41
42
 
42
43
  선택기의 100%는 이전 버전의 115% 크기입니다. 기존에 저장한 크기는 새 기준으로 환산합니다. 상하 분할과 전체화면 카드는 제거하고, 동일한 너비의 3열 오른쪽에 **¼ · ½ · ¼** 배치를 제공합니다. 최대화 단축키와 화면 상단 가장자리의 최대화 동작은 계속 사용할 수 있습니다. 자동 크기 조절은 16인치 내장 화면의 기준 크기를 유지하며, 32인치 외장 화면에서는 이전 자동 크기의 약 80%를 새 100%로 사용합니다.
43
44
 
@@ -102,6 +103,8 @@ Git 대신 [Download ZIP](https://github.com/hojin-v/Tidy/archive/refs/heads/mai
102
103
  2. 그 영역으로 끌면 선택기가 펼쳐지고 창이 작은 미리보기로 줄어듭니다. 원하는 배치 칸으로 포인터를 옮깁니다.
103
104
  3. 마우스를 놓으면 창을 배치합니다. 빈 곳에서 놓으면 취소합니다.
104
105
 
106
+ 상단 중앙의 인식 범위에서는 포인터를 화면 맨 위 끝에 대도 선택기가 계속 열려 있습니다. 선택기 위쪽 여백에서는 최대화 미리보기가 표시되고, 놓으면 최대화됩니다. 포인터를 아래의 배치 칸으로 내리면 열린 선택기에서 바로 배치를 고를 수 있습니다.
107
+
105
108
  **Super**를 누르면 창 보기와 한 행 배치 선택기가 함께 열립니다. **Super+A**로 앱 목록을 열면 선택기와 배치 미리보기를 숨기고, 창 보기로 돌아오면 다시 표시합니다. 창 미리보기를 원하는 칸에 끌어 놓거나, 칸을 클릭해 원래 포커스된 창을 배치할 수 있습니다. 검색은 글자를 입력할 때 나타납니다.
106
109
 
107
110
  창 보기에서는 창 미리보기를 잡고 움직이는 즉시 작아지며, 놓거나 취소하면 원래 크기로 돌아옵니다. 배치 칸에 놓으면 작은 미리보기에서 배치 위치로 이어집니다.
@@ -138,6 +141,17 @@ macOS판은 아래 배치 동작에 **Control+Option**을 사용합니다. 단
138
141
 
139
142
  ## Settings
140
143
 
144
+ ### 배치 구성 (선택 기능)
145
+
146
+ **설정 → 배치 구성 → 배치선택기 구성 사용자 지정**을 켜면 사용할 수 있습니다. 기본값은 끔이며, 켜기 전에는 현재의 6개 배치·순서·선택기 크기가 그대로 유지됩니다. 끄면 언제든 원래 구성을 사용하고 직접 만든 배치는 보관합니다.
147
+
148
+ - **배치 추가·제거와 순서**: 기존 배치와 추가 프리셋을 체크해 표시하고, 위·아래 버튼으로 순서를 바꿉니다. 추가 프리셋은 위아래 분할, 오른쪽 중심, 4열, 6칸, 8칸, 3행입니다.
149
+ - **표시 개수**: 선택한 배치를 모두 표시하거나, 개수를 직접 지정하거나, 모니터에 맞춰 자동으로 조절합니다. 개수가 제한되면 선택 목록 위쪽부터 사용합니다. 추가된 배치가 많으면 여러 행으로 표시합니다.
150
+ - **모니터별 설정**: 모니터마다 공통 설정·수동·자동을 선택할 수 있습니다. 자동 모드는 감지된 인치수, 배율이 적용된 작업 영역 해상도와 방향을 함께 고려합니다. 크기 정보가 없으면 해상도를 사용하며 인치수를 직접 입력할 수도 있습니다.
151
+ - **격자로 만들기**: 행·열을 1~12개로 정하고 드래그해 사각형 영역을 추가합니다. 영역을 클릭하면 삭제하며, 되돌리기와 남은 칸 채우기도 제공합니다. 모든 칸을 겹침 없이 채우고 이름을 입력해 저장합니다. 배치 하나에 최대 24개 영역을 만들 수 있습니다.
152
+
153
+ 자동 모드의 기본 상한은 22인치 미만 4개, 22~26인치 6개, 27~33인치 8개, 34인치 이상 12개입니다. 좁은 작업 영역과 세로 화면에서는 표시 개수를 더 줄이며, 선택한 배치 수보다 많이 표시하지 않습니다. 이 기능을 사용하지 않으면 모니터 크기와 관계없이 기존 6개 배치를 표시합니다.
154
+
141
155
  macOS에서는 `tidy prefs` 또는 메뉴 막대 아이콘으로 설정을 엽니다. 설정 범위는 [macOS 안내](docs/MACOS.md#shortcuts-and-settings)를 참고하세요. 아래 옵션은 GNOME판 기준입니다.
142
156
 
143
157
  앱 목록의 **Tidy** 또는 **상단 격자 아이콘 → 설정 및 단축키…**에서 변경합니다. 설정은 즉시 반영됩니다.
package/desktop/core.js CHANGED
@@ -1,8 +1,9 @@
1
- import {ACTIONS, directionalMonitor, zoneRect, ZONES} from '../lib/layouts.js';
1
+ import {ACTIONS, directionalMonitor, zoneParts, zoneRect} from '../lib/layouts.js';
2
+ import {defaultLayoutConfig, validateLayoutConfig} from '../lib/layoutConfig.js';
2
3
 
3
4
  export function defaultSettings() {
4
5
  const keys = {Left: 'Left', Right: 'Right', Up: 'Up', Down: 'Down', Return: 'Enter', space: 'Space'};
5
- return {gap: 8, dragPicker: true, edgeSnap: true, openAtLogin: true,
6
+ return {gap: 8, dragPicker: true, edgeSnap: true, openAtLogin: true, layoutConfig: defaultLayoutConfig(),
6
7
  shortcuts: Object.fromEntries(ACTIONS.map(([id, , , accelerator]) => {
7
8
  const key = accelerator.replace('<Super><Alt>', '');
8
9
  return [id, `Control+Alt+${keys[key] ?? key.toUpperCase()}`];
@@ -26,7 +27,8 @@ export function validateSettings(value) {
26
27
  const enabled = Object.values(shortcuts).filter(Boolean).map(key => key.toLowerCase());
27
28
  if (new Set(enabled).size !== enabled.length) throw new Error('Shortcuts must be unique.');
28
29
  return {gap: value.gap, dragPicker: value.dragPicker, edgeSnap: value.edgeSnap,
29
- openAtLogin: value.openAtLogin, shortcuts};
30
+ openAtLogin: value.openAtLogin, shortcuts,
31
+ layoutConfig: value.layoutConfig === undefined ? defaultLayoutConfig() : validateLayoutConfig(value.layoutConfig)};
30
32
  }
31
33
 
32
34
  export function sameRect(a, b, tolerance = 3) {
@@ -75,7 +77,7 @@ export class TilingController {
75
77
  zone = {left: 'right', right: 'left', top: 'bottom', bottom: 'top'}[action];
76
78
  }
77
79
  }
78
- if (!Object.hasOwn(ZONES, zone)) throw new Error('Unknown layout.');
80
+ if (!zoneParts(zone)) throw new Error('Unknown layout.');
79
81
  const area = monitors[monitor].workArea ?? monitors[monitor];
80
82
  return {window, rect: zoneRect(area, zone, zone === 'maximize' ? 0 : gap), zone, key,
81
83
  restore: previous?.zone === 'maximize' ? previous.restore : window.rect};
@@ -0,0 +1,171 @@
1
+ import {DEFAULT_LAYOUT_IDS, addGridRegion, defaultLayoutConfig, fillGrid, gridSelection,
2
+ layoutCatalog, readLayoutConfig, validateGrid, validateLayoutConfig} from '../lib/layoutConfig.js';
3
+ import {zoneParts} from '../lib/layouts.js';
4
+
5
+ export function mountLayoutSettings(root, initial, monitors, text, element, labels = {}) {
6
+ let config = readLayoutConfig(initial);
7
+ const section = element('section', '', 'layout-customization');
8
+ root.append(section);
9
+ const labelInput = (parent, title, input) => {
10
+ const label = element('label', title, 'setting'); label.append(input); parent.append(label); return input;
11
+ };
12
+ const select = (labels, values, current, changed) => {
13
+ const node = element('select');
14
+ labels.forEach((label, index) => { const option = element('option', label); option.value = values[index]; node.append(option); });
15
+ node.value = current; node.onchange = () => changed(node.value); return node;
16
+ };
17
+ const number = (value, low, high, changed) => {
18
+ const node = element('input'); node.type = 'number'; node.min = low; node.max = high; node.value = value;
19
+ node.onchange = () => changed(Number(node.value)); return node;
20
+ };
21
+ const modes = ['all', 'manual', 'auto'];
22
+ const names = [text('Show all selected layouts', '선택한 배치 모두 표시'), text('Set a count manually', '개수 직접 지정'),
23
+ text('Adapt to each monitor', '모니터에 맞춰 자동 조절')];
24
+ const render = () => {
25
+ section.replaceChildren();
26
+ section.append(element('h2', text('Optional layout customization', '선택 기능 · 배치 구성')));
27
+ section.append(element('p', text('Off by default. Disabling this restores the original six layouts without deleting your work.',
28
+ '기본값은 끔입니다. 끄면 기존 6개 배치를 그대로 사용하며 만든 배치는 보관합니다.')));
29
+ const enabled = element('input'); enabled.type = 'checkbox'; enabled.checked = config.enabled;
30
+ enabled.dataset.layoutEnabled = '';
31
+ enabled.onchange = () => { config.enabled = enabled.checked; };
32
+ labelInput(section, text('Customize picker layouts', '배치선택기 구성 사용자 지정'), enabled);
33
+ labelInput(section, text('Number of layouts', '표시할 배치 개수'), select(names, modes, config.mode, value => { config.mode = value; render(); }));
34
+ if (config.mode === 'manual')
35
+ labelInput(section, text('Manual layout count', '수동 표시 개수'), number(config.count, 1, 24, value => { config.count = value; }));
36
+ section.append(element('p', text('Limited counts use the top of this list. Automatic counts consider inches, usable resolution and orientation.',
37
+ '개수가 제한되면 목록 위쪽부터 표시합니다. 자동 모드는 인치수와 작업 영역 해상도·방향을 함께 고려합니다.')));
38
+ const catalog = layoutCatalog(config);
39
+ const list = element('div', '', 'layout-list');
40
+ const ordered = [...config.selected.map(id => catalog.find(layout => layout.id === id)),
41
+ ...catalog.filter(layout => !config.selected.includes(layout.id))];
42
+ ordered.forEach(layout => {
43
+ const row = element('div', '', 'setting');
44
+ const label = element('label', labels[layout.name] ?? layout.name);
45
+ const check = element('input'); check.type = 'checkbox'; check.checked = config.selected.includes(layout.id);
46
+ check.dataset.layoutId = layout.id;
47
+ check.onchange = () => {
48
+ if (!check.checked && config.selected.length === 1) { check.checked = true; return; }
49
+ config.selected = check.checked ? [...config.selected, layout.id] : config.selected.filter(id => id !== layout.id);
50
+ render();
51
+ };
52
+ const preview = element('span', '', 'layout-mini');
53
+ for (const zone of layout.zones) {
54
+ const [x, y, width, height] = zoneParts(zone), part = element('span');
55
+ Object.assign(part.style, {left: `${x * 100}%`, top: `${y * 100}%`, width: `${width * 100}%`, height: `${height * 100}%`});
56
+ preview.append(part);
57
+ }
58
+ label.prepend(preview); label.prepend(check); row.append(label);
59
+ const actions = element('div', '', 'row-actions');
60
+ [-1, 1].forEach(delta => {
61
+ const arrow = element('button', delta < 0 ? '↑' : '↓');
62
+ arrow.setAttribute('aria-label', text(delta < 0 ? 'Move up' : 'Move down', delta < 0 ? '위로 이동' : '아래로 이동'));
63
+ const index = config.selected.indexOf(layout.id);
64
+ arrow.disabled = index < 0 || index + delta < 0 || index + delta >= config.selected.length;
65
+ arrow.onclick = () => { [config.selected[index], config.selected[index + delta]] = [config.selected[index + delta], config.selected[index]]; render(); };
66
+ actions.append(arrow);
67
+ });
68
+ const custom = config.custom.find(item => item.id === layout.id);
69
+ if (custom) {
70
+ const edit = element('button', text('Edit', '편집')); edit.onclick = () => editor(custom); actions.append(edit);
71
+ const remove = element('button', text('Delete', '삭제')); remove.onclick = () => {
72
+ config.custom = config.custom.filter(item => item.id !== custom.id);
73
+ config.selected = config.selected.filter(id => id !== custom.id);
74
+ if (!config.selected.length) config.selected = [...DEFAULT_LAYOUT_IDS]; render();
75
+ }; actions.append(remove);
76
+ }
77
+ row.append(actions); list.append(row);
78
+ });
79
+ section.append(list);
80
+ const add = element('button', text('Create grid layout', '격자 배치 만들기')); add.dataset.createLayout = '';
81
+ add.onclick = () => editor(null); section.append(add);
82
+ const restore = element('button', text('Use the original defaults', '기본 배치로 되돌리기'));
83
+ restore.onclick = () => { config = {...defaultLayoutConfig(), custom: config.custom}; render(); }; section.append(restore);
84
+ for (const monitor of monitors ?? []) {
85
+ const details = element('details');
86
+ details.append(element('summary', `${monitor.id} · ${monitor.width} × ${monitor.height}${monitor.inches >= 8 ? ` · ${monitor.inches.toFixed(1)}″` : ''}`));
87
+ const override = config.monitors[monitor.id] ?? {mode: 'inherit', count: 6, inches: 0};
88
+ const update = (key, value) => { config.monitors[monitor.id] = {...override, ...config.monitors[monitor.id], [key]: value}; };
89
+ labelInput(details, text('Number of layouts', '배치 개수'), select([text('Use the main setting', '공통 설정 사용'), ...names],
90
+ ['inherit', ...modes], override.mode, value => update('mode', value)));
91
+ labelInput(details, text('Manual count', '수동 개수'), number(override.count, 1, 24, value => update('count', value)));
92
+ const inches = number(override.inches, 0, 100, value => update('inches', value)); inches.step = 0.1;
93
+ labelInput(details, text('Diagonal in inches (0 = detected size)', '대각선 인치수 (0 = 자동 감지)'), inches);
94
+ section.append(details);
95
+ }
96
+ };
97
+ const editor = original => {
98
+ const dialog = element('dialog', '', 'grid-editor');
99
+ dialog.append(element('h2', text(original ? 'Edit grid layout' : 'Create grid layout', original ? '격자 배치 편집' : '격자 배치 만들기')));
100
+ const name = element('input'); name.placeholder = text('Layout name', '배치 이름'); name.value = original?.name ?? ''; name.maxLength = 60;
101
+ name.dataset.layoutName = ''; dialog.append(name);
102
+ let columns = original?.columns ?? 3, rows = original?.rows ?? 2;
103
+ let regions = original?.regions.map(region => [...region]) ?? [], start = null, end = null, keyboardStart = null;
104
+ const history = [];
105
+ const message = element('p', '', 'message');
106
+ const tools = element('div', '', 'buttons');
107
+ const grid = element('div', '', 'editor-grid'); grid.dataset.editorGrid = '';
108
+ const redraw = () => {
109
+ grid.replaceChildren(); grid.style.gridTemplateColumns = `repeat(${columns}, 1fr)`;
110
+ grid.style.gridTemplateRows = `repeat(${rows}, 1fr)`;
111
+ const pending = start && end ? gridSelection(columns, rows, start, end) : null;
112
+ for (let y = 0; y < rows; y++) {
113
+ for (let x = 0; x < columns; x++) {
114
+ const index = regions.findIndex(([rx, ry, w, h]) => x >= rx && x < rx + w && y >= ry && y < ry + h);
115
+ const cell = element('button', index >= 0 ? String(index + 1) : '');
116
+ cell.setAttribute('aria-label', `${x + 1}, ${y + 1}`);
117
+ if (index >= 0) cell.style.background = ['#515e7a', '#725b77', '#4f7770'][index % 3];
118
+ if (pending && x >= pending[0] && x < pending[0] + pending[2] && y >= pending[1] && y < pending[1] + pending[3]) cell.className = 'pending';
119
+ cell.onclick = event => {
120
+ if (event.detail !== 0) return;
121
+ if (!keyboardStart) { keyboardStart = [x, y]; message.textContent = text('Choose the opposite corner.', '반대쪽 모서리를 선택하세요.'); }
122
+ else { add(gridSelection(columns, rows, keyboardStart, [x, y])); keyboardStart = null; }
123
+ };
124
+ grid.append(cell);
125
+ }
126
+ }
127
+ };
128
+ const update = next => { history.push(regions); regions = next; message.textContent = ''; redraw(); };
129
+ const add = rectangle => {
130
+ try { update(addGridRegion(regions, rectangle)); }
131
+ catch (error) { message.textContent = labels[error.message] ?? error.message; }
132
+ };
133
+ const point = event => { const rect = grid.getBoundingClientRect(); return [
134
+ Math.floor((event.clientX - rect.x) / rect.width * columns), Math.floor((event.clientY - rect.y) / rect.height * rows)]; };
135
+ grid.onpointerdown = event => { event.preventDefault(); start = end = point(event); grid.setPointerCapture(event.pointerId); redraw(); };
136
+ grid.onpointermove = event => { if (start) { end = point(event); redraw(); } };
137
+ grid.onpointerup = event => {
138
+ if (!start) return;
139
+ end = point(event);
140
+ const rectangle = gridSelection(columns, rows, start, end);
141
+ const index = rectangle[2] === 1 && rectangle[3] === 1 ? regions.findIndex(([x, y, w, h]) =>
142
+ rectangle[0] >= x && rectangle[0] < x + w && rectangle[1] >= y && rectangle[1] < y + h) : -1;
143
+ start = end = null;
144
+ if (index >= 0) update(regions.filter((_, i) => i !== index)); else add(rectangle);
145
+ };
146
+ grid.onpointercancel = () => { start = end = null; redraw(); };
147
+ labelInput(dialog, text('Columns', '열'), number(columns, 1, 12, value => { columns = value; regions = []; history.length = 0; redraw(); }));
148
+ labelInput(dialog, text('Rows', '행'), number(rows, 1, 12, value => { rows = value; regions = []; history.length = 0; redraw(); }));
149
+ dialog.append(element('p', text('Drag across cells to add a region; click a region to remove it. Keyboard: activate its two opposite corners.',
150
+ '격자를 드래그해 영역을 추가하고 클릭해 삭제합니다. 키보드로는 두 모서리를 차례로 선택하세요.')));
151
+ dialog.append(grid, message);
152
+ const undo = element('button', text('Undo', '되돌리기')); undo.onclick = () => { if (history.length) { regions = history.pop(); redraw(); } }; tools.append(undo);
153
+ const fill = element('button', text('Fill remaining cells', '남은 칸 채우기')); fill.dataset.fillGrid = '';
154
+ fill.onclick = () => { try { update(fillGrid(columns, rows, regions)); } catch (error) { message.textContent = labels[error.message] ?? error.message; } }; tools.append(fill);
155
+ const clear = element('button', text('Clear', '모두 지우기')); clear.onclick = () => update([]); tools.append(clear);
156
+ const cancel = element('button', text('Cancel', '취소')); cancel.onclick = () => dialog.remove(); tools.append(cancel);
157
+ const save = element('button', text('Save layout', '배치 저장')); save.dataset.saveLayout = '';
158
+ save.onclick = () => {
159
+ try {
160
+ const layout = {id: original?.id ?? `custom-${crypto.randomUUID()}`, name: name.value.trim(), ...validateGrid({columns, rows, regions})};
161
+ const next = structuredClone(config), index = next.custom.findIndex(item => item.id === layout.id);
162
+ if (index >= 0) next.custom[index] = layout; else { next.custom.push(layout); next.selected.push(layout.id); }
163
+ config = validateLayoutConfig(next); dialog.remove(); render();
164
+ } catch (error) { message.textContent = labels[error.message] ?? error.message; }
165
+ }; tools.append(save); dialog.append(tools);
166
+ document.body.append(dialog); dialog.showModal(); redraw();
167
+ dialog.addEventListener('close', () => dialog.remove());
168
+ };
169
+ render();
170
+ return {value: () => validateLayoutConfig(config), reset: () => { config = defaultLayoutConfig(); render(); }};
171
+ }
package/desktop/main.js CHANGED
@@ -2,7 +2,8 @@ import {app, BrowserWindow, globalShortcut, ipcMain, Menu, nativeImage, screen,
2
2
  import {existsSync, mkdirSync, readFileSync, rmSync, writeFileSync} from 'node:fs';
3
3
  import {dirname, join} from 'node:path';
4
4
  import {fileURLToPath} from 'node:url';
5
- import {ACTIONS, contains, dragIntent, LAYOUTS, ZONES} from '../lib/layouts.js';
5
+ import {ACTIONS, contains, dragIntent, inPickerTrigger, zoneParts} from '../lib/layouts.js';
6
+ import {layoutCatalog, pickerLayouts} from '../lib/layoutConfig.js';
6
7
  import {createTranslator} from '../lib/i18nCore.js';
7
8
  import {defaultSettings, DragTracker, TilingController, validateSettings} from './core.js';
8
9
  import {desktopPaths} from './manage.js';
@@ -47,11 +48,17 @@ let requestedSettings = false;
47
48
  let readyForUI = false;
48
49
  let lastHeartbeat = 0;
49
50
  let shutdownComplete = false;
51
+ let displaySizes = new Map();
52
+ let pickerLayoutSignature = '';
50
53
  const controller = new TilingController();
51
54
  const drag = new DragTracker();
52
55
  const settingsFile = join(configDirectory, 'settings.json');
53
56
  const statusFile = join(base, 'status.json');
54
57
  const monitors = () => screen.getAllDisplays().map(display => ({...display.bounds, id: display.id, workArea: display.workArea}));
58
+ const layoutMonitor = display => ({...display.bounds, id: String(display.id), workArea: display.workArea,
59
+ inches: displaySizes.get(String(display.id)) ?? 0});
60
+ const layoutsFor = display => pickerLayouts(settings.layoutConfig, layoutMonitor(display));
61
+ const pickerDisplayInfo = () => screen.getAllDisplays().find(display => display.id === pickerDisplay) ?? screen.getPrimaryDisplay();
55
62
 
56
63
  function report(error) {
57
64
  lastError = error.message;
@@ -87,6 +94,14 @@ async function start() {
87
94
  catch (error) { lastError = error.message; }
88
95
  }
89
96
  bridge = new NativeBridge(join(directory, 'native'));
97
+ const refreshDisplays = async () => {
98
+ try { displaySizes = new Map((await bridge.request('displays')).map(display => [display.id, display.inches])); }
99
+ catch { displaySizes = new Map(); }
100
+ };
101
+ await refreshDisplays();
102
+ screen.on('display-added', refreshDisplays);
103
+ screen.on('display-removed', () => { hidePicker(); refreshDisplays(); });
104
+ screen.on('display-metrics-changed', () => { hidePicker(); refreshDisplays(); });
90
105
  trusted = (await bridge.request('permissions', {prompt: false})).trusted;
91
106
  const bitmap = Buffer.alloc(24 * 24 * 4);
92
107
  for (let y = 4; y < 20; y++) {
@@ -105,10 +120,12 @@ async function start() {
105
120
  updateTray();
106
121
  ipcMain.handle('tidy:state', event => {
107
122
  checkSender(event);
108
- return {settings, defaults: defaultSettings(), layouts: LAYOUTS, zones: ZONES,
123
+ const layouts = layoutsFor(pickerDisplayInfo());
124
+ return {settings, defaults: defaultSettings(), layouts,
125
+ zones: Object.fromEntries(layouts.flatMap(layout => layout.zones.map(zone => [zone, zoneParts(zone)]))),
126
+ catalog: layoutCatalog(settings.layoutConfig), monitors: screen.getAllDisplays().map(layoutMonitor),
109
127
  actions: ACTIONS.map(([id, title]) => ({id, title: translate(title)})), trusted, shortcutFailures, lastError,
110
- labels: Object.fromEntries(['Tidy Settings', 'Settings and shortcuts…', 'Halves', 'Wide', 'Focus', 'Three columns',
111
- 'Wide center', 'Four quarters'].map(text => [text, translate(text)])),
128
+ labels: Object.fromEntries(Object.keys(catalogs.ko).map(text => [text, translate(text)])),
112
129
  language: app.getLocale().startsWith('ko') ? 'ko' : 'en'};
113
130
  });
114
131
  ipcMain.handle('tidy:save', (event, value) => {
@@ -130,6 +147,7 @@ async function start() {
130
147
  throw error;
131
148
  }
132
149
  settings = next;
150
+ hidePicker();
133
151
  lastError = '';
134
152
  return true;
135
153
  });
@@ -142,13 +160,13 @@ async function start() {
142
160
  checkSender(event, picker);
143
161
  const target = pickerTarget;
144
162
  const displayId = pickerDisplay;
145
- if (Object.hasOwn(ZONES, zone) && target)
163
+ if (layoutsFor(pickerDisplayInfo()).some(layout => layout.zones.includes(zone)) && target)
146
164
  enqueue(() => execute(zone, target, displayId));
147
165
  hidePicker();
148
166
  });
149
167
  ipcMain.on('tidy:regions', (event, regions) => {
150
168
  checkSender(event, picker);
151
- if (Array.isArray(regions)) hitRegions = regions.filter(region => Object.hasOwn(ZONES, region.zone) &&
169
+ if (Array.isArray(regions)) hitRegions = regions.filter(region => zoneParts(region.zone) &&
152
170
  ['x', 'y', 'width', 'height'].every(key => Number.isFinite(region[key])));
153
171
  });
154
172
  ipcMain.on('tidy:close', event => { checkSender(event, picker); hidePicker(); });
@@ -211,6 +229,11 @@ async function showPicker(target, dragging, displayId = null) {
211
229
  const displays = screen.getAllDisplays();
212
230
  const display = displays.find(item => item.id === displayId) ?? screen.getDisplayMatching(target.rect);
213
231
  const area = display.workArea;
232
+ pickerTarget = target;
233
+ pickerDisplay = display.id;
234
+ dragMode = dragging;
235
+ const layouts = layoutsFor(display);
236
+ const signature = JSON.stringify(layouts);
214
237
  if (!picker) {
215
238
  picker = new BrowserWindow({...windowOptions(), width: 820, height: 142, frame: false, resizable: false,
216
239
  alwaysOnTop: true, skipTaskbar: true, focusable: !dragging, roundedCorners: true});
@@ -218,12 +241,15 @@ async function showPicker(target, dragging, displayId = null) {
218
241
  picker.on('blur', () => { if (!dragMode) hidePicker(); });
219
242
  picker.on('closed', () => { picker = null; });
220
243
  await picker.loadFile(join(directory, 'index.html'), {query: {mode: 'picker'}});
244
+ pickerLayoutSignature = signature;
221
245
  }
222
- pickerTarget = target;
223
- pickerDisplay = display.id;
224
- dragMode = dragging;
225
- const width = Math.min(820, area.width);
226
- picker.setBounds({x: Math.round(area.x + (area.width - width) / 2), y: area.y + 12, width, height: Math.min(142, area.height)});
246
+ if (signature !== pickerLayoutSignature) {
247
+ hitRegions = []; pickerLayoutSignature = signature;
248
+ picker.webContents.send('changed');
249
+ }
250
+ const width = Math.min(settings.layoutConfig.enabled ? Math.min(6, layouts.length) * 132 + 28 : 820, area.width);
251
+ const height = settings.layoutConfig.enabled ? Math.ceil(layouts.length / 6) * 91 + 51 : 142;
252
+ picker.setBounds({x: Math.round(area.x + (area.width - width) / 2), y: area.y + 12, width, height: Math.min(height, area.height)});
227
253
  picker.setFocusable(!dragging);
228
254
  picker.setIgnoreMouseEvents(dragging);
229
255
  if (dragging) picker.showInactive();
@@ -269,20 +295,23 @@ async function poll() {
269
295
  const pointer = screen.getCursorScreenPoint();
270
296
  if (event?.type === 'drag' && !preferences?.isFocused()) {
271
297
  const display = screen.getDisplayNearestPoint(pointer);
272
- let intent = dragIntent(display.bounds, display.workArea, pointer.x, pointer.y, {picker: settings.dragPicker});
273
- if (picker?.isVisible() && dragMode && pickerDisplay === display.id && contains(picker.getBounds(), pointer.x, pointer.y))
274
- intent = {type: 'picker'};
275
- if (intent?.type === 'picker' && settings.dragPicker) {
298
+ const trigger = {picker: settings.dragPicker};
299
+ const intent = dragIntent(display.bounds, display.workArea, pointer.x, pointer.y, trigger);
300
+ const inTrigger = inPickerTrigger(display.bounds, display.workArea, pointer.x, pointer.y, trigger);
301
+ const overPicker = picker?.isVisible() && dragMode && pickerDisplay === display.id &&
302
+ contains(picker.getBounds(), pointer.x, pointer.y);
303
+ if (settings.dragPicker && (inTrigger || (overPicker && intent?.type !== 'tile'))) {
276
304
  await showPicker(event.window, true, display.id);
277
305
  const bounds = picker.getBounds();
278
- const hit = hitRegions.find(region => contains(region, pointer.x - bounds.x, pointer.y - bounds.y));
306
+ const hit = intent?.type === 'tile' ? null :
307
+ hitRegions.find(region => contains(region, pointer.x - bounds.x, pointer.y - bounds.y));
279
308
  selection = hit ? {zone: hit.zone, window: event.window, displayId: display.id} : null;
280
309
  picker.webContents.send('hover', hit?.zone ?? null);
281
310
  } else {
282
311
  hidePicker();
283
- if (intent?.type === 'tile' && settings.edgeSnap)
284
- selection = {zone: intent.zone, window: event.window, displayId: display.id};
285
312
  }
313
+ if (intent?.type === 'tile' && settings.edgeSnap)
314
+ selection = {zone: intent.zone, window: event.window, displayId: display.id};
286
315
  if (selection) {
287
316
  const list = monitors();
288
317
  const plan = controller.plan(selection.window, selection.zone, list, settings.gap,
package/desktop/manage.js CHANGED
@@ -132,7 +132,7 @@ export function desktopCommand(command, {platform = process.platform, env = proc
132
132
  const desktopSource = join(packageRoot, 'desktop');
133
133
  cpSync(desktopSource, join(appRoot, 'desktop'), {recursive: true,
134
134
  filter: path => !relative(desktopSource, path).split(sep).includes('node_modules')});
135
- for (const name of ['layouts.js', 'i18nCore.js', 'translations.json'])
135
+ for (const name of ['layouts.js', 'layoutConfig.js', 'i18nCore.js', 'translations.json'])
136
136
  cpSync(join(packageRoot, 'lib', name), join(appRoot, 'lib', name));
137
137
  for (const name of ['LICENSE', 'NOTICE']) cpSync(join(packageRoot, name), join(appRoot, name));
138
138
  const version = readJSON(join(packageRoot, 'package.json')).version;
@@ -88,6 +88,12 @@ func respond(_ line: String) -> [String: Any] {
88
88
  let result: Any
89
89
  switch request["op"] as? String {
90
90
  case "snapshot": result = snapshot((request["ignorePid"] as? Int32) ?? 0)
91
+ case "displays":
92
+ result = NSScreen.screens.compactMap { screen -> [String: Any]? in
93
+ guard let number = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? NSNumber else { return nil }
94
+ let size = CGDisplayScreenSize(CGDirectDisplayID(number.uint32Value))
95
+ return ["id": number.stringValue, "inches": hypot(size.width, size.height) / 25.4]
96
+ }
91
97
  case "place": result = try place(request)
92
98
  case "permissions":
93
99
  let options = [kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: request["prompt"] as? Bool ?? false]
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "tidy-desktop",
3
- "version": "0.20.2",
3
+ "version": "0.21.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "tidy-desktop",
9
- "version": "0.20.2",
9
+ "version": "0.21.0",
10
10
  "dependencies": {
11
11
  "electron": "45.2.3"
12
12
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tidy-desktop",
3
- "version": "0.20.2",
3
+ "version": "0.21.0",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "main": "main.js",
@@ -1,3 +1,4 @@
1
+ import {mountLayoutSettings} from './layout-editor.js';
1
2
  const mode = new URLSearchParams(location.search).get('mode');
2
3
  const root = document.querySelector('#app');
3
4
  document.body.className = mode;
@@ -14,14 +15,18 @@ else {
14
15
  return node;
15
16
  };
16
17
  if (mode === 'picker') {
18
+ let observer;
19
+ const render = current => {
20
+ observer?.disconnect(); root.replaceChildren();
17
21
  root.append(element('div', text('Choose a layout · Esc to close', '배치를 고르세요 · Esc로 닫기'), 'hint'));
18
22
  const layouts = element('div', '', 'layouts');
19
- for (const layout of state.layouts) {
23
+ layouts.style.gridTemplateColumns = `repeat(${Math.min(6, current.layouts.length)}, minmax(0, 1fr))`;
24
+ for (const layout of current.layouts) {
20
25
  const card = element('div');
21
26
  card.append(element('div', state.labels[layout.name] ?? layout.name, 'layout-label'));
22
27
  const diagram = element('div', '', 'diagram');
23
28
  for (const zone of layout.zones) {
24
- const [x, y, width, height] = state.zones[zone];
29
+ const [x, y, width, height] = current.zones[zone];
25
30
  const button = element('button', '', 'zone');
26
31
  button.dataset.zone = zone;
27
32
  button.setAttribute('aria-label', `${state.labels[layout.name] ?? layout.name}: ${zone}`);
@@ -40,7 +45,10 @@ else {
40
45
  // Prepare hit regions before the picker is shown; a hidden window may
41
46
  // not receive its first ResizeObserver notification until it paints.
42
47
  regions();
43
- new ResizeObserver(regions).observe(root);
48
+ observer = new ResizeObserver(regions); observer.observe(root);
49
+ };
50
+ render(state);
51
+ window.tidy.changed(async () => render(await window.tidy.state()));
44
52
  window.tidy.hover(zone => document.querySelectorAll('.zone').forEach(node => node.classList.toggle('selected', node.dataset.zone === zone)));
45
53
  document.addEventListener('keydown', event => { if (event.key === 'Escape') window.tidy.close(); });
46
54
  } else {
@@ -89,6 +97,7 @@ else {
89
97
  shortcuts[action.id] = input;
90
98
  label.append(input); root.append(label);
91
99
  }
100
+ const layoutSettings = mountLayoutSettings(root, state.settings.layoutConfig, state.monitors, text, element, state.labels);
92
101
  const buttons = element('div', '', 'buttons');
93
102
  const save = element('button', text('Save', '저장'));
94
103
  save.onclick = async () => {
@@ -96,6 +105,7 @@ else {
96
105
  save.disabled = true;
97
106
  await window.tidy.save({gap: Number(fields.gap.value), dragPicker: fields.dragPicker.checked,
98
107
  edgeSnap: fields.edgeSnap.checked, openAtLogin: fields.openAtLogin.checked,
108
+ layoutConfig: layoutSettings.value(),
99
109
  shortcuts: Object.fromEntries(Object.entries(shortcuts).map(([key, input]) => [key, input.value.trim()]))});
100
110
  message.textContent = text('Saved.', '저장했습니다.');
101
111
  } catch (error) { message.textContent = error.message; }
@@ -104,6 +114,7 @@ else {
104
114
  };
105
115
  const reset = element('button', text('Restore defaults', '기본값 불러오기'));
106
116
  reset.onclick = () => {
117
+ layoutSettings.reset();
107
118
  for (const [key, input] of Object.entries(fields)) {
108
119
  if (input.type === 'checkbox') input.checked = state.defaults[key];
109
120
  else input.value = state.defaults[key];
package/desktop/style.css CHANGED
@@ -23,3 +23,18 @@ input[type=text], input[type=number] {background: #1a1a1e; color: #eee; border:
23
23
  .zone:hover::after, .zone.selected::after, .zone:focus-visible::after {background: #b3b3be; border-color: #eee;}
24
24
  .preview {background: transparent;}
25
25
  .preview #app {position: fixed; inset: 3px; border: 2px solid #d0d0dc; border-radius: 12px; background: #77778555; box-shadow: inset 0 0 15px #aaa2;}
26
+ select {font: inherit; color: #eee; background: #252529; border: 1px solid #626269; border-radius: 6px; padding: 6px; max-width: 260px;}
27
+ .layout-customization {margin-top: 28px; border-top: 1px solid #626269; padding-top: 18px;}
28
+ .layout-list .setting {align-items: center;}
29
+ .layout-list label {display: flex; align-items: center; gap: 10px;}
30
+ .layout-mini {position: relative; display: inline-block; width: 64px; height: 36px; flex-shrink: 0;}
31
+ .layout-mini span {position: absolute; border: 2px solid #252529; background: #85858d;}
32
+ .row-actions {display: flex; gap: 4px;}
33
+ .row-actions button {padding: 5px 8px;}
34
+ details {margin-top: 18px; padding: 10px; border: 1px solid #626269; border-radius: 8px;}
35
+ dialog.grid-editor {width: min(640px, 92vw); max-height: 94vh; overflow: auto; color: #eee; background: #252529; border: 1px solid #85858d; border-radius: 14px;}
36
+ dialog::backdrop {background: #0009;}
37
+ .editor-grid {display: grid; height: 280px; gap: 2px; touch-action: none; margin-top: 16px; background: #16161a; padding: 3px;}
38
+ .editor-grid button {padding: 0; border-radius: 2px; min-width: 0; min-height: 0;}
39
+ .editor-grid button.pending {outline: 2px solid #eee; background: #8098c4 !important;}
40
+ .grid-editor .buttons {flex-wrap: wrap;}
Binary file
@@ -27,12 +27,15 @@ npm 배포 이름은 `@hnode/tidy`이고 실행 파일은 `bin/tidy.js`입니다
27
27
  ```bash
28
28
  GSETTINGS_BACKEND=memory GSETTINGS_SCHEMA_DIR="$PWD/schemas" gjs -m tests/lease-smoke.js
29
29
  /usr/bin/python3 scripts/test-shell.py
30
+ /usr/bin/python3 scripts/test-shell.py --startup-only
30
31
  /usr/bin/python3 scripts/test-shell.py --migration-only
31
32
  TIDY_TEST_LEGACY_UUID=tidy@hnode.dev /usr/bin/python3 scripts/test-shell.py --migration-only
32
33
  ```
33
34
 
34
35
  Shell 통합 테스트는 GNOME 50의 `gnome-shell-test-tool`과 가상 모니터를 지원하는 그래픽 환경이 필요합니다. 별도 D-Bus, 런타임 디렉터리, 설정 저장소와 헤드리스 Wayland 세션에서 동작합니다.
35
36
 
37
+ `--startup-only`는 테스트용 확장의 모듈 읽기를 지연하고 그 도중 실제 `apply-update`를 실행합니다. 로그인 도구가 GNOME의 오류 내용 없는 임시 `ERROR` 상태를 기다리고, 읽기가 끝난 뒤 활성화와 예약 파일 정리를 완료하는지 확인합니다. 지연 코드는 임시 테스트 ZIP에만 추가합니다.
38
+
36
39
  Ubuntu Dock이 설치된 환경에서는 `TIDY_TEST_UBUNTU_DOCK=1 /usr/bin/python3 scripts/test-shell.py`로 Tidy 활성화 후 앱 표시 버튼이 교체되는 경우도 확인합니다. 선택기는 교체된 버튼과 관계없이 Super+A 앱 목록에서 숨겨져야 합니다.
37
40
 
38
41
  ## Test coverage
package/docs/MACOS.md CHANGED
@@ -18,7 +18,7 @@ tidy doctor
18
18
  tidy install
19
19
  ```
20
20
 
21
- 0.20.2 배포본을 버전 고정으로 테스트하는 절차는 [배포본 Mac 테스트](RELEASING.md#test-the-published-package-on-mac)에 있습니다. 전역 설치 없이 `npx --yes @hnode/tidy@0.20.2 install`로도 설치할 수 있습니다.
21
+ 0.21.0 배포본을 버전 고정으로 테스트하는 절차는 [배포본 Mac 테스트](RELEASING.md#test-the-published-package-on-mac)에 있습니다. 전역 설치 없이 `npx --yes @hnode/tidy@0.21.0 install`로도 설치할 수 있습니다.
22
22
 
23
23
  소스의 변경 사항을 사용하려면 저장소에서 실행하세요.
24
24
 
package/docs/README.en.md CHANGED
@@ -31,18 +31,23 @@ The table below describes the GNOME edition. macOS provides the six-layout picke
31
31
  | --- | --- |
32
32
  | Top layout picker | Drop a window into one of six layouts arranged in a single row. |
33
33
  | Maximize button picker | Hover over maximize or restore to open a three-column, two-row picker below the button. Can be disabled in settings. |
34
- | Edge snapping | Other top edges maximize; left and right edges tile halves. |
34
+ | Edge snapping | The very top edge maximizes, including above the picker; left and right edges tile halves. |
35
35
  | Overview integration | Press Super to open window overview and the single-row picker together. The picker is hidden in the Super+A application grid. |
36
36
  | Custom shortcuts | Use Super+Alt for halves, quarters, thirds and two-thirds; customize the bindings in settings. |
37
37
  | Multiple monitors | Repeat an arrow shortcut to move to the monitor in that direction, including above and below. Picker size adapts to each monitor. |
38
38
  | Linked resizing | Drag shared boundaries to resize adjacent tiled windows together. Enabled by default. |
39
39
  | Optional snap assist | Choose live window previews with titles inside empty regions. Multiple windows of the same app appear separately. Disabled by default. |
40
40
  | Size and spacing | Adjust picker sizes and window gaps, including a separate overview picker size. |
41
+ | Optional layout customization | Choose visible layouts and their order, set automatic or manual per-monitor counts, and create layouts on a grid. Off by default; the original six layouts stay unchanged. |
41
42
 
42
43
  The 100% picker size now matches the previous 115% size. Saved sizes are converted to the new reference. Top/bottom and maximize cards are removed, and a **¼ · ½ · ¼** layout sits immediately to the right of equal thirds. Maximize shortcuts and top-edge maximization remain available. Automatic sizing preserves the 16-inch built-in reference; on a 32-inch external monitor, the new 100% matches approximately 80% of the previous automatic size.
43
44
 
44
45
  The maximize button picker waits about 350 milliseconds before opening. Click a cell to arrange that window, move away or press Esc to dismiss. It uses actual accessibility button information and supports English and Korean maximize/restore labels, including Brave’s Korean restore control and nested titlebar containers; custom titlebars that do not expose these controls are skipped. The option defaults to on and is independent of top-edge dragging.
45
46
 
47
+ Optional customization is available under **Settings → Layout customization**. It defaults to off and preserves the original six layouts, order and size. Enable it to select and reorder layouts, choose all/manual/automatic counts, and override counts or physical inches per monitor. Automatic counts consider physical size, usable logical resolution and orientation; they never exceed the number of selected layouts.
48
+
49
+ Use **Create grid layout** to draw rectangular regions on a grid of up to 12 rows and columns. Click a region to remove it, use Undo or Fill remaining cells, then name and save the completed layout. Regions must cover the grid without overlap, with at most 24 regions per layout. Custom layouts can be edited or deleted, and disabling customization preserves them for later use.
50
+
46
51
  ## Platform Support
47
52
 
48
53
  | Environment | Status |
@@ -108,6 +113,8 @@ Super and overview integration below are GNOME features. On macOS, use the menu
108
113
  2. Drag into that area to reveal the layouts and shrink the window into a small preview. Move the pointer onto the desired layout cell.
109
114
  3. Release to tile the window. Release over empty space to cancel.
110
115
 
116
+ The picker stays open throughout its top-center activation area, including at the very top edge. The gap above the picker previews maximization; release there to maximize. Move down onto a layout cell to select it without reopening the picker.
117
+
111
118
  Press **Super** to open window overview and the single-row layout picker together. **Super+A** hides the picker and previews while the application grid is open; returning to window overview restores them. Drag a window preview into a cell, or click a cell to place the previously focused window. Search appears when you type.
112
119
 
113
120
  Window previews shrink as soon as you start dragging in window overview, and return to their original size on release or cancellation. Dropping a window into a layout continues directly from the miniature to its final placement.
package/docs/RELEASING.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Tidy는 **@hnode/tidy**라는 공개 npm 패키지로 배포합니다. `tidy` CLI, GNOME 확장 ZIP과 macOS 데스크톱 앱 소스를 포함합니다. 루트 패키지에는 런타임 npm 의존성이 없고, macOS의 명시적 `tidy install` 시 별도 사용자 폴더에 고정 버전의 Electron을 설치합니다. 확장 ZIP과 데스크톱 설치에는 GPL 소스와 라이선스 파일을 포함합니다.
4
4
 
5
- 현재 배포 준비 버전은 **0.20.2**입니다. macOS 설치·업데이트·제거, 메뉴 막대 선택기, Control+Option 단축키와 Swift Accessibility 창 제어를 포함합니다. GNOME의 남은 공간 선택기는 창별 실시간 미리보기와 제목을 표시하며, 확장 UUID는 `tidy@hnode`, 내부 버전은 **24**입니다. 기존 UUID에서 설정을 유지해 이전하며, 설치·업데이트 완료 시 재로그인 필요 여부를 안내합니다. Mac의 실제 창 조작은 배포본을 받은 뒤 검증하며, 자동 검사 통과와 구분합니다.
5
+ 현재 배포 준비 버전은 **0.21.0**이며, GNOME 확장 UUID는 `tidy@hnode`, 내부 버전은 **27**입니다. 기본값은 기존 6개 배치와 같은 순서·크기를 유지합니다. 선택 기능을 켜면 배치 추가·제거·순서 변경, 모니터 인치수와 작업 영역에 따른 자동·수동 개수 조절, 격자 배치 생성·편집을 사용할 수 있습니다. 상단 중앙 인식 범위에서는 화면 맨 위 끝에 포인터를 대도 배치 선택기가 계속 열려 있습니다. 선택기 위쪽 여백에 놓으면 최대화하고, 아래의 배치 칸으로 이동하면 선택기를 다시 여는 과정 없이 배치를 고릅니다. 로그인 직후 자동 활성화는 GNOME의 모듈 읽기가 끝날 때까지 기다려, 초기 상태를 실제 확장 오류로 판단하지 않도록 수정했습니다. GNOME과 macOS가 같은 가장자리 계산을 사용합니다. Mac의 실제 창 조작은 별도로 검증하며, 자동 검사 통과와 구분합니다.
6
6
 
7
7
  ## Prepare
8
8
 
@@ -15,8 +15,8 @@ npm run check
15
15
  npm run test:package
16
16
  npm pack --dry-run
17
17
  npm pack --pack-destination dist
18
- node tests/npm-package-smoke.js dist/hnode-tidy-0.20.2.tgz
19
- sha256sum dist/hnode-tidy-0.20.2.tgz
18
+ node tests/npm-package-smoke.js dist/hnode-tidy-0.21.0.tgz
19
+ sha256sum dist/hnode-tidy-0.21.0.tgz
20
20
  ```
21
21
 
22
22
  `prepack`이 Node.js로 최신 소스의 확장 ZIP을 다시 빌드합니다. GNOME 배포용 tarball은 `glib-compile-schemas`가 있는 Linux에서 빌드해 컴파일한 스키마까지 검증하세요. macOS에서는 GLib 없이 소스 스키마를 포함한 ZIP을 만들 수 있습니다. 공개 파일은 `package.json`의 `files` 목록으로 제한합니다. `desktop/native/macos.swift`, UI와 공통 `lib/layouts.js`가 포함되는지 확인하세요. 로그, 테스트, `.npmrc`, 캐시, `node_modules`는 포함하지 않습니다. npm 패키지 설치 자체는 데스크톱 설정을 바꾸지 않으며 `postinstall`은 사용하지 않습니다.
@@ -27,9 +27,35 @@ sha256sum dist/hnode-tidy-0.20.2.tgz
27
27
 
28
28
  ```bash
29
29
  /usr/bin/python3 scripts/test-shell.py
30
+ /usr/bin/python3 scripts/test-shell.py --startup-only
30
31
  TIDY_TEST_UBUNTU_DOCK=1 /usr/bin/python3 scripts/test-shell.py
31
32
  ```
32
33
 
34
+ ## Local test before publishing
35
+
36
+ 검증한 로컬 tarball로 현재 사용자의 확장을 업데이트합니다. npm 캐시에서 실행하므로 전역 CLI 버전은 바뀌지 않습니다.
37
+
38
+ ```bash
39
+ npm exec --offline --yes --package ./dist/hnode-tidy-0.21.0.tgz -- tidy --version
40
+ npm exec --offline --yes --package ./dist/hnode-tidy-0.21.0.tgz -- tidy install
41
+ ```
42
+
43
+ GNOME은 이미 읽은 JavaScript를 세션 동안 캐시하므로, 설치 후 **로그아웃하고 다시 로그인**해야 합니다. 설치 도구가 다음 로그인에 버전 27을 자동으로 활성화합니다. 확인할 때는 다음 명령으로 `Version: 27`, `Enabled: Yes`, `State: ACTIVE`를 확인하세요.
44
+
45
+ ```bash
46
+ gnome-extensions info tidy@hnode
47
+ ```
48
+
49
+ 일반 창의 제목 표시줄을 잡고 다음 동작을 확인합니다.
50
+
51
+ - 상단 중앙에서 선택기를 연 뒤 화면 맨 위 끝까지 올려도 선택기가 계속 열려 있고, 최대화 미리보기가 표시되며 놓으면 최대화됩니다.
52
+ - 상단 중앙 끝으로 바로 끌어도 선택기가 열리며, 놓으면 최대화됩니다.
53
+ - 맨 위에서 아래로 내려오면 선택기의 닫힘·열림 없이 배치를 바로 고를 수 있고, 배치 칸에 놓으면 해당 칸으로 배치됩니다.
54
+ - 좌우 절반 배치와 중앙 밖 상단 최대화가 동작하며, 외장 모니터에서도 같은 결과를 확인합니다.
55
+ - 사용자 지정이 기본적으로 꺼져 있고 기존 6개 배치·순서·크기가 유지되는지 확인합니다.
56
+ - 배치 구성에서 사용자 지정을 켜고 추가 프리셋·표시 순서·수동 개수·모니터별 자동 개수를 바꿉니다. 격자 배치를 저장·편집하고 실제 창을 각 영역에 놓아 봅니다.
57
+ - 사용자 지정을 끄면 원래 6개 배치로 돌아가고, 다시 켰을 때 만든 배치가 보관돼 있는지 확인합니다.
58
+
33
59
  ## Publish
34
60
 
35
61
  `@hnode` 사용자 계정 또는 해당 조직에 패키지를 게시할 권한이 필요합니다. 검증한 tarball을 그대로 게시합니다.
@@ -37,8 +63,8 @@ TIDY_TEST_UBUNTU_DOCK=1 /usr/bin/python3 scripts/test-shell.py
37
63
  ```bash
38
64
  npm login --registry=https://registry.npmjs.org/
39
65
  npm whoami --registry=https://registry.npmjs.org/
40
- npm publish ./dist/hnode-tidy-0.20.2.tgz --access public --tag latest
41
- npm view @hnode/tidy@0.20.2 version os dist.integrity --json
66
+ npm publish ./dist/hnode-tidy-0.21.0.tgz --access public --tag latest
67
+ npm view @hnode/tidy@0.21.0 version os dist.integrity --json
42
68
  npm view @hnode/tidy dist-tags --json
43
69
  ```
44
70
 
@@ -49,16 +75,16 @@ npm이 요청하는 브라우저 로그인·2FA를 완료하세요. 같은 버
49
75
  Node.js 22.12 이상과 Xcode Command Line Tools가 필요합니다. 컴파일러가 없다면 `xcode-select --install`로 설치를 완료한 다음 진행하세요. 게시한 버전을 명시해 이전 `latest`나 전역 설치본과 혼동하지 않도록 합니다.
50
76
 
51
77
  ```sh
52
- npx --yes @hnode/tidy@0.20.2 --version
53
- npx --yes @hnode/tidy@0.20.2 doctor
54
- npx --yes @hnode/tidy@0.20.2 install
55
- npx --yes @hnode/tidy@0.20.2 status
78
+ npx --yes @hnode/tidy@0.21.0 --version
79
+ npx --yes @hnode/tidy@0.21.0 doctor
80
+ npx --yes @hnode/tidy@0.21.0 install
81
+ npx --yes @hnode/tidy@0.21.0 status
56
82
  ```
57
83
 
58
- 첫 명령은 `0.20.2`를 출력해야 합니다. **시스템 설정 → 개인정보 보호 및 보안 → 손쉬운 사용**에서 Tidy를 허용하세요. 메뉴 막대에서 Tidy를 종료하고 다음 명령으로 다시 실행하면 새 권한을 적용합니다.
84
+ 첫 명령은 `0.21.0`를 출력해야 합니다. **시스템 설정 → 개인정보 보호 및 보안 → 손쉬운 사용**에서 Tidy를 허용하세요. 메뉴 막대에서 Tidy를 종료하고 다음 명령으로 다시 실행하면 새 권한을 적용합니다.
59
85
 
60
86
  ```sh
61
- npx --yes @hnode/tidy@0.20.2 prefs
87
+ npx --yes @hnode/tidy@0.21.0 prefs
62
88
  ```
63
89
 
64
90
  TextEdit나 브라우저 같은 일반 창을 선택한 뒤 확인하세요.
@@ -71,11 +97,11 @@ TextEdit나 브라우저 같은 일반 창을 선택한 뒤 확인하세요.
71
97
  업데이트와 제거도 같은 공개 버전으로 확인할 수 있습니다.
72
98
 
73
99
  ```sh
74
- npx --yes @hnode/tidy@0.20.2 update
75
- npx --yes @hnode/tidy@0.20.2 uninstall
100
+ npx --yes @hnode/tidy@0.21.0 update
101
+ npx --yes @hnode/tidy@0.21.0 uninstall
76
102
  ```
77
103
 
78
- 제거 후 앱과 로그인 자동 실행 등록이 없어지고 설정은 보관돼야 합니다. macOS 기본 타일링과 시스템 단축키는 변경하지 않습니다. 실패 시 `sw_vers`, `uname -m`, `node --version`과 `npx --yes @hnode/tidy@0.20.2 status` 결과를 기록하세요. 설치 실패 시 터미널에 출력된 오류도 함께 확인합니다.
104
+ 제거 후 앱과 로그인 자동 실행 등록이 없어지고 설정은 보관돼야 합니다. macOS 기본 타일링과 시스템 단축키는 변경하지 않습니다. 실패 시 `sw_vers`, `uname -m`, `node --version`과 `npx --yes @hnode/tidy@0.21.0 status` 결과를 기록하세요. 설치 실패 시 터미널에 출력된 오류도 함께 확인합니다.
79
105
 
80
106
  ## User commands
81
107
 
@@ -0,0 +1,138 @@
1
+ import {LAYOUTS} from './layouts.js';
2
+
3
+ export const DEFAULT_LAYOUT_IDS = ['halves', 'wide', 'focus', 'thirds', 'wide-center', 'quarters'];
4
+ export const MAX_LAYOUTS = 24;
5
+ const modes = ['all', 'manual', 'auto'];
6
+ const integer = (value, low, high) => Number.isInteger(value) && value >= low && value <= high;
7
+ export const gridZone = (columns, rows, [x, y, width, height]) => `grid:${columns}:${rows}:${x}:${y}:${width}:${height}`;
8
+ const uniform = (columns, rows) => Array.from({length: columns * rows}, (_, index) =>
9
+ gridZone(columns, rows, [index % columns, Math.floor(index / columns), 1, 1]));
10
+ export const EXTRA_LAYOUTS = [
11
+ {id: 'rows', name: 'Top and bottom', zones: ['top', 'bottom']},
12
+ {id: 'mirror-focus', name: 'Focus on right', zones: ['top-left', 'bottom-left', 'right']},
13
+ {id: 'four-columns', name: 'Four columns', zones: uniform(4, 1)},
14
+ {id: 'six-grid', name: 'Six regions', zones: uniform(3, 2)},
15
+ {id: 'eight-grid', name: 'Eight regions', zones: uniform(4, 2)},
16
+ {id: 'three-rows', name: 'Three rows', zones: uniform(1, 3)},
17
+ ];
18
+
19
+ export function defaultLayoutConfig() {
20
+ return {enabled: false, mode: 'all', count: 6, selected: [...DEFAULT_LAYOUT_IDS], custom: [], monitors: {}};
21
+ }
22
+
23
+ export function validateGrid(layout) {
24
+ if (!layout || !integer(layout.columns, 1, 12) || !integer(layout.rows, 1, 12) ||
25
+ !Array.isArray(layout.regions) || layout.regions.length < 1 || layout.regions.length > 24)
26
+ throw new Error('Use a grid of 1–12 rows and columns with 1–24 regions.');
27
+ const occupied = new Set();
28
+ for (const region of layout.regions) {
29
+ if (!Array.isArray(region) || region.length !== 4 || !region.every(Number.isInteger))
30
+ throw new Error('Each region must be a rectangle on the grid.');
31
+ const [x, y, width, height] = region;
32
+ if (x < 0 || y < 0 || width < 1 || height < 1 || x + width > layout.columns || y + height > layout.rows)
33
+ throw new Error('Regions must stay inside the grid.');
34
+ for (let row = y; row < y + height; row++) {
35
+ for (let column = x; column < x + width; column++) {
36
+ const key = row * layout.columns + column;
37
+ if (occupied.has(key)) throw new Error('Regions cannot overlap.');
38
+ occupied.add(key);
39
+ }
40
+ }
41
+ }
42
+ if (occupied.size !== layout.columns * layout.rows)
43
+ throw new Error('Fill every grid cell before saving.');
44
+ return {columns: layout.columns, rows: layout.rows, regions: layout.regions.map(region => [...region])};
45
+ }
46
+
47
+ export function gridSelection(columns, rows, start, end) {
48
+ const clamp = (value, high) => Math.max(0, Math.min(high - 1, Math.floor(value)));
49
+ const [ax, ay] = [clamp(start[0], columns), clamp(start[1], rows)];
50
+ const [bx, by] = [clamp(end[0], columns), clamp(end[1], rows)];
51
+ return [Math.min(ax, bx), Math.min(ay, by), Math.abs(ax - bx) + 1, Math.abs(ay - by) + 1];
52
+ }
53
+
54
+ export function addGridRegion(regions, region) {
55
+ const [x, y, width, height] = region;
56
+ if (regions.some(([ox, oy, ow, oh]) => x < ox + ow && x + width > ox && y < oy + oh && y + height > oy))
57
+ throw new Error('Regions cannot overlap.');
58
+ if (regions.length >= 24) throw new Error('A layout can have at most 24 regions.');
59
+ return [...regions, [...region]];
60
+ }
61
+
62
+ export function fillGrid(columns, rows, regions) {
63
+ const result = regions.map(region => [...region]);
64
+ for (let y = 0; y < rows; y++) {
65
+ for (let x = 0; x < columns; x++) {
66
+ if (!result.some(([ox, oy, width, height]) => x >= ox && x < ox + width && y >= oy && y < oy + height))
67
+ result.push([x, y, 1, 1]);
68
+ }
69
+ }
70
+ if (result.length > 24) throw new Error('A layout can have at most 24 regions.');
71
+ return result;
72
+ }
73
+
74
+ export function layoutCatalog(config = defaultLayoutConfig()) {
75
+ return [...LAYOUTS.map((layout, index) => ({...layout, id: DEFAULT_LAYOUT_IDS[index]})), ...EXTRA_LAYOUTS,
76
+ ...config.custom.map(layout => ({id: layout.id, name: layout.name,
77
+ zones: layout.regions.map(region => gridZone(layout.columns, layout.rows, region))}))];
78
+ }
79
+
80
+ export function validateLayoutConfig(value) {
81
+ if (!value || typeof value.enabled !== 'boolean' || !modes.includes(value.mode) || !integer(value.count, 1, MAX_LAYOUTS) ||
82
+ !Array.isArray(value.custom) || value.custom.length > 20 || !Array.isArray(value.selected) ||
83
+ value.selected.length < 1 || value.selected.length > MAX_LAYOUTS ||
84
+ !value.monitors || typeof value.monitors !== 'object' || Array.isArray(value.monitors))
85
+ throw new Error('Invalid layout customization settings.');
86
+ const custom = value.custom.map(layout => {
87
+ if (!layout || typeof layout.id !== 'string' || !/^custom-[a-zA-Z0-9-]{1,60}$/.test(layout.id) ||
88
+ typeof layout.name !== 'string' || !layout.name.trim() || layout.name.length > 60)
89
+ throw new Error('Give each custom layout a name of 1–60 characters.');
90
+ return {id: layout.id, name: layout.name.trim(), ...validateGrid(layout)};
91
+ });
92
+ if (new Set(custom.map(layout => layout.id)).size !== custom.length)
93
+ throw new Error('Custom layout identifiers must be unique.');
94
+ const ids = new Set(layoutCatalog({custom}).map(layout => layout.id));
95
+ if (new Set(value.selected).size !== value.selected.length || !value.selected.every(id => ids.has(id)))
96
+ throw new Error('Choose at least one available layout.');
97
+ const monitors = {};
98
+ if (Object.keys(value.monitors).length > 32) throw new Error('Too many monitor overrides.');
99
+ for (const [id, monitor] of Object.entries(value.monitors)) {
100
+ if (id.length > 200 || ['__proto__', 'prototype', 'constructor'].includes(id) || !monitor ||
101
+ !['inherit', ...modes].includes(monitor.mode) || !integer(monitor.count, 1, MAX_LAYOUTS) ||
102
+ !Number.isFinite(monitor.inches) || (monitor.inches !== 0 && (monitor.inches < 8 || monitor.inches > 100)))
103
+ throw new Error('Invalid monitor layout settings.');
104
+ monitors[id] = {mode: monitor.mode, count: monitor.count, inches: monitor.inches};
105
+ }
106
+ return {enabled: value.enabled, mode: value.mode, count: value.count, selected: [...value.selected], custom, monitors};
107
+ }
108
+
109
+ export function readLayoutConfig(value) {
110
+ try { return validateLayoutConfig(typeof value === 'string' ? JSON.parse(value) : value); }
111
+ catch { return defaultLayoutConfig(); }
112
+ }
113
+
114
+ // This is Tidy's opt-in policy, using physical size and effective workspace.
115
+ // It does not change the existing six-layout default on any monitor.
116
+ export function automaticLayoutCount(monitor = {}) {
117
+ const width = monitor.workArea?.width ?? monitor.width ?? 1920;
118
+ const height = monitor.workArea?.height ?? monitor.height ?? 1080;
119
+ const inches = monitor.inches;
120
+ let count = inches >= 34 ? 12 : inches >= 27 ? 8 : inches >= 22 ? 6 : inches >= 8 ? 4 :
121
+ width >= 2560 ? 10 : width >= 1600 ? 6 : 4;
122
+ if (width < height) count = Math.min(count, 6);
123
+ if (width < 1000) count = Math.min(count, 4);
124
+ else if (width < 1400) count = Math.min(count, 6);
125
+ return count;
126
+ }
127
+
128
+ export function pickerLayouts(config, monitor = {}) {
129
+ if (!config.enabled) return LAYOUTS;
130
+ const catalog = new Map(layoutCatalog(config).map(layout => [layout.id, layout]));
131
+ const selected = config.selected.map(id => catalog.get(id)).filter(Boolean);
132
+ const override = Object.hasOwn(config.monitors, monitor.id) ? config.monitors[monitor.id] : null;
133
+ const mode = override && override.mode !== 'inherit' ? override.mode : config.mode;
134
+ const profile = {...monitor, inches: override?.inches || monitor.inches};
135
+ const count = mode === 'all' ? selected.length : mode === 'auto' ? automaticLayoutCount(profile) :
136
+ override?.mode === 'manual' ? override.count : config.count;
137
+ return selected.slice(0, count);
138
+ }
package/lib/layouts.js CHANGED
@@ -41,8 +41,19 @@ export const ACTIONS = [
41
41
  ['next-monitor', "Move to next monitor", 'next-monitor', '<Super><Alt>n'],
42
42
  ];
43
43
 
44
+ export function zoneParts(zone) {
45
+ if (Array.isArray(zone)) return zone;
46
+ if (Object.hasOwn(ZONES, zone)) return ZONES[zone];
47
+ const match = typeof zone === 'string' && /^grid:(\d+):(\d+):(\d+):(\d+):(\d+):(\d+)$/.exec(zone);
48
+ if (!match) return null;
49
+ const [columns, rows, x, y, width, height] = match.slice(1).map(Number);
50
+ if (columns < 1 || columns > 12 || rows < 1 || rows > 12 || width < 1 || height < 1 ||
51
+ x + width > columns || y + height > rows) return null;
52
+ return [x / columns, y / rows, width / columns, height / rows];
53
+ }
54
+
44
55
  export function zoneRect(area, zone, gap = 0) {
45
- const parts = typeof zone === 'string' ? ZONES[zone] : zone;
56
+ const parts = zoneParts(zone);
46
57
  if (!parts || area.width <= 0 || area.height <= 0)
47
58
  throw new Error('Invalid zone or work area');
48
59
  const [x, y, width, height] = parts;
@@ -69,16 +80,20 @@ export function contains(rect, x, y) {
69
80
  return x >= rect.x && y >= rect.y && x < rect.x + rect.width && y < rect.y + rect.height;
70
81
  }
71
82
 
72
- export function dragIntent(monitor, area, x, y, {height = 96, width = 320,
83
+ export function inPickerTrigger(monitor, area, x, y, {height = 96, width = 320,
73
84
  center = area.x + area.width / 2, picker = true} = {}) {
85
+ const halfWidth = Math.min(width, area.width - 24) / 2;
86
+ return picker && contains(monitor, x, y) && Math.abs(x - center) <= halfWidth && y <= area.y + height;
87
+ }
88
+
89
+ export function dragIntent(monitor, area, x, y, options = {}) {
74
90
  if (!contains(monitor, x, y))
75
91
  return null;
76
- const halfWidth = Math.min(width, area.width - 24) / 2;
77
- if (picker && Math.abs(x - center) <= halfWidth && y <= area.y + height)
78
- return {type: 'picker'};
79
- // The rest of the top edge maximizes; the side edges tile directly.
92
+ // The very top always maximizes, including above the picker.
80
93
  if (y <= area.y + 12)
81
94
  return {type: 'tile', zone: 'maximize'};
95
+ if (inPickerTrigger(monitor, area, x, y, options))
96
+ return {type: 'picker'};
82
97
  if (x <= monitor.x + 12)
83
98
  return {type: 'tile', zone: 'left'};
84
99
  if (x >= monitor.x + monitor.width - 12)
@@ -10,12 +10,12 @@
10
10
  "Disable native Super+arrow tiling": "기존 Super+방향키 창 배치 끄기",
11
11
  "Disable GNOME Super+arrow tiling, maximize and restore shortcuts. Super+Alt and edge dragging remain available. Turn this option off to restore the original shortcuts.": "GNOME의 Super+방향키 배치·최대화·복원을 끕니다. Super+Alt와 마우스 가장자리 배치는 계속 사용할 수 있습니다. 끄면 원래 단축키를 복원합니다.",
12
12
  "Top-center layout picker": "상단 중앙 배치 선택기",
13
- "While dragging, the picker opens at the top center. Other top edges maximize; left and right edges tile halves.": "드래그할 때 상단 중앙에서만 열립니다. 나머지 상단은 최대화, 좌우 가장자리는 절반 배치입니다.",
13
+ "While dragging, the picker opens near the top center. The very top edge maximizes across the screen; left and right edges tile halves.": "드래그할 때 상단 중앙 부근에서 선택기가 열립니다. 화면 맨 위 가장자리는 중앙을 포함해 최대화, 좌우 가장자리는 절반 배치입니다.",
14
14
  "Choose windows for the remaining space": "남은 공간의 창 선택",
15
15
  "Dragging and spacing": "드래그와 간격",
16
16
  "Match activation width to picker": "선택기 너비에 인식 범위 맞추기",
17
17
  "The top activation area and drag hint follow the picker width on each monitor. Turn off to use a custom width. Default: on.": "상단 인식 범위와 드래그 안내의 너비를 모니터별 선택기 너비에 맞춥니다. 끄면 직접 너비를 정할 수 있습니다. 기본값: 켬",
18
- "A small hint appears while dragging. Move into the top-center area to reveal layouts and shrink the dragged window. Other top edges and side edges tile directly.": "창을 드래그하면 상단에 안내가 살짝 나타납니다. 상단 중앙으로 가져가면 선택기가 펼쳐지고 잡고 있는 창이 작아집니다. 중앙 외 상단과 좌우 가장자리는 바로 배치합니다.",
18
+ "Move into the top-center area to open layouts. The picker stays open at the very top edge; drop in the gap above it to maximize, or move down to choose a layout.": "상단 중앙의 인식 범위에 들어가면 배치 선택기가 열립니다. 화면 맨 위 끝에서도 선택기는 열린 상태를 유지하며, 선택기 위쪽 여백에 놓으면 최대화하고 아래 배치 칸으로 내리면 배치를 고를 수 있습니다.",
19
19
  "Pause near the top center to open layouts. Other top edges and side edges tile directly.": "상단 중앙 영역에 잠시 머물면 선택기가 열립니다. 중앙 외 상단과 좌우 가장자리는 바로 배치합니다.",
20
20
  "Activation area height": "중앙 감지 높이",
21
21
  "Distance from the top of the monitor work area, in logical pixels": "모니터 작업 영역 위쪽에서의 거리 (논리 픽셀)",
@@ -48,7 +48,7 @@
48
48
  "Three columns": "세 칸",
49
49
  "Focus": "집중",
50
50
  "Four quarters": "네 칸",
51
- "Top and bottom": "위아래",
51
+ "Top and bottom": "위아래 분할",
52
52
  "Maximize": "전체",
53
53
  "Left half / left monitor": "왼쪽 절반 / 왼쪽 모니터",
54
54
  "Right half / right monitor": "오른쪽 절반 / 오른쪽 모니터",
@@ -134,6 +134,61 @@
134
134
  "GNOME could not remove Tidy.": "GNOME이 Tidy를 제거하지 못했습니다.",
135
135
  "Quit": "종료",
136
136
  "Tidy supports Linux with GNOME Shell 46–50 and macOS.": "Tidy는 GNOME Shell 46–50 기반 Linux와 macOS를 지원합니다.",
137
- "Tidy · Window tiling for Linux and macOS\n\nUsage: tidy <command>\n tidy [options]\n\nCommands:\n install Install Tidy for the current user\n update Install this package version of Tidy\n uninstall Remove Tidy and restore desktop settings\n prefs Open settings and shortcuts\n status Show installation and runtime status\n doctor Check system requirements\n\nOptions:\n -h, --help Show this help\n -v, --version Show package version\n\nGNOME: log out and back in once. macOS: starts immediately.": "Tidy · Linux와 macOS 창 배치\n\n사용법: tidy <명령>\n tidy [옵션]\n\n명령:\n install 현재 사용자에게 Tidy 설치\n update 현재 npm 패키지 버전으로 Tidy 갱신\n uninstall Tidy 제거 및 데스크톱 설정 복원\n prefs 설정 및 단축키 열기\n status 설치 및 실행 상태 확인\n doctor 시스템 요구 사항 확인\n\n옵션:\n -h, --help 도움말 표시\n -v, --version npm 패키지 버전 표시\n\nGNOME: 한 번 로그아웃하고 다시 로그인하세요. macOS: 바로 실행됩니다."
137
+ "Tidy · Window tiling for Linux and macOS\n\nUsage: tidy <command>\n tidy [options]\n\nCommands:\n install Install Tidy for the current user\n update Install this package version of Tidy\n uninstall Remove Tidy and restore desktop settings\n prefs Open settings and shortcuts\n status Show installation and runtime status\n doctor Check system requirements\n\nOptions:\n -h, --help Show this help\n -v, --version Show package version\n\nGNOME: log out and back in once. macOS: starts immediately.": "Tidy · Linux와 macOS 창 배치\n\n사용법: tidy <명령>\n tidy [옵션]\n\n명령:\n install 현재 사용자에게 Tidy 설치\n update 현재 npm 패키지 버전으로 Tidy 갱신\n uninstall Tidy 제거 및 데스크톱 설정 복원\n prefs 설정 및 단축키 열기\n status 설치 및 실행 상태 확인\n doctor 시스템 요구 사항 확인\n\n옵션:\n -h, --help 도움말 표시\n -v, --version npm 패키지 버전 표시\n\nGNOME: 한 번 로그아웃하고 다시 로그인하세요. macOS: 바로 실행됩니다.",
138
+ "Region {number}": "영역 {number}",
139
+ "Focus on right": "오른쪽 중심",
140
+ "Four columns": "4열",
141
+ "Six regions": "6칸",
142
+ "Eight regions": "8칸",
143
+ "Three rows": "3행",
144
+ "Layout customization": "배치 구성",
145
+ "Optional layout customization": "선택 기능 · 배치 구성",
146
+ "Off by default. The original six layouts, order and size remain unchanged until you enable this feature.": "기본값은 끔입니다. 이 기능을 켜기 전에는 기존 6개 배치와 순서, 크기를 그대로 유지합니다.",
147
+ "Customize picker layouts": "배치선택기 구성 사용자 지정",
148
+ "Number of layouts": "표시할 배치 개수",
149
+ "Show all selected layouts": "선택한 배치 모두 표시",
150
+ "Set a count manually": "개수 직접 지정",
151
+ "Adapt to each monitor": "모니터에 맞춰 자동 조절",
152
+ "Manual layout count": "수동 표시 개수",
153
+ "Changes apply immediately": "변경 사항은 즉시 적용됩니다",
154
+ "Limited counts use the layouts at the top of your list. Automatic counts consider inches, usable resolution and orientation.": "개수가 제한되면 목록 위쪽부터 표시합니다. 자동 모드는 인치수와 작업 영역 해상도·방향을 함께 고려합니다.",
155
+ "Visible layouts": "표시할 배치",
156
+ "Choose layouts and use the arrows to change their order.": "배치를 선택하고 화살표로 표시 순서를 바꾸세요.",
157
+ "Move up": "위로",
158
+ "Move down": "아래로",
159
+ "Edit": "편집",
160
+ "Delete": "삭제",
161
+ "Create a layout on a grid": "격자로 배치 만들기",
162
+ "Create layout": "배치 만들기",
163
+ "Use the original defaults": "기본 배치로 되돌리기",
164
+ "Your custom layouts are kept for later.": "직접 만든 배치는 보관합니다.",
165
+ "Per-monitor settings": "모니터별 설정",
166
+ "Automatic physical size is used when available. You can enter the diagonal in inches or override the count for each monitor.": "감지된 실제 모니터 크기를 사용합니다. 모니터마다 인치수를 직접 입력하거나 표시 개수를 따로 정할 수 있습니다.",
167
+ "Physical size unavailable": "모니터 크기 정보를 확인할 수 없습니다",
168
+ "Use the main setting": "공통 설정 사용",
169
+ "Enter monitor size manually": "모니터 크기 직접 입력",
170
+ "Monitor diagonal (inches)": "모니터 대각선 길이 (인치)",
171
+ "Edit grid layout": "격자 배치 편집",
172
+ "Create grid layout": "격자 배치 만들기",
173
+ "Layout name": "배치 이름",
174
+ "Columns": "열",
175
+ "Rows": "행",
176
+ "Drag across cells to add a rectangular region. Click a region to remove it.": "격자를 드래그해 사각형 영역을 추가하세요. 영역을 클릭하면 삭제합니다.",
177
+ "Undo": "되돌리기",
178
+ "Fill remaining cells": "남은 칸 채우기",
179
+ "Clear grid": "모두 지우기",
180
+ "Save layout": "배치 저장",
181
+ "Use a grid of 1–12 rows and columns with 1–24 regions.": "행과 열은 1~12개, 영역은 1~24개로 설정하세요.",
182
+ "Each region must be a rectangle on the grid.": "각 영역은 격자에 맞춘 사각형이어야 합니다.",
183
+ "Regions must stay inside the grid.": "영역이 격자를 벗어날 수 없습니다.",
184
+ "Regions cannot overlap.": "영역이 겹칠 수 없습니다.",
185
+ "Fill every grid cell before saving.": "모든 격자를 채운 뒤 저장하세요.",
186
+ "A layout can have at most 24 regions.": "배치 하나에 최대 24개 영역을 만들 수 있습니다.",
187
+ "Invalid layout customization settings.": "배치 구성 설정이 올바르지 않습니다.",
188
+ "Give each custom layout a name of 1–60 characters.": "사용자 배치 이름을 1~60자로 입력하세요.",
189
+ "Custom layout identifiers must be unique.": "사용자 배치 식별자가 중복될 수 없습니다.",
190
+ "Choose at least one available layout.": "사용할 배치를 하나 이상 선택하세요.",
191
+ "Too many monitor overrides.": "모니터별 설정 개수가 너무 많습니다.",
192
+ "Invalid monitor layout settings.": "모니터별 배치 설정이 올바르지 않습니다."
138
193
  }
139
194
  }
package/metadata.json CHANGED
@@ -10,6 +10,6 @@
10
10
  "50"
11
11
  ],
12
12
  "settings-schema": "org.gnome.shell.extensions.winubun",
13
- "version": 24,
13
+ "version": 27,
14
14
  "url": "https://github.com/hojin-v/Tidy"
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hnode/tidy",
3
- "version": "0.20.2",
3
+ "version": "0.21.0",
4
4
  "description": "Window tiling for GNOME and macOS with a layout picker, custom shortcuts and multi-monitor support",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,6 +16,7 @@
16
16
  "desktop/package-lock.json",
17
17
  "desktop/native/*.swift",
18
18
  "lib/layouts.js",
19
+ "lib/layoutConfig.js",
19
20
  "lib/i18nCore.js",
20
21
  "lib/translations.json",
21
22
  "metadata.json",
package/scripts/manage.py CHANGED
@@ -270,6 +270,19 @@ def activate():
270
270
  expected = json.loads((DEST / 'metadata.json').read_text())['version']
271
271
  if registered.get('version') != expected:
272
272
  raise RuntimeError(_('New Tidy code is installed. Please log out and log back in to apply it automatically.'))
273
+ # Shell exposes metadata before its asynchronous module import finishes.
274
+ # During that import it uses ERROR with an empty error message. Do not
275
+ # change enabled/disabled settings until loading has actually completed.
276
+ for attempt in range(50):
277
+ state = registered.get('state')
278
+ if state in (1, 2, 6):
279
+ break
280
+ if state in (3, 4, 99) and (state != 3 or registered.get('error')):
281
+ raise RuntimeError(_('Tidy extension error: ') + (registered.get('error') or _('Unknown error')))
282
+ time.sleep(0.2)
283
+ registered = extension_info()
284
+ else:
285
+ raise RuntimeError(_('Extension transition timed out: {uuid}', uuid=UUID))
273
286
  STATE.mkdir(parents=True, exist_ok=True)
274
287
  handover = STATE / 'handover.json'
275
288
  previous = json.loads(handover.read_text()) if handover.exists() else []
@@ -285,8 +298,8 @@ def activate():
285
298
  info = extension_info()
286
299
  if info.get('state') == 1:
287
300
  break
288
- if info.get('state') == 3:
289
- raise RuntimeError(_('Tidy extension error: ') + info.get('error', _('Unknown error')))
301
+ if info.get('state') == 3 and info.get('error'):
302
+ raise RuntimeError(_('Tidy extension error: ') + info['error'])
290
303
  time.sleep(0.1)
291
304
  else:
292
305
  raise RuntimeError(_('Tidy activation failed. Restoring the previous tiling configuration.\n') + json.dumps(info, ensure_ascii=False))