Skip to content

Commit

Permalink
* add runtime option 'systray action' to trigger show/hide state
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer10 committed Apr 1, 2016
1 parent 0b8f2b7 commit 5a010a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
7 changes: 4 additions & 3 deletions README.md
Expand Up @@ -24,9 +24,10 @@ Features:
```
- command-line runtime options
```
echo quit > /tmp/jalv.select.fifo$UID
echo show > /tmp/jalv.select.fifo$UID
echo hide > /tmp/jalv.select.fifo$UID
echo 'quit' > /tmp/jalv.select.fifo$UID
echo 'show' > /tmp/jalv.select.fifo$UID
echo 'hide' > /tmp/jalv.select.fifo$UID
echo 'sytray action' > /tmp/jalv.select.fifo$UID
```
- keyboard shortcuts

Expand Down
14 changes: 11 additions & 3 deletions jalv.select.cpp
Expand Up @@ -367,7 +367,7 @@ LV2PluginList::LV2PluginList() :
menuQuit.signal_activate().connect(
sigc::mem_fun(*this, &LV2PluginList::on_button_quit));
show_all();
treeView.grab_focus();
take_focus();
}

LV2PluginList::~LV2PluginList() {
Expand Down Expand Up @@ -540,6 +540,12 @@ bool LV2PluginList::key_release_event(GdkEventKey *ev) {
return true;
}

void LV2PluginList::take_focus() {
Gtk::TreeModel::iterator iter = selection->get_selected();
if(iter) selection->unselect(*iter);
treeView.grab_focus();
}

void LV2PluginList::systray_menu(guint button, guint32 activate_time) {
MenuPopup.show_all();
MenuPopup.popup(2, gtk_get_current_event_time());
Expand All @@ -554,7 +560,7 @@ void LV2PluginList::systray_hide() {
options.hidden = false;
}
present();
treeView.grab_focus();
take_focus();
} else {
get_window()->get_root_origin(mainwin_x, mainwin_y);
hide();
Expand All @@ -570,7 +576,7 @@ void LV2PluginList::come_up() {
get_window()->get_root_origin(mainwin_x, mainwin_y);
}
present();
treeView.grab_focus();
take_focus();
}

void LV2PluginList::go_down() {
Expand Down Expand Up @@ -622,6 +628,8 @@ bool FiFoChannel::read_fifo(Glib::IOCondition io_condition)
fc->runner->come_up();
} else if (buf.compare("hide\n") == 0) {
fc->runner->go_down();
} else if (buf.compare("systray action\n") == 0) {
fc->runner->systray_hide();
} else if (buf.find("PID: ") != Glib::ustring::npos) {
fc->own_pid +="\n";
if(buf.compare(fc->own_pid) != 0) {
Expand Down
6 changes: 4 additions & 2 deletions jalv.select.h
Expand Up @@ -224,17 +224,19 @@ class LV2PluginList : public Gtk::Window {
LV2_Feature map_feature;
KeyGrabber *kg;
FiFoChannel *fc;

void get_interpreter();
void fill_list();
void refill_list();
void new_list();
void fill_class_list();
void systray_menu(guint button, guint32 activate_time);
void show_preset_menu();
void take_focus();
void button_release_event(GdkEventButton *ev);
bool key_release_event(GdkEventKey *ev);



virtual void on_combo_changed();
virtual void on_entry_changed();
virtual void on_button_quit();
Expand Down

0 comments on commit 5a010a0

Please sign in to comment.