Adding the width scaling as a parameter. - tthingmenu - A simple graphical menu launcher for X11.
Log
Files
Refs
LICENSE
---
commit 9fbca8b3f21d2d0ad07d19ec8222c2a3fd89b984
parent 85c2c65341cb8953afe7fc9fea794efca060c3d9
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed,  7 Sep 2011 22:00:18 +0200

Adding the width scaling as a parameter.

Diffstat:
  config.def.h                        |       2 ++
  thingmenu-menu.sh                   |      50 +++++++++++++++++++++++++++++++
  thingmenu.c                         |       8 +++++---

3 files changed, 57 insertions(+), 3 deletions(-)
---
diff --git a/config.def.h b/config.def.h
@@ -7,3 +7,5 @@ static const char *pressfgcolor = "#000000";
 static const char *highlightbgcolor = "#bbbbbb";
 static const char *highlightfgcolor = "#000000";
 
+static const int widthscaling = 1.5;
+
diff --git a/thingmenu-menu.sh b/thingmenu-menu.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+POSARGS="-ww 400 -wh 400"
+
+case "$1" in
+        "svkbd")
+                thingmenu $POSARGS -- \
+                        "svkbd de" "svkbd-de -wy -16" \
+                        "svkbd en" "svkbd-en -wy -16" \
+                        "svkbd arrows" "svkbd-arrows -wy -16" \
+                        "back" "thinkpad-menu.sh"
+                ;;
+        "conn")
+                thingmenu $POSARGS -- \
+                        "WWAN start" "sudo conn -s wwan" \
+                        "WWAN stop" "sudo conn -k wwan" \
+                        "WiFi start" "sudo conn -s wifi" \
+                        "WiFi stop" "sudo conn -k wifi" \
+                        "Ethernet start" "sudo conn -s eth" \
+                        "Ethernet stop" "sudo conn -k eth" \
+                        "back" "thinkpad-menu.sh"
+                ;;
+        "fn")
+                thingmenu $POSARGS -- \
+                        "backlight +10%" "xbacklight -inc 10%" \
+                        "backlight -10%" "xbacklight -dec 10%" \
+                        "battery" "sleep 1; xset dpms force off" \
+                        "suspend" "pm-suspend" \
+                        "hibernate" "pm-hibernate" \
+                        "rotate" "thinkpad-rotate.sh" \
+                        "monitor switch" "thinkpad-fn-f7.sh" \
+                        "back" "thinkpad-menu.sh"
+                ;;
+        "sound")
+                thingmenu $POSARGS -- \
+                        "volume +10%" "amixer set Master 10%+" \
+                        "volume -10%" "amixer set Master 10%-" \
+                        "toggle mute" "amixer set Master toggle" \
+                        "back" "thinkpad-menu.sh"
+                ;;
+        *)
+                thingmenu $POSARGS -- \
+                        "svkbd menu" "thinkpad-menu.sh svkbd" \
+                        "conn menu" "thinkpad-menu.sh conn" \
+                        "fn menu" "thinkpad-menu.sh fn" \
+                        "sound menu" "thinkpad-menu.sh sound" \
+                        "xkill" "xkill"
+                ;;
+esac
+
diff --git a/thingmenu.c b/thingmenu.c
@@ -289,8 +289,10 @@ initfont(const char *fontstr)
                 XFreeFontSet(dpy, dc.font.set);
         dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def);
         if(missing) {
-                while(n--)
-                        fprintf(stderr, "svkbd: missing fontset: %s\n", missing[n]);
+                while(n--) {
+                        fprintf(stderr, "thingmenu: missing fontset: %s\n",
+                                        missing[n]);
+                }
                 XFreeStringList(missing);
         }
         if(dc.font.set) {
@@ -394,7 +396,7 @@ setup(void)
                 if (ls > www)
                         www = ls;
         }
-        www *= 1.5;
+        www *= widthscaling;
 
         if (ww == 0) {
                 if (horizontal) {