Add Fvwm Perl module to send signals to kbdd.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.fvwm/FvwmKbdd.pl Sat Jul 07 02:25:52 2012 +0300
@@ -0,0 +1,54 @@
+#!/usr/bin/perl -w
+
+use lib `fvwm-perllib dir`;
+use FVWM::Module;
+use General::Parse;
+use Net::DBus;
+
+# dbus-send --dest=ru.gentoo.KbddService /ru/gentoo/KbddService ru.gentoo.kbdd.set_layout uint32:1
+
+# Net::DBus
+my $bus = Net::DBus->session();
+# Net::DBus::RemoteService
+my $service = $bus->get_service("ru.gentoo.KbddService");
+# Net::DBus::RemoteObject
+my $object = $service->get_object("/ru/gentoo/KbddService");
+
+my $module = new FVWM::Module(
+ Name => "FvwmKbdd",
+ Mask => M_STRING,
+ Debug => 1,
+);
+
+sub kbdd {
+ my ($module, $event) = @_;
+ my ($action, @args) = get_tokens($event->_text);
+ if ($action eq "hello") {
+ $module->send("Echo Hello from Kbdd...");
+ } elsif ($action eq "hel") {
+ $module->send("Echo xxx...");
+ } elsif ($action eq "kbdd") {
+ my $no = $args[0];
+ if ((0 <= $no) && ($no < 4)) {
+ $object->set_layout(Net::DBus::dbus_uint32($no));
+ } else {
+ $module->send("Echo Error: Kbdd no " . $no . "is not in 1..4 range");
+ }
+ } elsif ($action eq "stop") {
+ $module->send("Echo Kbdd exit...");
+ $module->terminate;
+ } else {
+ $module->send("Echo Kbdd unknown action: " . $action);
+ }
+}
+
+$module->addHandler(M_STRING, \&kbdd);
+
+$module->send("Echo Kbdd loaded...");
+
+# Terminate itself after 5 sec.
+# my $scheduler = $module->track('Scheduler');
+# $scheduler->schedule(5, sub { $module->terminate; });
+
+$module->event_loop;
+
--- a/.fvwm/config Fri Jul 06 19:29:26 2012 +0300
+++ b/.fvwm/config Sat Jul 07 02:25:52 2012 +0300
@@ -8,10 +8,10 @@
SetEnv fvwm_icon $[FVWM_USERDIR]/icons
SetEnv screenshot_home $[HOME]/.screenshot
-#####################
-# Set the image path.
-#####################
+################################################################
+# Set paths.
+ModulePath $[FVWM_USERDIR]:+
ImagePath $[fvwm_icon];.xpm:$[fvwm_img]
# #################
@@ -243,9 +243,9 @@
Key F12 A S CursorMove +50p +0p
# Switch input method.
-Key 1 A 3 Exec dbus-send --dest=ru.gentoo.KbddService /ru/gentoo/KbddService ru.gentoo.kbdd.set_layout uint32:0
-Key 2 A 3 Exec dbus-send --dest=ru.gentoo.KbddService /ru/gentoo/KbddService ru.gentoo.kbdd.set_layout uint32:1
-Key 3 A 3 Exec dbus-send --dest=ru.gentoo.KbddService /ru/gentoo/KbddService ru.gentoo.kbdd.set_layout uint32:2
+Key 1 A 3 SendToModule FvwmKbdd.pl kbdd 0
+Key 2 A 3 SendToModule FvwmKbdd.pl kbdd 1
+Key 3 A 3 SendToModule FvwmKbdd.pl kbdd 2
# Win+R like in Windows.
Key R A 3 Exec exec gmrun
@@ -428,8 +428,12 @@
# First and after all restart.
# All fvwm modules exit after restart fvwm, so you must put they there.
AddToFunc StartFunction
+# + I Module FvwmDebug --xconsole
+# + I KillModule FvwmDebug
+# + I Module FvwmGtkDebug
+# + I Module FvwmConsole
+ I Module FvwmPager 0 4
+ I Module FvwmAuto 1 -menter enter_handler
-# + I Module FvwmPerl
++ I Module FvwmKbdd.pl
# Add next to load desktop image (must be .xpm or .png)
# + I Exec fvwm-root -r ~/tmp/MagicItemComp2_1280x1024.png
--- a/Makefile Fri Jul 06 19:29:26 2012 +0300
+++ b/Makefile Sat Jul 07 02:25:52 2012 +0300
@@ -75,6 +75,7 @@
done; \
fi; \
done
+ chmod a+x ~/.fvwm/FvwmKbdd.pl
for item in $(IFNONEXIST_ITEMS); do \
if [ -f $$item -a ! -f $(HOME)/$$item ]; then \
install -m 640 $$item $(HOME)/$$item; \