[Pommed-commits] [SCM] pommed - hotkeys handler for Apple laptops branch, master, updated. 1.36-7-g7e00acb
Julien BLACHE
jb at jblache.org
Sat Feb 5 17:27:42 UTC 2011
The following commit has been merged in the master branch:
commit c83d9ef89864793ba5408f82aae6db518d991a18
Author: Julien BLACHE <jb at jblache.org>
Date: Sun Dec 26 17:33:33 2010 -0500
Make keyboard backlight idle level configurable
Rather than switching the keyboard backlight off entirely, make it possible
to fade it down to some configurable, low level.
Based on a patch from Alex Launi <alex.launi at canonical.com>.
diff --git a/ChangeLog b/ChangeLog
index 61eacdb..67f97ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@ ChangeLog for pommed
version 1.37:
- pommed: fix oversight in applesmc probing change.
- pommed: prefer nvidia_bl over Nouveau.
+ - pommed: add new option to fade keyboard backlight instead of
+ switching off when idle. From Alex Launi <alex.launi at canonical.com>.
version 1.36:
- pommed: probe for applesmc through /sys/class/hwmon.
diff --git a/pommed.conf.mactel b/pommed.conf.mactel
index 97d2c6d..d4d2d2c 100644
--- a/pommed.conf.mactel
+++ b/pommed.conf.mactel
@@ -87,8 +87,10 @@ kbd {
off_threshold = 40
# enable/disable automatic backlight
auto = yes
- # idle timer - switches off keyboard backlight automatically (timeout in seconds, -1 to disable)
+ # idle timer - fades keyboard backlight automatically (timeout in seconds, -1 to disable)
idle_timer = 60
+ # idle level - level to fade keyboard to after idle_timer seconds. Defaults to switching off.
+ # idle_level = 20
}
# CD/DVD drive ejection
diff --git a/pommed.conf.pmac b/pommed.conf.pmac
index dac961e..899fb79 100644
--- a/pommed.conf.pmac
+++ b/pommed.conf.pmac
@@ -61,8 +61,10 @@ kbd {
off_threshold = 40
# enable/disable automatic backlight
auto = yes
- # idle timer - switches off keyboard backlight automatically (timeout in seconds, -1 to disable)
+ # idle timer - fades keyboard backlight automatically (timeout in seconds, -1 to disable)
idle_timer = 60
+ # idle level - level to fade keyboard to after idle_timer seconds. Defaults to switching off.
+ # idle_level = 20
}
# CD/DVD drive ejection
diff --git a/pommed/conffile.c b/pommed/conffile.c
index d54b9e2..bec7118 100644
--- a/pommed/conffile.c
+++ b/pommed/conffile.c
@@ -113,6 +113,7 @@ static cfg_opt_t kbd_opts[] =
CFG_INT("off_threshold", 40, CFGF_NONE),
CFG_BOOL("auto", 1, CFGF_NONE),
CFG_INT("idle_timer", 60, CFGF_NONE),
+ CFG_INT("idle_level", KBD_BACKLIGHT_OFF, CFGF_NONE),
CFG_END()
};
@@ -226,6 +227,7 @@ config_print(void)
printf(" auto off threshold: %d\n", kbd_cfg.off_thresh);
printf(" auto enable: %s\n", (kbd_cfg.auto_on) ? "yes" : "no");
printf(" idle timer: %d%s\n", kbd_cfg.idle, (kbd_cfg.idle > 0) ? "s" : "");
+ printf(" idle level: %d\n", kbd_cfg.idle_lvl);
printf(" + CD eject:\n");
printf(" enabled: %s\n", (eject_cfg.enabled) ? "yes" : "no");
printf(" device: %s\n", eject_cfg.device);
@@ -358,6 +360,7 @@ config_load(void)
kbd_cfg.off_thresh = cfg_getint(sec, "off_threshold");
kbd_cfg.auto_on = cfg_getbool(sec, "auto");
kbd_cfg.idle = cfg_getint(sec, "idle_timer");
+ kbd_cfg.idle_lvl = cfg_getint(sec, "idle_level");
kbd_backlight_fix_config();
sec = cfg_getsec(cfg, "eject");
diff --git a/pommed/conffile.h b/pommed/conffile.h
index 5b4a26a..6082160 100644
--- a/pommed/conffile.h
+++ b/pommed/conffile.h
@@ -53,6 +53,7 @@ struct _kbd_cfg {
int off_thresh;
int auto_on;
int idle;
+ int idle_lvl;
};
struct _eject_cfg {
diff --git a/pommed/kbd_auto.c b/pommed/kbd_auto.c
index d513262..c8be030 100644
--- a/pommed/kbd_auto.c
+++ b/pommed/kbd_auto.c
@@ -48,11 +48,17 @@ kbd_backlight_toggle(void)
void
kbd_backlight_inhibit_set(int mask)
{
+ int lvl;
+
if (!kbd_bck_info.inhibit)
kbd_bck_info.inhibit_lvl = kbd_bck_info.level;
- kbd_backlight_set(KBD_BACKLIGHT_OFF,
- (mask & KBD_MASK_AUTO) ? (KBD_AUTO) : (KBD_USER));
+ if (mask & KBD_INHIBIT_IDLE)
+ lvl = (kbd_cfg.idle_lvl < kbd_bck_info.level) ? kbd_cfg.idle_lvl : kbd_bck_info.level;
+ else
+ lvl = KBD_BACKLIGHT_OFF;
+
+ kbd_backlight_set(lvl, (mask & KBD_MASK_AUTO) ? (KBD_AUTO) : (KBD_USER));
kbd_bck_info.inhibit |= mask;
--
pommed - hotkeys handler for Apple laptops
More information about the Pommed-commits
mailing list