welcome - welcome - a terminal program which always greets you

git clone git://git.bcharge.de/welcome.git

About | Log | Files | Refs | License

commit 66b9c41573ded51009f6657e9ece40fb76cef49b
parent 0eb7692a92641249f0c5d1f5c19e2759892981d2
Author: Bakar Chargeishvili <bakar@bcharge.de>
Date:   Mon, 11 Dec 2023 20:44:20 +0100

Add more indicators and a skull

Diffstat:
MREADME.md | 2+-
Askull | 8++++++++
Mwelcome.c | 32+++++++++++++++++++++++++++-----
3 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md @@ -1,3 +1,3 @@ -# Welcome - a program which always greets you +# welcome - a program which always greets you Coming soon... diff --git a/skull b/skull @@ -0,0 +1,8 @@ + _.--""--._ + / _ _ \ + _ ( (_\ /_) ) _ +{ \._\ /\ /_./ } +/_"=-.}______{.-="_\ + _ _.=("""")=._ _ +(_'"_.-"`~~`"-._"'_) + {_" "_} diff --git a/welcome.c b/welcome.c @@ -125,10 +125,11 @@ int main() noecho(); curs_set(0); start_color(); - init_pair(1, COLOR_RED, COLOR_BLACK); - WINDOW* mainframe = newwin(LINES,COLS-2,0,1); + use_default_colors(); + init_pair(1, COLOR_RED, -1); + WINDOW* mainframe = newwin(LINES,COLS-2,0,1); wattron(mainframe,COLOR_PAIR(1)); //printw("Hello World !!!"); wattron(mainframe,A_BLINK); @@ -143,22 +144,41 @@ int main() init_string(&location); string temperature; init_string(&temperature); + string precip; + init_string(&precip); + string sunlife; + init_string(&sunlife); + string wind; + init_string(&wind); char *events = calloc(MAXPIPE + 1,sizeof(char)); char *today = calloc(MAXPIPE + 1,sizeof(char)); + char *skull = calloc(MAXPIPE + 1,sizeof(char)); curl("wttr.in/?format=%l",&location); curl("wttr.in/?format=%t%20(%f)",&temperature); + curl("wttr.in/?format=%w",&wind); + curl("wttr.in/?format=%p",&precip); + curl("wttr.in/?format=%S%20-%20%s",&sunlife); pipe("calcurse -r7 --format-apt='- %S -> %E %m\n' --output-datefmt=\"%B %d, %Y\"",events); pipe("date '+%B %d, %Y' | tr -d '\n'",today); + pipe("cat skull",skull); if(events[0]=='\0') strcpy(events,"🎉 Looks like you have not planned anything 🎉\n" ); + /*************************** * Print the information * ***************************/ - wprintw(mainframe,"Today is:\t%s\n",today); - wprintw(mainframe,"We are in:\t%s\n",location.ptr); - wprintw(mainframe,"Temperature:\t%s\n",temperature.ptr); + wprintw(mainframe,"Today is:\t\t%s\n",today); + wprintw(mainframe,"We are in:\t\t%s\n",location.ptr); + wprintw(mainframe,"Temperature:\t\t%s\n",temperature.ptr); + wprintw(mainframe,"Wind speed:\t\t%s\n",wind.ptr); + wprintw(mainframe,"Precipitation:\t\t%s\n",precip.ptr); + wprintw(mainframe,"Sunrise and sunset:\t%s\n",sunlife.ptr); + for (int i = 0; i < 2; ++i) { + mvwaddstr(mainframe,20,0+i*30,skull); + napms(200); + } refresh(); wrefresh(mainframe); @@ -175,5 +195,7 @@ int main() getch(); endwin(); + /* TODO: Clean memory <11-12-23, bakar> */ + return 0; }