Skip to content

Commit 56d8f73

Browse files
committed
initial work on basic bar
1 parent 5734457 commit 56d8f73

21 files changed

+1052
-0
lines changed

basic_bar/.qmlformat.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[General]
2+
FunctionsSpacing=true
3+
IndentWidth=2
4+
MaxColumnWidth=-1
5+
NewlineType=native
6+
NormalizeOrder=true
7+
ObjectsSpacing=true
8+
UseTabs=false

basic_bar/Containers/Left.qml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import QtQuick
2+
import QtQuick.Layouts
3+
import Quickshell
4+
import Quickshell.Wayland
5+
6+
import "../Data/" as Dat
7+
import "../Widgets/" as Wid
8+
9+
Item {
10+
RowLayout {
11+
anchors.bottom: parent.bottom
12+
anchors.left: parent.left
13+
anchors.top: parent.top
14+
15+
Wid.OsText {
16+
}
17+
18+
Wid.Workspaces {
19+
}
20+
21+
Wid.WorkspaceName {
22+
}
23+
}
24+
}

basic_bar/Containers/Middle.qml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import QtQuick
2+
import QtQuick.Layouts
3+
import Quickshell
4+
import Quickshell.Wayland
5+
6+
import "../Data/" as Dat
7+
import "../Widgets/" as Wid
8+
9+
Item {
10+
RowLayout {
11+
anchors.bottom: parent.bottom
12+
anchors.horizontalCenter: parent.horizontalCenter
13+
anchors.top: parent.top
14+
15+
Wid.Clock {
16+
}
17+
}
18+
}

basic_bar/Containers/Right.qml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import QtQuick
2+
import QtQuick.Layouts
3+
import Quickshell
4+
import Quickshell.Wayland
5+
6+
import "../Data/" as Dat
7+
import "../Widgets/" as Wid
8+
9+
Item {
10+
RowLayout {
11+
anchors.bottom: parent.bottom
12+
anchors.right: parent.right
13+
anchors.top: parent.top
14+
layoutDirection: Qt.RightToLeft
15+
16+
Wid.Session {
17+
}
18+
19+
Wid.PowerProfs {
20+
}
21+
}
22+
}

basic_bar/Data/Audio.qml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
pragma Singleton
2+
import QtQuick
3+
import Quickshell
4+
import Quickshell.Services.Pipewire
5+
6+
// WARNING don't forget to track nodes with PwNodeObjectTracler
7+
Singleton {
8+
id: root
9+
10+
function getSinkIcon(node: PwNode): string {
11+
return (node.muted) ? "󰝟" : (node.volume > 0.5) ? "󰕾" : (node.volume > 0.01) ? "󰖀" : "󰕿";
12+
}
13+
14+
function getSourceIcon(node: PwNode): string {
15+
return (node.muted) ? "󰍭" : "󰍬";
16+
}
17+
18+
function toggleMute(node: PwNode) {
19+
node.audio.muted = !node.audio.muted;
20+
}
21+
22+
function wheelAction(event: WheelEvent, node: PwNode) {
23+
if (event.angleDelta.y < 0) {
24+
node.audio.volume -= 0.01;
25+
} else {
26+
node.audio.volume += 0.01;
27+
}
28+
29+
if (node.audio.volume > 1.3) {
30+
node.audio.volume = 1.3;
31+
}
32+
if (root.sink.audio.volume < 0) {
33+
node.audio.volume = 0.0;
34+
}
35+
}
36+
}

basic_bar/Data/Colors.qml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
pragma Singleton
2+
import Quickshell
3+
import QtQuick
4+
5+
Singleton {
6+
7+
// light theme for testing purposes
8+
// feel free to uncomment to get flash banged lol
9+
10+
// readonly property color background: "#f4fafb"
11+
// readonly property color error: "#ba1a1a"
12+
// readonly property color error_container: "#ffdad6"
13+
// readonly property color inverse_on_surface: "#ecf2f2"
14+
// readonly property color inverse_primary: "#80d4da"
15+
// readonly property color inverse_surface: "#2b3232"
16+
// readonly property color on_background: "#161d1d"
17+
// readonly property color on_error: "#ffffff"
18+
// readonly property color on_error_container: "#410002"
19+
// readonly property color on_primary: "#ffffff"
20+
// readonly property color on_primary_container: "#002022"
21+
// readonly property color on_primary_fixed: "#002022"
22+
// readonly property color on_primary_fixed_variant: "#004f53"
23+
// readonly property color on_secondary: "#ffffff"
24+
// readonly property color on_secondary_container: "#041f21"
25+
// readonly property color on_secondary_fixed: "#041f21"
26+
// readonly property color on_secondary_fixed_variant: "#324b4d"
27+
// readonly property color on_surface: "#161d1d"
28+
// readonly property color on_surface_variant: "#3f4949"
29+
// readonly property color on_tertiary: "#ffffff"
30+
// readonly property color on_tertiary_container: "#091b36"
31+
// readonly property color on_tertiary_fixed: "#091b36"
32+
// readonly property color on_tertiary_fixed_variant: "#374764"
33+
// readonly property color outline: "#6f7979"
34+
// readonly property color outline_variant: "#bec8c9"
35+
// readonly property color primary: "#00696e"
36+
// readonly property color primary_container: "#9cf0f6"
37+
// readonly property color primary_fixed: "#9cf0f6"
38+
// readonly property color primary_fixed_dim: "#80d4da"
39+
// readonly property color scrim: "#000000"
40+
// readonly property color secondary: "#4a6365"
41+
// readonly property color secondary_container: "#cce8e9"
42+
// readonly property color secondary_fixed: "#cce8e9"
43+
// readonly property color secondary_fixed_dim: "#b1cccd"
44+
// readonly property color shadow: "#000000"
45+
// readonly property color source_color: "#478185"
46+
// readonly property color surface: "#f4fafb"
47+
// readonly property color surface_bright: "#f4fafb"
48+
// readonly property color surface_container: "#e9efef"
49+
// readonly property color surface_container_high: "#e3e9e9"
50+
// readonly property color surface_container_highest: "#dde4e4"
51+
// readonly property color surface_container_low: "#eff5f5"
52+
// readonly property color surface_container_lowest: "#ffffff"
53+
// readonly property color surface_dim: "#d5dbdb"
54+
// readonly property color surface_tint: "#00696e"
55+
// readonly property color surface_variant: "#dae4e5"
56+
// readonly property color tertiary: "#4e5f7d"
57+
// readonly property color tertiary_container: "#d6e3ff"
58+
// readonly property color tertiary_fixed: "#d6e3ff"
59+
// readonly property color tertiary_fixed_dim: "#b6c7e9"
60+
61+
readonly property color background: "#121318"
62+
readonly property color error: "#ffb4ab"
63+
readonly property color error_container: "#93000a"
64+
readonly property color inverse_on_surface: "#2f3036"
65+
readonly property color inverse_primary: "#4d5c92"
66+
readonly property color inverse_surface: "#e3e1e9"
67+
readonly property color on_background: "#e3e1e9"
68+
readonly property color on_error: "#690005"
69+
readonly property color on_error_container: "#ffdad6"
70+
readonly property color on_primary: "#1d2d61"
71+
readonly property color on_primary_container: "#dce1ff"
72+
readonly property color on_primary_fixed: "#04174b"
73+
readonly property color on_primary_fixed_variant: "#354479"
74+
readonly property color on_secondary: "#2b3042"
75+
readonly property color on_secondary_container: "#dee1f9"
76+
readonly property color on_secondary_fixed: "#161b2c"
77+
readonly property color on_secondary_fixed_variant: "#424659"
78+
readonly property color on_surface: "#e3e1e9"
79+
readonly property color on_surface_variant: "#c6c5d0"
80+
readonly property color on_tertiary: "#432740"
81+
readonly property color on_tertiary_container: "#ffd7f5"
82+
readonly property color on_tertiary_fixed: "#2c122a"
83+
readonly property color on_tertiary_fixed_variant: "#5b3d57"
84+
readonly property color outline: "#90909a"
85+
readonly property color outline_variant: "#45464f"
86+
readonly property color primary: "#b6c4ff"
87+
readonly property color primary_container: "#354479"
88+
readonly property color primary_fixed: "#dce1ff"
89+
readonly property color primary_fixed_dim: "#b6c4ff"
90+
readonly property color scrim: "#000000"
91+
readonly property color secondary: "#c2c5dd"
92+
readonly property color secondary_container: "#424659"
93+
readonly property color secondary_fixed: "#dee1f9"
94+
readonly property color secondary_fixed_dim: "#c2c5dd"
95+
readonly property color shadow: "#000000"
96+
readonly property color surface: "#121318"
97+
readonly property color surface_bright: "#38393f"
98+
readonly property color surface_container: "#1e1f25"
99+
readonly property color surface_container_high: "#292a2f"
100+
readonly property color surface_container_highest: "#34343a"
101+
readonly property color surface_container_low: "#1a1b21"
102+
readonly property color surface_container_lowest: "#0d0e13"
103+
readonly property color surface_dim: "#121318"
104+
readonly property color surface_tint: "#b6c4ff"
105+
readonly property color tertiary: "#e3bada"
106+
readonly property color tertiary_container: "#5b3d57"
107+
readonly property color tertiary_fixed: "#ffd7f5"
108+
readonly property color tertiary_fixed_dim: "#e3bada"
109+
110+
function withAlpha(color: color, alpha: real): color {
111+
return Qt.rgba(color.r, color.g, color.b, alpha);
112+
}
113+
}

basic_bar/Data/Fonts.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pragma Singleton
2+
import Quickshell
3+
4+
Singleton {
5+
readonly property string caskaydia: "CaskaydiaMono Nerd"
6+
readonly property string dejavuSans: "Dejavu Sans"
7+
readonly property string hurricane: "Hurricane"
8+
readonly property string jpKaisei: "Kaisei Decol"
9+
readonly property string rye: "Rye"
10+
}

basic_bar/Data/Time.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pragma Singleton
2+
import Quickshell
3+
import QtQuick
4+
5+
SystemClock {
6+
id: clock
7+
8+
enabled: true
9+
precision: SystemClock.Seconds
10+
}

basic_bar/Generics/MatIcon.qml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// a thin wrapper for Material Symbols
2+
import QtQuick
3+
import "../Data/" as Dat
4+
5+
Text {
6+
id: root
7+
8+
property real fill: 0
9+
property int grad: 0
10+
required property string icon
11+
12+
font.family: "Material Symbols Rounded"
13+
font.hintingPreference: Font.PreferFullHinting
14+
15+
// refer https://developers.google.com/fonts/docs/material_symbols
16+
font.variableAxes: {
17+
"FILL": root.fill,
18+
"opsz": root.fontInfo.pixelSize,
19+
// "GRAD": root.grad,
20+
"wght": root.fontInfo.weight
21+
}
22+
renderType: Text.NativeRendering
23+
text: root.icon
24+
25+
Behavior on fill {
26+
NumberAnimation {
27+
duration: 180
28+
easing.type: Easing.InOutQuad
29+
}
30+
}
31+
}

basic_bar/Generics/MouseArea.qml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import QtQuick
2+
import "../Data/" as Dat
3+
4+
MouseArea {
5+
id: area
6+
7+
property real clickOpacity: 0.2
8+
property real hoverOpacity: 0.08
9+
property color layerColor: "white"
10+
property NumberAnimation layerOpacityAnimation: NumberAnimation {
11+
duration: 200
12+
easing.type: Easing.InOutQuad
13+
}
14+
property int layerRadius: parent?.radius ?? 0
15+
property alias layerRect: layer
16+
17+
anchors.fill: parent
18+
hoverEnabled: true
19+
20+
onContainsMouseChanged: layer.opacity = (area.containsMouse) ? area.hoverOpacity : 0
21+
onContainsPressChanged: layer.opacity = (area.containsPress) ? area.clickOpacity : area.hoverOpacity
22+
23+
Rectangle {
24+
id: layer
25+
26+
anchors.fill: parent
27+
color: area.layerColor
28+
opacity: 0
29+
radius: area.layerRadius
30+
31+
Behavior on opacity {
32+
animation: area.layerOpacityAnimation
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)