moving away from stylix

This commit is contained in:
Charlie Root 2024-08-15 23:13:09 +02:00
commit 8f63946c67
18 changed files with 35 additions and 13 deletions

View file

@ -0,0 +1,9 @@
_: {
imports = [
./stylix.nix
./quickshell
./qt.nix
./gtk.nix
./module.nix
];
}

57
modules/style/gtk.nix Normal file
View file

@ -0,0 +1,57 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.theming.gtk;
inherit (config.modules.other.system) username;
in {
options.modules.theming.gtk = {
enable = mkEnableOption "gtk theming";
name = mkOption {
description = "gtk theme name";
type = types.str;
};
package = mkOption {
description = "gtk theme package";
type = types.package;
};
# iconTheme = mkOption {
# description = "gtk icon theme";
# type = with types; submodule {
# options = {
# name = mkOption {
# description = "gtk icon theme name";
# type = str;
# };
# package = mkOption {
# description = "gtk icon theme package";
# type = package;
# };
# };
# };
# };
};
config = mkIf cfg.enable {
home-manager.users.${username} = {
gtk = {
enable = true;
# theme = {
# package = pkgs.gruvbox-gtk-theme;
# name = "Gruvbox-Dark-BL";
# };
iconTheme = {
name = "Papirus-Dark";
package = pkgs.catppuccin-papirus-folders;
};
};
home.sessionVariables = {
#GTK_THEME = "Gruvbox-Dark-BL";
# GTK_USE_PORTAL = "1";
};
};
};
}

18
modules/style/module.nix Normal file
View file

@ -0,0 +1,18 @@
{config, ...}: let
inherit (config.modules.style.cursor) package name size;
inherit (config.modules.other.system) username;
in {
home-manager.users.${username} = {
home.pointerCursor = {
# inherit the default values set in the options,
# since these are the once I need on all my systems.
inherit package name size;
# make gtk follow the cursor choices
gtk.enable = true;
# ditto
x11.enable = true;
};
};
}

59
modules/style/qt.nix Normal file
View file

@ -0,0 +1,59 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
theme = {
package = pkgs.gruvbox-gtk-theme;
name = "Gruvbox-Dark-BL";
};
cfg = config.modules.theming.qt;
inherit (config.modules.other.system) username;
in {
options.modules.theming.qt = {
enable = mkEnableOption "qt theming";
name = mkOption {
description = "qt theme name";
type = types.str;
};
variant = mkOption {
description = "qt theme variant";
type = types.str;
};
accentColour = mkOption {
description = "accent colour for qt theme";
type = types.str;
};
package = mkOption {
description = "qt theme package";
type = types.package;
};
};
config = mkIf cfg.enable {
environment.sessionVariables = {QT_QPA_PLATFORMTHEME = "qt5ct";};
environment.variables = {
QT_STYLE_OVERRIDE = lib.mkForce "kvantum";
GTK_THEME = theme.name;
};
home-manager.users.${username} = {
qt = {
enable = true;
# style = {
# inherit (cfg) name package;
# };
};
home = {
packages = with pkgs; [
qt5.qttools
libsForQt5.qt5ct
libsForQt5.qtstyleplugin-kvantum
breeze-icons
];
};
};
};
}

View file

@ -0,0 +1,27 @@
import Quickshell // for ShellRoot and PanelWindow
import Quickshell.Io // For Processes
import QtQuick // For Text
Scope {
Variants {
model: Quickshell.screens
PanelWindow {
property var modelData
screen: modelData
anchors {
bottom: true
left: true
right: true
}
height: 25
ClockWidget {
anchors.centerIn: parent
}
}
}
}

View file

@ -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
}
}

View file

@ -0,0 +1,6 @@
import Quickshell // for ShellRoot and PanelWindow
ShellRoot {
Bar {}
}

View file

@ -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
}
}

View 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)
});
}
}

View file

@ -0,0 +1,28 @@
{
config,
lib,
inputs,
pkgs,
impurity,
...
}: 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."x86_64-linux".default
pamtester
];
home-manager.users.${username}.xdg.configFile."quickshell/manifest.conf".text = toKeyValue {} {
# bar = "${impurity.link ./bar}";
# bar = "${./bar}";
};
};
}

105
modules/style/stylix.nix Normal file
View file

@ -0,0 +1,105 @@
{
config,
inputs,
pkgs,
lib,
...
}: let
cfg = config.modules.usrEnv.style.stylix;
inherit (config.modules.usrEnv.style.stylix) image cursor fontsizes;
inherit (config.modules.other.system) username;
inherit (lib) mkIf;
in {
imports = [inputs.stylix.nixosModules.stylix];
config = mkIf cfg.enable {
stylix = {
enable = false;
autoEnable = false;
homeManagerIntegration = {
followSystem = true;
autoImport = true;
};
# base16Scheme = scheme;
base16Scheme = {
scheme = "3024-custom";
# base00 = "090300"; # ----
base00 = "000000"; # Black
base01 = "3a3432"; # Dark grey
base02 = "4a4543"; # Lighter grey
base03 = "5c5855"; # Light greLight grey
base04 = "807d7c"; # +
base05 = "a5a2a2"; # ++
base06 = "d6d5d4"; # +++
base07 = "f7f7f7"; # ++++
base08 = "db2d20"; # red
base09 = "e8bbd0"; # orange
base0A = "fded02"; # yellow
base0B = "01a252"; # green
base0C = "b5e4f4"; # aqua
base0D = "01a0e4"; # blue
base0E = "a16a94"; # purple
base0F = "cdab53"; # brown
};
inherit image;
polarity = "dark";
cursor = {
inherit (cursor) size package name;
# package = pkgs.bibata-cursors;
# name = "Bibata-Modern-Classic";
};
fonts = {
sizes = {
inherit (fontsizes) terminal popups applications;
};
monospace = {
package =
pkgs.nerdfonts.override {fonts = ["JetBrainsMono" "ComicShannsMono"];};
# name = "JetBrainsMono";
name = "ComicShannsMono Nerd Font";
};
serif = config.stylix.fonts.monospace;
sansSerif = config.stylix.fonts.monospace;
emoji = {
package = pkgs.noto-fonts-color-emoji;
name = "Noto Color Emoji";
};
};
opacity = {
applications = 1.0;
popups = 1.0;
desktop = 1.0;
terminal = 1.0;
};
targets = {
console.enable = true;
fish.enable = true;
grub.enable = false;
grub.useImage = true;
gtk.enable = true;
lightdm.enable = true;
nixos-icons.enable = true;
plymouth.enable = true;
plymouth.logoAnimated = true;
};
};
home-manager.users.${username} = {
stylix.targets = {
btop.enable = true;
helix.enable = true;
dunst.enable = true;
firefox.enable = true;
foot.enable = true;
fzf.enable = true;
hyprland.enable = true;
lazygit.enable = true;
emacs.enable = true;
kde.enable = true;
yazi.enable = true;
zellij.enable = true;
};
};
};
}