From 502b35e3789f3d5adc1ab29f2f6245508e3bf700 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Thu, 10 Sep 2026 22:41:58 -0400 Subject: [PATCH] init --- .envrc | 1 + .flox/.gitattributes | 1 + .flox/.gitignore | 5 + .flox/env.json | 4 + .flox/env/manifest.lock | 252 +++++++++++++++++++++++++++++ .flox/env/manifest.toml | 98 +++++++++++ .flox/telemetry_id | 1 + .qmllint.ini | 3 + .qmlls.ini | 3 + .zed/settings.json | 38 +++++ example.json | 21 +++ qs-app-carousel/.qmlls.ini | 3 + qs-app-carousel/App.qml | 9 ++ qs-app-carousel/AppButton.qml | 49 ++++++ qs-app-carousel/Config.qml | 7 + qs-app-carousel/LauncherWindow.qml | 163 +++++++++++++++++++ qs-app-carousel/Theme.qml | 29 ++++ qs-app-carousel/qmldir | 5 + qs-app-carousel/shell.qml | 47 ++++++ 19 files changed, 739 insertions(+) create mode 100644 .envrc create mode 100644 .flox/.gitattributes create mode 100644 .flox/.gitignore create mode 100644 .flox/env.json create mode 100644 .flox/env/manifest.lock create mode 100644 .flox/env/manifest.toml create mode 100644 .flox/telemetry_id create mode 100644 .qmllint.ini create mode 100644 .qmlls.ini create mode 100644 .zed/settings.json create mode 100644 example.json create mode 100644 qs-app-carousel/.qmlls.ini create mode 100644 qs-app-carousel/App.qml create mode 100644 qs-app-carousel/AppButton.qml create mode 100644 qs-app-carousel/Config.qml create mode 100644 qs-app-carousel/LauncherWindow.qml create mode 100644 qs-app-carousel/Theme.qml create mode 100644 qs-app-carousel/qmldir create mode 100644 qs-app-carousel/shell.qml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1b9d177 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +eval "$(flox activate)" diff --git a/.flox/.gitattributes b/.flox/.gitattributes new file mode 100644 index 0000000..bb5491e --- /dev/null +++ b/.flox/.gitattributes @@ -0,0 +1 @@ +env/manifest.lock linguist-generated=true linguist-language=JSON diff --git a/.flox/.gitignore b/.flox/.gitignore new file mode 100644 index 0000000..8d21186 --- /dev/null +++ b/.flox/.gitignore @@ -0,0 +1,5 @@ +run/ +cache/ +lib/ +log/ +!env/ diff --git a/.flox/env.json b/.flox/env.json new file mode 100644 index 0000000..16df2ad --- /dev/null +++ b/.flox/env.json @@ -0,0 +1,4 @@ +{ + "name": "skygqts", + "version": 1 +} diff --git a/.flox/env/manifest.lock b/.flox/env/manifest.lock new file mode 100644 index 0000000..ce1b70b --- /dev/null +++ b/.flox/env/manifest.lock @@ -0,0 +1,252 @@ +{ + "lockfile-version": 1, + "manifest": { + "schema-version": "1.14.0", + "install": { + "qtdeclarative": { + "pkg-path": "qt6.qtdeclarative" + }, + "qtdoc": { + "pkg-path": "qt6.qtdoc" + }, + "quickshell": { + "pkg-path": "quickshell", + "systems": [ + "aarch64-linux", + "x86_64-linux" + ] + } + }, + "hook": {}, + "profile": {}, + "options": {} + }, + "packages": [ + { + "attr_path": "qt6.qtdeclarative", + "broken": false, + "derivation": "/nix/store/6vf4wd2dglyvack38rz8wyi1ip3i8n9n-qtdeclarative-6.11.2.drv", + "description": "Cross-platform application framework for C++", + "install_id": "qtdeclarative", + "license": "[ GFDL-1.3-or-later, GPL-2.0-or-later, LGPL-2.1-or-later, LGPL-3.0-or-later ]", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "qtdeclarative-6.11.2", + "pname": "qtdeclarative", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T04:59:37.007322Z", + "stabilities": [ + "unstable" + ], + "version": "6.11.2", + "outputs_to_install": [], + "outputs": { + "dev": "/nix/store/5n87lrv6igwrbbas82cni0bamdlpgbb0-qtdeclarative-6.11.2-dev", + "out": "/nix/store/kmk6xvimcy29fnq6nzsdhmz5rfbzn3gd-qtdeclarative-6.11.2" + }, + "system": "aarch64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "qt6.qtdeclarative", + "broken": false, + "derivation": "/nix/store/cjf0yxnmcd3j16gkbnlifglc3n6h60kl-qtdeclarative-6.11.2.drv", + "description": "Cross-platform application framework for C++", + "install_id": "qtdeclarative", + "license": "[ GFDL-1.3-or-later, GPL-2.0-or-later, LGPL-2.1-or-later, LGPL-3.0-or-later ]", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "qtdeclarative-6.11.2", + "pname": "qtdeclarative", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T05:32:39.524792Z", + "stabilities": [ + "unstable" + ], + "version": "6.11.2", + "outputs_to_install": [], + "outputs": { + "debug": "/nix/store/hc79jsmms5g74abm3skbri43g39za0kl-qtdeclarative-6.11.2-debug", + "dev": "/nix/store/cncx0kwg751pxg1rr2v8d6g08kvbd9zl-qtdeclarative-6.11.2-dev", + "out": "/nix/store/8qfd1w03nvs0lz0fx1i3sx9pma1zi8bw-qtdeclarative-6.11.2" + }, + "system": "aarch64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "qt6.qtdeclarative", + "broken": false, + "derivation": "/nix/store/ji775hi29892mdxqp84zblmw3abgd2m7-qtdeclarative-6.11.2.drv", + "description": "Cross-platform application framework for C++", + "install_id": "qtdeclarative", + "license": "[ GFDL-1.3-or-later, GPL-2.0-or-later, LGPL-2.1-or-later, LGPL-3.0-or-later ]", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "qtdeclarative-6.11.2", + "pname": "qtdeclarative", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T06:09:51.818503Z", + "stabilities": [ + "unstable" + ], + "version": "6.11.2", + "outputs_to_install": [], + "outputs": { + "debug": "/nix/store/dj2p8dk1lin46rfqmi9ir6g512y4r335-qtdeclarative-6.11.2-debug", + "dev": "/nix/store/xq9lyq13d8npfx26adhm1d8d38gfqgjv-qtdeclarative-6.11.2-dev", + "out": "/nix/store/fx21gyydnjdcy7r3ricmsq1iijdivdwl-qtdeclarative-6.11.2" + }, + "system": "x86_64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "qt6.qtdoc", + "broken": false, + "derivation": "/nix/store/bp8jysx95r6gyfw4mkz6lyxkap7jm8nj-qtdoc-6.11.2.drv", + "description": "Cross-platform application framework for C++", + "install_id": "qtdoc", + "license": "[ GFDL-1.3-or-later, GPL-2.0-or-later, LGPL-2.1-or-later, LGPL-3.0-or-later ]", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "qtdoc-6.11.2", + "pname": "qtdoc", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T04:59:37.010093Z", + "stabilities": [ + "unstable" + ], + "version": "6.11.2", + "outputs_to_install": [], + "outputs": { + "dev": "/nix/store/dyzg6vg6n0y2rzwkg5h21c8j236c6z1w-qtdoc-6.11.2-dev", + "out": "/nix/store/z7j9kmpgbbh1ssdp557acg7q7zf906bf-qtdoc-6.11.2" + }, + "system": "aarch64-darwin", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "qt6.qtdoc", + "broken": false, + "derivation": "/nix/store/fp4r5rf5iq34kfyn9ccjpg150nikdgzf-qtdoc-6.11.2.drv", + "description": "Cross-platform application framework for C++", + "install_id": "qtdoc", + "license": "[ GFDL-1.3-or-later, GPL-2.0-or-later, LGPL-2.1-or-later, LGPL-3.0-or-later ]", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "qtdoc-6.11.2", + "pname": "qtdoc", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T05:32:39.528164Z", + "stabilities": [ + "unstable" + ], + "version": "6.11.2", + "outputs_to_install": [], + "outputs": { + "debug": "/nix/store/p66qpgf5qbp3fhd7c8pwgm4dz30mckk2-qtdoc-6.11.2-debug", + "dev": "/nix/store/80lhjxc0zh4shg8z461629z9afa3a5yj-qtdoc-6.11.2-dev", + "out": "/nix/store/hlfdacc6qh1p3jvy33p9jxmv3si47vz7-qtdoc-6.11.2" + }, + "system": "aarch64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "qt6.qtdoc", + "broken": false, + "derivation": "/nix/store/hhkjf8lfz7bqwyzq7495z1nn1jsiay3y-qtdoc-6.11.2.drv", + "description": "Cross-platform application framework for C++", + "install_id": "qtdoc", + "license": "[ GFDL-1.3-or-later, GPL-2.0-or-later, LGPL-2.1-or-later, LGPL-3.0-or-later ]", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "qtdoc-6.11.2", + "pname": "qtdoc", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T06:09:51.821658Z", + "stabilities": [ + "unstable" + ], + "version": "6.11.2", + "outputs_to_install": [], + "outputs": { + "debug": "/nix/store/ys29n58nsqvv6qzfipcw39w01kfaipis-qtdoc-6.11.2-debug", + "dev": "/nix/store/8x5jwyp99lk018ljarxhvy7zl0lmxlw3-qtdoc-6.11.2-dev", + "out": "/nix/store/hxr8rdv629c2hqb5y7a6jlysfcn40zx9-qtdoc-6.11.2" + }, + "system": "x86_64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "quickshell", + "broken": false, + "derivation": "/nix/store/28k3b6m29774k1g4wihhviib9kzrp8zv-quickshell-0.3.1.drv", + "description": "Flexible QtQuick based desktop shell toolkit", + "install_id": "quickshell", + "license": "LGPL-3.0-only", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "quickshell-0.3.1", + "pname": "quickshell", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T05:32:40.204839Z", + "stabilities": [ + "unstable" + ], + "unfree": false, + "version": "0.3.1", + "outputs_to_install": [ + "out" + ], + "outputs": { + "debug": "/nix/store/m9iaq00x3wj9d56hxbmbnnbzhfi86rgi-quickshell-0.3.1-debug", + "out": "/nix/store/hnw9kk48z8jqp0pqha5gwnpyawpcxq34-quickshell-0.3.1" + }, + "system": "aarch64-linux", + "group": "toplevel", + "priority": 5 + }, + { + "attr_path": "quickshell", + "broken": false, + "derivation": "/nix/store/i74mbh5kis1q2018lj8bi14dmhrx5kv1-quickshell-0.3.1.drv", + "description": "Flexible QtQuick based desktop shell toolkit", + "install_id": "quickshell", + "license": "LGPL-3.0-only", + "locked_url": "https://github.com/flox/nixpkgs?rev=d6524aaca2ff07876657ae2b323f24be4874944b", + "name": "quickshell-0.3.1", + "pname": "quickshell", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", + "rev_count": 1069856, + "rev_date": "2026-09-08T15:35:43Z", + "scrape_date": "2026-09-09T06:09:52.499504Z", + "stabilities": [ + "unstable" + ], + "unfree": false, + "version": "0.3.1", + "outputs_to_install": [ + "out" + ], + "outputs": { + "debug": "/nix/store/12gf9sg9k944fsjg2zi718mkbaxbwiqc-quickshell-0.3.1-debug", + "out": "/nix/store/bizld3m6skqh1fsjf6invqgaicyfvkyz-quickshell-0.3.1" + }, + "system": "x86_64-linux", + "group": "toplevel", + "priority": 5 + } + ] +} diff --git a/.flox/env/manifest.toml b/.flox/env/manifest.toml new file mode 100644 index 0000000..d66bf8e --- /dev/null +++ b/.flox/env/manifest.toml @@ -0,0 +1,98 @@ +schema-version = "1.14.0" + + +## Install Packages -------------------------------------------------- +## $ flox install gum <- puts a package in [install] section below +## $ flox search gum <- search for a package +## $ flox show gum <- show all versions of a package +## ------------------------------------------------------------------- +[install] +qtdeclarative.pkg-path = "qt6.qtdeclarative" +qtdoc.pkg-path = "qt6.qtdoc" +quickshell.pkg-path = "quickshell" +quickshell.systems = ["aarch64-linux", "x86_64-linux"] +# gum.pkg-path = "gum" +# gum.version = "^0.14.5" + + +## Environment Variables --------------------------------------------- +## ... available for use in the activated environment +## as well as [hook], [profile] scripts and [services] below. +## ------------------------------------------------------------------- +[vars] +# INTRO_MESSAGE = "It's gettin' Flox in here" + + +## Activation Hook --------------------------------------------------- +## ... run by _bash_ shell when you run 'flox activate'. +## ------------------------------------------------------------------- +[hook] +# on-activate = ''' +# # -> Set variables, create files and directories +# # -> Perform initialization steps, e.g. create a python venv +# # -> Useful environment variables: +# # - FLOX_ENV_PROJECT=/home/user/example +# # - FLOX_ENV=/home/user/example/.flox/run +# # - FLOX_ENV_CACHE=/home/user/example/.flox/cache +# ''' + + +## Profile script ---------------------------------------------------- +## ... sourced by _your shell_ when you run 'flox activate'. +## ------------------------------------------------------------------- +[profile] +# common = ''' +# gum style \ +# --foreground 212 --border-foreground 212 --border double \ +# --align center --width 50 --margin "1 2" --padding "2 4" \ +# $INTRO_MESSAGE +# ''' +## Shell-specific customizations such as setting aliases go here: +# bash = ... +# zsh = ... +# fish = ... + + +## Services --------------------------------------------------------- +## $ flox services start <- Starts all services +## $ flox services status <- Status of running services +## $ flox activate --start-services <- Activates & starts all +## ------------------------------------------------------------------ +[services] +# myservice.command = "python3 -m http.server" + + +## Include ---------------------------------------------------------- +## ... environments to create a composed environment +## ------------------------------------------------------------------ +[include] +# environments = [ +# { dir = "../common" } +# ] + + +## Build and publish your own packages ------------------------------ +## $ flox build +## $ flox publish +## ------------------------------------------------------------------ +[build] +# [build.myproject] +# description = "The coolest project ever" +# version = "0.0.1" +# command = """ +# mkdir -p $out/bin +# cargo build --release +# cp target/release/myproject $out/bin/myproject +# """ + + +## Other Environment Options ----------------------------------------- +[options] +# Systems that environment is compatible with +# systems = [ +# "aarch64-darwin", +# "aarch64-linux", +# "x86_64-linux", +# ] +# Uncomment to disable CUDA detection. +# cuda-detection = false diff --git a/.flox/telemetry_id b/.flox/telemetry_id new file mode 100644 index 0000000..5ab4ffa --- /dev/null +++ b/.flox/telemetry_id @@ -0,0 +1 @@ +7241c56c-5faa-464b-ba4d-bd941a58b696 diff --git a/.qmllint.ini b/.qmllint.ini new file mode 100644 index 0000000..81dabeb --- /dev/null +++ b/.qmllint.ini @@ -0,0 +1,3 @@ +[General] +DisableDefaultImports=false +MaxWarnings=-1 diff --git a/.qmlls.ini b/.qmlls.ini new file mode 100644 index 0000000..c701321 --- /dev/null +++ b/.qmlls.ini @@ -0,0 +1,3 @@ +[General] +importPaths=/run/current-system/sw/lib/qt-6/qml:qs-app-carousel:. +buildDir= diff --git a/.zed/settings.json b/.zed/settings.json new file mode 100644 index 0000000..ac9da12 --- /dev/null +++ b/.zed/settings.json @@ -0,0 +1,38 @@ +{ + "languages": { + "QML": { + "language_servers": ["qmljs"], + "inlay_hints": { + "enabled": true + } + } + }, + "lsp": { + "qml": { + "binary": { + "arguments": [ + "-E", + "-I", + "/run/current-system/sw/lib/qt-6/qml", + "-I", + "qs-app-carousel", + "-I", + "." + ] + } + }, + "qmljs": { + "binary": { + "arguments": [ + "-E", + "-I", + "/run/current-system/sw/lib/qt-6/qml", + "-I", + "qs-app-carousel", + "-I", + "." + ] + } + } + } +} diff --git a/example.json b/example.json new file mode 100644 index 0000000..7aa7c05 --- /dev/null +++ b/example.json @@ -0,0 +1,21 @@ +{ + "apps":[ + { + "name": "Chromium", + "image": "chromium", + "isIcon": true, + "exec": ["chromium"] + }, + { + "name": "Netflix", + "image": "https://assets.nflxext.com/us/ffe/siteui/common/icons/nficon2023.ico", + "exec": ["chromium", "--app=https://www.netflix.com"] + }, + { + "name": "Settings", + "image": "system-settings", + "isIcon": true, + "exec": ["dms", "ipc", "call", "settings", "toggle"] + } + ] +} diff --git a/qs-app-carousel/.qmlls.ini b/qs-app-carousel/.qmlls.ini new file mode 100644 index 0000000..df82ada --- /dev/null +++ b/qs-app-carousel/.qmlls.ini @@ -0,0 +1,3 @@ +[General] +importPaths=/run/current-system/sw/lib/qt-6/qml:. +buildDir= diff --git a/qs-app-carousel/App.qml b/qs-app-carousel/App.qml new file mode 100644 index 0000000..1629b1f --- /dev/null +++ b/qs-app-carousel/App.qml @@ -0,0 +1,9 @@ +import QtQuick +import Quickshell.Io + +JsonObject { + property string name + property string image + property bool isIcon: false + property list exec +} diff --git a/qs-app-carousel/AppButton.qml b/qs-app-carousel/AppButton.qml new file mode 100644 index 0000000..1e86ed1 --- /dev/null +++ b/qs-app-carousel/AppButton.qml @@ -0,0 +1,49 @@ +import QtQuick +import Quickshell +import QtQuick.Layouts + +Rectangle { + id: root + + required property var theme + required property App app + required property bool selected + + signal activated() + + width: theme.cardWidth + height: theme.cardHeight + radius: theme.cornerRadius + color: theme.cardBg + border.width: selected ? 3 : 1 + border.color: selected ? theme.selectedBorder : theme.cardBorder + clip: true + + ColumnLayout { + spacing: 10 + width: root.theme.cardWidth + height: root.theme.cardHeight + anchors.fill: parent + anchors.margins: root.theme.cardPadding + Image { + fillMode: Image.PreserveAspectFit + Layout.alignment: Qt.AlignCenter + Layout.fillWidth: true + Layout.fillHeight: true + source: root.app.isIcon ? Quickshell.iconPath(root.app.image) : root.app.image + } + Text { + id: label + elide: Text.ElideRight + color: root.theme.textColor + text: root.app.name + font.pixelSize: root.theme.fontSize + Layout.alignment: Qt.AlignHCenter + } + } + + MouseArea { + anchors.fill: parent + onClicked: root.activated() + } +} diff --git a/qs-app-carousel/Config.qml b/qs-app-carousel/Config.qml new file mode 100644 index 0000000..df92991 --- /dev/null +++ b/qs-app-carousel/Config.qml @@ -0,0 +1,7 @@ +pragma Singleton +import QtQuick +import Quickshell + +QtObject { + readonly property string appConfigPath: Quickshell.env("SKYG_APP_CAROUSEL") +} diff --git a/qs-app-carousel/LauncherWindow.qml b/qs-app-carousel/LauncherWindow.qml new file mode 100644 index 0000000..0d51f44 --- /dev/null +++ b/qs-app-carousel/LauncherWindow.qml @@ -0,0 +1,163 @@ +import QtQuick +import Quickshell +import Quickshell.Wayland +import Quickshell.Hyprland + +PanelWindow { + id: root + + required property bool shellOpen + required property list apps + + signal requestClose() + + visible: root.shellOpen + + color: "transparent" + + WlrLayershell.namespace: "quickshell:launcher" + WlrLayershell.layer: WlrLayer.Overlay + WlrLayershell.exclusiveZone: -1 + WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None + + anchors { + top: true + left: true + right: true + bottom: true + } + + property Theme theme: Theme {} + + property int selectedIndex: 0 + + readonly property int centerIndex: root.selectedIndex + + function clampSelection() { + if (root.apps.length === 0) return; + if (root.selectedIndex >= root.apps.length) root.selectedIndex = root.apps.length - 1; + if (root.selectedIndex < 0) root.selectedIndex = 0; + } + + function moveSelection(delta) { + if (root.apps.length === 0) return; + root.selectedIndex = (root.selectedIndex + delta + root.apps.length) % root.apps.length; + } + + function activateSelection() { + const app = root.apps[root.selectedIndex]; + if (!app) { root.requestClose(); return; } + Quickshell.execDetached(app.exec); + root.requestClose(); + } + + onVisibleChanged: { + if (root.visible) { + root.selectedIndex = 0; + Qt.callLater(() => focusScope.forceActiveFocus()); + } + } + + HyprlandFocusGrab { + windows: [root] + active: root.visible + onCleared: { + if (root.visible) root.requestClose(); + } + } + + Rectangle { + anchors.fill: parent + color: "#cc0b0e14" + + MouseArea { + anchors.fill: parent + onClicked: root.requestClose() + } + } + + FocusScope { + id: focusScope + anchors.fill: parent + focus: root.visible + + Keys.onPressed: event => { + switch (event.key) { + case Qt.Key_Left: + root.moveSelection(-1); + break; + case Qt.Key_Right: + root.moveSelection(1); + break; + case Qt.Key_Return: + case Qt.Key_Enter: + root.activateSelection(); + break; + case Qt.Key_Escape: + root.requestClose(); + break; + default: + return; + } + event.accepted = true; + } + + WheelHandler { + id: swipeHandler + target: focusScope + property real accX: 0 + + function step(delta) { + root.moveSelection(delta); + swipeHandler.accX = 0; + } + + onWheel: event => { + const px = event.pixelDelta; + const ang = event.angleDelta; + const dx = px.x !== 0 ? px.x : ang.x; + swipeHandler.accX += dx; + if (swipeHandler.accX <= -root.theme.swipeThreshold) swipeHandler.step(1); + else if (swipeHandler.accX >= root.theme.swipeThreshold) swipeHandler.step(-1); + } + } + + Item { + anchors.fill: parent + + Repeater { + model: root.apps + + AppButton { + required property var modelData + required property int index + + theme: root.theme + app: modelData + selected: index === root.selectedIndex + + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + anchors.horizontalCenterOffset: (index - root.centerIndex) * root.theme.carouselStepX + opacity: 1 - Math.min(Math.abs(index - root.centerIndex) * root.theme.carouselFadeStep, root.theme.carouselMaxFade) + scale: 1 - Math.min(Math.abs(index - root.centerIndex) * root.theme.carouselScaleStep, root.theme.carouselMaxScaleReduction) + + Behavior on anchors.horizontalCenterOffset { + NumberAnimation { duration: root.theme.carouselDuration; easing.type: Easing.OutCubic } + } + Behavior on opacity { + NumberAnimation { duration: root.theme.carouselDuration } + } + Behavior on scale { + NumberAnimation { duration: root.theme.carouselDuration } + } + + onActivated: { + root.selectedIndex = index; + root.activateSelection(); + } + } + } + } + } +} diff --git a/qs-app-carousel/Theme.qml b/qs-app-carousel/Theme.qml new file mode 100644 index 0000000..e262b88 --- /dev/null +++ b/qs-app-carousel/Theme.qml @@ -0,0 +1,29 @@ +import QtQuick + +QtObject { + readonly property color cardBg: "#332a2e3a" + readonly property color cardBorder: "#40ffffff" + readonly property color selectedBorder: "#7aa2f7" + readonly property color textColor: "#ffffff" + readonly property color labelBg: "#99000000" + readonly property real cornerRadius: 10 + readonly property real cardWidth: 240 + readonly property real cardHeight: 240 + readonly property real cardPadding: 10 + readonly property real cardSpacing: 40 + readonly property real fontSize: 24 + + // Carousel layout: fixed step distance between slots, and per-step + // falloff for opacity/scale as items recede from the centered (selected) + // slot. + readonly property real carouselStepX: cardWidth + cardSpacing + readonly property real carouselFadeStep: 0.35 + readonly property real carouselMaxFade: 0.85 + readonly property real carouselScaleStep: 0.08 + readonly property real carouselMaxScaleReduction: 0.3 + readonly property int carouselDuration: 220 + + // A two-finger swipe must cross this many pixels (or angleDelta units) + // before the selection steps once. + readonly property int swipeThreshold: 120 +} diff --git a/qs-app-carousel/qmldir b/qs-app-carousel/qmldir new file mode 100644 index 0000000..3ac38ff --- /dev/null +++ b/qs-app-carousel/qmldir @@ -0,0 +1,5 @@ +singleton Config 1.0 Config.qml +App 1.0 App.qml +AppButton 1.0 AppButton.qml +LauncherWindow 1.0 LauncherWindow.qml +Theme 1.0 Theme.qml diff --git a/qs-app-carousel/shell.qml b/qs-app-carousel/shell.qml new file mode 100644 index 0000000..6bf3bf2 --- /dev/null +++ b/qs-app-carousel/shell.qml @@ -0,0 +1,47 @@ +import Quickshell +import QtQuick +import Quickshell.Io + + +ShellRoot { + id: shell + + + property bool launcherOpen: true + + FileView { + id: config + path: Config.appConfigPath + watchChanges: true + onFileChanged: reload() + onAdapterUpdated: writeAdapter() + + JsonAdapter { + id: adapter + property var apps + } + } + + Component.onCompleted: { + console.log("Current config:", Config.appConfigPath, config.adapter.apps) + } + IpcHandler { + target: "launcher" + + function toggle(): void { + shell.launcherOpen = !shell.launcherOpen; + } + function open(): void { + shell.launcherOpen = true; + } + function close(): void { + shell.launcherOpen = false; + } + } + + // LauncherWindow { + // shellOpen: shell.launcherOpen + // onRequestClose: shell.launcherOpen = false + // apps: adapter.apps + // } +}