ashell: support yaml and toml config

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-06-29 17:17:51 -05:00
parent f62e9a8114
commit 650a38ebe8
11 changed files with 226 additions and 6 deletions

View file

@ -0,0 +1,8 @@
[modules]
center = ["Window Title"]
left = ["Workspaces"]
right = ["SystemInfo", "Clock"]
[workspaces]
show_empty = true
visibility_mode = "MonitorSpecific"

View file

@ -0,0 +1,34 @@
{ pkgs, ... }:
let
ashellPackage = pkgs.runCommand "ashell-0.5.0" { } ''
mkdir -p $out/bin
echo '#!/bin/sh' > $out/bin/ashell
chmod +x $out/bin/ashell
'';
in
{
programs.ashell = {
enable = true;
package = ashellPackage;
settings = {
modules = {
left = [ "Workspaces" ];
center = [ "Window Title" ];
right = [
"SystemInfo"
"Clock"
];
};
workspaces = {
visibility_mode = "MonitorSpecific";
show_empty = true;
};
};
};
nmt.script = ''
assertFileExists home-files/.config/ashell/config.toml
assertFileContent home-files/.config/ashell/config.toml ${./basic-toml-config-expected.toml}
'';
}

View file

@ -0,0 +1,11 @@
modules:
center:
- Window Title
left:
- Workspaces
right:
- SystemInfo
- Clock
workspaces:
showEmpty: true
visibilityMode: MonitorSpecific

View file

@ -0,0 +1,34 @@
{ pkgs, ... }:
let
ashellPackage = pkgs.runCommand "ashell-0.4.1" { } ''
mkdir -p $out/bin
echo '#!/bin/sh' > $out/bin/ashell
chmod +x $out/bin/ashell
'';
in
{
programs.ashell = {
enable = true;
package = ashellPackage;
settings = {
modules = {
left = [ "Workspaces" ];
center = [ "Window Title" ];
right = [
"SystemInfo"
"Clock"
];
};
workspaces = {
visibilityMode = "MonitorSpecific";
showEmpty = true;
};
};
};
nmt.script = ''
assertFileExists home-files/.config/ashell.yml
assertFileContent home-files/.config/ashell.yml ${./basic-yaml-config-expected.yml}
'';
}

View file

@ -0,0 +1,13 @@
[modules]
center = ["WindowTitle"]
left = ["Workspaces"]
right = ["SystemInfo"]
[system_info]
refresh_rate = 1000
show_cpu = true
show_memory = true
[workspaces]
show_empty = true
visibility_mode = "MonitorSpecific"

View file

@ -0,0 +1,37 @@
{ pkgs, ... }:
let
ashellPackage = pkgs.runCommand "ashell-0.5.0" { } ''
mkdir -p $out/bin
echo '#!/bin/sh' > $out/bin/ashell
chmod +x $out/bin/ashell
'';
in
{
programs.ashell = {
enable = true;
package = ashellPackage;
settings = {
modules = {
left = [ "Workspaces" ];
center = [ "WindowTitle" ];
right = [ "SystemInfo" ];
};
workspaces = {
visibilityMode = "MonitorSpecific";
showEmpty = true;
};
systemInfo = {
refreshRate = 1000;
showCpu = true;
showMemory = true;
};
};
};
test.asserts.warnings.enable = true;
nmt.script = ''
assertFileExists home-files/.config/ashell/config.toml
assertFileContent home-files/.config/ashell/config.toml ${./camelcase-migration-expected.toml}
'';
}

View file

@ -0,0 +1,9 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
ashell-basic-toml = ./basic-toml-config.nix;
ashell-basic-yaml = ./basic-yaml-config.nix;
ashell-camelcase-migration = ./camelcase-migration.nix;
ashell-empty-settings = ./empty-settings.nix;
ashell-systemd-service = ./systemd-service.nix;
}

View file

@ -0,0 +1,13 @@
{ ... }:
{
programs.ashell = {
enable = true;
settings = { };
};
nmt.script = ''
assertPathNotExists home-files/.config/ashell/config.toml
assertPathNotExists home-files/.config/ashell.yml
'';
}

View file

@ -0,0 +1,11 @@
[Install]
WantedBy=hyprland-session.target
[Service]
ExecStart=@ashell-0.5.0@/bin/ashell
Restart=on-failure
[Unit]
After=hyprland-session.target
Description=ashell status bar
Documentation=https://github.com/MalpenZibo/ashell/tree/0.4.1

View file

@ -0,0 +1,33 @@
{ pkgs, ... }:
let
ashellPackage = pkgs.runCommand "ashell-0.5.0" { } ''
mkdir -p $out/bin
echo '#!/bin/sh' > $out/bin/ashell
chmod +x $out/bin/ashell
'';
in
{
programs.ashell = {
enable = true;
package = ashellPackage;
settings = {
modules = {
left = [ "Workspaces" ];
};
};
systemd = {
enable = true;
target = "hyprland-session.target";
};
};
nmt.script = ''
assertFileExists home-files/.config/ashell/config.toml
assertFileExists home-files/.config/systemd/user/ashell.service
# Check that the service file contains the expected content
assertFileRegex home-files/.config/systemd/user/ashell.service "ExecStart=.*ashell-0.5.0.*/bin/ashell"
assertFileRegex home-files/.config/systemd/user/ashell.service "WantedBy=hyprland-session.target"
assertFileRegex home-files/.config/systemd/user/ashell.service "Description=ashell status bar"
'';
}