Project

General

Profile

[script] Hide all idle channels and querys (no new message color) v0.5

Added by Mr. BS about 9 years ago

Changelog

  • v0.5
    - More fine control, features and what more you find.
  • v0.4
    - Now each window has its own timeout based on global one!
    - When Status Window gets focus, all windows in this network are unhidden, turning easy to return to some previous channel.
    - Minor fixes and overall improvements (liar, just more code hard to understand).
  • v0.3.1
    - Increased default timeout to 120 seconds.
    - Added hotkey F3 to force unhide all windows.
    - Some typo and minor code fixes.
  • v0.3
    - Changed /window -h parameter to -wN to help avoid stuck windows, a known .Net mdi bug.
    - Added event On Active to make the window visible in *bars again, example if you send /join #channel.
  • v0.2
    - Fixed some bugs, like hiding active window when called by a timer.
    - Added menu to toggle auto mode.
    - Moved menu from channel to menubar.
    - Changed manual unhide windows parameter to -u to be more compliant to standard commands flags.
  • v0.1.2
    - Now it check if window is hidden prior to restoring to avoid scrollbar flickering.
  • v0.1.1
    - Exclude windows with unread highlights.
    - Added channel menu for a convenient toggle.
  • v0.1
    - Initial release

Script

; http://dev.adiirc.com/boards/5/topics/475
; Version 0.5

alias -l hidle.version {
  return v0.5
}

; Hide all idle channels and querys (no new message color):
;  /hidle

; Force unhide all windows if need:
;  /hidle -u

; Lets hide inactive windows after xx seconds on AdiIRC startup?!
on *:START: {
  if ($exists($hidle.file)) hload -m hidle $hidle.file
  else {
    freshstart
  }
  .timerhidle -o 0 1 hidle
}

alias -l freshstart {
  hmake hidle
}

alias -l hidle.file {
  return $qt($adiircdir\hidle_Windows.dat)
}

alias -l hidle.save {
  hsave hidle $hidle.file
}

; Global timeout
alias -l hidle.timeout {
  return 60
}

; Restore windows on unloading script
on *:UNLOAD: hidle -u

alias F3 {
  hidle -u
}

alias hidle {
  scon -a dohidle $1
}

alias -l dohidle {
  var %w $window(*,0), %wtype, %wname, %wid, %wcolor, %widle, %wstate

  while (%w) {
    %wtype = $istok(channel query,$window(*,%w).type,32)
    %wid = $window(*,%w).wid
    %wname = $window(@ $+ %wid)
    %wcid = $window(@ $+ %wid).cid
    %wcolor = $istok(message highlight,$window(@ $+ %wid).sbcolor,32)
    %widle = $($+(%,hidle_,%wid),2)
    %wstate = $window(@ $+ %wid).tbstate

    if (%wtype) && ($activewid != %wid) {

      if (%widle) dec %hidle_ $+ %wid

      if (u isin $1) {
        window -w3 %wname
        set -e %hidle_ $+ %wid $hidle.timeout()
      }
      elseif (!%wcolor) && (!%widle) && (%wstate) {

        ; skip hidding if Status is active and window is from same network, otherwise you will need to togle focus to get 'Unhide windows on focus network status' working.
        if ($active == Status Window) && (%wcid == $activecid) { }
        else {
          window -w0 %wname
          set -e %hidle_ $+ %wid $hidle.timeout()
        }
      }

    }

    dec %w
  }
}

; Unhide on focus
on *:ACTIVE:*: {
  if ($hget(hidle,unhide_on_status_focus).data == $null) return

  var %lwid = $lactivewid

  if ($window(@ $+ %lwid).type isin channel query) && (%lwid != $wid) set -e %hidle_ $+ %lwid $hidle.timeout()  
  if (!$window($active).tbstate) && ($window($active).type isin channel query) window -w3 $active
  if ($window($active).type == status) && (%lwid != $wid) .timer -m 1 1 dohidle -u

}

; Unhide on activity
on *:TEXT:*:#,?: {
  if (!$halted) {
    wunhide
  }
}

on *:ACTION:*:#,?: {
  if (!$halted) {
    wunhide
  }
}

alias -l wunhide {
  var %w = @ $+ $wid
  if (!$window(%w).tbstate) window -w3 %w
}

menu menubar {
  -
  Idle Windows
  .$style(2) $chr(91) Global config - hidle $hidle.version $chr(93):noop
  .-
  .$chr(28) Auto hide control $chr(9) $iif($timer(Hidle),On,Off):toggle
  .$chr(28) Global timeout in seconds $chr(9) $iif($hget(hidle,global_timeout).data,$v1,$hidle.timeout())): var %v $input(Global timeout in seconds for $crlf $+ $crlf $+ Send empty value to restore original config,oeq,hidle,$iif($hget(hidle,global_timeout).data,$v1)) | if (%v isnum 1-) hadd -m hidle global_timeout %v | if ($remove(%v,$chr(32)) == $null) hadd -m hidle global_timeout $hidle.timeout() | hidle.save
  .$chr(28) Unhide windows on focus network status $chr(9) $iif($hget(hidle,unhide_on_status_focus).data,$v1,No)): var %v $input(Unhide windows on focus network status?,oqm,hidle,,Yes,No) | hadd -m hidle unhide_on_status_focus %v | hidle.save
  .-
  .$iif($window($active).type isin channel query,$style(2) $chr(91) $active @ $network $chr(93) custom rules):noop
  .-
  .$iif($window($active).type isin channel query,$chr(28) Timeout $chr(9) $iif($hget(hidle,# $+ @ $+ $network).data,$v1,Follow global)): var %v $input(Timeout in seconds for $active $crlf $+ $crlf $+ Send empty value to follow global config,oeq,hidle,$iif($hget(hidle,# $+ @ $+ $network).data,$v1)) | if (%v isnum 1-) hadd -m hidle # $+ @ $+ $network %v | if ($remove(%v,$chr(32)) == $null) hdel hidle # $+ @ $+ $network | hidle.save
  .$iif($window($active).type isin channel query,$chr(28) Exclude channel (stay visible) $chr(9) $iif(# $+ @ $+ $network isin $hget(hidle,exclusions).data,Yes,No)): hadd -m hidle exclusions $iif(# $+ @ $+ $network isin $hget(hidle,exclusions).data, $remtok($hget(hidle,exclusions).data,# $+ @ $+ $network,1,32) , $addtok($hget(hidle,exclusions).data,# $+ @ $+ $network,32) )) | hidle.save
  .-
  .$style(2) $chr(91) Manual tools $chr(93):noop
  .-
  .$chr(28) Hide read windows (no new message): hidle
  .$chr(28) Force unhide all: hidle -u
}

alias -l toggle {
  if ($timer(hidle)) {
    scon -a hidle -u
    .timerhidle off
  }
  else {
    .timerhidle 0 1 hidle
  }
}

I highly recommend to use together to my version of HideWindow script, it is an excellent complementary companion.

mIRC compatible ✔


Replies (5)

RE: [script] Hide all idle channels and querys (no new message color) v0.2 - Added by Mr. BS almost 8 years ago

New release.

  • v0.2
    - Fixed some bugs, like hiding active window when called by a timer.
    - Added menu to toggle auto mode. (still being enabled on startup, prefix On Start event by a semicolon (comment) to disable it)
    - Moved menu from channel to menubar.
    - Changed manual unhide windows parameter to -u to be more compliant to standard commands flags.

RE: [script] Hide all idle channels and querys (no new message color) v0.3 - Added by Mr. BS almost 8 years ago

Rushed a new release.

  • v0.3
    - Changed /window -h parameter to -wN to help avoid stuck windows, a known .Net mdi bug.
    - Added event On Active to make window visible in *bars again, example if you send /join #channel.

What more it need? Unhide windows only on highlight? Buttons for quick toggle? Exclusion list? Be free to post your suggestion, because the current features set is almost enough for me!

RE: [script] Hide all idle channels and querys (no new message color) v0.3.1 - Added by Mr. BS almost 8 years ago

Rushed a new release².

v0.3.1
- Increased default timeout to 120 seconds.
- Added hotkey F3 to force unhide all windows.
- Some typo and minor code fixes.

RE: [script] Hide all idle channels and querys (no new message color) v0.4 - Added by Mr. BS almost 8 years ago

More one release of my new fav script.

  • v0.4
    - Now each window has its own timeout based on global one! No more hiding a channel in "random" intervals. \o/
    - When Status Window get focus, all windows in this network are unhiden, turning easy to return to some previous channel.
    - Minor fixes and overall improvements.

RE: [script] Hide all idle channels and querys (no new message color) v0.4 - Added by Mr. BS about 7 years ago

New version 0.5, half done a few months ago, releasing now. Hope it works for who give it a try.

  • v0.5
    - More fine control, features and what more you find.
    (1-5/5)