fvwm-window-search 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/README.md +13 -8
 - data/focus.sh +16 -1
 - data/fvwm-window-search +25 -8
 - data/lib.rb +5 -5
 - metadata +12 -7
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: dd55a9dff4bdaee0fcb2e3aab600d85f6c0d40b8a706ea1dd0d7d17e2c0a83c8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b47ae4bac4a1a0e68f629306de58e76f6d0111f48e1a9bb686fb63362179161b
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 13ce630d60e59c33f1bd26c6b29f4dcca5134dabc8d4f0a6a54f812e9d5d50ebb4ca644031e126785cefdaad6cd95ce008a3ca7167deb04b103a0e9dfc43ed53
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 00311f2288294e4556f3e38b297c33581a7f0ab0b8ced615daf07d31c88682d0555b164a8eb5be6d68729495a8460469ed244511d93d8f2cab0793abac7a8fbc
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -5,14 +5,14 @@ Incremental window search & immediate switch to the selected window 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
                $ gem install fvwm-window-search
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            * Should work w/  
     | 
| 
       11 
     | 
    
         
            -
            * Filtering by  
     | 
| 
      
 10 
     | 
    
         
            +
            * Should work w/ most stackings X11 window managers.
         
     | 
| 
      
 11 
     | 
    
         
            +
            * Filtering by window name/resource/classe.
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            ## Reqs
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
            * Ruby
         
     | 
| 
      
 15 
     | 
    
         
            +
            * Ruby 2.4+
         
     | 
| 
       16 
16 
     | 
    
         
             
            * `xwininfo` & `xdotool` (`xorg-x11-utils` & `xdotool` Fedora pkgs)
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            ## Compilation
         
     | 
| 
         @@ -22,7 +22,12 @@ not contravene w/ a system-installed dmenu. 
     | 
|
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            ## Usage
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
            ~~~
         
     | 
| 
      
 26 
     | 
    
         
            +
            $ ./fvwm-window-search -h
         
     | 
| 
      
 27 
     | 
    
         
            +
            Usage: fvwm-window-search [options]
         
     | 
| 
      
 28 
     | 
    
         
            +
                -c path                          an alternative path to conf.yaml
         
     | 
| 
      
 29 
     | 
    
         
            +
                -r                               focus a window only if Return is pressed
         
     | 
| 
      
 30 
     | 
    
         
            +
            ~~~
         
     | 
| 
       26 
31 
     | 
    
         | 
| 
       27 
32 
     | 
    
         
             
            To customise dmenu or filtering, create a yaml file
         
     | 
| 
       28 
33 
     | 
    
         
             
            `$XDG_CONFIG_HOME/fvwm-window-search/conf.yaml`, e.g.:
         
     | 
| 
         @@ -40,8 +45,8 @@ filter: 
     | 
|
| 
       40 
45 
     | 
    
         
             
            ~~~
         
     | 
| 
       41 
46 
     | 
    
         | 
| 
       42 
47 
     | 
    
         
             
            Subkeys in `dmenu` are the usual CLOs for
         
     | 
| 
       43 
     | 
    
         
            -
            [dmenu(1)][]. `selhook-return-key-focus-only` is  
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
            [dmenu(1)][]. `selhook-return-key-focus-only` is an equivalent of `-r`
         
     | 
| 
      
 49 
     | 
    
         
            +
            CLO.
         
     | 
| 
       45 
50 
     | 
    
         | 
| 
       46 
51 
     | 
    
         
             
            [dmenu(1)]: https://manpages.debian.org/unstable/suckless-tools/dmenu.1.en.html
         
     | 
| 
       47 
52 
     | 
    
         | 
| 
         @@ -51,7 +56,7 @@ a subkey is an array of regexes. See the defaults in 
     | 
|
| 
       51 
56 
     | 
    
         | 
| 
       52 
57 
     | 
    
         
             
            ## Bugs
         
     | 
| 
       53 
58 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
            * Tested only w/  
     | 
| 
      
 59 
     | 
    
         
            +
            * Tested only w/ Fvwm3.
         
     | 
| 
       55 
60 
     | 
    
         
             
            * No distinction between normal & iconified windows.
         
     | 
| 
       56 
61 
     | 
    
         | 
| 
       57 
62 
     | 
    
         
             
            ## License
         
     | 
    
        data/focus.sh
    CHANGED
    
    | 
         @@ -4,4 +4,19 @@ id=`echo "$1" | awk -F'|' '{print $NF} END { exit $NF == "" ? 1 : 0}'` || { 
     | 
|
| 
       4 
4 
     | 
    
         
             
                echo "usage: `basename "$0"` 'name | class | id'"
         
     | 
| 
       5 
5 
     | 
    
         
             
                exit 1
         
     | 
| 
       6 
6 
     | 
    
         
             
            }
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # tries to put a mouse pointer as shown on the picture below (▲ is the
         
     | 
| 
      
 9 
     | 
    
         
            +
            # pointer):
         
     | 
| 
      
 10 
     | 
    
         
            +
            #
         
     | 
| 
      
 11 
     | 
    
         
            +
            # +-------------+
         
     | 
| 
      
 12 
     | 
    
         
            +
            # |    Title    |
         
     | 
| 
      
 13 
     | 
    
         
            +
            # +-------------+
         
     | 
| 
      
 14 
     | 
    
         
            +
            # |      ▲      |
         
     | 
| 
      
 15 
     | 
    
         
            +
            # |             |
         
     | 
| 
      
 16 
     | 
    
         
            +
            # |             |
         
     | 
| 
      
 17 
     | 
    
         
            +
            # +-------------+
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            eval "`xdotool getwindowgeometry --shell "$id"`"
         
     | 
| 
      
 20 
     | 
    
         
            +
            x=$((WIDTH/2))
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            xdotool windowactivate "$id" mousemove --window "$id" "$x" 0
         
     | 
    
        data/fvwm-window-search
    CHANGED
    
    | 
         @@ -3,18 +3,13 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require_relative './lib'
         
     | 
| 
       4 
4 
     | 
    
         
             
            include FvwmWindowSearch
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'yaml'
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            def options_load
         
     | 
| 
       8 
     | 
    
         
            -
              xdg_config_home = ENV['XDG_CONFIG_HOME'] || File.expand_path('~/.config')
         
     | 
| 
       9 
     | 
    
         
            -
              conf = File.join xdg_config_home, 'fvwm-window-search', 'conf.yaml'
         
     | 
| 
       10 
     | 
    
         
            -
              r = File.read conf rescue nil
         
     | 
| 
       11 
     | 
    
         
            -
              YAML.load r, conf rescue errx 1, "invalid config: #{$!}" if r
         
     | 
| 
       12 
     | 
    
         
            -
            end
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'optparse'
         
     | 
| 
       13 
7 
     | 
    
         | 
| 
       14 
8 
     | 
    
         
             
            def options
         
     | 
| 
       15 
9 
     | 
    
         
             
              default = {
         
     | 
| 
       16 
10 
     | 
    
         
             
                "dmenu" => {               # each key is a corresponding CL option
         
     | 
| 
       17 
11 
     | 
    
         
             
                  "selhook" => File.join(__dir__, "focus.sh %s"),
         
     | 
| 
      
 12 
     | 
    
         
            +
                  "selhook-return-key-focus-only" => false,
         
     | 
| 
       18 
13 
     | 
    
         
             
                  "fn" => "Monospace-10",
         
     | 
| 
       19 
14 
     | 
    
         
             
                  "l" => 8,
         
     | 
| 
       20 
15 
     | 
    
         
             
                  "b" => true,
         
     | 
| 
         @@ -27,7 +22,29 @@ def options 
     | 
|
| 
       27 
22 
     | 
    
         
             
                }
         
     | 
| 
       28 
23 
     | 
    
         
             
              }
         
     | 
| 
       29 
24 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
               
     | 
| 
      
 25 
     | 
    
         
            +
              cl = options_load_cl
         
     | 
| 
      
 26 
     | 
    
         
            +
              env = deep_merge(default, options_load_file(cl) || {})
         
     | 
| 
      
 27 
     | 
    
         
            +
              deep_merge env, cl
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            def options_load_cl
         
     | 
| 
      
 31 
     | 
    
         
            +
              opt = { "dmenu" => {} }
         
     | 
| 
      
 32 
     | 
    
         
            +
              OptionParser.new do |o|
         
     | 
| 
      
 33 
     | 
    
         
            +
                o.on("-c path", "an alternative path to conf.yaml") { |v| opt["conf"] = v }
         
     | 
| 
      
 34 
     | 
    
         
            +
                o.on("-r", "focus a window only if Return is pressed") do
         
     | 
| 
      
 35 
     | 
    
         
            +
                  opt["dmenu"]["selhook-return-key-focus-only"] = true
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              end.parse!
         
     | 
| 
      
 38 
     | 
    
         
            +
              opt
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            def options_load_file opt       # return nil if config wasn't found
         
     | 
| 
      
 42 
     | 
    
         
            +
              conf = opt["conf"] || -> do
         
     | 
| 
      
 43 
     | 
    
         
            +
                xdg_config_home = ENV['XDG_CONFIG_HOME'] || File.expand_path('~/.config')
         
     | 
| 
      
 44 
     | 
    
         
            +
                File.join xdg_config_home, 'fvwm-window-search', 'conf.yaml'
         
     | 
| 
      
 45 
     | 
    
         
            +
              end.call
         
     | 
| 
      
 46 
     | 
    
         
            +
              r = File.read conf rescue nil
         
     | 
| 
      
 47 
     | 
    
         
            +
              YAML.load r, conf rescue errx 1, "invalid config: #{$!}" if r
         
     | 
| 
       31 
48 
     | 
    
         
             
            end
         
     | 
| 
       32 
49 
     | 
    
         | 
| 
       33 
50 
     | 
    
         
             
            def menu params, text
         
     | 
    
        data/lib.rb
    CHANGED
    
    | 
         @@ -71,8 +71,8 @@ module FvwmWindowSearch 
     | 
|
| 
       71 
71 
     | 
    
         | 
| 
       72 
72 
     | 
    
         
             
              def windows_filter patterns, winlist
         
     | 
| 
       73 
73 
     | 
    
         
             
                desired = -> (type, value) {
         
     | 
| 
       74 
     | 
    
         
            -
                  include = patterns[type]. 
     | 
| 
       75 
     | 
    
         
            -
                  exclude = patterns[type]. 
     | 
| 
      
 74 
     | 
    
         
            +
                  include = patterns[type].select {|v| v[0] != '!'}
         
     | 
| 
      
 75 
     | 
    
         
            +
                  exclude = patterns[type].select {|v| v[0] == '!'}.map {|v| v[1..-1]}
         
     | 
| 
       76 
76 
     | 
    
         | 
| 
       77 
77 
     | 
    
         
             
                  exclude.each do |pattern|
         
     | 
| 
       78 
78 
     | 
    
         
             
                    return true if value.match pattern
         
     | 
| 
         @@ -83,9 +83,9 @@ module FvwmWindowSearch 
     | 
|
| 
       83 
83 
     | 
    
         
             
                  true
         
     | 
| 
       84 
84 
     | 
    
         
             
                }
         
     | 
| 
       85 
85 
     | 
    
         | 
| 
       86 
     | 
    
         
            -
                winlist. 
     | 
| 
       87 
     | 
    
         
            -
                  . 
     | 
| 
       88 
     | 
    
         
            -
                  . 
     | 
| 
      
 86 
     | 
    
         
            +
                winlist.select { |w| desired.call "class", w.class }
         
     | 
| 
      
 87 
     | 
    
         
            +
                  .select { |w| desired.call "resource", w.resource }
         
     | 
| 
      
 88 
     | 
    
         
            +
                  .select { |w| desired.call "name", w.name }
         
     | 
| 
       89 
89 
     | 
    
         
             
              end
         
     | 
| 
       90 
90 
     | 
    
         | 
| 
       91 
91 
     | 
    
         
             
              def deep_merge first, second
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,19 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fvwm-window-search
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.2.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Alexander Gromnitsky
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: "."
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2020-07- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2020-07-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: |
         
     | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
      
 14 
     | 
    
         
            +
              A window switcher: search for windows interactively using a patched
         
     | 
| 
      
 15 
     | 
    
         
            +
              dmenu utility (comes with the gem). This was originally made for Fvwm,
         
     | 
| 
      
 16 
     | 
    
         
            +
              but it's been fully rewritten to work out-of-the-box with any stacking
         
     | 
| 
      
 17 
     | 
    
         
            +
              window manager. Requires xdotool & xwininfo installed.
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              It differs from rofi & co in that it activates (brings up) windows
         
     | 
| 
      
 20 
     | 
    
         
            +
              _during_ the search.
         
     | 
| 
       17 
21 
     | 
    
         
             
            email: alexander.gromnitsky@gmail.com
         
     | 
| 
       18 
22 
     | 
    
         
             
            executables:
         
     | 
| 
       19 
23 
     | 
    
         
             
            - fvwm-window-search
         
     | 
| 
         @@ -40,7 +44,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       40 
44 
     | 
    
         
             
              requirements:
         
     | 
| 
       41 
45 
     | 
    
         
             
              - - ">="
         
     | 
| 
       42 
46 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       43 
     | 
    
         
            -
                  version:  
     | 
| 
      
 47 
     | 
    
         
            +
                  version: 2.4.0
         
     | 
| 
       44 
48 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       45 
49 
     | 
    
         
             
              requirements:
         
     | 
| 
       46 
50 
     | 
    
         
             
              - - ">="
         
     | 
| 
         @@ -50,5 +54,6 @@ requirements: [] 
     | 
|
| 
       50 
54 
     | 
    
         
             
            rubygems_version: 3.1.2
         
     | 
| 
       51 
55 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       52 
56 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       53 
     | 
    
         
            -
            summary:  
     | 
| 
      
 57 
     | 
    
         
            +
            summary: 'A window switcher: an interactive incremental windows search & selection
         
     | 
| 
      
 58 
     | 
    
         
            +
              for X Window'
         
     | 
| 
       54 
59 
     | 
    
         
             
            test_files: []
         
     |