helmuthdu / conky_colors

CONKY-colors is an easier way to configure Conky
GNU General Public License v3.0
122 stars 39 forks source link

Changes to make it possible to create a package for fedora #13

Closed helmuthdu closed 11 years ago

helmuthdu commented 12 years ago

"I want to package your script and add it to fedora repositories, but there's some problems that i hope you can fix upstream: Most problem is about fonts, first i think you should remove Arial_Black.ttf from fonts and just add msfonts (or msttcorefonts in ubuntu) in dependencies! that font isn't free at all and i think it shuoldn't be there at all :) (it belong to another package) But about other fonts like weather, clocks, etc. I asked in fonts mailing list and they told me you shouldn't add those in /usr/share/fonts/OTF & /usr/share/fonts/TTF. you should add it in your application directory (/usr/sharer/conkycolor/fonts/*), then use FcConfigAppFontAddDir() to add that directory to Fonts database. This will really help that if anybody want to remove conky-colors from their GNU/Linux Linux distribution and this is a true way to add those because they're not unicode-encoded characters."

android-808 commented 12 years ago

There is nothing stopping the original writer editing the RPM spec file to adjust the installation to package the existing version, but it does make some sense to me. The following issues raised are pretty straight forward:

Not sure about FcConfigAppFontAddDir() usage, never tried it. I imagine it must be a run once thing to replace the exisitng "sudo fc-cache -v -f" Could be added as part of the main executable if that's the case. Is it necessary? Command could just as easily be run in pre/post install/remove scripts like I do.

helmuthdu commented 12 years ago

This bug was from a email that i received yesterday. Already fixed the Arial Black issue and the makefile. But i'm still trying to figure out the way to add the font folder into font database. In arch wiki there is a option to add the follow line into .xinitrc file: xset +fp /usr/share/fonts/local/ # Prepend a custom font path to Xorg's list of known font paths but idt this is the best way to do it...

android-808 commented 12 years ago

I'll add the ms font package to the dependencies on my own tomorrow when I've got access to the laptop.

I don't really like the idea of requiring an .xinitrc file, it may cause conflicts and cause confusion on distros like Ubuntu with a greater amount of novices. It should just work out of the box. One option could be wrapping "conky -c .conkycolors/conkyrc" in a shell script which set up the font paths on launch. This would not work correctly for testing multiple configs though. My current procedure is to rely on the pre/post scripts to call fc-cache. It was something I pulled in from another project.

I'll see if I can dig up some clearer explanations of what's expected. Not touched RPM spec files before so I'll have to look it up.

android-808 commented 12 years ago

Package is building okay, ttf-ms-fonts is being used correctly. Unfortunately I can't use the Makefile to install the package contents anymore as the symlinks are causing problems.

helmuthdu commented 12 years ago

it will now copy the fonts dir into /usr/share/fonts directory

android-808 commented 12 years ago

Symlinking the fonts was actually quite a neat idea in terms of removal, would it please fedora packager? Who knows. If you could reply asking them to get to comment on the issue here so we can all come to a usable solution it would probably make things simpler in the long run.

ln -fs $(DESTDIR)/usr/share/conkycolors/bin/conkyTask $(DESTDIR)/usr/bin/ct ln -fs $(DESTDIR)/usr/share/conkycolors/fonts/conkycolors $(DESTDIR)/usr/share/fonts

I've had trouble with ct for a while, just thought I hadn't shipped it at all but finally realised what happens here. When building package with DESTDIR = /home/user/abs/conky-colors/ the link was both created in and pointed to the fake root. The package is then built from the content of the fake root. This resulted in it containing a link to a file within the temporary fake root rather than the actual file installed.

One idea I had would be to move out all install code except symlinks to another target. This target could then be called by the install target first before creating links. A second package target could then reuse this install routine setting up its own symlinks afterwards.

android-808 commented 12 years ago

Latest Makefile change causes fonts to be installed to /usr/share/fonts/fonts/conkycolors.

android-808 commented 12 years ago

have you heard anyone back from the fedora packager yet?

i haven't incorporated the latest changes into my package yet, haven't had a chance to build and test. i can tell you that the current version has now been downloaded over 220 times since 16th june.

helmuthdu commented 12 years ago

No, i will try to contact him. Good to know :)

hedayat commented 12 years ago

Hi! I'm a friend of the packager! I'm going to shed some light on the problem:

  1. The problem is actually NOT in the name of the fonts directory, the problem is if the fonts should be placed under /usr/share/fonts (where system fonts are supposed to be), or under a custom directory (e.g. /usr/share/conky-colors/) so that they are specific to the application.
  2. The answer is related to the fonts themselves: if the fonts are Unicode-encoded fonts and the symbols are using standard codes which are considered for such fonts, they are fonts which provide a subset of Unicode code page so they must be placed under /usr/share/fonts/. (Because they are not necessarily restricted to conky-colors and can be used anywhere else when such symbols are needed). However, if the fonts do not follow Unicode standard, they are custom fonts and are specific to conky-colors. In this case, these fonts should not be placed under /usr/share/fonts and should be under a non-font directory. This way, these fonts will not be registered in the system, and no applications will see them. This is when FcConfigAppFontAddDir() function comes into the scene: it will be used by conky-colors so that it (and only it) can see the fonts. Therefore, no, it is NOT a one time call function. It should be always called by conky colors so that it can use the fonts, while they are invisible for other applications.

Why this is important for packaging conky-colors in Fedora? Because Fedora guidelines require that all fonts which are placed under /usr/share/fonts/ to be packaged as a separate package (more accurately, each font family in a separate package) because someone might want to use the fonts but not conky-colors, and the package should go through a review process specific to font packages. But if the fonts are specific to conky-colors, they can be placed into the same package as conky-colors since they are not usable for anybody else, and a separate review for the fonts are not needed.

android-808 commented 12 years ago

I'm not fully versed in the use of FcConfigAppFontAddDir() but I don't think it will work in this scenario. Conky-colors (the executable) doesn't actually use any fonts, it purely runs on the console. Font loading and display is done by conky.

I'm on holiday at the moment so I am unable to look in a great deal of depth this week. Need to find the sources of all fonts used and see if any are already package for Fedora.

Webdings is an MS font and is shipped in ttf-ms-fonts in Arch so it could be removed at least for me. Might be same story for Fedora. I'm not sure I would remove all the fonts in case it is being built from source on another distro. Might be worth adding a seperate rule in the Makefile or moving them into a seperate download.

hedayat commented 12 years ago

Would you please first answer the main question: if Conky fonts are unicode fonts? IIRC, there were some Conky* fonts in the archive. Are they Unicode fonts? (like Webdings which is a unicode font AFAIK).

helmuthdu commented 12 years ago

Some fonts dont follow the unicode standard, they were created just for conky.

hedayat commented 12 years ago

Therefore, those fonts should not be placed under /usr/share/fonts (or any subdirectories there); but I don't know what to do about font loading problem (which are loaded by conky itself rather than conky-colors). So, maybe the packager should try the harder path of having this fonts accepted as separate font packages in Fedora...

android-808 commented 12 years ago

The font loading problem would seem to be the deciding factor as to the final location of the fonts within Fedora. I don't know if you could force conky to run xset +fp once on initial refresh to add a custom directory, but it would be a nasty hack,

I'm trying to draw up a complete list of where each font is currently used to see if there are any which can be removed to make packaging fonts easier. So far a quick grep of the src directory has revealed the following BUT beware I haven't checked any of the scripts yet to see if they make use of them.

aClock_{Hour,Min}.ttf only in default Arrows.ttf not used? Wind direction? Buttons ans Switches JL.ttf not used? Media navigation buttons clockFaces.ttf not used? ConkySymbols not used? ConkyWeather not used? Devil inside.ttf not used? Digirtu.ttf only in default (grep Digital Readout) Marvosym.ttf in player and default (grep Martin Vogel) Musicelements.ttf only in conkyplayer OpenLogos.ttf only in default (distro icons) Pie charts for maps.ttf not used? PizzadudeBullets.ttf in default and sls Poky.ttf only in default RsbillsDng.ttf not used? pins, penknife, knife, pointers/fingers, glasses, thumbs, arrows StyleBats.ttf not used? VariShapes Solid.ttf only in default Weather.ttf only in default Webdings.ttf only in conkyplayer

Known external: Arial and Arial Black only in default

hedayat commented 12 years ago

Thank you for the investigation. If they are not really used, it'll speed up the package review process a lot. Yes, I agree that the xset hack is not what we want.

android-808 commented 12 years ago

Forgot Ubuntu family of fonts as external.

I think ConkyWeather may be a left over from old weather script. As for Arial/Arial Black, I wonder if it is worth switching to a replacement like Liberation Sans.

It worrys me slightly that I haven't got a lot of returns for other themes. Need to look through scripts a bit more.

helmuthdu commented 12 years ago

i will try to check this today and remove all the unused fonts and replace other, like the Weather font can be replaced for Webdings (it just use the temperature icon anyway)

android-808 commented 12 years ago

I would leave the Weather/Webdings as is. For starters I can't see a suitable replacement for the thermometer icon. Secondly Webdings being part of ms-fonts may cause more issues with packaging on some distros. I also like the current icon.

Finally, as Weather contains icons for all..er..weathers, it may be possible to enhance the defaults view so that the weather symbol changes to denote the current forecast. Could be implemented as a command line option. The existing conkyYahooWeather script strips out an element called yweather:forecast which contains a code="xx" variable, where xx is a number from 0 to 47 (or 3200 if n/a) . See http://developer.yahoo.com/weather/#codes for details.

!/bin/bash

MIN="min" MAX="max" CUR="cur" UNIT="c" CODE="code" //new param

if [ "$1" = "$CUR" ]; then ... elif [ "$1" = "$CODE" ]; then curl -s --connect-timeout 30 "http://weather.yahooapis.com/forecastrss?p=$2&u=$3" | sed '/<yweather:condition/,1!d' | sed 's/.code="([^"])".*/\1/' fi

conkyForecast has a list mapping this code to the characters in conkyWeather.ttf, http://bazaar.launchpad.net/~conky-companions/+junk/conkyforecast/view/head:/conkyForecast.py#L225

helmuthdu commented 12 years ago

The weather font isnt used anymore, conkyForecast was removed bc its not working anymore. I have deleted all unused fonts and replaced many "dings" for those in Webdings. (I think its much better now) I will check later about the yahoo weather.

EDIT: I had added the Wingdings font, its a free alternative to Webdings

android-808 commented 12 years ago

I'll try to check out the changes tomorrow. Got another early start at work.

I updated earlier post to show changes to YahooWeather script to extract the code. I think the sed commands are correct, I admit I'm a newb at that. Need to find a way to process the output though if you want to use it. Someday I'll work out if github allows markup for code sections, took way to many attempts to make it readable.

A lot of the conkyForecast stuff would probably work if someone was to redirect the queries to Yahoo. IIRC it used to work via weather.com, but they made some changes/removed api docs or something. Yahoo still use weather.com to provide the data, all of the codes mentioned above are the same for both sites.

android-808 commented 12 years ago

I keep getting a 0 byte file for conkyForecast.template being created, due to this line: initialize.c: CREATE("touch %s/templates/conkyForecast.template", datadir); Should this now be removed?

I much prefer the previous icons being used for network and weather in the default view, they looked simpler and cleaner. I find the new dowload/upload icons look more like they should refer to disk usage and the thermometer looks a bit chunky.

Two fonts I've come across today that may be ok: iconic has some smart icons that could be used for up/download featuring a cloud and assoicated arrow, amongst others. CC Share Alike 3.0 license. entypo CC as well

The IP icon is ok but may need some alignment, just a shame it doesn't have softer edges.

android-808 commented 11 years ago

The saga continues...

Arch have recently upgraded to fontconfig 2.10.1, replacing several config files along the way. As a side effect, "ConkySymbol", "Open Logos" and "Pie charts for maps" (possibly more - Web/wingdings?) have start causing problems for several users, including myself. For Open Logos at least, it seems to be something to do with the font encoding being for Mac, but I don't know how to convert it.

helmuthdu commented 11 years ago

Confirming this bug, i will check what can be done.

helmuthdu commented 11 years ago

I reeconded (to UnicodeBMP) the fonts and everything seems to work fine now. :)

android-808 commented 11 years ago

Push the changes and I'll update the PKGBUILD.

helmuthdu commented 11 years ago

Already there :)

android-808 commented 11 years ago

Will push changes to PKGBUILD shortly

android-808 commented 11 years ago

Open Logos not updated. All the others are working fine.

helmuthdu commented 11 years ago

Well, its already in unicodeBMP, thats why i thought it was fine. To fix this font will be a little harder to port, i have to realocate all "icons", bc for some reason they moved to letters like ǵ,æ,ð.

helmuthdu commented 11 years ago

All logos are working, with diferent keys (thats sucks). But its working for conky-colors.

android-808 commented 11 years ago

Strange. For me in FontForge it appeared as TrueType Mac/ Unicode Mac or something like that, but I've never used it before tonight.

The only thing I don't like about having to encode them all is are they going to break on other distros?

Off topic a bit: conkyWeather.ttf Is it possible to reorder the characters in the file so that they are the same order as the id codes listed here: http://bazaar.launchpad.net/~conky-companions/+junk/conkyforecast/view/head:/conkyForecast.py#L225 Using something like 0=A, 1=B etc, the conkyYahooWeather modification I posted above could just add the code number to the unicode value/ascii code of A and return the corresponding character for the weather code.

helmuthdu commented 11 years ago

I dont think dat would be hard to do... i will try to update the script this week. :)

android-808 commented 11 years ago

Just don't really like the thermometer. Looks bulky compared to everything else, plus it adds weather status that is lacking compared to other modes.

helmuthdu commented 11 years ago

I know that some icons didnt "fit", i did what i could to fix this issue, but in the end, i think this issue cant be fixed. I'm thinking of adding back some old icons.

android-808 commented 11 years ago

As stated earlier, I think the old network upload/download icons and IP address worked better. The Fedora guys don't seem to be helping out with packaging, so if they want different they can help :p

Either that or we create a custom font with cherry picked icons we like.

helmuthdu commented 11 years ago

Finally can close this issue, there's no proprietary fonts anymore. Only have 2 external fonts: digirtu and PieChartsformaps, both free.