Project

General

Profile

[Script] Only include channels in alt + [0-9]

Added by Per Amundsen almost 9 years ago

Only include channels when pressing alt + [0-9].

2021/01/30 Added check for whether altgr is pressed

on *:KEYDOWN:*:49,50,51,52,53,54,55,56,57,48:{
  if ($mouse.key !& 8) || ($version > 4.1 && $mouse.key & 256) {
    return
  }

  var %n $replacen($keyval), %s 0, %t 0
  var %cid $cid
  while (%s < $scon(0)) {

    inc %s
    scon %s
    var %c 0
    while (%c < $window(*, 0)) {

      inc %c      
      if ($window(*, %c).type == channel) {        

        inc %t
        if (%t == %n) {
          var %win $window(*, %c)
          if (%win) && ($active != %win || %cid != $cid) {
            window -a %win
            halt
          }
        }
      }
    }     
  }
  halt    
}

alias -l replacen return $replace($1,49,1,50,2,51,3,52,4,53,5,54,6,55,7,56,8,57,9,49,10)