diff --git a/modules/home/scripts/default.nix b/modules/home/scripts/default.nix index 75fe787..a6dd18b 100644 --- a/modules/home/scripts/default.nix +++ b/modules/home/scripts/default.nix @@ -35,6 +35,9 @@ fi ''; in { + home.file.".local/bin/dsize".source = ./dsize; + home.file.".local/bin/runbg".source = ./runbg; + home.file.".local/bin/music".source = ./music; home.packages = with pkgs; [ wall-change wallpaper-picker diff --git a/modules/home/scripts/dsize b/modules/home/scripts/dsize new file mode 100644 index 0000000..48a75cf --- /dev/null +++ b/modules/home/scripts/dsize @@ -0,0 +1,7 @@ +#!/bin/bash + +if [ "$#" -eq 1 ]; then + du -hs $1 +else + echo "[ERROR] => Wrong number of parameters" +fi diff --git a/modules/home/scripts/music b/modules/home/scripts/music new file mode 100644 index 0000000..a37c0ba --- /dev/null +++ b/modules/home/scripts/music @@ -0,0 +1,9 @@ +#!/bin/bash + +if [[ $# == 0 ]]; then + runbg audacious -t +elif [[ $1 == -s ]]; then + pkill audacious +else + echo "[ERROR] => Wrong argument..." +fi diff --git a/modules/home/scripts/runbg b/modules/home/scripts/runbg new file mode 100644 index 0000000..be0df9f --- /dev/null +++ b/modules/home/scripts/runbg @@ -0,0 +1,15 @@ +#!/bin/bash +[ $# -eq 0 ] && { # $# is number of args + echo "$(basename $0): missing command" >&2 + exit 1 +} +prog="$(which "$1")" # see below +[ -z "$prog" ] && { + echo "$(basename $0): unknown command: $1" >&2 + exit 1 +} +shift # remove $1, now $prog, from args +tty -s && exec /dev/null # if stdout is a terminal, redirect to null +tty -s <&2 && exec 2>&1 # stderr to stdout (which might not be null) +"$prog" "$@" & # $@ is all args