mirror of
https://github.com/nix-community/home-manager
synced 2024-11-25 14:10:29 +00:00
spotify-player: add support for actions
Actions were added in the v0.19.1 release.
This commit is contained in:
parent
eea1bc6072
commit
c7cfdb3864
3 changed files with 66 additions and 7 deletions
|
@ -1,12 +1,12 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkEnableOption mkPackageOption mkOption literalExpression mkIf;
|
||||||
mkEnableOption mkPackageOption mkOption types literalExpression mkIf;
|
inherit (lib.types) listOf;
|
||||||
|
|
||||||
cfg = config.programs.spotify-player;
|
cfg = config.programs.spotify-player;
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
tomlType = tomlFormat.type;
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with lib.hm.maintainers; [ diniamo ];
|
meta.maintainers = with lib.hm.maintainers; [ diniamo ];
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ in {
|
||||||
package = mkPackageOption pkgs "spotify-player" { };
|
package = mkPackageOption pkgs "spotify-player" { };
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = tomlFormat.type;
|
type = tomlType;
|
||||||
default = { };
|
default = { };
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
themes = mkOption {
|
themes = mkOption {
|
||||||
type = types.listOf tomlFormat.type;
|
type = listOf tomlType;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
[
|
[
|
||||||
|
@ -94,7 +94,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
keymaps = mkOption {
|
keymaps = mkOption {
|
||||||
type = types.listOf tomlFormat.type;
|
type = listOf tomlType;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
example = literalExpression ''
|
example = literalExpression ''
|
||||||
[
|
[
|
||||||
|
@ -129,6 +129,36 @@ in {
|
||||||
for the full list of options.
|
for the full list of options.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
actions = mkOption {
|
||||||
|
type = listOf tomlType;
|
||||||
|
default = [ ];
|
||||||
|
example = literalExpression ''
|
||||||
|
[
|
||||||
|
{
|
||||||
|
action = "GoToArtist";
|
||||||
|
key_sequence = "g A";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "GoToAlbum";
|
||||||
|
key_sequence = "g B";
|
||||||
|
target = "PlayingTrack";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "ToggleLiked";
|
||||||
|
key_sequence = "C-l";
|
||||||
|
}
|
||||||
|
]
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Configuration written to the `actions` field of
|
||||||
|
{file}`$XDG_CONFIG_HOME/spotify-player/keymap.toml`.
|
||||||
|
|
||||||
|
See
|
||||||
|
<https://github.com/aome510/spotify-player/blob/master/docs/config.md#actions>
|
||||||
|
for the full list of options.
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -146,7 +176,7 @@ in {
|
||||||
|
|
||||||
"spotify-player/keymap.toml" = mkIf (cfg.keymaps != [ ]) {
|
"spotify-player/keymap.toml" = mkIf (cfg.keymaps != [ ]) {
|
||||||
source = tomlFormat.generate "spotify-player-keymap" {
|
source = tomlFormat.generate "spotify-player-keymap" {
|
||||||
inherit (cfg) keymaps;
|
inherit (cfg) keymaps actions;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,3 +1,16 @@
|
||||||
|
[[actions]]
|
||||||
|
action = "GoToArtist"
|
||||||
|
key_sequence = "g A"
|
||||||
|
|
||||||
|
[[actions]]
|
||||||
|
action = "GoToAlbum"
|
||||||
|
key_sequence = "g B"
|
||||||
|
target = "PlayingTrack"
|
||||||
|
|
||||||
|
[[actions]]
|
||||||
|
action = "ToggleLiked"
|
||||||
|
key_sequence = "C-l"
|
||||||
|
|
||||||
[[keymaps]]
|
[[keymaps]]
|
||||||
command = "NextTrack"
|
command = "NextTrack"
|
||||||
key_sequence = "g n"
|
key_sequence = "g n"
|
||||||
|
|
|
@ -87,6 +87,22 @@
|
||||||
key_sequence = "q";
|
key_sequence = "q";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
actions = [
|
||||||
|
{
|
||||||
|
action = "GoToArtist";
|
||||||
|
key_sequence = "g A";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "GoToAlbum";
|
||||||
|
key_sequence = "g B";
|
||||||
|
target = "PlayingTrack";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
action = "ToggleLiked";
|
||||||
|
key_sequence = "C-l";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
test.stubs.spotify-player = { };
|
test.stubs.spotify-player = { };
|
||||||
|
|
Loading…
Reference in a new issue