diff options
Diffstat (limited to '')
| -rw-r--r-- | pkgs/by-name/sw/swallow/package.nix (renamed from modules/home.legacy/conf/beets/plugins/play/default.nix) | 24 | ||||
| -rwxr-xr-x | pkgs/by-name/sw/swallow/swallow.sh | 25 |
2 files changed, 38 insertions, 11 deletions
diff --git a/modules/home.legacy/conf/beets/plugins/play/default.nix b/pkgs/by-name/sw/swallow/package.nix index 9d26f16a..16608143 100644 --- a/modules/home.legacy/conf/beets/plugins/play/default.nix +++ b/pkgs/by-name/sw/swallow/package.nix @@ -8,16 +8,18 @@ # You should have received a copy of the License along with this program. # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - lib, - pkgs, - config, - ... -}: { - programs.beets.settings.play = { - command = "${lib.getExe pkgs.mpc} $args add"; - relative_to = config.services.mpd.musicDirectory; + writeShellApplication, + # Dependencies + river-classic, +}: +writeShellApplication { + name = "swallow"; + text = builtins.readFile ./swallow.sh; - # Run the command with the returned paths as arguments - raw = true; - }; + # We need to inherit the path, so that we can spawn stuff in a swallowed mode. + inheritPath = true; + + runtimeInputs = [ + river-classic + ]; } diff --git a/pkgs/by-name/sw/swallow/swallow.sh b/pkgs/by-name/sw/swallow/swallow.sh new file mode 100755 index 00000000..ac1858ea --- /dev/null +++ b/pkgs/by-name/sw/swallow/swallow.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env dash +# Based on: https://codeberg.org/nirodhvana/reservoir/src/commit/2fa8c14877799a03bb927f048c2907dbb418fd68/dot-local/bin/gobble + +# Inspired by https://github.com/swindlesmccoop/not-just-dotfiles/blob/master/.local/bin/swallow + +swallow_tag=$((1 << 9)) +eat() { + riverctl set-view-tags $swallow_tag +} + +throwup() { + riverctl set-focused-tags $swallow_tag && + riverctl send-to-previous-tags && + riverctl focus-previous-tags +} + +if [ -z "$*" ]; then + printf "ERROR: No arguments supplied\n" +elif ! command -v "$1" >/dev/null; then + printf "ERROR: Command '%s' does not exist\n" "$1" +else + eat && "$@" + + throwup +fi |
