chore: initial commit

Initial commit
This commit is contained in:
2026-04-16 17:15:42 -05:00
commit f8ed47acff
16 changed files with 1863 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
nix/
+234
View File
@@ -0,0 +1,234 @@
import "nix"
import Quickshell
import Quickshell.Wayland
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
// You'll need to create or import a fuzzy matching utility
// For desktop entries, you may need a custom C++ plugin or use
// QProcess to query applications
PanelWindow {
id: win
anchors {
top: true
bottom: true
left: true
right: true
}
exclusionMode: ExclusionMode.Ignore
focusable: true
color: "transparent"
// Main content container
Rectangle {
id: contentBox
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 100
width: 700
height: contentCol.implicitHeight + contentCol.anchors.topMargin + contentCol.anchors.bottomMargin
radius: 12
color: Theme.bg
palette {
text: Theme.fg
placeholderText: Theme.shaded
windowText: Theme.fg
}
// Close on escape and handle Alt+number shortcuts
Keys.onPressed: event => {
if (event.key === Qt.Key_Escape) {
win.visible = false;
event.accepted = true;
return;
}
// Handle Alt+1 through Alt+9
if (event.modifiers & Qt.AltModifier) {
var num = -1;
if (event.key >= Qt.Key_1 && event.key <= Qt.Key_9) {
num = event.key - Qt.Key_1; // 0-8
} else if (event.key === Qt.Key_0) {
num = 9; // Alt+0 for 10th item if needed
}
if (num >= 0 && num < appList.count) {
launch(appList.get(num));
event.accepted = true;
}
}
}
ColumnLayout {
id: contentCol
anchors.fill: parent
anchors.margins: 15
Layout.preferredHeight: 20
spacing: 10
// Search entry row
RowLayout {
id: searchEntry
Layout.fillWidth: true
spacing: 10
Text {
font.pixelSize: 32
text: ""
color: Theme.accent
}
TextField {
id: searchField
Layout.fillWidth: true
placeholderText: "Application"
font.pixelSize: 24
background: Rectangle {
color: "transparent"
}
onTextChanged: search(text)
onAccepted: {
if (appList.count > 0) {
console.log("launching:", appList.get(0).name);
launch(appList.get(0));
}
}
Component.onCompleted: forceActiveFocus()
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 3
color: Theme.divider
visible: appList.count > 0
}
// Application list
ListView {
id: listView
visible: appList.count > 0
Layout.fillWidth: true
Layout.preferredHeight: Math.min(appList.count * 50, 450)
model: appList
spacing: 0
clip: true
delegate: Button {
id: entryButton
width: listView.width
height: 50
background: Rectangle {
color: entryButton.hovered ? Theme.accent : "transparent"
radius: 14
}
contentItem: RowLayout {
anchors.fill: parent
anchors.leftMargin: 12
anchors.rightMargin: 12
spacing: 10
Image {
source: model.icon ? "image://icon/" + model.icon : ""
Layout.preferredWidth: 32
Layout.preferredHeight: 32
}
Label {
text: model.name
font.pixelSize: 24
Layout.fillWidth: true
elide: Text.ElideRight
maximumLineCount: 1
wrapMode: Text.Wrap
}
Label {
text: "⌘" + (index + 1)
Layout.alignment: Qt.AlignRight
color: entryButton.hovered ? Theme.fg : Theme.accent
font.pointSize: 12
}
}
onClicked: launch(model)
}
}
}
}
// Close when clicking outside content
MouseArea {
anchors.fill: parent
onPressed: mouse => {
var pnt = mapToItem(contentBox, mouse.x, mouse.y);
if (!contentBox.contains(Qt.point(pnt.x, pnt.y))) {
win.visible = false;
}
}
// Let clicks pass through to content
propagateComposedEvents: true
}
// Data model for applications
ListModel {
id: appList
}
// Function to perform fuzzy search
function search(text) {
if (text === "") {
appList.clear();
return;
}
// You'll need to implement fuzzy_query
// This could be via a C++ plugin or calling an external process
// For now, placeholder showing the pattern:
var results = DesktopEntries.applications.values;
appList.clear();
for (var i = 0; i < results.length; i++) {
appList.append(results[i]);
}
}
// Function to launch application
function launch(app) {
if (!app)
return;
win.visible = false;
app.execute();
}
// Handle visibility changes
onVisibleChanged: {
if (visible) {
searchField.forceActiveFocus();
searchField.selectAll();
} else {
searchField.text = "";
appList.clear();
}
}
}
+352
View File
@@ -0,0 +1,352 @@
import "nix"
import "one.krantz.rshell"
import Quickshell
import Quickshell.Io
import Quickshell.Widgets
import Quickshell.Hyprland
import Quickshell.Services.UPower
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Shapes
Variants {
model: Quickshell.screens
PanelWindow {
id: panel
// the screen from the screens list will be injected into this
// property
required property var modelData
// we can then set the window's screen to the injected property
screen: modelData
anchors.top: true
anchors.left: true
anchors.right: true
implicitHeight: 36
margins.top: 7
margins.left: 7
margins.right: 7
color: "transparent"
Rectangle {
id: bar
anchors.fill: parent
radius: 7
color: Theme.bg
// Left section
Pane {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
topPadding: 0
bottomPadding: 0
leftPadding: 10
rightPadding: 10
background: Rectangle {
radius: bar.radius
color: Theme.containerBg
}
RowLayout {
anchors.fill: parent
spacing: 10
Text {
id: clock
Layout.fillHeight: true
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
color: Theme.text
font.bold: true
text: Time.time
}
Rectangle {
Layout.fillHeight: true
width: 3
color: Theme.divider
}
Text {
id: codedirstat
Layout.fillHeight: true
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
color: Theme.text
font.bold: true
text: `${CodeDirStat.files}<font color=\"${Theme.shaded}\">󰈔 </font>${CodeDirStat.commits}<font color=\"${Theme.shaded}\">󰅟 </font>${CodeDirStat.stashes}<font color=\"${Theme.shaded}\"></font>`
}
}
}
// Center section
RowLayout {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.leftMargin: 10
anchors.rightMargin: 10
spacing: 10
Repeater {
model: 6
Rectangle {
id: workspace
required property int index
readonly property HyprlandWorkspace ws: {
Hyprland.workspaces.values.find(ws => ws.id === index + 1);
}
width: 16
height: width
radius: width * 0.5
border.width: 3
border.color: Theme.inactive
color: "transparent"
states: [
State {
name: "active-current"
when: (workspace.ws && workspace.ws.active && workspace.ws.monitor.name === panel.screen.name)
PropertyChanges {
target: workspace
color: workspace.border.color
border.color: Theme.accent
}
},
State {
name: "active-other"
when: (workspace.ws && workspace.ws.active)
PropertyChanges {
target: workspace
color: workspace.border.color
border.color: Theme.fg
}
},
State {
name: "current"
when: (workspace.ws && workspace.ws.monitor.name === panel.screen.name)
PropertyChanges {
target: workspace
border.color: Theme.accent
}
},
State {
name: "other"
when: (workspace.ws)
PropertyChanges {
target: workspace
border.color: Theme.fg
}
}
]
transitions: Transition {
ParallelAnimation {
ColorAnimation {
target: workspace
property: "color"
duration: 500
easing.type: Easing.InOutQuad
}
ColorAnimation {
target: workspace.border
property: "color"
duration: 500
easing.type: Easing.InOutQuad
}
}
}
}
}
}
// Right section
Pane {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
topPadding: 0
bottomPadding: 0
leftPadding: 10
rightPadding: 10
background: Rectangle {
radius: bar.radius
color: Theme.containerBg
}
RowLayout {
anchors.fill: parent
spacing: 10
Item {
id: batteryIcon
property UPowerDevice battery: UPower.displayDevice
visible: battery.isPresent
width: 60
height: 30
property real borderWidth: 3
scale: 2 / 3
// Properties
property color lowColor: Theme.bad
property color mediumColor: Theme.ok
property color highColor: Theme.good
property color borderColor: Theme.fg
// Calculate fill color based on level
property color fillColor: {
if (battery.percentage <= 0.15)
return lowColor;
if (battery.percentage <= 0.4)
return mediumColor;
return highColor;
}
// Battery body with border
Rectangle {
id: batteryBody
anchors.fill: parent
color: "transparent"
border.color: batteryIcon.borderColor
border.width: batteryIcon.borderWidth
radius: 7
// Fill progress bar
Rectangle {
id: fillBar
anchors {
left: parent.left
top: parent.top
bottom: parent.bottom
margins: batteryIcon.borderWidth + 2
}
width: Math.max(0, (parent.width - 2 * batteryIcon.borderWidth) * batteryIcon.battery.percentage)
color: batteryIcon.fillColor
radius: 2
// Smooth animation for level changes
Behavior on width {
NumberAnimation {
duration: 1000
easing.type: Easing.OutCubic
}
}
// Color transition animation
Behavior on color {
ColorAnimation {
duration: 500
}
}
}
}
// Battery positive terminal (nub)
Rectangle {
id: batteryNub
anchors {
left: batteryBody.right
verticalCenter: batteryBody.verticalCenter
}
width: 6
height: 12
color: batteryIcon.borderColor
radius: 1
}
// Lightning bolt (visible when charging)
Shape {
id: lightningBolt
anchors.centerIn: batteryBody
width: 14
height: 20
scale: 0.8
visible: batteryIcon.battery.state === UPowerDeviceState.Charging || batteryIcon.battery.state === UPowerDeviceState.FullyCharged || batteryIcon.battery.state === UPowerDeviceState.PendingCharge
opacity: batteryIcon.battery.state === UPowerDeviceState.FullyCharged || batteryIcon.battery.state === UPowerDeviceState.PendingCharge ? 100 : 0
// Pulsing animation
SequentialAnimation on opacity {
running: batteryIcon.battery.state === UPowerDeviceState.Charging
loops: Animation.Infinite
NumberAnimation {
to: 1
duration: 400
}
NumberAnimation {
to: 0.4
duration: 400
}
}
ShapePath {
strokeWidth: 1
fillColor: batteryIcon.borderColor
startX: 5
startY: 20
PathLine {
x: 14
y: 8
}
PathLine {
x: 7
y: 8
}
PathLine {
x: 11
y: 0
}
PathLine {
x: 7
y: 0
}
PathLine {
x: 0
y: 12
}
PathLine {
x: 7
y: 12
}
PathLine {
x: 5
y: 20
}
}
}
}
}
}
}
}
}
+18
View File
@@ -0,0 +1,18 @@
import "nix"
pragma Singleton
import Quickshell
import QtQuick
Singleton {
id: root
readonly property string time: {
Qt.formatDateTime(clock.date, "MM/dd/yy hh:mm:ss AP")
}
SystemClock {
id: clock
precision: SystemClock.Seconds
}
}