aboutsummaryrefslogtreecommitdiffstats
path: root/ido-mode
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-01-09 11:55:20 +0000
committerTom Feist <shabble@metavore.org>2011-01-09 11:55:20 +0000
commit201451a263eabc14a6788ca22f00cc63d95c8a88 (patch)
tree0e241eaa59e4dad951cb66e6c9f1458e054bdca6 /ido-mode
parentmodule/test: putting my email address on the internets? Great idea! (diff)
downloadirssi-scripts-bare_module_v1.0.tar.gz
irssi-scripts-bare_module_v1.0.zip
ido-mode/ido_switcher: added a ido_show_active_first setting to prioritisebare_module_v1.0
active windows. On by default.
Diffstat (limited to 'ido-mode')
-rw-r--r--ido-mode/ido_switcher.pl25
1 files changed, 17 insertions, 8 deletions
diff --git a/ido-mode/ido_switcher.pl b/ido-mode/ido_switcher.pl
index 5576b32..0ad9518 100644
--- a/ido-mode/ido_switcher.pl
+++ b/ido-mode/ido_switcher.pl
@@ -129,6 +129,7 @@ my $showing_help = 0;
my $need_clear = 0;
my $sort_ordering = "start-asc";
+my $sort_active_first = 0;
# /set configurable settings
my $ido_show_count;
@@ -275,9 +276,10 @@ sub load_uberprompt_failed {
}
sub ido_switch_init {
- Irssi::settings_add_bool('ido_switch', 'ido_switch_debug', 0);
- Irssi::settings_add_bool('ido_switch', 'ido_use_flex', 1);
- Irssi::settings_add_int ('ido_switch', 'ido_show_count', 5);
+ Irssi::settings_add_bool('ido_switch', 'ido_switch_debug', 0);
+ Irssi::settings_add_bool('ido_switch', 'ido_use_flex', 1);
+ Irssi::settings_add_bool('ido_switch', 'ido_show_active_first', 1);
+ Irssi::settings_add_int ('ido_switch', 'ido_show_count', 5);
Irssi::command_bind('ido_switch_start', \&ido_switch_start);
@@ -288,9 +290,10 @@ sub ido_switch_init {
}
sub setup_changed {
- $DEBUG_ENABLED = Irssi::settings_get_bool('ido_switch_debug');
- $ido_show_count = Irssi::settings_get_int ('ido_show_count');
- $ido_use_flex = Irssi::settings_get_bool('ido_use_flex');
+ $DEBUG_ENABLED = Irssi::settings_get_bool('ido_switch_debug');
+ $ido_show_count = Irssi::settings_get_int ('ido_show_count');
+ $ido_use_flex = Irssi::settings_get_bool('ido_use_flex');
+ $sort_active_first = Irssi::settings_get_bool('ido_show_active_first');
}
@@ -384,9 +387,15 @@ sub get_all_windows {
my $list_ref = shift;
my @ret = @$list_ref;
- @ret = sort { $a->{num} <=> $b->{num} } @ret;
+ @ret = sort { $a->{num} <=> $b->{num} } @ret;
+ if ($sort_active_first) {
+ my @active = grep { $_->{active} } @ret;
+ my @inactive = grep { not $_->{active} } @ret;
- return @ret;
+ return (@active, @inactive);
+ } else {
+ return @ret;
+ }
}
sub ido_switch_select {