#!/bin/bash # configure reads TITLE and DESCRIPTION # shellcheck disable=SC2034 TITLE="Printers" # shellcheck disable=SC2034 DESCRIPTION="Add your network's printers to every print dialog" # Exists once you've run this, even if you added none, so this isn't "to do" # on machines without a printer PRINTERS_CONF="$HOME/.config/coredesktop/printers" is_installed() { command -v lpadmin } # Set up here, or a network printer was already added some other way is_configured() { [ -f "$PRINTERS_CONF" ] || LC_ALL=C lpstat -v 2> /dev/null | grep -qE ': (ipps?|dnssd)://' } run_configure() { bash "$COREDESKTOP/system/setup-printers.sh" || return 1 mkdir -p "$(dirname "$PRINTERS_CONF")" && touch "$PRINTERS_CONF" }