/* * $Id$ * * Keyboard shortcuts applet * Part of Equinox Desktop Environment (EDE). * Copyright (c) 2005-2006 EDE Authors. * * This program is licenced under terms of the * GNU General Public Licence version 2 or newer. * See COPYING for details. */ #include "ekeys.h" using namespace fltk; using namespace edelib; #define NR_HOTKEYS 30 static struct { char systemname[20]; char uiname[50]; char command[50]; } hotkeys[] = { {"NextWindow", "Next window", ""}, {"PreviousWindow", "Previous window", ""}, {"NextDesktop", "Next workspace", ""}, {"PreviousDesktop", "Previous workspace", ""}, {"FastRun", "Run program", ""}, {"FindUtil", "Find file", ""}, {"CloseWindow", "Close window", ""}, {"MinimizeWindow", "Minimize window", ""}, {"MaximizeWindow", "Maximize window", ""}, {"Desktop1", "Workspace 1", ""}, {"Desktop2", "Workspace 2", ""}, {"Desktop3", "Workspace 3", ""}, {"Desktop4", "Workspace 4", ""}, {"Desktop5", "Workspace 5", ""}, {"Desktop6", "Workspace 6", ""}, {"Desktop7", "Workspace 7", ""}, {"Desktop8", "Workspace 8", ""}, {"App1", "", ""}, {"App2", "", ""}, {"App3", "", ""}, {"App4", "", ""}, {"App5", "", ""}, {"App6", "", ""}, {"App7", "", ""}, {"App8", "", ""}, {"App9", "", ""}, {"App10", "", ""}, {"App11", "", ""}, {"App12", "", ""}, }; int keycodes[NR_HOTKEYS]; static void sendClientMessage(XWindow w, Atom a, long x) { XEvent ev; long mask; memset(&ev, 0, sizeof(ev)); ev.xclient.type = ClientMessage; ev.xclient.window = w; ev.xclient.message_type = a; ev.xclient.format = 32; ev.xclient.data.l[0] = x; ev.xclient.data.l[1] = CurrentTime; mask = 0L; if (w == RootWindow(xdisplay, xscreen)) mask = SubstructureRedirectMask; XSendEvent(xdisplay, w, False, mask, &ev); } void sendUpdateInfo() { // No worky /* unsigned int i, nrootwins; XWindow dw1, dw2, *rootwins = 0; int screen_count = ScreenCount(fltk::xdisplay); extern Atom FLTKChangeSettings; for (int s = 0; s < screen_count; s++) { XWindow root = RootWindow(fltk::xdisplay, s); XQueryTree(fltk::xdisplay, root, &dw1, &dw2, &rootwins, &nrootwins); for (i = 0; i < nrootwins; i++) { if (rootwins[i]!=RootWindow(fltk::xdisplay, fltk::xscreen)) { sendClientMessage(rootwins[i], FLTKChangeSettings, 0); } } } XFlush(fltk::xdisplay);*/ } int getshortcutfor(const char* action) { for (int i=0; i= 'a') && (key[0] <= 'z')) { parsed += key[0]; } else if ((key[0] >= 'A') && (key[0] <= 'Z')) { parsed += (key[0] - 'A' + 'a'); } } } return parsed; } void readKeysConfiguration() { Config globalConfig(Config::find_file("wmanager.conf", 0), true, false); globalConfig.set_section("Hotkeys"); for (int i=0; i0 && tmp != "") strncpy(hotkeys[i].uiname, hotkeys[i].systemname, 20); } } globalConfig.set_section("ApplicationNames"); for (int i=0; iclear(); // Rewrite? for (int i=0; iadd ( hotkeys[i].uiname); } void addShortcut(const char *name, const char *cmd) { if ((strcmp(name,"") !=0) && (strcmp(cmd,"") != 0)) { for (int i=0; i