From 5158f3ff8f7150a03205a6ed925b3f790ff75d7c Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Fri, 9 Aug 2024 11:54:07 +0200 Subject: [PATCH] quickshell fixes --- flake.lock | 16 ++++++++++ flake.nix | 3 ++ hosts/default.nix | 8 +++++ hosts/vali/temperance/programs.nix | 1 + modules/gui/schizofox/default.nix | 4 +-- modules/other/home-manager.nix | 3 +- modules/styling/quickshell/bar/Bar.qml | 27 ++-------------- .../styling/quickshell/bar/ClockWidget.qml | 31 +++++++++++++++++++ modules/styling/quickshell/bar/time/Time.qml | 28 +++++++++++++++++ modules/styling/quickshell/default.nix | 4 ++- 10 files changed, 96 insertions(+), 29 deletions(-) create mode 100644 modules/styling/quickshell/bar/ClockWidget.qml create mode 100644 modules/styling/quickshell/bar/time/Time.qml diff --git a/flake.lock b/flake.lock index 356e316..b6fc962 100644 --- a/flake.lock +++ b/flake.lock @@ -963,6 +963,21 @@ "type": "github" } }, + "impurity": { + "locked": { + "lastModified": 1689836741, + "narHash": "sha256-82KeRg2sAqDXCdzVs8P8GoqVaPsZjkWgrfsj6kgOLTY=", + "owner": "outfoxxed", + "repo": "impurity.nix", + "rev": "bbc41b69ab5485cd55aa315d08cff865781d3913", + "type": "github" + }, + "original": { + "owner": "outfoxxed", + "repo": "impurity.nix", + "type": "github" + } + }, "lib-aggregate": { "inputs": { "flake-utils": "flake-utils_6", @@ -3326,6 +3341,7 @@ "home-manager": "home-manager", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", + "impurity": "impurity", "neovim-flake": "neovim-flake", "nix-super": "nix-super", "nixos-hardware": "nixos-hardware", diff --git a/flake.nix b/flake.nix index a55c08e..b978baf 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,9 @@ # Helix my beloved helix.url = "github:helix-editor/helix"; + # Impurity, ruining my nice pure system + impurity.url = "github:outfoxxed/impurity.nix"; + # Hyprland, my main compositor hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; diff --git a/hosts/default.nix b/hosts/default.nix index fc0c12d..a7f4b70 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -38,6 +38,14 @@ in { ./vali/temperance ../modules inputs.home-manager.nixosModules.home-manager + + { + imports = [inputs.impurity.nixosModules.impurity]; + impurity = { + enable = true; + configRoot = self; + }; + } ]; }; diff --git a/hosts/vali/temperance/programs.nix b/hosts/vali/temperance/programs.nix index 9af861f..6e44220 100644 --- a/hosts/vali/temperance/programs.nix +++ b/hosts/vali/temperance/programs.nix @@ -43,6 +43,7 @@ in { keepassxc krita lazygit + libreoffice librewolf libtool links2 diff --git a/modules/gui/schizofox/default.nix b/modules/gui/schizofox/default.nix index 15bcebf..a170ba1 100644 --- a/modules/gui/schizofox/default.nix +++ b/modules/gui/schizofox/default.nix @@ -36,8 +36,8 @@ in { */ #TabsToolbar {visibility: collapse;} - /* #navigator-toolbox {visibility: collapse;} */ - browser {margin-right: -14px; margin-bottom: -14px;} + /* #navigator-toolbox {visibility: collapse;} + browser {margin-right: -14px; margin-bottom: -14px;} */ ''; }; diff --git a/modules/other/home-manager.nix b/modules/other/home-manager.nix index 3701b58..f74fd14 100644 --- a/modules/other/home-manager.nix +++ b/modules/other/home-manager.nix @@ -3,6 +3,7 @@ inputs, lib, self, + impurity, ... }: with lib; let @@ -20,7 +21,7 @@ in { useUserPackages = true; useGlobalPkgs = true; backupFileExtension = "hm.old"; - extraSpecialArgs = {inherit inputs self;}; + extraSpecialArgs = {inherit inputs self impurity;}; users.${username} = { programs = { home-manager.enable = true; diff --git a/modules/styling/quickshell/bar/Bar.qml b/modules/styling/quickshell/bar/Bar.qml index bc95eb2..307b541 100644 --- a/modules/styling/quickshell/bar/Bar.qml +++ b/modules/styling/quickshell/bar/Bar.qml @@ -3,8 +3,6 @@ import Quickshell.Io // For Processes import QtQuick // For Text Scope { - id: root - property string time; Variants { model: Quickshell.screens @@ -14,37 +12,16 @@ Scope { screen: modelData anchors { - top: true + bottom: true left: true right: true } height: 30 - Text { + ClockWidget { anchors.centerIn: parent - - // now just time instead of root.time - text: time } } } - - Process { - id: dateProc - command: ["date"] - running: true - - stdout: SplitParser { - // now just time instead of root.time - onRead: data => time = data - } - } - - Timer { - interval: 1000 - running: true - repeat: true - onTriggered: dateProc.running = true - } } diff --git a/modules/styling/quickshell/bar/ClockWidget.qml b/modules/styling/quickshell/bar/ClockWidget.qml new file mode 100644 index 0000000..f7d45fa --- /dev/null +++ b/modules/styling/quickshell/bar/ClockWidget.qml @@ -0,0 +1,31 @@ + +import Quickshell.Io +import QtQuick +import QtQuick.Layouts + +Item { + property string time + + Text { + text: time + } + + Process { + id: dateProc + command: ["date", "-u", "+%a, %d %b %H:%M:%S"] + running: true + + stdout: SplitParser { + onRead: data => time = data + } + } + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: dateProc.running = true + } + +} + diff --git a/modules/styling/quickshell/bar/time/Time.qml b/modules/styling/quickshell/bar/time/Time.qml new file mode 100644 index 0000000..6750d42 --- /dev/null +++ b/modules/styling/quickshell/bar/time/Time.qml @@ -0,0 +1,28 @@ +// with this line our type becomes a singleton +pragma Singleton + +import Quickshell +import Quickshell.Io +import QtQuick + +// your singletons should always have Singleton as the type +Singleton { + property string time + + Process { + id: dateProc + command: ["date"] + running: true + + stdout: SplitParser { + onRead: data => time = data + } + } + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: dateProc.running = true + } +} diff --git a/modules/styling/quickshell/default.nix b/modules/styling/quickshell/default.nix index 5317555..46f1141 100644 --- a/modules/styling/quickshell/default.nix +++ b/modules/styling/quickshell/default.nix @@ -3,6 +3,7 @@ lib, inputs, pkgs, + impurity, ... }: let inherit (inputs) quickshell; @@ -20,7 +21,8 @@ in { pamtester ]; home-manager.users.${username}.xdg.configFile."quickshell/manifest.conf".text = toKeyValue {} { - bar = "${./bar}"; + bar = "${impurity.link ./bar}"; + # bar = "${./bar}"; }; }; }