You are not logged in.
<item label="20 21 22 23 24 25 26 " />
<item label="27 28 29 30 31 " /> <<<<<<<<-------------
<item label=" " />
Notice the trailing spaces after day 31 in the marked line above!
That is because 'cal' highlights todays date. Only the highlights are not visible in the terminal output. (You can make them visible by catching the output in a file and using octal dump on the file: od -oc <captured-output-file>
Edit the script $HOME/bin/date-menu.sh:
Change line
cal | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
to
cal -h | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
and it should work.
Offline
Online
So after xaos52's fix I got to thinking. Yea, yea, I know - dangerous! BUT ....
If "cal -h" can do it maybe "ncal -hw" can do it and get the current week numbers as well.
menu.xml entries:
<menu execute="date-menu.sh" id="pipe-month" label="Month"/>
<menu execute="date-menu2.sh" id="pipe-month2" label="Month Wk#"/>
And to make sure we are on the same page: date-menu.sh (somewhere in your path)
#!/bin/sh
#
# Update xoas52 - leading spaces removed.
# <menu execute="t12" id="calendar" label="Calendar"/>
#
# /home/sector11/bin/date-menu.sh
# <menu execute="date-menu.sh" id="calendar" label="Month"/>
#
# This is in the public domain. Honestly, how can you claim anything to something
# this simple?
#
# Outputs a simple openbox pipe menu to display the date, time, and calendar.
# You need 'date' and 'cal'. You should have these. Additionally, the calendar
# only appears properly formated if you use a mono spaced font.
# Outputs the selected row from the calender output.
# If you don't use a mono spaced font, you would have to play with spacing here.
# It would probably involve a very complicated mess. Is there a way to force a
# different font per menu?
calRow() {
cal -h | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
}
# Build the menu
cat << EOFMENU
<openbox_pipe_menu>
<separator label="`date +%A\ \ \ \ \ %H:%M`" />
<item label="`date +%B\ %d,\ %Y`" />
<separator />
<item label="`calRow 2`" />
<item label="`calRow 3`" />
<item label="`calRow 4`" />
<item label="`calRow 5`" />
<item label="`calRow 6`" />
<item label="`calRow 7`" />
<item label="`calRow 8`" />
</openbox_pipe_menu>
EOFMENU
With ncal: date-menu2.sh (again - somewhere in your path)
#!/bin/sh
#
# Update xoas52 - leading spaces removed.
# <menu execute="t12" id="calendar" label="Calendar"/>
#
# /home/sector11/bin/date-menu.sh
# <menu execute="date-menu.sh" id="calendar" label="Month"/>
#
# This is in the public domain. Honestly, how can you claim anything to something
# this simple?
#
# Outputs a simple openbox pipe menu to display the date, time, and calendar.
# You need 'date' and 'cal'. You should have these. Additionally, the calendar
# only appears properly formated if you use a mono spaced font.
# Outputs the selected row from the calender output.
# If you don't use a mono spaced font, you would have to play with spacing here.
# It would probably involve a very complicated mess. Is there a way to force a
# different font per menu?
calRow() {
ncal -hw | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
}
# Build the menu
cat << EOFMENU
<openbox_pipe_menu>
<separator label="`date +%A\ \ \ \ \ %H:%M`" />
<item label="`date +%B\ %d,\ %Y`" />
<separator />
<item label="`calRow 2`" />
<item label="`calRow 3`" />
<item label="`calRow 4`" />
<item label="`calRow 5`" />
<item label="`calRow 6`" />
<item label="`calRow 7`" />
<item label="`calRow 8`" />
<item label="`calRow 9`" />
</openbox_pipe_menu>
EOFMENU
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
Now we need to rewrite it to use @johnraff's `bl-include` variables, for that pure BL touch
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
The variable you'll never use - look at the calendar on the wall over your monitor.
- the pictures are better, like this!
But it just might work - blamecredit 'searchone', he got me interested in this.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
Now we need to rewrite it to use @johnraff's `bl-include` variables, for that pure BL touch wink
Or search for a way to highlight fields in a pipemenu's output.
Offline
Looks like you are not first one to stumble over this problem
Here
Offline
Problem already solved! You are all super ... thanks !!!
English by Google - blame them, Ich bin Deutscher.
Offline
Looks like you are not first one to stumble over this problem
Hmmm it's been around for a while then. Fo all O searched I never found that.
Now we need to rewrite it to use @johnraff's `bl-include` variables, for that pure BL touch wink
Or search for a way to highlight fields in a pipemenu's output.
That would be something.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
I suspect you have a newer version of cal which uses -h for help and perhaps another option for _not_ highlighting the current day. See 'man cal' (and hope they did not forget to change the man page)
Just to finish this line of thought in this thread; for Debian Sid, using "ncal -h" in the script makes the pipemenu work properly. However, "ncal -h" in a terminal returns the help items/usage. Weird.
Good you got it working S11.
You must unlearn what you have learned.
-- yoda
Online
Quick silly question - suppose I want to use this in my ob menu but don't use a monospace font. I can't figure any way to define a font for a single standalone menu option, via the xml or the script or anything else. Anyone have any ideas?
Offline
Looks like you can.
In openbox/rc.xml you can specify font per 'place'.
<font place="MenuHeader">
<name>Monospace</name>
<size>10</size>
<!-- font size in points -->
<weight>Normal</weight>
<!-- 'bold' or 'normal' -->
<slant>Normal</slant>
<!-- 'italic' or 'normal' -->
</font>
<font place="MenuItem">
<name>Monospace</name>
<size>10</size>
<!-- font size in points -->
<weight>Normal</weight>
<!-- 'bold' or 'normal' -->
<slant>Normal</slant>
<!-- 'italic' or 'normal' -->
</font>
I have not experimented with this.
Let us know if it works.
Offline
Quick silly question - suppose I want to use this in my ob menu but don't use a monospace font. I can't figure any way to define a font for a single standalone menu option, via the xml or the script or anything else. Anyone have any ideas?
I came to the conclusion a while ago that it couldn't be done within text items - it is Openbox that determines the displayed font, and I never found a way to do it on the fly. You can set different typefaces and font types for menu titles and menu items, but that doesn't help in this scenario for highlighting
It is possible to specify xml tags for eg highlighting, but AFAICS Openbox doesn't support that approach. The OB boards are probably the best place to search for answers.
EDIT ninja'd by @xaos52! I will have to investigate some more.....
EDIT2 Fonts can only be specified for "ActiveWindow", "InactiveWindow", "MenuHeader", "MenuItem", "ActiveOnScreenDisplay", "InactiveOnScreenDisplay"
Last edited by damo (2016-03-31 16:22:32)
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
@PackRat
If you add one line in the script
<item label="`calRow 8`" />
<item label="`calRow 9`" /> <<-- this line w/o this comment
... and use "ncal -hw" to you get the 9th line with week numbers?
31 Mar 16 @ 12:17:14 ~
$ ncal -hw
March 2016
Su 6 13 20 27
Mo 7 14 21 28
Tu 1 8 15 22 29
We 2 9 16 23 30
Th 3 10 17 24 31
Fr 4 11 18 25
Sa 5 12 19 26
9 10 11 12 13
31 Mar 16 @ 12:24:58 ~
$
What about: "-help"
31 Mar 16 @ 12:28:25 ~
$ cal -help
Usage: cal [general options] [-hjy] [[month] year]
cal [general options] [-hj] [-m month] [year]
ncal [general options] [-bhJjpwySM] [-s country_code] [[month] year]
ncal [general options] [-bhJeoSM] [year]
General options: [-NC31] [-A months] [-B months]
For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]
31 Mar 16 @ 12:28:34 ~
$ ncal -help
ncal: invalid option -- 'l'
Usage: cal [general options] [-hjy] [[month] year]
cal [general options] [-hj] [-m month] [year]
ncal [general options] [-bhJjpwySM] [-s country_code] [[month] year]
ncal [general options] [-bhJeoSM] [year]
General options: [-NC31] [-A months] [-B months]
For debug the highlighting: [-H yyyy-mm-dd] [-d yyyy-mm]
31 Mar 16 @ 12:29:08 ~
$
Also with:
ncal -hw -A1 | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
I can see a partial (no month name) of "next" month. -A2 doesn't work though.
Julian days if interested ... probably not a lot of people, but nice to know it's available.
ncal -hwj -A1 | gawk -v row=$1 '{ if (NR==row) { print $0 } }'
All this: just because I like 'playing' with things' - Don't look Dear, not for you! O:)
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
Looks like you can.
In openbox/rc.xml you can specify font per 'place'.I have not experimented with this.
Let us know if it works.
The OpenBox rc.xml file is what OBConfig » Appearance sets. So no, no way for a single entry - YET!
It's probably a well hidden undocumented feature documented in some dark corner of the interwebs.
Menu Item is the one that "needs" to be 'mono' - but that's the entire OB Display.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
but that's the entire OB Display
?
I configured eveything 'Liberation Sans' except 'menu item' which is set to 'Monospace'.
Seems to be working...
The calendar has Monospace. All 'other places' are using 'Liberation Sans'.
Offline
but that's the entire OB Display
?
I configured eveything 'Liberation Sans' except 'menu item' which is set to 'Monospace'.
Seems to be working...
The calendar has Monospace. All 'other places' are using 'Liberation Sans'.
But then all other menu items will also be monospace when they are displayed.
Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt «» BunsenLabs on DeviantArt
Offline
xaos52 wrote:but that's the entire OB Display
?
I configured eveything 'Liberation Sans' except 'menu item' which is set to 'Monospace'.
Seems to be working...
The calendar has Monospace. All 'other places' are using 'Liberation Sans'.But then all other menu items will also be monospace when they are displayed.
And there lies my point.
cloverskull didn't what to use a mono font for anything except the "Month" display ... unfortunately we can not set a font for a specific "menu entry" . . . YET!
Only way I see to fix cloverskull up is to create a conky with the calendar (highlighting allowed) in a box that can have a menu entry exactly like this script except it opens the conky in a "windowed" box that can be closed like any app. But that's not a pipemenu.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
@Sector11 - Agree, that probably makes the most sense, but also is not worth the time and effort. Now, if it had google calendar integration...
Offline
^
It's already been done - years ago. A simple tweak updated it.
Gcal - yea, that's been done too. But that's another story for another thread.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online