You are not logged in.

#21 2016-03-30 18:39:09

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

  <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

#22 2016-03-30 19:05:27

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

Well, waddya know!  That fixed it ...
B2vaAh9b.jpg
Well, had to change to a mono font as well ... now to find a nicer mono font for OB.  smile

Thank you xoas52.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Online

#23 2016-03-30 21:24:06

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

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

2016_03_30_18_05_49_Scrot11.jpg
This is just one of those: In case someone wants it things!  roll


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Online

#24 2016-03-30 21:34:52

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

Now we need to rewrite it to use @johnraff's `bl-include` variables, for that pure BL touch wink


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

#25 2016-03-30 23:18:09

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

lol  lol  lol

The variable you'll never use - look at the calendar on the wall over your monitor.
- the pictures are better, like this!  wink

But it just might work - blamecredit 'searchone', he got me interested in this.  smile


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Online

#26 2016-03-31 07:14:32

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

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

#27 2016-03-31 07:33:56

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

Looks like you are not first one to stumble over this problem
Here

Offline

#28 2016-03-31 08:10:28

searchone
Member
From: Walhalla
Registered: 2016-01-31
Posts: 107

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

Problem already solved! You are all super ... thanks !!!


English by Google - blame them, Ich bin Deutscher.

Offline

#29 2016-03-31 12:27:20

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

xaos52 wrote:

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

xaos52 wrote:

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


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Online

#30 2016-03-31 14:56:41

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,660

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

xaos52 wrote:

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

#31 2016-03-31 15:36:28

cloverskull
Member
Registered: 2015-10-01
Posts: 348

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

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

#32 2016-03-31 16:00:14

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

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

#33 2016-03-31 16:07:31

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

cloverskull wrote:

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 sad

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

#34 2016-03-31 16:11:30

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

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

2016_03_31_12_47_39_Scrot11.jpg

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 } }'

2016_03_31_13_04_39_Scrot11.jpg


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

#35 2016-03-31 16:24:30

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

xaos52 wrote:

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.
2016_03_31_13_26_05_Scrot11.jpg
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

#36 2016-03-31 16:55:20

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

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

#37 2016-03-31 17:00:51

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

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.


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

#38 2016-03-31 17:14:16

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

damo wrote:
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" sad  . . .  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.  sad


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Online

#39 2016-03-31 17:50:51

cloverskull
Member
Registered: 2015-10-01
Posts: 348

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

@Sector11 - Agree, that probably makes the most sense, but also is not worth the time and effort. smile Now, if it had google calendar integration... smile

Offline

#40 2016-03-31 18:19:20

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: [SOLVED] Can not implement OB pipemenu: date-menu.sh

lol  lol  lol   It's already been done - years ago. A simple tweak updated it.

2016_03_31_15_24_53_Scrot11.png

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

Board footer

Powered by FluxBB