calendar in terminal (urxvt)

Forum rules
We don't support installations in VirtualBox, VMWare, qemu or others. We ignore posts about WINE, PlayOnLinux, Steam and Skype. We don't support btrfs, lvm, UEFI, side-by-side installations with GPT or dualboot with anything newer than Windows XP.
Google your problem first. Check the Wiki. Read the existing threads. It's okay to "hijack" an existing thread, yes! If your problem is not yet covered, open a new thread. To get the quickest possible help, mention the exact release codename in your post (uname -a is a good idea, too). Due to the lack of crystal balls, attach the output of lspci -nnk if you encounter hardware problems.
User avatar
mt12345
Saltimbocca-Roller
Posts: 15
Joined: Sun Jun 19, 2016 2:15 pm
Location: Europe

calendar in terminal (urxvt)

Unread post by mt12345 » Sat Oct 22, 2016 2:22 pm

$ x-terminal-emulator -e nano

it works fine but

$ x-terminal-emulator -e cal

doesn't.
Why is that?

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: calendar in terminal (urxvt)

Unread post by pidsley » Sat Oct 22, 2016 2:38 pm

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.

User avatar
mt12345
Saltimbocca-Roller
Posts: 15
Joined: Sun Jun 19, 2016 2:15 pm
Location: Europe

Re: calendar in terminal (urxvt)

Unread post by mt12345 » Sat Oct 22, 2016 3:08 pm

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.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: calendar in terminal (urxvt)

Unread post by machinebacon » Sat Oct 22, 2016 3:59 pm

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.
..gnutella..

User avatar
twodogs
Riesenpenis
Posts: 33
Joined: Tue Feb 26, 2013 2:08 am
Location: St. Cloud, Florida USA

Re: calendar in terminal (urxvt)

Unread post by twodogs » Sat Oct 22, 2016 4:06 pm

^cool.

User avatar
mt12345
Saltimbocca-Roller
Posts: 15
Joined: Sun Jun 19, 2016 2:15 pm
Location: Europe

Re: calendar in terminal (urxvt)

Unread post by mt12345 » Sat Oct 22, 2016 4:19 pm

$ term-hold cal

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

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: calendar in terminal (urxvt)

Unread post by machinebacon » Sat Oct 22, 2016 4:37 pm

Code: Select all

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

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: calendar in terminal (urxvt)

Unread post by pidsley » Sat Oct 22, 2016 5:28 pm

Code: Select all

man xmessage

Code: Select all

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

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: calendar in terminal (urxvt)

Unread post by pidsley » Sat Oct 22, 2016 7:37 pm

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.

User avatar
mt12345
Saltimbocca-Roller
Posts: 15
Joined: Sun Jun 19, 2016 2:15 pm
Location: Europe

Re: calendar in terminal (urxvt)

Unread post by mt12345 » Sun Oct 23, 2016 12:50 am

I left xcal for later, there is separate thread about it.
'top' already added.

machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

Re: calendar in terminal (urxvt)

Unread post by machinebacon » Sun Oct 23, 2016 1:08 am

machinebacon wrote:

Code: Select all

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

User avatar
mt12345
Saltimbocca-Roller
Posts: 15
Joined: Sun Jun 19, 2016 2:15 pm
Location: Europe

Re: calendar in terminal (urxvt)

Unread post by mt12345 » Sun Oct 23, 2016 1:23 am

so did that fucking work?
for cal it's fucking perfect.

User avatar
mt12345
Saltimbocca-Roller
Posts: 15
Joined: Sun Jun 19, 2016 2:15 pm
Location: Europe

Re: calendar in terminal (urxvt)

Unread post by mt12345 » Sun Oct 23, 2016 1:44 am

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.

Post Reply