Compare commits

...

3 Commits

Author SHA1 Message Date
tux
352eb99568 style: format code 2026-09-11 02:10:39 +05:30
tux
f2268f65e7 feat(cava): update bar opacity using level 2026-09-04 22:56:32 +05:30
tux
6357b949b3 feat(bar): add smooth sliding highlight to workspaces 2026-09-04 22:55:22 +05:30
4 changed files with 224 additions and 145 deletions

View File

@@ -15,14 +15,12 @@
}; };
}; };
outputs = outputs = {
{
self, self,
nixpkgs, nixpkgs,
quickshell, quickshell,
treefmt-nix, treefmt-nix,
}: }: let
let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
@@ -37,13 +35,12 @@
projectRootFile = "flake.nix"; projectRootFile = "flake.nix";
programs = { programs = {
nixfmt.enable = true; alejandra.enable = true;
qmlformat.enable = true; qmlformat.enable = true;
clang-format.enable = true; clang-format.enable = true;
}; };
}; };
in in rec {
rec {
formatter.${system} = treefmtEval.config.build.wrapper; formatter.${system} = treefmtEval.config.build.wrapper;
packages.${system} = { packages.${system} = {

View File

@@ -39,7 +39,7 @@ Rectangle {
radius: bar.width / 2 radius: bar.width / 2
color: Theme.colors.accent color: Theme.colors.accent
antialiasing: true antialiasing: true
opacity: 0.55 + 0.45 * bar.height / Math.max(1, barRow.height) opacity: 0.45 + (bar.level * 0.55)
Behavior on height { Behavior on height {
NumberAnimation { NumberAnimation {

View File

@@ -4,11 +4,24 @@ import QtQuick
import Quickshell.Hyprland import Quickshell.Hyprland
import qs.config import qs.config
Row { Item {
id: root id: root
property int count: 7 property int count: 7
implicitWidth: pillsRow.implicitWidth
implicitHeight: Theme.workspaces.height
Behavior on implicitWidth {
NumberAnimation {
duration: Theme.duration
easing.type: Easing.OutQuint
}
}
Row {
id: pillsRow
anchors.fill: parent
spacing: Theme.spacing spacing: Theme.spacing
Repeater { Repeater {
@@ -21,14 +34,17 @@ Row {
property var ws: Hyprland.workspaces.values.find(w => w.id === pill.index + 1) property var ws: Hyprland.workspaces.values.find(w => w.id === pill.index + 1)
property bool isActive: Hyprland.focusedWorkspace?.id === (pill.index + 1) property bool isActive: Hyprland.focusedWorkspace?.id === (pill.index + 1)
z: 1
radius: Theme.workspaces.radius radius: Theme.workspaces.radius
implicitHeight: Theme.workspaces.height implicitHeight: Theme.workspaces.height
implicitWidth: pill.isActive ? pill.implicitHeight * Theme.workspaces.activeWidthRatio : pill.implicitHeight implicitWidth: pill.isActive ? pill.implicitHeight * Theme.workspaces.activeWidthRatio : pill.implicitHeight
color: { color: {
if (pill.isActive)
return "transparent";
if (handler.hovered) if (handler.hovered)
return Theme.colors.accent; return Theme.colors.accent;
if (pill.isActive || pill.ws) if (pill.ws)
return Theme.colors.accent; return Theme.colors.secondaryForeground;
return Theme.colors.inActive; return Theme.colors.inActive;
} }
@@ -36,7 +52,7 @@ Row {
hoverEnabled: true hoverEnabled: true
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: Hyprland.dispatch("workspace " + (pill.index + 1)) onClicked: Hyprland.dispatch("hl.dsp.focus({ workspace = " + (pill.index + 1) + " })")
} }
HoverHandler { HoverHandler {
@@ -45,7 +61,7 @@ Row {
Behavior on color { Behavior on color {
ColorAnimation { ColorAnimation {
duration: Theme.duration duration: Theme.duration + 50
} }
} }
@@ -57,4 +73,72 @@ Row {
} }
} }
} }
}
Rectangle {
id: highlight
z: 2
radius: Theme.workspaces.radius
color: Theme.colors.accent
readonly property real activeW: Theme.workspaces.height * Theme.workspaces.activeWidthRatio
readonly property real inactiveW: Theme.workspaces.height
property int curIdx: Hyprland.focusedWorkspace ? Hyprland.focusedWorkspace.id - 1 : -1
property int prevIdx: 0
function getX(index, activeIndex) {
if (index < 0)
return 0;
let x = 0;
for (let i = 0; i < index; i++)
x += (i === activeIndex ? activeW : inactiveW) + pillsRow.spacing;
return x;
}
property real targetLeft: curIdx >= 0 ? getX(curIdx, curIdx) : 0
property real targetRight: curIdx >= 0 ? targetLeft + activeW : 0
property real actualLeft: targetLeft
property real actualRight: targetRight
Behavior on actualLeft {
NumberAnimation {
id: leftAnim
duration: Theme.duration
easing.type: Easing.OutQuint
}
}
Behavior on actualRight {
NumberAnimation {
id: rightAnim
duration: Theme.duration
easing.type: Easing.OutQuint
}
}
onCurIdxChanged: {
if (curIdx >= 0 && prevIdx >= 0) {
if (curIdx > prevIdx) {
leftAnim.duration = 400;
rightAnim.duration = 300;
} else if (curIdx < prevIdx) {
leftAnim.duration = 300;
rightAnim.duration = 400;
}
}
if (curIdx >= 0)
prevIdx = curIdx;
}
x: actualLeft
width: actualRight - actualLeft
height: parent.height
opacity: curIdx >= 0 ? 1 : 0
Behavior on opacity {
NumberAnimation {
duration: 180
}
}
}
} }

View File

@@ -10,34 +10,32 @@
cava, cava,
wallust, wallust,
nerd-fonts, nerd-fonts,
extraRuntimeDeps ? [ ], extraRuntimeDeps ? [],
}: }: let
let
version = "0.1.0"; version = "0.1.0";
runtimeDeps = [ runtimeDeps =
[
cava cava
wallust wallust
] ]
++ extraRuntimeDeps; ++ extraRuntimeDeps;
fontconfig = makeFontsConf { fontconfig = makeFontsConf {
fontDirectories = [ nerd-fonts.fira-code ]; fontDirectories = [nerd-fonts.fira-code];
}; };
# Unlike lib.fileset, this keeps untracked files (the flake only sees # Unlike lib.fileset, this keeps untracked files (the flake only sees
# git-tracked paths) while dropping build artifacts. # git-tracked paths) while dropping build artifacts.
src = lib.cleanSourceWith { src = lib.cleanSourceWith {
src = lib.cleanSource ./.; src = lib.cleanSource ./.;
filter = filter = path: _: let
path: _:
let
name = baseNameOf path; name = baseNameOf path;
in in
!(name == "dist" || name == "result" || name == "result-bin" || lib.hasPrefix "build" name); !(name == "dist" || name == "result" || name == "result-bin" || lib.hasPrefix "build" name);
}; };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit version src; inherit version src;
pname = "tshell"; pname = "tshell";
@@ -79,4 +77,4 @@ stdenv.mkDerivation {
mainProgram = "tshell"; mainProgram = "tshell";
platforms = lib.platforms.linux; platforms = lib.platforms.linux;
}; };
} }