/* * Plain launcher program for Jay Bromley's Xkeyboard library. * * Copyright (C) 2010 by Sergey Mironov * * This file is part of Xkb-switch. * Xkb-switch is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Xkb-switch is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Xkb-switch. If not, see . */ #include #include #include #include #include "XKeyboard.h" #include "XKbSwitch.hpp" using namespace std; using namespace kb; void usage() { cerr << "Usage: xkb-switch -s ARG Sets current layout group to ARG" << endl; cerr << " xkb-switch -l|--list Displays all layout groups" << endl; cerr << " xkb-switch -h|--help Displays this message" << endl; cerr << " xkb-switch -v|--version Shows version number" << endl; cerr << " xkb-switch -w|--wait [-p] Waits for group change" << endl; cerr << " xkb-switch -W Infinitely waits for group change, prints group names to stdout" << endl; cerr << " xkb-switch -n|--next Switch to the next layout group" << endl; cerr << " xkb-switch [-p] Displays current layout group" << endl; } string print_layouts(const string_vector& sv) { ostringstream oss; bool fst = true; oss << "["; for(string_vector::const_iterator i=sv.begin(); i!=sv.end(); i++) { if(!fst) oss << " "; oss << *i; fst = false; } oss << "]"; return oss.str(); } int main( int argc, char* argv[] ) { string_vector syms; using namespace std; try { int m_cnt = 0; int m_wait = 0; int m_lwait = 0; int m_print = 0; int m_next = 0; int m_list = 0; string newgrp; for(int i=1; i