Page 1 of 1

calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 2:22 pm
by mt12345
$ x-terminal-emulator -e nano

it works fine but

$ x-terminal-emulator -e cal

doesn't.
Why is that?

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 2:38 pm
by pidsley
Because "cal" doesn't hold the terminal. Your second command runs the calendar and then immediately exits.

This should work if you are using a terminal emulator that respects the "-hold" option (urxvt does):

Code: Select all

x-terminal-emulator -hold -e cal
But you will have to kill the process to make it exit.

What are you trying to do? There may be a better way.

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 3:08 pm
by mt12345
trying to add

command "calendar" "x-terminal-emulator -e ncal -3"
command "procs" "x-terminal-emulator -e ps -ax"

to .cwmrc (swikee)

in case of ps hold is no option because I need access to terminal eg. to kill process.

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 3:59 pm
by machinebacon
write some wrappers and put them into /usr/local/bin, or a universal wrapper there, called "term-hold"

Code: Select all

#/bin/bash
x-terminal-emulator -e $@
read n
then do a
chmod a+x /usr/local/bin/term-hold

This accepts something like "term-hold ncal -3" and closes after enter has been pressed, e.g.

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 4:06 pm
by twodogs
^cool.

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 4:19 pm
by mt12345
$ term-hold cal

still doesn't work. first terminal is on hold instead of the new one with 'cal'

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 4:37 pm
by machinebacon

Code: Select all

#/bin/bash
x-terminal-emulator -e bash -c "$@ && read"

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 5:28 pm
by pidsley

Code: Select all

man xmessage

Code: Select all

ncal -h -3 | xmessage -file -
ps ax | xmessage -file -

Re: calendar in terminal (urxvt)

Posted: Sat Oct 22, 2016 7:37 pm
by pidsley
Also don't forget "xcal" :

Image

And you might consider just starting htop (or top -- either one will hold the terminal open) in a terminal instead of "ps ax" :

Code: Select all

x-terminal-emulator -e top
I guess my point is not to get so hung up on one way of doing something that you ignore other options that might be easier or better.

Re: calendar in terminal (urxvt)

Posted: Sun Oct 23, 2016 12:50 am
by mt12345
I left xcal for later, there is separate thread about it.
'top' already added.

Re: calendar in terminal (urxvt)

Posted: Sun Oct 23, 2016 1:08 am
by machinebacon
machinebacon wrote:

Code: Select all

#/bin/bash
x-terminal-emulator -e bash -c "$@ && read"
so did that fucking work?

Re: calendar in terminal (urxvt)

Posted: Sun Oct 23, 2016 1:23 am
by mt12345
so did that fucking work?
for cal it's fucking perfect.

Re: calendar in terminal (urxvt)

Posted: Sun Oct 23, 2016 1:44 am
by mt12345

Code: Select all

ncal -h -3 | xmessage -file -
'-h' is necessary to avoid corrupted output but it disables highlighting the current day, making calendar useless.

anyway I can't figure out full syntax.