Compare commits
3 Commits
fe4558d628
...
feat/windo
Author | SHA1 | Date | |
---|---|---|---|
|
72b8a3badf | ||
|
185a8e233c | ||
|
84777c4db1 |
36
Makefile
36
Makefile
@@ -1,36 +0,0 @@
|
||||
NAME=aerospike
|
||||
DOMAIN=lucaso.io
|
||||
|
||||
.PHONY: all pack install clean
|
||||
|
||||
all: dist/extension.js
|
||||
|
||||
node_modules: package.json
|
||||
pnpm install
|
||||
|
||||
dist/extension.js : node_modules
|
||||
tsc
|
||||
|
||||
schemas/gschemas.compiled: schemas/org.gnome.shell.extensions.$(NAME).gschema.xml
|
||||
glib-compile-schemas schemas
|
||||
|
||||
$(NAME).zip: dist/extension.js dist/prefs.js schemas/gschemas.compiled
|
||||
@rm -rf dist/*
|
||||
@cp metadata.json dist/
|
||||
@cp stylesheet.css dist/
|
||||
@mkdir dist/schemas
|
||||
@cp schemas/*.compiled dist/schemas/
|
||||
@(cd dist && zip ../$(NAME).zip -9r .)
|
||||
|
||||
pack: $(NAME).zip
|
||||
|
||||
install: $(NAME).zip
|
||||
|
||||
clean:
|
||||
@rm -rf dist node_modules $(NAME).zip
|
||||
|
||||
test:
|
||||
@dbus-run-session -- gnome-shell --nested --wayland
|
||||
|
||||
.PHONY: install-and-test
|
||||
install-and-test: install test
|
917
extension.ts
917
extension.ts
File diff suppressed because it is too large
Load Diff
22
justfile
22
justfile
@@ -1,19 +1,22 @@
|
||||
set dotenv-load
|
||||
NAME:="aerospike"
|
||||
DOMAIN:="lucaso.io"
|
||||
FULL_NAME:=NAME + "@" + DOMAIN
|
||||
|
||||
packages:
|
||||
pnpm install
|
||||
|
||||
build: packages
|
||||
build: packages && build-schemas
|
||||
rm -rf dist/*
|
||||
tsc
|
||||
glib-compile-schemas schemas
|
||||
cp metadata.json dist/
|
||||
cp stylesheet.css dist/
|
||||
mkdir dist/schemas
|
||||
cp schemas/*.compiled dist/schemas/
|
||||
mkdir -p dist/schemas
|
||||
|
||||
build-schemas:
|
||||
glib-compile-schemas schemas
|
||||
cp schemas/org.gnome.shell.extensions.aerospike.gschema.xml dist/schemas/
|
||||
cp schemas/gschemas.compiled dist/schemas/
|
||||
|
||||
build-package: build
|
||||
cd dist && zip ../{{NAME}}.zip -9r .
|
||||
@@ -25,6 +28,15 @@ install: build
|
||||
cp -r dist/* ~/.local/share/gnome-shell/extensions/{{NAME}}@{{DOMAIN}}/
|
||||
|
||||
run:
|
||||
dbus-run-session -- gnome-shell --nested --wayland
|
||||
env MUTTER_DEBUG_DUMMY_MODE_SPECS=1280x720 dbus-run-session -- gnome-shell --nested --wayland
|
||||
|
||||
install-and-run: install run
|
||||
|
||||
#pack: build
|
||||
# gnome-extensions pack dist \
|
||||
# --force \
|
||||
# --out-dir . \
|
||||
# --schema ../schemas/org.gnome.shell.extensions.aerospike.gschema.xml
|
||||
#
|
||||
#install-pack: pack
|
||||
# gnome-extensions install ./{{FULL_NAME}}.shell-extension.zip --force
|
@@ -1,9 +1,11 @@
|
||||
{
|
||||
"name": "aerospike",
|
||||
"description": "Adds pretty rainbow or static borders to the active and inactive windows",
|
||||
"description": "I3 Like Tiling Window Manager for Gnome",
|
||||
"uuid": "aerospike@lucaso.io",
|
||||
"settings-schema": "org.gnome.shell.extensions.aerospike",
|
||||
"shell-version": [
|
||||
"47",
|
||||
"48"
|
||||
]
|
||||
],
|
||||
"gettext-domain": "aerospike@lucaso.io",
|
||||
"url": "https://gitea.chaosdev.gay/lucasoskorep/aerospike@lucaso.io"
|
||||
}
|
||||
|
@@ -16,11 +16,11 @@
|
||||
"homepage": "https://github.com/example/my-extension#readme",
|
||||
"sideEffects": false,
|
||||
"devDependencies": {
|
||||
"@girs/gjs": "^4.0.0-beta.23",
|
||||
"@girs/gnome-shell": "^48.0.1",
|
||||
"eslint": "^9.23.0",
|
||||
"@girs/gjs": "4.0.0-beta.23",
|
||||
"@girs/gnome-shell": "^48.0.2",
|
||||
"eslint": "^9.24.0",
|
||||
"eslint-plugin-jsdoc": "^50.6.9",
|
||||
"typescript": "^5.8.2"
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@girs/mtk-16": "16.0.0-4.0.0-beta.23"
|
||||
|
166
pnpm-lock.yaml
generated
166
pnpm-lock.yaml
generated
@@ -13,20 +13,20 @@ importers:
|
||||
version: 16.0.0-4.0.0-beta.23
|
||||
devDependencies:
|
||||
'@girs/gjs':
|
||||
specifier: ^4.0.0-beta.23
|
||||
specifier: 4.0.0-beta.23
|
||||
version: 4.0.0-beta.23
|
||||
'@girs/gnome-shell':
|
||||
specifier: ^48.0.1
|
||||
version: 48.0.1
|
||||
specifier: ^48.0.2
|
||||
version: 48.0.2
|
||||
eslint:
|
||||
specifier: ^9.23.0
|
||||
version: 9.23.0
|
||||
specifier: ^9.24.0
|
||||
version: 9.24.0
|
||||
eslint-plugin-jsdoc:
|
||||
specifier: ^50.6.9
|
||||
version: 50.6.9(eslint@9.23.0)
|
||||
version: 50.6.9(eslint@9.24.0)
|
||||
typescript:
|
||||
specifier: ^5.8.2
|
||||
version: 5.8.2
|
||||
specifier: ^5.8.3
|
||||
version: 5.8.3
|
||||
|
||||
packages:
|
||||
|
||||
@@ -34,8 +34,8 @@ packages:
|
||||
resolution: {integrity: sha512-xjZTSFgECpb9Ohuk5yMX5RhUEbfeQcuOp8IF60e+wyzWEF0M5xeSgqsfLtvPEX8BIyOX9saZqzuGPmZ8oWc+5Q==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
'@eslint-community/eslint-utils@4.4.1':
|
||||
resolution: {integrity: sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==}
|
||||
'@eslint-community/eslint-utils@4.5.1':
|
||||
resolution: {integrity: sha512-soEIOALTfTK6EjmKMMoLugwaP0rzkad90iIWd1hMO9ARkSAyjfMfkRRhLvD5qH7vvM0Cg72pieUfR6yh6XxC4w==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
|
||||
@@ -44,32 +44,36 @@ packages:
|
||||
resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==}
|
||||
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
|
||||
|
||||
'@eslint/config-array@0.19.2':
|
||||
resolution: {integrity: sha512-GNKqxfHG2ySmJOBSHg7LxeUx4xpuCoFjacmlCoYWEbaPXLwvfIjixRI12xCQZeULksQb23uiA8F40w5TojpV7w==}
|
||||
'@eslint/config-array@0.20.0':
|
||||
resolution: {integrity: sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/config-helpers@0.2.0':
|
||||
resolution: {integrity: sha512-yJLLmLexii32mGrhW29qvU3QBVTu0GUmEf/J4XsBtVhp4JkIUFN/BjWqTF63yRvGApIDpZm5fa97LtYtINmfeQ==}
|
||||
'@eslint/config-helpers@0.2.1':
|
||||
resolution: {integrity: sha512-RI17tsD2frtDu/3dmI7QRrD4bedNKPM08ziRYaC5AhkGrzIAJelm9kJU1TznK+apx6V+cqRz8tfpEeG3oIyjxw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/core@0.12.0':
|
||||
resolution: {integrity: sha512-cmrR6pytBuSMTaBweKoGMwu3EiHiEC+DoyupPmlZ0HxBJBtIxwe+j/E4XPIKNx+Q74c8lXKPwYawBf5glsTkHg==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/core@0.13.0':
|
||||
resolution: {integrity: sha512-yfkgDw1KR66rkT5A8ci4irzDysN7FRpq3ttJolR88OqQikAWqwA8j5VZyas+vjyBNFIJ7MfybJ9plMILI2UrCw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/eslintrc@3.3.1':
|
||||
resolution: {integrity: sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/js@9.23.0':
|
||||
resolution: {integrity: sha512-35MJ8vCPU0ZMxo7zfev2pypqTwWTofFZO6m4KAtdoFhRpLJUpHTZZ+KB3C7Hb1d7bULYwO4lJXGCi5Se+8OMbw==}
|
||||
'@eslint/js@9.24.0':
|
||||
resolution: {integrity: sha512-uIY/y3z0uvOGX8cp1C2fiC4+ZmBhp6yZWkojtHL1YEMnRt1Y63HB9TM17proGEmeG7HeUY+UP36F0aknKYTpYA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/object-schema@2.1.6':
|
||||
resolution: {integrity: sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@eslint/plugin-kit@0.2.7':
|
||||
resolution: {integrity: sha512-JubJ5B2pJ4k4yGxaNLdbjrnk9d/iDz6/q8wOilpIowd6PJPgaxCuHBnBszq7Ce2TyMrywm5r4PnKm6V3iiZF+g==}
|
||||
'@eslint/plugin-kit@0.2.8':
|
||||
resolution: {integrity: sha512-ZAoA40rNMPwSm+AeHpCq8STiNAwzWLJuP8Xv4CHIc9wv/PSuExjMrmjfYNj682vW0OOiZ1HKxzvjQr9XZIisQA==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
'@girs/accountsservice-1.0@1.0.0-4.0.0-beta.23':
|
||||
@@ -129,8 +133,8 @@ packages:
|
||||
'@girs/gmodule-2.0@2.0.0-4.0.0-beta.23':
|
||||
resolution: {integrity: sha512-Dc+Pq1peNlwQ0o/WFsUzT1qt3oqgMLBhzjEfOTGAD0Jw1Ut3QCoBuryVFFNMIruOKnSSBoBnQO7Qelly5aSd2w==}
|
||||
|
||||
'@girs/gnome-shell@48.0.1':
|
||||
resolution: {integrity: sha512-6Oj8cLTD2vwfiNAI7AexLEW/UpZswbiw9Kdg4scf0Te3DpK/YD2M+KKYFyxXafQUlfNg/HEHlRpeo+0f4OWjnQ==}
|
||||
'@girs/gnome-shell@48.0.2':
|
||||
resolution: {integrity: sha512-hrlnTCc6y9O7GTn7M7YAufKdmIF8Et7ZFTRRUVXyv3hBHAor0bUFDrHdmVD+D7KdMHCJrtaLW6EtUCRQyovU2A==}
|
||||
|
||||
'@girs/gnomebg-4.0@4.0.0-4.0.0-beta.23':
|
||||
resolution: {integrity: sha512-mXipjnVd+lUSMhUeugo49TXo32ihlKiN2ggpGDLIcD6ZfGe644DSgxoHFeYkn44HmNW39DvSqF9AcSvLP0cZJA==}
|
||||
@@ -218,12 +222,12 @@ packages:
|
||||
resolution: {integrity: sha512-xeO57FpIu4p1Ri3Jq/EXq4ClRm86dVF2z/+kvFnyqVYRavTZmaFaUBbWCOuuTh0o/g7DSsk6kc2vrS4Vl5oPOQ==}
|
||||
engines: {node: '>=18.18'}
|
||||
|
||||
'@pkgr/core@0.1.1':
|
||||
resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==}
|
||||
'@pkgr/core@0.1.2':
|
||||
resolution: {integrity: sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ==}
|
||||
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
||||
|
||||
'@types/estree@1.0.6':
|
||||
resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==}
|
||||
'@types/estree@1.0.7':
|
||||
resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==}
|
||||
|
||||
'@types/json-schema@7.0.15':
|
||||
resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}
|
||||
@@ -233,8 +237,8 @@ packages:
|
||||
peerDependencies:
|
||||
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
|
||||
acorn@8.14.0:
|
||||
resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==}
|
||||
acorn@8.14.1:
|
||||
resolution: {integrity: sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
@@ -284,8 +288,8 @@ packages:
|
||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
debug@4.3.7:
|
||||
resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==}
|
||||
debug@4.4.0:
|
||||
resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
|
||||
engines: {node: '>=6.0'}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
@@ -296,8 +300,8 @@ packages:
|
||||
deep-is@0.1.4:
|
||||
resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==}
|
||||
|
||||
es-module-lexer@1.5.4:
|
||||
resolution: {integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==}
|
||||
es-module-lexer@1.6.0:
|
||||
resolution: {integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==}
|
||||
|
||||
escape-string-regexp@4.0.0:
|
||||
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
|
||||
@@ -321,8 +325,8 @@ packages:
|
||||
resolution: {integrity: sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
|
||||
eslint@9.23.0:
|
||||
resolution: {integrity: sha512-jV7AbNoFPAY1EkFYpLq5bslU9NLNO8xnEeQXwErNibVryjk67wHVmddTBilc5srIttJDBrB0eMHKZBFbSIABCw==}
|
||||
eslint@9.24.0:
|
||||
resolution: {integrity: sha512-eh/jxIEJyZrvbWRe4XuVclLPDYSYYYgLy5zXGGxD6j8zjSAxFEzI2fL/8xNq6O2yKqVt+eF2YhV+hxjV6UKXwQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
@@ -372,8 +376,8 @@ packages:
|
||||
resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
flatted@3.3.1:
|
||||
resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==}
|
||||
flatted@3.3.3:
|
||||
resolution: {integrity: sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==}
|
||||
|
||||
glob-parent@6.0.2:
|
||||
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
|
||||
@@ -490,8 +494,8 @@ packages:
|
||||
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
semver@7.6.3:
|
||||
resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==}
|
||||
semver@7.7.1:
|
||||
resolution: {integrity: sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
|
||||
@@ -512,8 +516,8 @@ packages:
|
||||
spdx-expression-parse@4.0.0:
|
||||
resolution: {integrity: sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==}
|
||||
|
||||
spdx-license-ids@3.0.20:
|
||||
resolution: {integrity: sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==}
|
||||
spdx-license-ids@3.0.21:
|
||||
resolution: {integrity: sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==}
|
||||
|
||||
strip-json-comments@3.1.1:
|
||||
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
|
||||
@@ -534,8 +538,8 @@ packages:
|
||||
resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
typescript@5.8.2:
|
||||
resolution: {integrity: sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==}
|
||||
typescript@5.8.3:
|
||||
resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==}
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
@@ -563,31 +567,35 @@ snapshots:
|
||||
esquery: 1.6.0
|
||||
jsdoc-type-pratt-parser: 4.1.0
|
||||
|
||||
'@eslint-community/eslint-utils@4.4.1(eslint@9.23.0)':
|
||||
'@eslint-community/eslint-utils@4.5.1(eslint@9.24.0)':
|
||||
dependencies:
|
||||
eslint: 9.23.0
|
||||
eslint: 9.24.0
|
||||
eslint-visitor-keys: 3.4.3
|
||||
|
||||
'@eslint-community/regexpp@4.12.1': {}
|
||||
|
||||
'@eslint/config-array@0.19.2':
|
||||
'@eslint/config-array@0.20.0':
|
||||
dependencies:
|
||||
'@eslint/object-schema': 2.1.6
|
||||
debug: 4.3.7
|
||||
debug: 4.4.0
|
||||
minimatch: 3.1.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@eslint/config-helpers@0.2.0': {}
|
||||
'@eslint/config-helpers@0.2.1': {}
|
||||
|
||||
'@eslint/core@0.12.0':
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.15
|
||||
|
||||
'@eslint/core@0.13.0':
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.15
|
||||
|
||||
'@eslint/eslintrc@3.3.1':
|
||||
dependencies:
|
||||
ajv: 6.12.6
|
||||
debug: 4.3.7
|
||||
debug: 4.4.0
|
||||
espree: 10.3.0
|
||||
globals: 14.0.0
|
||||
ignore: 5.3.2
|
||||
@@ -598,13 +606,13 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
'@eslint/js@9.23.0': {}
|
||||
'@eslint/js@9.24.0': {}
|
||||
|
||||
'@eslint/object-schema@2.1.6': {}
|
||||
|
||||
'@eslint/plugin-kit@0.2.7':
|
||||
'@eslint/plugin-kit@0.2.8':
|
||||
dependencies:
|
||||
'@eslint/core': 0.12.0
|
||||
'@eslint/core': 0.13.0
|
||||
levn: 0.4.1
|
||||
|
||||
'@girs/accountsservice-1.0@1.0.0-4.0.0-beta.23':
|
||||
@@ -767,7 +775,7 @@ snapshots:
|
||||
'@girs/glib-2.0': 2.84.0-4.0.0-beta.23
|
||||
'@girs/gobject-2.0': 2.84.0-4.0.0-beta.23
|
||||
|
||||
'@girs/gnome-shell@48.0.1':
|
||||
'@girs/gnome-shell@48.0.2':
|
||||
dependencies:
|
||||
'@girs/accountsservice-1.0': 1.0.0-4.0.0-beta.23
|
||||
'@girs/adw-1': 1.8.0-4.0.0-beta.23
|
||||
@@ -1065,17 +1073,17 @@ snapshots:
|
||||
|
||||
'@humanwhocodes/retry@0.4.2': {}
|
||||
|
||||
'@pkgr/core@0.1.1': {}
|
||||
'@pkgr/core@0.1.2': {}
|
||||
|
||||
'@types/estree@1.0.6': {}
|
||||
'@types/estree@1.0.7': {}
|
||||
|
||||
'@types/json-schema@7.0.15': {}
|
||||
|
||||
acorn-jsx@5.3.2(acorn@8.14.0):
|
||||
acorn-jsx@5.3.2(acorn@8.14.1):
|
||||
dependencies:
|
||||
acorn: 8.14.0
|
||||
acorn: 8.14.1
|
||||
|
||||
acorn@8.14.0: {}
|
||||
acorn@8.14.1: {}
|
||||
|
||||
ajv@6.12.6:
|
||||
dependencies:
|
||||
@@ -1122,28 +1130,28 @@ snapshots:
|
||||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
debug@4.3.7:
|
||||
debug@4.4.0:
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
|
||||
deep-is@0.1.4: {}
|
||||
|
||||
es-module-lexer@1.5.4: {}
|
||||
es-module-lexer@1.6.0: {}
|
||||
|
||||
escape-string-regexp@4.0.0: {}
|
||||
|
||||
eslint-plugin-jsdoc@50.6.9(eslint@9.23.0):
|
||||
eslint-plugin-jsdoc@50.6.9(eslint@9.24.0):
|
||||
dependencies:
|
||||
'@es-joy/jsdoccomment': 0.49.0
|
||||
are-docs-informative: 0.0.2
|
||||
comment-parser: 1.4.1
|
||||
debug: 4.3.7
|
||||
debug: 4.4.0
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint: 9.23.0
|
||||
eslint: 9.24.0
|
||||
espree: 10.3.0
|
||||
esquery: 1.6.0
|
||||
parse-imports: 2.2.1
|
||||
semver: 7.6.3
|
||||
semver: 7.7.1
|
||||
spdx-expression-parse: 4.0.0
|
||||
synckit: 0.9.2
|
||||
transitivePeerDependencies:
|
||||
@@ -1158,25 +1166,25 @@ snapshots:
|
||||
|
||||
eslint-visitor-keys@4.2.0: {}
|
||||
|
||||
eslint@9.23.0:
|
||||
eslint@9.24.0:
|
||||
dependencies:
|
||||
'@eslint-community/eslint-utils': 4.4.1(eslint@9.23.0)
|
||||
'@eslint-community/eslint-utils': 4.5.1(eslint@9.24.0)
|
||||
'@eslint-community/regexpp': 4.12.1
|
||||
'@eslint/config-array': 0.19.2
|
||||
'@eslint/config-helpers': 0.2.0
|
||||
'@eslint/config-array': 0.20.0
|
||||
'@eslint/config-helpers': 0.2.1
|
||||
'@eslint/core': 0.12.0
|
||||
'@eslint/eslintrc': 3.3.1
|
||||
'@eslint/js': 9.23.0
|
||||
'@eslint/plugin-kit': 0.2.7
|
||||
'@eslint/js': 9.24.0
|
||||
'@eslint/plugin-kit': 0.2.8
|
||||
'@humanfs/node': 0.16.6
|
||||
'@humanwhocodes/module-importer': 1.0.1
|
||||
'@humanwhocodes/retry': 0.4.2
|
||||
'@types/estree': 1.0.6
|
||||
'@types/estree': 1.0.7
|
||||
'@types/json-schema': 7.0.15
|
||||
ajv: 6.12.6
|
||||
chalk: 4.1.2
|
||||
cross-spawn: 7.0.6
|
||||
debug: 4.3.7
|
||||
debug: 4.4.0
|
||||
escape-string-regexp: 4.0.0
|
||||
eslint-scope: 8.3.0
|
||||
eslint-visitor-keys: 4.2.0
|
||||
@@ -1200,8 +1208,8 @@ snapshots:
|
||||
|
||||
espree@10.3.0:
|
||||
dependencies:
|
||||
acorn: 8.14.0
|
||||
acorn-jsx: 5.3.2(acorn@8.14.0)
|
||||
acorn: 8.14.1
|
||||
acorn-jsx: 5.3.2(acorn@8.14.1)
|
||||
eslint-visitor-keys: 4.2.0
|
||||
|
||||
esquery@1.6.0:
|
||||
@@ -1233,10 +1241,10 @@ snapshots:
|
||||
|
||||
flat-cache@4.0.1:
|
||||
dependencies:
|
||||
flatted: 3.3.1
|
||||
flatted: 3.3.3
|
||||
keyv: 4.5.4
|
||||
|
||||
flatted@3.3.1: {}
|
||||
flatted@3.3.3: {}
|
||||
|
||||
glob-parent@6.0.2:
|
||||
dependencies:
|
||||
@@ -1321,7 +1329,7 @@ snapshots:
|
||||
|
||||
parse-imports@2.2.1:
|
||||
dependencies:
|
||||
es-module-lexer: 1.5.4
|
||||
es-module-lexer: 1.6.0
|
||||
slashes: 3.0.12
|
||||
|
||||
path-exists@4.0.0: {}
|
||||
@@ -1334,7 +1342,7 @@ snapshots:
|
||||
|
||||
resolve-from@4.0.0: {}
|
||||
|
||||
semver@7.6.3: {}
|
||||
semver@7.7.1: {}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
dependencies:
|
||||
@@ -1349,9 +1357,9 @@ snapshots:
|
||||
spdx-expression-parse@4.0.0:
|
||||
dependencies:
|
||||
spdx-exceptions: 2.5.0
|
||||
spdx-license-ids: 3.0.20
|
||||
spdx-license-ids: 3.0.21
|
||||
|
||||
spdx-license-ids@3.0.20: {}
|
||||
spdx-license-ids@3.0.21: {}
|
||||
|
||||
strip-json-comments@3.1.1: {}
|
||||
|
||||
@@ -1361,7 +1369,7 @@ snapshots:
|
||||
|
||||
synckit@0.9.2:
|
||||
dependencies:
|
||||
'@pkgr/core': 0.1.1
|
||||
'@pkgr/core': 0.1.2
|
||||
tslib: 2.8.1
|
||||
|
||||
tslib@2.8.1: {}
|
||||
@@ -1370,7 +1378,7 @@ snapshots:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
|
||||
typescript@5.8.2: {}
|
||||
typescript@5.8.3: {}
|
||||
|
||||
uri-js@4.4.1:
|
||||
dependencies:
|
||||
|
54
prefs.ts
54
prefs.ts
@@ -1,52 +1,4 @@
|
||||
import Gtk from 'gi://Gtk';
|
||||
import Adw from 'gi://Adw';
|
||||
import Gio from 'gi://Gio';
|
||||
import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
// This file is just a wrapper around the compiled TypeScript code
|
||||
import MyExtensionPreferences from './src/prefs.js';
|
||||
|
||||
export default class GnomeRectanglePreferences extends ExtensionPreferences {
|
||||
_settings?: Gio.Settings
|
||||
|
||||
fillPreferencesWindow(window: Adw.PreferencesWindow): Promise<void> {
|
||||
this._settings = this.getSettings();
|
||||
|
||||
const page = new Adw.PreferencesPage({
|
||||
title: _('General'),
|
||||
iconName: 'dialog-information-symbolic',
|
||||
});
|
||||
|
||||
const animationGroup = new Adw.PreferencesGroup({
|
||||
title: _('Animation'),
|
||||
description: _('Configure move/resize animation'),
|
||||
});
|
||||
page.add(animationGroup);
|
||||
|
||||
const animationEnabled = new Adw.SwitchRow({
|
||||
title: _('Enabled'),
|
||||
subtitle: _('Wether to animate windows'),
|
||||
});
|
||||
animationGroup.add(animationEnabled);
|
||||
|
||||
const paddingGroup = new Adw.PreferencesGroup({
|
||||
title: _('Paddings'),
|
||||
description: _('Configure the padding between windows'),
|
||||
});
|
||||
page.add(paddingGroup);
|
||||
|
||||
const paddingInner = new Adw.SpinRow({
|
||||
title: _('Inner'),
|
||||
subtitle: _('Padding between windows'),
|
||||
adjustment: new Gtk.Adjustment({
|
||||
lower: 0,
|
||||
upper: 1000,
|
||||
stepIncrement: 1
|
||||
})
|
||||
});
|
||||
paddingGroup.add(paddingInner);
|
||||
|
||||
window.add(page)
|
||||
|
||||
this._settings!.bind('animate', animationEnabled, 'active', Gio.SettingsBindFlags.DEFAULT);
|
||||
this._settings!.bind('padding-inner', paddingInner, 'value', Gio.SettingsBindFlags.DEFAULT);
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
export default MyExtensionPreferences;
|
@@ -1,10 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist>
|
||||
<schema id="org.gnome.shell.extensions.aerospike" path="/org/gnome/shell/extensions/aerospike/">
|
||||
<key name="tiling-type" type="s">
|
||||
<default>"Horizontal"</default>
|
||||
<summary>Type of tiling</summary>
|
||||
<description>The type of tiling provided by aerospace</description>
|
||||
<key name="keybinding-1" type="as">
|
||||
<default><![CDATA[['<Super>1']]]></default>
|
||||
<summary>Keybinding for action 1</summary>
|
||||
<description>Keyboard shortcut for triggering action 1</description>
|
||||
</key>
|
||||
|
||||
<key name="keybinding-2" type="as">
|
||||
<default><![CDATA[['<Super>2']]]></default>
|
||||
<summary>Keybinding for action 2</summary>
|
||||
<description>Keyboard shortcut for triggering action 2</description>
|
||||
</key>
|
||||
|
||||
<key name="keybinding-3" type="as">
|
||||
<default><![CDATA[['<Super>3']]]></default>
|
||||
<summary>Keybinding for action 3</summary>
|
||||
<description>Keyboard shortcut for triggering action 3</description>
|
||||
</key>
|
||||
|
||||
<key name="keybinding-4" type="as">
|
||||
<default><![CDATA[['<Super>4']]]></default>
|
||||
<summary>Keybinding for action 4</summary>
|
||||
<description>Keyboard shortcut for triggering action 4</description>
|
||||
</key>
|
||||
|
||||
<key name="dropdown-option" type="s">
|
||||
<default>'option1'</default>
|
||||
<summary>Dropdown selection</summary>
|
||||
<description>Option selected from the dropdown menu</description>
|
||||
</key>
|
||||
|
||||
<key name="color-selection" type="s">
|
||||
<default>'rgb(255,0,0)'</default>
|
||||
<summary>Selected color</summary>
|
||||
<description>Color chosen from the color picker</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
192
src/prefs.ts
Normal file
192
src/prefs.ts
Normal file
@@ -0,0 +1,192 @@
|
||||
import Adw from 'gi://Adw';
|
||||
import Gio from 'gi://Gio';
|
||||
import Gtk from 'gi://Gtk';
|
||||
import Gdk from 'gi://Gdk';
|
||||
import { ExtensionPreferences, gettext as _ } from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
|
||||
|
||||
export default class MyExtensionPreferences extends ExtensionPreferences {
|
||||
async fillPreferencesWindow(window: Adw.PreferencesWindow) {
|
||||
// Create settings object
|
||||
const settings = this.getSettings('org.gnome.shell.extensions.aerospike');
|
||||
|
||||
// Create a preferences page
|
||||
const page = new Adw.PreferencesPage({
|
||||
title: _('Settings'),
|
||||
icon_name: 'preferences-system-symbolic',
|
||||
});
|
||||
window.add(page);
|
||||
|
||||
// Create keybindings group
|
||||
const keybindingsGroup = new Adw.PreferencesGroup({
|
||||
title: _('Keyboard Shortcuts'),
|
||||
});
|
||||
page.add(keybindingsGroup);
|
||||
|
||||
// Add keybinding rows
|
||||
this.addKeybindingRow(keybindingsGroup, settings, 'keybinding-1', _('Action 1'));
|
||||
this.addKeybindingRow(keybindingsGroup, settings, 'keybinding-2', _('Action 2'));
|
||||
this.addKeybindingRow(keybindingsGroup, settings, 'keybinding-3', _('Action 3'));
|
||||
this.addKeybindingRow(keybindingsGroup, settings, 'keybinding-4', _('Action 4'));
|
||||
|
||||
// Create options group
|
||||
const optionsGroup = new Adw.PreferencesGroup({
|
||||
title: _('Options'),
|
||||
});
|
||||
page.add(optionsGroup);
|
||||
|
||||
// Add dropdown
|
||||
const dropdownRow = new Adw.ComboRow({
|
||||
title: _('Select an option'),
|
||||
});
|
||||
optionsGroup.add(dropdownRow);
|
||||
|
||||
// Create dropdown model
|
||||
const dropdownModel = new Gtk.StringList();
|
||||
dropdownModel.append(_('Option 1'));
|
||||
dropdownModel.append(_('Option 2'));
|
||||
dropdownModel.append(_('Option 3'));
|
||||
dropdownModel.append(_('Option 4'));
|
||||
|
||||
dropdownRow.set_model(dropdownModel);
|
||||
|
||||
// Set the active option based on settings
|
||||
const currentOption = settings.get_string('dropdown-option');
|
||||
switch (currentOption) {
|
||||
case 'option1':
|
||||
dropdownRow.set_selected(0);
|
||||
break;
|
||||
case 'option2':
|
||||
dropdownRow.set_selected(1);
|
||||
break;
|
||||
case 'option3':
|
||||
dropdownRow.set_selected(2);
|
||||
break;
|
||||
case 'option4':
|
||||
dropdownRow.set_selected(3);
|
||||
break;
|
||||
default:
|
||||
dropdownRow.set_selected(0);
|
||||
}
|
||||
|
||||
// Connect dropdown change signal
|
||||
dropdownRow.connect('notify::selected', () => {
|
||||
const selected = dropdownRow.get_selected();
|
||||
let optionValue: string;
|
||||
|
||||
switch (selected) {
|
||||
case 0:
|
||||
optionValue = 'option1';
|
||||
break;
|
||||
case 1:
|
||||
optionValue = 'option2';
|
||||
break;
|
||||
case 2:
|
||||
optionValue = 'option3';
|
||||
break;
|
||||
case 3:
|
||||
optionValue = 'option4';
|
||||
break;
|
||||
default:
|
||||
optionValue = 'option1';
|
||||
}
|
||||
|
||||
settings.set_string('dropdown-option', optionValue);
|
||||
});
|
||||
|
||||
// Add color button
|
||||
const colorRow = new Adw.ActionRow({
|
||||
title: _('Choose a color'),
|
||||
});
|
||||
optionsGroup.add(colorRow);
|
||||
|
||||
const colorButton = new Gtk.ColorButton();
|
||||
colorRow.add_suffix(colorButton);
|
||||
colorRow.set_activatable_widget(colorButton);
|
||||
|
||||
// Set current color from settings
|
||||
const colorStr = settings.get_string('color-selection');
|
||||
const rgba = new Gdk.RGBA();
|
||||
rgba.parse(colorStr);
|
||||
colorButton.set_rgba(rgba);
|
||||
|
||||
// Connect color button signal
|
||||
colorButton.connect('color-set', () => {
|
||||
const color = colorButton.get_rgba().to_string();
|
||||
settings.set_string('color-selection', color);
|
||||
});
|
||||
}
|
||||
|
||||
private addKeybindingRow(
|
||||
group: Adw.PreferencesGroup,
|
||||
settings: Gio.Settings,
|
||||
key: string,
|
||||
title: string
|
||||
) {
|
||||
const shortcutsRow = new Adw.ActionRow({
|
||||
title: title,
|
||||
});
|
||||
|
||||
group.add(shortcutsRow);
|
||||
|
||||
// Create a button for setting shortcuts
|
||||
const shortcutButton = new Gtk.Button({
|
||||
valign: Gtk.Align.CENTER,
|
||||
label: settings.get_strv(key)[0] || _("Disabled")
|
||||
});
|
||||
|
||||
shortcutsRow.add_suffix(shortcutButton);
|
||||
shortcutsRow.set_activatable_widget(shortcutButton);
|
||||
|
||||
// When clicking the button, show a dialog or start listening for keystroke
|
||||
shortcutButton.connect('clicked', () => {
|
||||
// Show a simple popup stating that the shortcut is being recorded
|
||||
const dialog = new Gtk.MessageDialog({
|
||||
modal: true,
|
||||
text: _("Press a key combination to set as shortcut"),
|
||||
secondary_text: _("Press Esc to cancel or Backspace to disable"),
|
||||
buttons: Gtk.ButtonsType.CANCEL,
|
||||
transient_for: group.get_root() as Gtk.Window
|
||||
});
|
||||
|
||||
// Create a keypress event controller
|
||||
const controller = new Gtk.EventControllerKey();
|
||||
dialog.add_controller(controller);
|
||||
|
||||
controller.connect('key-pressed', (_controller, keyval, keycode, state) => {
|
||||
// Get the key name
|
||||
let keyName = Gdk.keyval_name(keyval);
|
||||
|
||||
// Handle special cases
|
||||
if (keyName === 'Escape') {
|
||||
dialog.response(Gtk.ResponseType.CANCEL);
|
||||
return Gdk.EVENT_STOP;
|
||||
} else if (keyName === 'BackSpace') {
|
||||
// Clear the shortcut
|
||||
settings.set_strv(key, []);
|
||||
shortcutButton.set_label(_("Disabled"));
|
||||
dialog.response(Gtk.ResponseType.OK);
|
||||
return Gdk.EVENT_STOP;
|
||||
}
|
||||
|
||||
// Convert modifier state to keybinding modifiers
|
||||
let modifiers = state & Gtk.accelerator_get_default_mod_mask();
|
||||
|
||||
// Ignore standalone modifier keys
|
||||
if (Gdk.ModifierType.SHIFT_MASK <= keyval && keyval <= Gdk.ModifierType.META_MASK)
|
||||
return Gdk.EVENT_STOP;
|
||||
|
||||
// Create accelerator string
|
||||
let accelerator = Gtk.accelerator_name(keyval, modifiers);
|
||||
if (accelerator) {
|
||||
settings.set_strv(key, [accelerator]);
|
||||
shortcutButton.set_label(accelerator);
|
||||
dialog.response(Gtk.ResponseType.OK);
|
||||
}
|
||||
|
||||
return Gdk.EVENT_STOP;
|
||||
});
|
||||
|
||||
dialog.present();
|
||||
});
|
||||
}
|
||||
}
|
20
src/utils.ts
Normal file
20
src/utils.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// Utility functions and type definitions
|
||||
|
||||
/**
|
||||
* Interface for the extension settings
|
||||
*/
|
||||
export interface ExtensionSettings {
|
||||
keybinding1: string[];
|
||||
keybinding2: string[];
|
||||
keybinding3: string[];
|
||||
keybinding4: string[];
|
||||
dropdownOption: string;
|
||||
colorSelection: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a message with the extension name prefix
|
||||
*/
|
||||
export function log(message: string): void {
|
||||
console.log(`[MyExtension] ${message}`);
|
||||
}
|
164
src/winGroup.ts
Normal file
164
src/winGroup.ts
Normal file
@@ -0,0 +1,164 @@
|
||||
import Meta from 'gi://Meta';
|
||||
import Mtk from '@girs/mtk-16';
|
||||
|
||||
export interface WindowTree {
|
||||
root: WindowNode | null;
|
||||
monitor: number;
|
||||
workspace: number;
|
||||
}
|
||||
|
||||
export interface WindowNode {
|
||||
window: Meta.Window | null;
|
||||
windowId: number | null;
|
||||
children: WindowNode[];
|
||||
parent: WindowNode | null;
|
||||
splitRatio: number;
|
||||
splitDirection: 'horizontal' | 'vertical';
|
||||
rect: {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
}
|
||||
|
||||
export function createWindowNode(window: Meta.Window | null = null): WindowNode {
|
||||
return {
|
||||
window: window,
|
||||
windowId: window ? window.get_id() : null,
|
||||
children: [],
|
||||
parent: null,
|
||||
splitRatio: 1.0,
|
||||
splitDirection: 'horizontal',
|
||||
rect: { x: 0, y: 0, width: 0, height: 0 }
|
||||
};
|
||||
}
|
||||
|
||||
export function addNodeChild(parent: WindowNode, child: WindowNode): void {
|
||||
child.parent = parent;
|
||||
parent.children.push(child);
|
||||
|
||||
// Update split ratios to be equal
|
||||
const childCount = parent.children.length;
|
||||
parent.children.forEach(node => {
|
||||
node.splitRatio = 1.0 / childCount;
|
||||
});
|
||||
}
|
||||
|
||||
export function removeNode(node: WindowNode, tree: WindowTree): WindowNode | null {
|
||||
if (!node.parent) {
|
||||
// This is the root node
|
||||
if (node.children.length > 0) {
|
||||
// Promote first child to root
|
||||
const newRoot = node.children[0];
|
||||
newRoot.parent = null;
|
||||
|
||||
// Transfer any other children to the new root
|
||||
for (let i = 1; i < node.children.length; i++) {
|
||||
addNodeChild(newRoot, node.children[i]);
|
||||
}
|
||||
|
||||
tree.root = newRoot;
|
||||
return newRoot;
|
||||
} else {
|
||||
// No children, tree is now empty
|
||||
tree.root = null;
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
// Remove from parent's children
|
||||
const parent = node.parent;
|
||||
const index = parent.children.indexOf(node);
|
||||
if (index !== -1) {
|
||||
parent.children.splice(index, 1);
|
||||
}
|
||||
|
||||
// Update split ratios of remaining siblings
|
||||
if (parent.children.length > 0) {
|
||||
const ratio = 1.0 / parent.children.length;
|
||||
parent.children.forEach(child => {
|
||||
child.splitRatio = ratio;
|
||||
});
|
||||
}
|
||||
|
||||
// Transfer any children to the parent
|
||||
node.children.forEach(child => {
|
||||
addNodeChild(parent, child);
|
||||
});
|
||||
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
||||
export function findNodeByWindowId(tree: WindowTree, windowId: number): WindowNode | null {
|
||||
if (!tree.root) return null;
|
||||
|
||||
function search(node: WindowNode): WindowNode | null {
|
||||
if (node.windowId === windowId) return node;
|
||||
|
||||
for (const child of node.children) {
|
||||
const result = search(child);
|
||||
if (result) return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return search(tree.root);
|
||||
}
|
||||
|
||||
export function calculateLayout(node: WindowNode, rect: {x: number, y: number, width: number, height: number}): void {
|
||||
// Update node's rect
|
||||
node.rect = {...rect};
|
||||
|
||||
// Process children recursively
|
||||
if (node.children.length > 0) {
|
||||
if (node.splitDirection === 'horizontal') {
|
||||
// Divide width with remainder handling
|
||||
let currentX = rect.x;
|
||||
let remainingWidth = rect.width;
|
||||
const lastChildIndex = node.children.length - 1;
|
||||
|
||||
node.children.forEach((child, index) => {
|
||||
const isLastChild = index === lastChildIndex;
|
||||
// Last child gets remainder to avoid gaps
|
||||
const childWidth = isLastChild ?
|
||||
remainingWidth :
|
||||
Math.floor(rect.width * child.splitRatio);
|
||||
|
||||
calculateLayout(child, {
|
||||
x: currentX,
|
||||
y: rect.y,
|
||||
width: childWidth,
|
||||
height: rect.height
|
||||
});
|
||||
|
||||
currentX += childWidth;
|
||||
remainingWidth -= childWidth;
|
||||
});
|
||||
} else {
|
||||
// Divide height with remainder handling
|
||||
let currentY = rect.y;
|
||||
let remainingHeight = rect.height;
|
||||
const lastChildIndex = node.children.length - 1;
|
||||
|
||||
node.children.forEach((child, index) => {
|
||||
const isLastChild = index === lastChildIndex;
|
||||
// Last child gets remainder to avoid gaps
|
||||
const childHeight = isLastChild ?
|
||||
remainingHeight :
|
||||
Math.floor(rect.height * child.splitRatio);
|
||||
|
||||
calculateLayout(child, {
|
||||
x: rect.x,
|
||||
y: currentY,
|
||||
width: rect.width,
|
||||
height: childHeight
|
||||
});
|
||||
|
||||
currentY += childHeight;
|
||||
remainingHeight -= childHeight;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -12,10 +12,11 @@
|
||||
},
|
||||
"include": [
|
||||
"ambient.d.ts",
|
||||
"prefs.ts",
|
||||
"src/**/*"
|
||||
],
|
||||
"files": [
|
||||
"extension.ts",
|
||||
"winGroup.ts",
|
||||
"prefs.ts"
|
||||
"src/winGroup.ts"
|
||||
],
|
||||
}
|
||||
|
Reference in New Issue
Block a user