provide basic descriptions for services

This commit is contained in:
end-4
2025-05-26 10:46:07 +02:00
parent f765fdf531
commit ede03f61bf
21 changed files with 85 additions and 14 deletions
@@ -1,6 +1,9 @@
import "root:/modules/common" import "root:/modules/common"
import QtQuick; import QtQuick;
/**
* Represents a message in an AI conversation. (Kind of) follows the OpenAI API message structure.
*/
QtObject { QtObject {
property string role property string role
property string content property string content
@@ -4,6 +4,9 @@ import "root:/modules/common/functions/fuzzysort.js" as Fuzzy
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
/**
* Eases searching for applications by name.
*/
Singleton { Singleton {
id: root id: root
+3
View File
@@ -4,6 +4,9 @@ import Quickshell.Services.Pipewire
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
/**
* A nice wrapper for default Pipewire audio sink and source.
*/
Singleton { Singleton {
id: root id: root
@@ -5,6 +5,9 @@ import Quickshell;
import Quickshell.Io; import Quickshell.Io;
import QtQuick; import QtQuick;
/**
* Basic polled Bluetooth state.
*/
Singleton { Singleton {
id: root id: root
+3
View File
@@ -7,6 +7,9 @@ import Quickshell.Io;
import Qt.labs.platform import Qt.labs.platform
import QtQuick; import QtQuick;
/**
* A service for interacting with various booru APIs.
*/
Singleton { Singleton {
id: root id: root
property Component booruResponseDataComponent: BooruResponseData {} property Component booruResponseDataComponent: BooruResponseData {}
@@ -1,6 +1,9 @@
import "root:/modules/common" import "root:/modules/common"
import QtQuick; import QtQuick;
/**
* A booru response.
*/
QtObject { QtObject {
property string provider property string provider
property var tags property var tags
+4 -1
View File
@@ -1,7 +1,7 @@
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
// From https://github.com/caelestia-dots/shell/ (`quickshell` branch) // From https://github.com/caelestia-dots/shell/ (`quickshell` branch) with modifications.
// It does not have a license, but the author has given permission. // It does not have a license, but the author has given permission.
import Quickshell import Quickshell
@@ -9,6 +9,9 @@ import Quickshell.Io
import Quickshell.Hyprland import Quickshell.Hyprland
import QtQuick import QtQuick
/**
* For managing brightness of monitors. Supports both brightnessctl and ddcutil.
*/
Singleton { Singleton {
id: root id: root
@@ -10,6 +10,11 @@ import Quickshell.Io
import Quickshell.Hyprland import Quickshell.Hyprland
import Qt.labs.platform import Qt.labs.platform
/**
* Loads and manages the shell configuration file.
* The config file is by default at XDG_CONFIG_HOME/illogical-impulse/config.json.
* Automatically reloaded when the file changes, but does not provide a way to save changes.
*/
Singleton { Singleton {
id: root id: root
property string fileDir: `${XdgDirectories.config}/illogical-impulse` property string fileDir: `${XdgDirectories.config}/illogical-impulse`
+3
View File
@@ -5,6 +5,9 @@ import Quickshell.Io
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
/**
* A nice wrapper for date and time strings.
*/
Singleton { Singleton {
property string time: Qt.formatDateTime(clock.date, "hh:mm") property string time: Qt.formatDateTime(clock.date, "hh:mm")
property string date: Qt.formatDateTime(clock.date, "dddd, dd/MM") property string date: Qt.formatDateTime(clock.date, "dddd, dd/MM")
@@ -7,6 +7,9 @@ import Quickshell.Io
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Hyprland import Quickshell.Hyprland
/**
* Provides access to some Hyprland data not available in Quickshell.Hyprland.
*/
Singleton { Singleton {
id: root id: root
property var windowList: [] property var windowList: []
@@ -9,8 +9,15 @@ import Quickshell.Io
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Hyprland import Quickshell.Hyprland
/**
* A service that provides access to Hyprland keybinds.
* Uses the `get_keybinds.py` script to parse comments in config files in a certain format and convert to JSON.
*/
Singleton { Singleton {
id: root id: root
property string keybindParserPath: FileUtils.trimFileProtocol(`${XdgDirectories.config}/quickshell/scripts/hyprland/get_keybinds.py`)
property string defaultKeybindConfigPath: FileUtils.trimFileProtocol(`${XdgDirectories.config}/hypr/hyprland/keybinds.conf`)
property string userKeybindConfigPath: FileUtils.trimFileProtocol(`${XdgDirectories.config}/hypr/custom/keybinds.conf`)
property var defaultKeybinds: {"children": []} property var defaultKeybinds: {"children": []}
property var userKeybinds: {"children": []} property var userKeybinds: {"children": []}
property var keybinds: ({ property var keybinds: ({
@@ -34,8 +41,7 @@ Singleton {
Process { Process {
id: getDefaultKeybinds id: getDefaultKeybinds
running: true running: true
command: [FileUtils.trimFileProtocol(`${XdgDirectories.config}/quickshell/scripts/hyprland/get_keybinds.py`), command: [root.keybindParserPath, "--path", root.defaultKeybindConfigPath,]
"--path", FileUtils.trimFileProtocol(`${XdgDirectories.config}/hypr/hyprland/keybinds.conf`),]
stdout: SplitParser { stdout: SplitParser {
onRead: data => { onRead: data => {
@@ -51,8 +57,7 @@ Singleton {
Process { Process {
id: getUserKeybinds id: getUserKeybinds
running: true running: true
command: [FileUtils.trimFileProtocol(`${XdgDirectories.config}/quickshell/scripts/hyprland/get_keybinds.py`), command: [root.keybindParserPath, "--path", root.userKeybindConfigPath]
"--path", FileUtils.trimFileProtocol(`${XdgDirectories.config}/hypr/custom/keybinds.conf`),]
stdout: SplitParser { stdout: SplitParser {
onRead: data => { onRead: data => {
@@ -8,14 +8,15 @@ import Quickshell.Io;
import Qt.labs.platform import Qt.labs.platform
import QtQuick; import QtQuick;
/**
* For storing sensitive data in the keyring.
* Use this for small data only, since it stores a JSON of the contents directly and doesn't use a database.
*/
Singleton { Singleton {
id: root id: root
property bool loaded: false property bool loaded: false
property var keyringData: ({}) property var keyringData: ({})
// onKeyringDataChanged: {
// console.log("[KeyringStorage] Keyring data changed:", JSON.stringify(root.keyringData));
// }
property var properties: { property var properties: {
"application": "illogical-impulse", "application": "illogical-impulse",
@@ -11,12 +11,12 @@ import Quickshell.Hyprland
import Qt.labs.platform import Qt.labs.platform
/** /**
* Renders LaTeX snippets with MicroTeX. * Renders LaTeX snippets with MicroTeX.
* For every request: * For every request:
* 1. Hash it * 1. Hash it
* 2. Check if the hash is already processed * 2. Check if the hash is already processed
* 3. If not, render it with MicroTeX and mark as processed * 3. If not, render it with MicroTeX and mark as processed
*/ */
Singleton { Singleton {
id: root id: root
@@ -6,6 +6,10 @@ import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
/**
* Automatically reloads generated material colors.
* It is necessary to run reapplyTheme() on startup because Singletons are lazily loaded.
*/
Singleton { Singleton {
id: root id: root
property string filePath: `${XdgDirectories.state}/user/generated/colors.json` property string filePath: `${XdgDirectories.state}/user/generated/colors.json`
@@ -1,12 +1,18 @@
pragma Singleton pragma Singleton
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
// From https://git.outfoxxed.me/outfoxxed/nixnew
// It does not have a license, but the author is okay with redistribution.
import QtQml.Models import QtQml.Models
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Services.Mpris import Quickshell.Services.Mpris
/**
* A service that provides easy access to the active Mpris player.
*/
Singleton { Singleton {
id: root; id: root;
property MprisPlayer trackedPlayer: null; property MprisPlayer trackedPlayer: null;
+3
View File
@@ -6,6 +6,9 @@ import Quickshell.Io;
import Quickshell.Services.Pipewire; import Quickshell.Services.Pipewire;
import QtQuick; import QtQuick;
/**
* Simple polled network state service.
*/
Singleton { Singleton {
id: root id: root
@@ -9,6 +9,12 @@ import Quickshell.Io
import Quickshell.Services.Notifications import Quickshell.Services.Notifications
import Qt.labs.platform import Qt.labs.platform
/**
* Provides extra features not in Quickshell.Services.Notifications:
* - Persistent storage
* - Popup notifications, with timeout
* - Notification groups by app
*/
Singleton { Singleton {
id: root id: root
component Notif: QtObject { component Notif: QtObject {
@@ -9,6 +9,10 @@ import Quickshell.Io
import Quickshell.Hyprland import Quickshell.Hyprland
import Qt.labs.platform import Qt.labs.platform
/**
* Manages persistent states across sessions.
* Run loadStates() once at startup to load the states, then use setState() and getState() to modify and access them.
*/
Singleton { Singleton {
id: root id: root
property string fileDir: XdgDirectories.state property string fileDir: XdgDirectories.state
@@ -6,6 +6,9 @@ import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
/**
* Simple polled resource usage service with RAM, Swap, and CPU usage.
*/
Singleton { Singleton {
property double memoryTotal: 1 property double memoryTotal: 1
property double memoryFree: 1 property double memoryFree: 1
@@ -5,6 +5,9 @@ import QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
/**
* Provides some system info: distro, username.
*/
Singleton { Singleton {
property string distroName: "Unknown" property string distroName: "Unknown"
property string distroId: "unknown" property string distroId: "unknown"
+4
View File
@@ -7,6 +7,10 @@ import Quickshell.Io;
import Qt.labs.platform import Qt.labs.platform
import QtQuick; import QtQuick;
/**
* Simple to-do list manager.
* Each item is an object with "content" and "done" properties.
*/
Singleton { Singleton {
id: root id: root
property var filePath: `${XdgDirectories.state}/user/todo.json` property var filePath: `${XdgDirectories.state}/user/todo.json`