summaryrefslogtreecommitdiff
path: root/desktop/icewm
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/icewm')
-rw-r--r--desktop/icewm/icewm-xdg-menu128
-rw-r--r--desktop/icewm/icewm.SlackBuild14
-rw-r--r--desktop/icewm/patches/icewm-1.3.7-menuiconsize.patch73
-rw-r--r--desktop/icewm/patches/icewm-1.3.7-thermal.patch41
-rw-r--r--desktop/icewm/patches/icewm-keys.patch43
5 files changed, 298 insertions, 1 deletions
diff --git a/desktop/icewm/icewm-xdg-menu b/desktop/icewm/icewm-xdg-menu
new file mode 100644
index 0000000000..529f9e2ab3
--- /dev/null
+++ b/desktop/icewm/icewm-xdg-menu
@@ -0,0 +1,128 @@
+#!/usr/bin/python2
+"""
+This script generates FreeDesktop application menu for IceWM window manager.
+
+Written by Konstantin Korikov <lostclus@ua.fm>, put in the public domain
+
+Requires pyxdg http://cvs.freedesktop.org/cgi-bin/viewcvs.cgi/pyxdg/
+
+USAGE EXAMPLE
+
+Add to $HOME/.icewm/menu this line:
+
+ menuprog Applications - icewm-xdg-menu
+
+and restart IceWM.
+"""
+
+import sys
+import locale
+import getopt
+import re
+import xdg.Menu
+import xdg.DesktopEntry
+import xdg.IconTheme
+import xdg.Config
+
+version = "0.3"
+
+def print_usage(exit_code = 1):
+ print """Usage: %s [options]
+Options:
+ --locale=locale set output languege and encoding
+ --root-folder folder folder to generate (for example: /Games)
+ --terminal command set terminal emulator command (default: xterm -e %%s)
+ --default-folder-icon icon icon for folders that not provide Icon option
+ --default-entry-icon icon icon for entries that not provide Icon option
+ --with-theme-paths convert icon base names to icon absolute paths
+ using icon theme
+ --entire-menu print entire menu
+ --icon-size set default icon size
+ --theme theme set icon theme
+ --help print this help and exit
+ --version print version and exit
+""" % sys.argv[0]
+ sys.exit(exit_code)
+
+def print_version():
+ print "%s version %s" % (
+ os.path.basename(sys.argv[0]), version)
+ sys.exit(0)
+
+root_folder = ""
+terminal = "xterm -e %s"
+default_folder_icon = "folder"
+default_entry_icon = "-"
+entire_menu = False
+with_theme_paths = False
+icon_size = 16
+
+exec_clean1_re = re.compile(r'%[a-zA-Z]')
+exec_clean2_re = re.compile(r'%%')
+encoding = None
+locale_str = None
+
+def find_icon(entry):
+ icon = entry.getIcon()
+ if icon and with_theme_paths:
+ icon = xdg.IconTheme.getIconPath(icon, icon_size) or icon
+ return icon
+
+def process_menu(menu):
+ for entry in menu.getEntries():
+ if isinstance(entry, xdg.Menu.Menu):
+ name = entry.getName() or entry.DesktopFileID
+ icon = find_icon(entry) or default_folder_icon
+
+ if entire_menu:
+ print ("menu \"%s\" \"%s\" {" % (name, icon)).encode(encoding)
+ process_menu(entry)
+ print "}".encode(encoding)
+ else:
+ print (("menuprog \"%s\" \"%s\" %s" % (name, icon, sys.argv[0])) +
+ (" --root-folder \"%s\"" % entry.getPath(org=True)) +
+ (" --terminal \"%s\"" % terminal) +
+ (" --default-folder-icon \"%s\"" % default_folder_icon) +
+ (" --default-entry-icon \"%s\"" % default_entry_icon) +
+ (" --theme \"%s\"" % xdg.Config.icon_theme) +
+ (" --icon-size \"%d\"" % icon_size) +
+ (with_theme_paths and " --with-theme-paths" or "")).encode(encoding),
+ if locale_str:
+ print (" --locale \"%s\"" % locale_str).encode(encoding),
+ print
+ elif isinstance(entry, xdg.Menu.MenuEntry):
+ de = entry.DesktopEntry
+ name = de.getName() or entry.DesktopFileID
+ icon = find_icon(de) or default_entry_icon
+ execute = exec_clean2_re.sub('%', exec_clean1_re.sub('', de.getExec()))
+ if de.getTerminal(): execute = terminal % execute
+ print ("prog \"%s\" \"%s\" %s" % (name, icon, execute)).encode(encoding)
+
+try: opts, args = getopt.getopt(sys.argv[1:], "",
+ ("help", "version", "locale=",
+ "root-folder=", "terminal=", "default-folder-icon=",
+ "default-entry-icon=", "entire-menu", "theme=", "with-theme-paths",
+ "icon-size="))
+except getopt.GetoptError: print_usage()
+
+locale.setlocale(locale.LC_ALL, "")
+
+for o, v in opts:
+ if o == "--locale":
+ locale_str = v
+ locale.setlocale(locale.LC_ALL, locale_str)
+ if o == "--root-folder": root_folder = v
+ elif o == "--terminal": terminal = v
+ elif o == "--default-folder-icon": default_folder_icon = v
+ elif o == "--default-entry-icon": default_entry_icon = v
+ elif o == "--entire-menu" : entire_menu = True
+ elif o == "--with-theme-paths" : with_theme_paths = True
+ elif o == "--icon-size": icon_size = int(v)
+ elif o == "--theme" : xdg.Config.setIconTheme(v)
+ elif o in ("-h", "-?", "--help"): print_usage(0)
+ elif o in ("-v", "--version"): print_version()
+
+encoding = locale.getlocale()[1] or 'UTF-8'
+menu = xdg.Menu.parse()
+if root_folder: menu = menu.getMenu(root_folder)
+process_menu(menu)
diff --git a/desktop/icewm/icewm.SlackBuild b/desktop/icewm/icewm.SlackBuild
index de7e089512..1e093cf2ce 100644
--- a/desktop/icewm/icewm.SlackBuild
+++ b/desktop/icewm/icewm.SlackBuild
@@ -24,7 +24,7 @@
PRGNAM=icewm
VERSION=${VERSION:-1.3.8}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -75,6 +75,15 @@ patch -p1 < $CWD/patches/explicitly-link-fontconfig.diff
# Since we put the html files in $docdir/html/, let's fix the integrated help:
patch -p1 < $CWD/patches/icewm-1.3.x-fix_html_docdir.diff
+# Fix thermal information handling (Gentoo Bug #452730 by Dag Bakke)
+patch -p1 < $CWD/patches/icewm-1.3.7-thermal.patch
+
+# Fix icon size in menu (thanks to Fedora via Gentoo, iiuc)
+patch -p1 < $CWD/patches/icewm-1.3.7-menuiconsize.patch
+
+# Set some sane keyboard shortcut defaults (thanks, Fedora)
+patch -p1 < $CWD/patches/icewm-keys.patch
+
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
@@ -113,6 +122,9 @@ cp -a \
AUTHORS BUGS CHANGES COPYING INSTALL PLATFORMS README* TODO VERSION \
$PKG/usr/doc/$PRGNAM-$VERSION
cp -a doc/*.html $PKG/usr/doc/$PRGNAM-$VERSION/html
+# Add a menu generator for xdg menus to docs
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/contrib
+cat $CWD/icewm-xdg-menu > $PKG/usr/doc/$PRGNAM-$VERSION/contrib/icewm-xdg-menu
cat $CWD/icewm.SlackBuild > $PKG/usr/doc/icewm-$VERSION/icewm.SlackBuild
mkdir -p $PKG/install
diff --git a/desktop/icewm/patches/icewm-1.3.7-menuiconsize.patch b/desktop/icewm/patches/icewm-1.3.7-menuiconsize.patch
new file mode 100644
index 0000000000..d051d5bc5f
--- /dev/null
+++ b/desktop/icewm/patches/icewm-1.3.7-menuiconsize.patch
@@ -0,0 +1,73 @@
+diff -Naur icewm-1.3.7.bak/src/yicon.cc icewm-1.3.7/src/yicon.cc
+--- icewm-1.3.7.bak/src/yicon.cc 2010-10-31 15:09:36.000000000 +0100
++++ icewm-1.3.7/src/yicon.cc 2011-11-07 19:41:52.841910531 +0100
+@@ -270,6 +270,10 @@
+ iconCache.getItem(0)->removeFromCache();
+ }
+
++int YIcon::menuSize() {
++ return menuIconSize;
++}
++
+ int YIcon::smallSize() {
+ return smallIconSize;
+ }
+diff -Naur icewm-1.3.7.bak/src/yicon.h icewm-1.3.7/src/yicon.h
+--- icewm-1.3.7.bak/src/yicon.h 2010-10-31 15:09:36.000000000 +0100
++++ icewm-1.3.7/src/yicon.h 2011-11-07 19:41:28.555296033 +0100
+@@ -25,6 +25,7 @@
+ bool isCached() { return fCached; }
+ void setCached(bool cached) { fCached = cached; }
+
++ static int menuSize();
+ static int smallSize();
+ static int largeSize();
+ static int hugeSize();
+diff -Naur icewm-1.3.7.bak/src/ymenu.cc icewm-1.3.7/src/ymenu.cc
+--- icewm-1.3.7.bak/src/ymenu.cc 2010-10-31 15:09:36.000000000 +0100
++++ icewm-1.3.7/src/ymenu.cc 2011-11-07 19:42:40.498474049 +0100
+@@ -153,8 +153,8 @@
+
+ #ifndef LITE
+ if (getItem(selItem)->getIcon() != null &&
+- YIcon::smallSize() > h)
+- h = YIcon::smallSize();
++ YIcon::menuSize() > h)
++ h = YIcon::menuSize();
+ #endif
+
+ if (x <= int(width() - h - 4))
+@@ -1023,8 +1023,8 @@
+ mitem->getIcon()->draw(g,
+ l + 1 + delta, t + delta + top + pad +
+ (eh - top - pad * 2 - bottom -
+- YIcon::smallSize()) / 2,
+- YIcon::smallSize());
++ YIcon::menuSize()) / 2,
++ YIcon::menuSize());
+ #endif
+ }
+
+diff -Naur icewm-1.3.7.bak/src/ymenuitem.cc icewm-1.3.7/src/ymenuitem.cc
+--- icewm-1.3.7.bak/src/ymenuitem.cc 2010-10-31 15:09:36.000000000 +0100
++++ icewm-1.3.7/src/ymenuitem.cc 2011-11-07 19:50:04.458316916 +0100
+@@ -86,8 +86,8 @@
+ int ih = fontHeight;
+
+ #ifndef LITE
+- if (YIcon::smallSize() > ih)
+- ih = YIcon::smallSize();
++ if (YIcon::menuSize() > ih)
++ ih = YIcon::menuSize();
+ #endif
+
+ if (wmLook == lookWarp4 || wmLook == lookWin95) {
+@@ -123,7 +123,7 @@
+ return 0;
+ #else
+ ref<YIcon> icon = getIcon();
+- return icon != null ? YIcon::smallSize(): 0;
++ return icon != null ? YIcon::menuSize(): 0;
+ #endif
+ }
+
diff --git a/desktop/icewm/patches/icewm-1.3.7-thermal.patch b/desktop/icewm/patches/icewm-1.3.7-thermal.patch
new file mode 100644
index 0000000000..f6b2cf71f0
--- /dev/null
+++ b/desktop/icewm/patches/icewm-1.3.7-thermal.patch
@@ -0,0 +1,41 @@
+diff -uprN a/src/acpustatus.cc b/src/acpustatus.cc
+--- a/src/acpustatus.cc 2010-10-31 15:09:36.000000000 +0100
++++ b/src/acpustatus.cc 2013-01-17 21:12:19.085715083 +0100
+@@ -315,6 +315,37 @@ int CPUStatus::getAcpiTemp(char *tempbuf
+ }
+ closedir(dir);
+ }
++ else if ((dir = opendir("/sys/class/thermal")) != NULL) {
++ struct dirent *de;
++
++ while ((de = readdir(dir)) != NULL) {
++
++ int fd, seglen;
++
++ if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)
++ continue;
++
++ sprintf(namebuf, "/sys/class/thermal/%s/temp", de->d_name);
++ fd = open(namebuf, O_RDONLY);
++ if (fd != -1) {
++ int len = read(fd, buf, sizeof(buf) - 1);
++ buf[len - 4] = '\0';
++ seglen = strlen(buf) + 4;
++ if (retbuflen + seglen >= buflen) {
++ retbuflen = -retbuflen;
++ close(fd);
++ closedir(dir);
++ break;
++ }
++ retbuflen += seglen;
++ strcat(tempbuf, " ");
++ strncat(tempbuf, buf, seglen);
++ strcat(tempbuf, " C");
++ close(fd);
++ }
++ }
++ closedir(dir);
++ }
+ return retbuflen;
+ }
+
diff --git a/desktop/icewm/patches/icewm-keys.patch b/desktop/icewm/patches/icewm-keys.patch
new file mode 100644
index 0000000000..7e136bb932
--- /dev/null
+++ b/desktop/icewm/patches/icewm-keys.patch
@@ -0,0 +1,43 @@
+--- icewm-1.2.30/lib/keys.in.old 2007-01-18 13:55:20.000000000 +0200
++++ icewm-1.2.30/lib/keys.in 2007-01-18 16:07:07.000000000 +0200
+@@ -9,28 +9,21 @@
+ # You'll have to omit XK_ prefixs and to replace XF86XK_ prefixes by
+ # XF86. Valid modifiers are Alt, Ctrl, Shift, Meta, Super and Hyper.
+ #
+-key "Alt+Ctrl+t" xterm
+-key "Alt+Ctrl+f" fte
+-key "Alt+Ctrl+e" nedit
+-key "Alt+Ctrl+g" gimp
+-key "Alt+Ctrl+n" netscape -noraise -remote openBrowser
+-key "Alt+Ctrl+b" netscape -noraise -remote openBookmarks
+-key "Alt+Ctrl+m" netscape -noraise -remote openURL(mailto:,new-window)
++key "Alt+Ctrl+t" xterm
++key "Alt+Ctrl+b" xdg-open about:blank
++key "Alt+Ctrl+s" xdg-open http://www.google.com
+
+-key "Alt+Ctrl+KP_Divide" aumix -v -5 # lower volume
+-key "Alt+Ctrl+KP_Multiply" aumix -v +5 # raise volume
++key "Super+KP_Subtract" amixer sset PCM 5%-
++key "Super+KP_Add" amixer sset PCM 5%+
+
+ # "Multimedia key" bindings for XFree86. Gather the keycodes of your
+ # advanced function keys by watching the output of the xev command whilest
+ # pressing those keys and map those symbols by using xmodmap.
+
+-key "XF86Standby" killall -QUIT icewm
+-key "XF86AudioLowerVolume" aumix -v -5
+-key "XF86AudioRaiseVolume" aumix -v +5
+-key "XF86AudioMute" aumix -v 0
+-key "XF86AudioPlay" cdplay play 1
+-key "XF86AudioStop" cdplay stop
+-key "XF86HomePage" netscape -noraise -remote openHomepage
+-key "XF86Mail" netscape -noraise -remote openURL(mailto:,new-window)
+-key "XF86Search" netscape -noraise -remote openURL(http://www.google.com/)
+-key "XF86Eject" eject
++key "XF86Standby" killall -QUIT icewm
++key "XF86AudioLowerVolume" amixer sset PCM 5%-
++key "XF86AudioRaiseVolume" amixer sset PCM 5%+
++key "XF86AudioMute" amixer sset PCM 0%
++key "XF86HomePage" xdg-open about:blank
++key "XF86Search" xdg-open http://www.google.com
++key "XF86Eject" eject