quickshell!
This commit is contained in:
parent
6697dbb64b
commit
dc8e6873c3
17 changed files with 251 additions and 47 deletions
35
modules/styling/quickshell/bar/shell.qml
Normal file
35
modules/styling/quickshell/bar/shell.qml
Normal file
|
@ -0,0 +1,35 @@
|
|||
import Quickshell // for ShellRoot and PanelWindow
|
||||
import QtQuick // for text
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import "workspaces" as Workspaces
|
||||
|
||||
ShellRoot {
|
||||
PanelWindow {
|
||||
anchors {
|
||||
top: true
|
||||
left : true
|
||||
right:true
|
||||
}
|
||||
height: 30
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
Loader {
|
||||
active: isSoleBar
|
||||
Layout.preferredHeight: active ? implicitHeight: 0;
|
||||
Layout.fillWidth: true
|
||||
sourceComponent: Workspaces.Widget {
|
||||
bar: root
|
||||
wsBaseIndex: 1
|
||||
}
|
||||
}
|
||||
Workspaces.Widget {
|
||||
bar: root
|
||||
Layout.fillWidth: true
|
||||
wsBaseIndex: 1;
|
||||
hideWhenEmpty: isSoleBar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
110
modules/styling/quickshell/bar/workspaces/Widget.qml
Normal file
110
modules/styling/quickshell/bar/workspaces/Widget.qml
Normal file
|
@ -0,0 +1,110 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Hyprland
|
||||
import ".."
|
||||
import "root:."
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
required property var bar;
|
||||
required property int wsBaseIndex;
|
||||
property int wsCount: 10;
|
||||
property bool hideWhenEmpty: false;
|
||||
implicitHeight: column.implicitHeight + 10;
|
||||
acceptedButtons: Qt.NoButton
|
||||
onWheel: event => {
|
||||
event.accepted = true;
|
||||
const step = -Math.sign(event.angleDelta.y);
|
||||
const targetWs = currentIndex + step;
|
||||
if (targetWs >= wsBaseIndex && targetWs < wsBaseIndex + wsCount) {
|
||||
Hyprland.dispatch(`workspace ${targetWs}`)
|
||||
}
|
||||
}
|
||||
readonly property HyprlandMonitor monitor: Hyprland.monitorFor(bar.screen);
|
||||
property int currentIndex: 0;
|
||||
property int existsCount: 0;
|
||||
visible: !hideWhenEmpty || existsCount > 0;
|
||||
|
||||
property real animPos: 0;
|
||||
Behavior on animPos { SmoothedAnimation { velocity: 100 } }
|
||||
|
||||
// destructor takes care of nulling
|
||||
signal workspaceAdded(workspace: HyprlandWorkspace);
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
spacing: 0
|
||||
anchors {
|
||||
fill: parent;
|
||||
topMargin: 0;
|
||||
margins: 5;
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: 10
|
||||
|
||||
MouseArea {
|
||||
id: wsItem
|
||||
onPressed: Hyprland.dispatch(`workspace ${wsIndex}`);
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 15
|
||||
|
||||
required property int index;
|
||||
property int wsIndex: wsBaseIndex + index;
|
||||
property HyprlandWorkspace workspace: null;
|
||||
property bool exists: workspace != null;
|
||||
property bool active: (monitor?.activeWorkspace ?? false) && monitor.activeWorkspace == workspace;
|
||||
|
||||
onActiveChanged: {
|
||||
if (active) root.currentIndex = wsIndex;
|
||||
}
|
||||
|
||||
onExistsChanged: {
|
||||
root.existsCount += exists ? 1 : -1;
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
function onWorkspaceAdded(workspace: HyprlandWorkspace) {
|
||||
if (workspace.id == wsItem.wsIndex) {
|
||||
wsItem.workspace = workspace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property real animActive: active ? 100 : 0
|
||||
Behavior on animActive { NumberAnimation { duration: 100 } }
|
||||
|
||||
property real animExists: exists ? 100 : 0
|
||||
Behavior on animExists { NumberAnimation { duration: 100 } }
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
height: 10
|
||||
width: parent.width
|
||||
scale: 1 + animActive * 0.003
|
||||
radius: height / 2
|
||||
border.color: ShellGlobals.colors.widgetOutline
|
||||
border.width: 1
|
||||
color: ShellGlobals.interpolateColors(animExists * 0.01, ShellGlobals.colors.widget, ShellGlobals.colors.widgetActive);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Hyprland.workspaces
|
||||
|
||||
function onObjectInsertedPost(workspace) {
|
||||
root.workspaceAdded(workspace);
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
Hyprland.workspaces.values.forEach(workspace => {
|
||||
root.workspaceAdded(workspace)
|
||||
});
|
||||
}
|
||||
}
|
27
modules/styling/quickshell/default.nix
Normal file
27
modules/styling/quickshell/default.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
system,
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs) quickshell;
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib.generators) toKeyValue;
|
||||
inherit (config.modules.other.system) username;
|
||||
cfg = config.modules.theming.quickshell;
|
||||
in {
|
||||
options.modules.theming.quickshell.enable = mkEnableOption "quickshell";
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
qt6.qtimageformats
|
||||
qt6.qt5compat
|
||||
quickshell.packages.${system}.default
|
||||
pamtester
|
||||
];
|
||||
home-manager.users.${username}.xdg.configFile."quickshell/manifest.conf".text = toKeyValue {} {
|
||||
bar = "${./bar}";
|
||||
};
|
||||
};
|
||||
}
|
0
modules/styling/quickshell/systray/Widget.qml
Normal file
0
modules/styling/quickshell/systray/Widget.qml
Normal file
Loading…
Add table
Add a link
Reference in a new issue