diff --git a/Cargo.toml b/Cargo.toml index 6e4526292..fbdbc1f47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,6 +36,13 @@ which = "*" xdg = "*" libnotify = { git = "https://github.com/hasufell/rust-libnotify.git", branch = "git-deps", optional = true } png = "^0.9.0" +lazy_static = "^0.2.8" +w_result = "^0.1.2" + + +[dependencies.x11] +version = "^2.14.0" +features = ["xlib", "xtst"] [dependencies.gtk] git = "https://github.com/gtk-rs/gtk.git" diff --git a/README.md b/README.md index a46b24847..a9b6a1f6c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,6 @@ Pretty much the same. Differences are: TODO ---- -- [ ] [hotkey support](https://github.com/hasufell/pnmixer-rust/issues/5) +- [x] [hotkey support](https://github.com/hasufell/pnmixer-rust/issues/5) - [ ] [translation](https://github.com/hasufell/pnmixer-rust/issues/4) - [X] [documentation](https://github.com/hasufell/pnmixer-rust/issues/3) diff --git a/data/ui/hotkey-dialog.glade b/data/ui/hotkey-dialog.glade new file mode 100644 index 000000000..a8a6d312e --- /dev/null +++ b/data/ui/hotkey-dialog.glade @@ -0,0 +1,188 @@ + + + + + + 300 + 200 + False + 5 + Set xxx HotKey + True + True + input-keyboard + dialog + + + True + False + 2 + + + True + False + end + + + False + True + True + True + + + True + False + center + + + True + False + gtk-cancel + + + False + True + 0 + + + + + True + False + 5 + Cancel + + + False + True + 1 + + + + + + + False + False + 0 + + + + + False + True + end + 3 + + + + + True + False + + + True + False + 10 + 10 + 57 + input-keyboard + 3 + + + False + False + 0 + + + + + True + False + vertical + + + True + False + Defining HotKey + + + + + + True + True + 0 + + + + + True + False + (press <Ctrl>C to reset) + + + True + True + 1 + + + + + True + True + 1 + + + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + True + False + Press new HotKey for xxx + True + + + True + True + 2 + + + + + True + False + + + + + + True + True + 4 + + + + + + button1 + + + diff --git a/data/ui/prefs-dialog.glade b/data/ui/prefs-dialog.glade index 7ab2e7e53..c1372447b 100644 --- a/data/ui/prefs-dialog.glade +++ b/data/ui/prefs-dialog.glade @@ -926,10 +926,229 @@ - + + True + False + start + 5 + 5 + 5 + 5 + vertical + + + True + False + 0 + none + + + True + False + 12 + vertical + + + Enable HotKeys + False + True + True + False + start + True + + + False + False + 5 + 0 + + + + + True + False + 12 + 12 + True + + + True + False + start + Command + + + + + + 0 + 0 + + + + + True + False + start + Mute/Unmute: + + + 0 + 1 + + + + + True + False + start + Volume Up: + + + 0 + 2 + + + + + True + False + start + Volume Down: + + + 0 + 3 + + + + + True + False + HotKey + + + + + + 1 + 0 + + + + + True + False + + + True + False + (None) + + + + + + + + 1 + 1 + + + + + True + False + + + True + False + (None) + + + + + + + + 1 + 2 + + + + + True + False + + + True + False + (None) + + + + + + + + 1 + 3 + + + + + True + False + Double-click a HotKey to assign a new HotKey + + + 0 + 4 + 2 + + + + + False + True + 1 + + + + + + + True + False + 5 + <b>HotKey Settings</b> + True + + + + + False + False + 5 + 0 + + + + + 3 + - + + True + False + HotKeys + + + 3 + False + diff --git a/src/alsa_card.rs b/src/alsa_card.rs index e42f55f41..1ab2bef46 100644 --- a/src/alsa_card.rs +++ b/src/alsa_card.rs @@ -316,7 +316,6 @@ extern "C" fn watch_cb(chan: *mut glib_sys::GIOChannel, error!("GIO error has occurred"); cb(AlsaEvent::AlsaCardError); } - _ => warn!("Unknown status from g_io_channel_read_chars()"), } return true as glib_sys::gboolean; } diff --git a/src/app_state.rs b/src/app_state.rs index c0563f288..21a427537 100644 --- a/src/app_state.rs +++ b/src/app_state.rs @@ -4,8 +4,10 @@ use audio::{Audio, AudioUser}; use errors::*; use gtk; +use hotkeys::Hotkeys; use prefs::*; use std::cell::RefCell; +use std::rc::Rc; use support_audio::*; use ui_entry::Gui; @@ -21,12 +23,15 @@ pub struct AppS { /// Mostly static GUI state. pub gui: Gui, /// Audio state. - pub audio: Audio, + pub audio: Rc