bar: component loader

This commit is contained in:
end-4
2026-02-03 18:17:02 +01:00
parent 680d8e85c8
commit 0e049db304
9 changed files with 228 additions and 39 deletions
@@ -50,7 +50,7 @@ Singleton {
interval: root.readWriteDelay
repeat: false
onTriggered: {
configFileView.reload()
configFileView.reload();
}
}
@@ -59,7 +59,7 @@ Singleton {
interval: root.readWriteDelay
repeat: false
onTriggered: {
configFileView.writeAdapter()
configFileView.writeAdapter();
}
}
@@ -92,12 +92,16 @@ Singleton {
property string tool: "functions" // search, functions, or none
property list<var> extraModels: [
{
"api_format": "openai", // Most of the time you want "openai". Use "gemini" for Google's models
"api_format": "openai" // Most of the time you want "openai". Use "gemini" for Google's models
,
"description": "This is a custom model. Edit the config to add more! | Anyway, this is DeepSeek R1 Distill LLaMA 70B",
"endpoint": "https://openrouter.ai/api/v1/chat/completions",
"homepage": "https://openrouter.ai/deepseek/deepseek-r1-distill-llama-70b:free", // Not mandatory
"icon": "spark-symbolic", // Not mandatory
"key_get_link": "https://openrouter.ai/settings/keys", // Not mandatory
"homepage": "https://openrouter.ai/deepseek/deepseek-r1-distill-llama-70b:free" // Not mandatory
,
"icon": "spark-symbolic" // Not mandatory
,
"key_get_link": "https://openrouter.ai/settings/keys" // Not mandatory
,
"key_id": "openrouter",
"model": "deepseek/deepseek-r1-distill-llama-70b:free",
"name": "Custom: DS R1 Dstl. LLaMA 70B",
@@ -240,9 +244,15 @@ Singleton {
property bool floatStyleShadow: true // Show shadow behind bar when cornerStyle == 1 (Float)
property bool borderless: false // true for no grouping of items
property string topLeftIcon: "spark" // Options: "distro" or any icon name in ~/.config/quickshell/ii/assets/icons
property list<string> screenList: [] // List of names, like "eDP-1", find out with 'hyprctl monitors' command
property bool showBackground: true
property bool verbose: true
property bool vertical: false
property JsonObject indicators: JsonObject {
property JsonObject notifications: JsonObject {
property bool showUnreadCount: false
}
}
property JsonObject resources: JsonObject {
property bool alwaysShowSwap: true
property bool alwaysShowCpu: true
@@ -250,7 +260,9 @@ Singleton {
property int swapWarningThreshold: 85
property int cpuWarningThreshold: 90
}
property list<string> screenList: [] // List of names, like "eDP-1", find out with 'hyprctl monitors' command
property JsonObject tooltips: JsonObject {
property bool clickToShow: false
}
property JsonObject utilButtons: JsonObject {
property bool showScreenSnip: true
property bool showColorPicker: false
@@ -260,6 +272,13 @@ Singleton {
property bool showPerformanceProfileToggle: false
property bool showScreenRecord: false
}
property JsonObject weather: JsonObject {
property bool enable: false
property bool enableGPS: true // gps based location
property string city: "" // When 'enableGPS' is false
property bool useUSCS: false // Instead of metric (SI) units
property int fetchInterval: 10 // minutes
}
property JsonObject workspaces: JsonObject {
property bool monochromeIcons: true
property int shown: 10
@@ -269,21 +288,6 @@ Singleton {
property list<string> numberMap: ["1", "2"] // Characters to show instead of numbers on workspace indicator
property bool useNerdFont: false
}
property JsonObject weather: JsonObject {
property bool enable: false
property bool enableGPS: true // gps based location
property string city: "" // When 'enableGPS' is false
property bool useUSCS: false // Instead of metric (SI) units
property int fetchInterval: 10 // minutes
}
property JsonObject indicators: JsonObject {
property JsonObject notifications: JsonObject {
property bool showUnreadCount: false
}
}
property JsonObject tooltips: JsonObject {
property bool clickToShow: false
}
}
property JsonObject battery: JsonObject {
@@ -343,7 +347,8 @@ Singleton {
property int mouseScrollFactor: 120
property int touchpadScrollFactor: 450
}
property JsonObject deadPixelWorkaround: JsonObject { // Hyprland leaves out 1 pixel on the right for interactions
property JsonObject deadPixelWorkaround: JsonObject {
// Hyprland leaves out 1 pixel on the right for interactions
property bool enable: false
}
}
@@ -358,7 +363,7 @@ Singleton {
}
property JsonObject launcher: JsonObject {
property list<string> pinnedApps: [ "org.kde.dolphin", "kitty", "cmake-gui"]
property list<string> pinnedApps: ["org.kde.dolphin", "kitty", "cmake-gui"]
}
property JsonObject light: JsonObject {
@@ -463,7 +468,7 @@ Singleton {
property bool monochromeIcons: true
property bool showItemId: false
property bool invertPinnedItems: true // Makes the below a whitelist for the tray and blacklist for the pinned area
property list<var> pinnedItems: [ "Fcitx" ]
property list<var> pinnedItems: ["Fcitx"]
property bool filterPassive: true
}
@@ -527,12 +532,30 @@ Singleton {
property JsonObject android: JsonObject {
property int columns: 5
property list<var> toggles: [
{ "size": 2, "type": "network" },
{ "size": 2, "type": "bluetooth" },
{ "size": 1, "type": "idleInhibitor" },
{ "size": 1, "type": "mic" },
{ "size": 2, "type": "audio" },
{ "size": 2, "type": "nightLight" }
{
"size": 2,
"type": "network"
},
{
"size": 2,
"type": "bluetooth"
},
{
"size": 1,
"type": "idleInhibitor"
},
{
"size": 1,
"type": "mic"
},
{
"size": 2,
"type": "audio"
},
{
"size": 2,
"type": "nightLight"
}
]
}
}
@@ -546,7 +569,7 @@ Singleton {
}
property JsonObject screenRecord: JsonObject {
property string savePath: Directories.videos.replace("file://","") // strip "file://"
property string savePath: Directories.videos.replace("file://", "") // strip "file://"
}
property JsonObject screenSnip: JsonObject {
@@ -580,11 +603,11 @@ Singleton {
property int adviseUpdateThreshold: 75 // packages
property int stronglyAdviseUpdateThreshold: 200 // packages
}
property JsonObject wallpaperSelector: JsonObject {
property bool useSystemFileDialog: false
}
property JsonObject windows: JsonObject {
property bool showTitlebar: true // Client-side decoration for shell apps
property bool centerTitle: true
@@ -59,6 +59,7 @@ Singleton {
// Cleanup on init
Component.onCompleted: {
Quickshell.execDetached(["mkdir", "-p", `${shellConfig}`])
Quickshell.execDetached(["mkdir", "-p", `${userComponents}`])
Quickshell.execDetached(["mkdir", "-p", `${favicons}`])
Quickshell.execDetached(["bash", "-c", `rm -rf '${coverArt}'; mkdir -p '${coverArt}'`])
Quickshell.execDetached(["bash", "-c", `rm -rf '${booruPreviews}'; mkdir -p '${booruPreviews}'`])
@@ -7,5 +7,6 @@ JsonObject {
property list<var> leftWidgets: []
property list<var> centerWidgets: []
property list<var> rightWidgets: []
property bool m3ExpressiveGrouping: true
}
}
@@ -0,0 +1,21 @@
import QtQuick
import qs.modules.common as C
// This is to enable future fancy styles for rectangles. Some ideas:
// - normal rounded rect
// - osk.sh
// - 3d
// i hope i actually get to this and not shrimply forget
Rectangle {
enum ContentLayer { Background, Pane, Group, Subgroup, Control }
property var contentLayer: StyledRectangle.ContentLayer.Pane // To appropriately add effects like shadows/3d-ization
color: switch(contentLayer) {
case StyledRectangle.ContentLayer.Background: C.Appearance.colors.colLayer0;
case StyledRectangle.ContentLayer.Pane: C.Appearance.colors.colLayer1;
case StyledRectangle.ContentLayer.Group: C.Appearance.colors.colLayer2;
case StyledRectangle.ContentLayer.Subgroup: C.Appearance.colors.colLayer3;
case StyledRectangle.ContentLayer.Control: C.Appearance.colors.colLayer4;
default: C.Appearance.colors.colLayer1;
}
}
@@ -0,0 +1,17 @@
import QtQuick
import qs.modules.common as C
FallbackLoader {
id: root
required property string componentName
property string context // Path for the builtin component
readonly property string componentNameWithExt: componentName.endsWith(".qml") ? componentName : `${componentName}.qml`
source: `${C.Directories.userComponents}/${componentNameWithExt}`
fallbacks: [
...(context ? [ `${context}/${componentNameWithExt}` ] : []),
componentNameWithExt
]
}
@@ -16,11 +16,8 @@ Item {
Side {
id: centerSide
anchors.horizontalCenter: parent.horizontalCenter
FallbackLoader {
asynchronous: true
source: "/home/end/.config/quickshell/ii/modules/ii/bar/WrongModuleName"
fallbacks: ["/home/end/.config/quickshell/ii/modules/ii/bar/Workspaces.qml"]
HBarUserFallbackComponentRepeater {
componentNames: [["Workspaces"]]
}
}
@@ -0,0 +1,57 @@
import QtQuick
import QtQuick.Layouts
import qs.modules.common as C
import qs.modules.common.widgets as W
Item {
id: root
property bool startSide: false
property bool endSide: false
property alias color: bg.color
property real margins: 4
property real padding: 4
default property alias data: layout.data
readonly property bool vertical: C.Config.options.bar.vertical
readonly property bool m3eRadius: C.Config.options.hefty.bar.m3ExpressiveGrouping
readonly property real barUndirectionalWidth: C.Config.options.bar.vertical ? C.Appearance.sizes.baseVerticalBarWidth : C.Appearance.sizes.baseBarHeight
implicitWidth: vertical ? barUndirectionalWidth : layout.implicitWidth + (padding + margins) * 2
implicitHeight: vertical ? layout.implicitHeight + (padding + margins) * 2 : barUndirectionalWidth
W.StyledRectangle {
id: bg
anchors.centerIn: parent
contentLayer: W.StyledRectangle.ContentLayer.Pane
width: (root.vertical ? root.barUndirectionalWidth : root.width) - root.margins * 2
height: (root.vertical ? root.height : root.barUndirectionalWidth) - root.margins * 2
property real fullRadius: Math.min(width, height) / 2
function getRadius(atSide) {
if (root.m3eRadius) {
if (atSide) return fullRadius;
else return C.Appearance.rounding.unsharpenmore;
} else {
return 12;
}
}
property real startRadius: getRadius(root.startSide)
property real endRadius: getRadius(root.endSide)
topLeftRadius: startRadius
topRightRadius: root.vertical ? startRadius : endRadius
bottomLeftRadius: root.vertical ? endRadius : startRadius
bottomRightRadius: endRadius
}
GridLayout {
id: layout
columns: C.Config.options.bar.vertical ? 1 : -1
anchors.centerIn: parent
property real spacing: 0
columnSpacing: spacing
rowSpacing: spacing
}
}
@@ -0,0 +1,61 @@
pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import qs.modules.common as C
import qs.modules.common.widgets as W
Repeater {
id: root
required property list<var> componentNames
property string context: Quickshell.shellPath("modules/hefty/topLayer/bar/widgets")
model: {
const m = componentNames.map(item => {
if (item instanceof Array)
return ({"type": "container", "value": item});
else
return ({"type": "component", "value": item});
});
for (var i = 0;i < m.length; i++) {
const item = m[i];
if (item.type === "container") {
item.startSide = (i === 0) || (m[i - 1].type !== "container");
item.endSide = (i + 1 >= m.length) || (m[i + 1].type !== "container");
}
}
// print(JSON.stringify(m, null, 2));
return m;
}
delegate: DelegateChooser {
role: "type"
DelegateChoice {
roleValue: "component"
delegate: W.UserFallbackLoader {
required property var modelData
componentName: modelData.value
context: root.context
}
}
DelegateChoice {
roleValue: "container"
delegate: HBarGroupContainer {
id: group
required property var modelData
startSide: modelData.startSide
endSide: modelData.endSide
Repeater {
model: group.modelData.value
delegate: W.UserFallbackLoader {
required property var modelData
componentName: modelData
context: root.context
}
}
}
}
}
}
@@ -0,0 +1,11 @@
import QtQuick
import QtQuick.Layouts
import qs.modules.ii.bar as IIBar
import qs.modules.common as C
IIBar.Workspaces {
id: root
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
implicitWidth: root.vertical ? C.Appearance.sizes.verticalBarWidth : (root.workspaceButtonWidth * root.workspacesShown - 2)
implicitHeight: root.vertical ? (root.workspaceButtonWidth * root.workspacesShown - 2) : C.Appearance.sizes.barHeight
}