dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

commit 157b1d389c2482d1a416259529cc257562ce9297
parent c178de2caca08fe871fc6c99b92a6967ab820779
Author: pyratebeard <root@pyratebeard.net>
Date:   Fri,  3 Jul 2020 17:38:42 +0100

tidied up welcome script

Diffstat:
Mzsh/.zsh/welcome.zsh | 52+++++++++++++++++++++++++---------------------------
1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/zsh/.zsh/welcome.zsh b/zsh/.zsh/welcome.zsh @@ -3,20 +3,14 @@ PTS=$(ps -U $USER | awk '{ print $2 }' | grep "pts/" | uniq | wc -l) audio_vol() { - _master="Master" - _usb="Dell USB Audio" - - if amixer | grep "$_master" >/dev/null ; then - amixer sset "$_master" 40% >/dev/null - elif amixer | grep "$_usb" >/dev/null ; then - amixer sset "$_usb" 25% >/dev/null - fi -} - -# script run on first terminal -script() { - audio_vol - tmux new -s main -n '~' + _master="Master" + _usb="Dell USB Audio" + + if amixer | grep "$_master" >/dev/null ; then + amixer sset "$_master" 40% >/dev/null + elif amixer | grep "$_usb" >/dev/null ; then + amixer sset "$_usb" 25% >/dev/null + fi } getnews() { @@ -26,17 +20,21 @@ getnews() { -d apiKey=$NEWS_API_KEY | jq -r '.articles[] | .title, .url, ""' | tr -d '\t' } -set -o vi -cat ~/tmp/pyratebeard_ansi_md - -if [[ ${PTS} -lt "2" ]] ; then - script -fi +# script run on first terminal +script() { + cat ~/tmp/pyratebeard_ansi_md + if [[ ${PTS} -lt "2" ]] ; then + audio_vol + tmux new -s main -n '~' + if [[ ${TMUX_PANE} == '%0' ]] ; then + echo -e "\n// WELCOME $(whoami | tr 'a-z' 'A-Z')\n" + echo -e "\nIRISH NEWS HEADLINES:" + getnews the-irish-times + echo -e "\nHACKER NEWS HEADLINES:" + getnews hacker-news + fi + fi +} -if [[ ${TMUX_PANE} == '%0' ]] ; then - echo -e "\n// WELCOME $(whoami | tr 'a-z' 'A-Z')\n" - echo -e "\nIRISH NEWS HEADLINES:" - getnews the-irish-times - echo -e "\nHACKER NEWS HEADLINES:" - getnews hacker-news -fi +set -o vi +script