這個程式是以管理用eww寫的snackbar為目的設計的
demo.webm
git pull https://github.com/Shiphan/snackdaemon.git
cd snackdaemon
go install目前尚未加入nixpkgs,但可以直接使用nix-init生成的檔案,類似這樣的用法:
Install on NixOS
environment.systemPackages = with pkgs; [
(buildGoModule rec {
pname = "snackdaemon";
version = "unstable-2024-06-26";
src = fetchFromGitHub {
owner = "Shiphan";
repo = "snackdaemon";
rev = "1b7679f5ee5b8ffd923273a84891845dd20b1c81";
hash = "sha256-IRGErIPlr5CEoR96S+k/ARaogewlOfc+PNklRe8s+lc=";
};
vendorHash = null;
ldflags = [ "-s" "-w" ];
meta = with lib; {
description = "Daemon for snackbar";
homepage = "https://github.com/Shiphan/snackdaemon/";
license = licenses.mit;
maintainers = with maintainers; [ ];
mainProgram = "snackdaemon";
};
})
];有幾個指令可以使用
snackdaemon daemon
snackdaemon reload
snackdaemon kill
snackdaemon ping
snackdaemon update <option>
snackdaemon close
snackdaemon help使用json格式進行設定
可以參考以下範例:
{
"timeout": "2s",
"openCommand": "eww open snackbar",
"updateCommand": "eww update snackbarIndex=%d",
"closeCommand": "eww close snackbar",
"options": [
"volume",
"player",
"screenbrightness",
"powerprofiles"
]
}第一次使用snackdaemon update option時會執行openCommand,並試著在options尋找符合option的項目,如果有找到的話,則使用該項的index替換掉updateCommand中的{},然後執行。
之後的每次update都是像第一次一樣,只是不會執行openCommand。
當最後一次update後經過timeout(以ms計)設定的時間、或是執行了snackdaemon close後,closeCommand會被執行,並重新開始新的循環。