ashell: support yaml and toml config
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
f62e9a8114
commit
650a38ebe8
11 changed files with 226 additions and 6 deletions
|
|
@ -0,0 +1,8 @@
|
|||
[modules]
|
||||
center = ["Window Title"]
|
||||
left = ["Workspaces"]
|
||||
right = ["SystemInfo", "Clock"]
|
||||
|
||||
[workspaces]
|
||||
show_empty = true
|
||||
visibility_mode = "MonitorSpecific"
|
||||
34
tests/modules/programs/ashell/basic-toml-config.nix
Normal file
34
tests/modules/programs/ashell/basic-toml-config.nix
Normal 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}
|
||||
'';
|
||||
}
|
||||
11
tests/modules/programs/ashell/basic-yaml-config-expected.yml
Normal file
11
tests/modules/programs/ashell/basic-yaml-config-expected.yml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
modules:
|
||||
center:
|
||||
- Window Title
|
||||
left:
|
||||
- Workspaces
|
||||
right:
|
||||
- SystemInfo
|
||||
- Clock
|
||||
workspaces:
|
||||
showEmpty: true
|
||||
visibilityMode: MonitorSpecific
|
||||
34
tests/modules/programs/ashell/basic-yaml-config.nix
Normal file
34
tests/modules/programs/ashell/basic-yaml-config.nix
Normal 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}
|
||||
'';
|
||||
}
|
||||
|
|
@ -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"
|
||||
37
tests/modules/programs/ashell/camelcase-migration.nix
Normal file
37
tests/modules/programs/ashell/camelcase-migration.nix
Normal 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}
|
||||
'';
|
||||
}
|
||||
9
tests/modules/programs/ashell/default.nix
Normal file
9
tests/modules/programs/ashell/default.nix
Normal 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;
|
||||
}
|
||||
13
tests/modules/programs/ashell/empty-settings.nix
Normal file
13
tests/modules/programs/ashell/empty-settings.nix
Normal 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
|
||||
'';
|
||||
}
|
||||
|
|
@ -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
|
||||
33
tests/modules/programs/ashell/systemd-service.nix
Normal file
33
tests/modules/programs/ashell/systemd-service.nix
Normal 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"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue