diff options
| author | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-07-27 14:28:38 -0400 |
|---|---|---|
| committer | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-07-27 14:28:38 -0400 |
| commit | 60b33d6edc6eff5142c2def85a07406ff867b5e5 (patch) | |
| tree | a73b13941e2b1bc2d8f49162c9bb9258a52b03c2 | |
| parent | fcb37bdf9e6107f1d34ff05c8558021d67a0aeec (diff) | |
| download | home-60b33d6edc6eff5142c2def85a07406ff867b5e5.tar.gz | |
modules/rmpc: initial config, song change notifications
| -rw-r--r-- | modules/rmpc/config.ron | 148 | ||||
| -rw-r--r-- | modules/rmpc/default.nix | 24 | ||||
| -rwxr-xr-x | modules/rmpc/notify.sh | 15 |
3 files changed, 187 insertions, 0 deletions
diff --git a/modules/rmpc/config.ron b/modules/rmpc/config.ron new file mode 100644 index 0000000..46f81b2 --- /dev/null +++ b/modules/rmpc/config.ron @@ -0,0 +1,148 @@ +#![enable(implicit_some)] +#![enable(unwrap_newtypes)] +#![enable(unwrap_variant_newtypes)] +( + address: "127.0.0.1:6600", + password: None, + theme: None, + cache_dir: None, + on_song_change: ["~/.config/rmpc/notify.sh"], + volume_step: 5, + max_fps: 30, + scrolloff: 0, + wrap_navigation: false, + enable_mouse: true, + status_update_interval_ms: 1000, + select_current_song_on_change: false, + album_art: ( + method: Auto, + max_size_px: (width: 1200, height: 1200), + disabled_protocols: ["http://", "https://"], + vertical_align: Center, + horizontal_align: Center, + ), + keybinds: ( + global: { + ":": CommandMode, + ",": VolumeDown, + "s": Stop, + ".": VolumeUp, + "<Tab>": NextTab, + "<S-Tab>": PreviousTab, + "1": SwitchToTab("Queue"), + "2": SwitchToTab("Directories"), + "3": SwitchToTab("Artists"), + "4": SwitchToTab("Album Artists"), + "5": SwitchToTab("Albums"), + "6": SwitchToTab("Playlists"), + "7": SwitchToTab("Search"), + "q": Quit, + ">": NextTrack, + "p": TogglePause, + "<": PreviousTrack, + "f": SeekForward, + "z": ToggleRepeat, + "x": ToggleRandom, + "c": ToggleConsume, + "v": ToggleSingle, + "b": SeekBack, + "~": ShowHelp, + "I": ShowCurrentSongInfo, + "O": ShowOutputs, + "P": ShowDecoders, + }, + navigation: { + "k": Up, + "j": Down, + "h": Left, + "l": Right, + "<Up>": Up, + "<Down>": Down, + "<Left>": Left, + "<Right>": Right, + "<C-k>": PaneUp, + "<C-j>": PaneDown, + "<C-h>": PaneLeft, + "<C-l>": PaneRight, + "<C-u>": UpHalf, + "N": PreviousResult, + "a": Add, + "A": AddAll, + "r": Rename, + "n": NextResult, + "g": Top, + "<Space>": Select, + "<C-Space>": InvertSelection, + "G": Bottom, + "<CR>": Confirm, + "i": FocusInput, + "J": MoveDown, + "<C-d>": DownHalf, + "/": EnterSearch, + "<C-c>": Close, + "<Esc>": Close, + "K": MoveUp, + "D": Delete, + }, + queue: { + "D": DeleteAll, + "<CR>": Play, + "<C-s>": Save, + "a": AddToPlaylist, + "d": Delete, + "i": ShowInfo, + "C": JumpToCurrent, + }, + ), + search: ( + case_sensitive: false, + mode: Contains, + tags: [ + (value: "any", label: "Any Tag"), + (value: "artist", label: "Artist"), + (value: "album", label: "Album"), + (value: "albumartist", label: "Album Artist"), + (value: "title", label: "Title"), + (value: "filename", label: "Filename"), + (value: "genre", label: "Genre"), + ], + ), + artists: ( + album_display_mode: SplitByDate, + album_sort_by: Date, + ), + tabs: [ + ( + name: "Queue", + pane: Split( + direction: Horizontal, + panes: [(size: "40%", pane: Pane(AlbumArt)), (size: "60%", pane: Pane(Queue))], + ), + ), + ( + name: "Directories", + pane: Pane(Directories), + ), + ( + name: "Artists", + pane: Pane(Artists), + ), + ( + name: "Album Artists", + pane: Pane(AlbumArtists), + ), + ( + name: "Albums", + pane: Pane(Albums), + ), + ( + name: "Playlists", + pane: Pane(Playlists), + ), + ( + name: "Search", + pane: Pane(Search), + ), + ], +) + diff --git a/modules/rmpc/default.nix b/modules/rmpc/default.nix new file mode 100644 index 0000000..429d00c --- /dev/null +++ b/modules/rmpc/default.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.modules.rmpc; +in +{ + options.modules.rmpc.enable = lib.mkEnableOption "rmpc"; + + config = lib.mkIf cfg.enable { + home.packages = [ + pkgs.rmpc + ]; + + xdg.configFile."rmpc/config.ron".source = ./config.ron; + xdg.configFile."rmpc/notify.sh" = { + source = ./notify.sh; + executable = true; + }; + }; +} diff --git a/modules/rmpc/notify.sh b/modules/rmpc/notify.sh new file mode 100755 index 0000000..7a17bfb --- /dev/null +++ b/modules/rmpc/notify.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +TMP_DIR="/tmp/rmpc" + +mkdir -p "$TMP_DIR" + +ALBUM_ART_PATH="$TMP_DIR/notification_cover" + +pkill mako +if ! rmpc albumart --output "$ALBUM_ART_PATH"; then + notify-send "Now Playing" "$ARTIST - $TITLE" +else + notify-send -i "${ALBUM_ART_PATH}" "Now Playing" "$ARTIST - $TITLE" +fi + |