uh-wm 0.0.2.pre → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +15 -0
  5. data/Gemfile +5 -0
  6. data/Guardfile +12 -0
  7. data/LICENSE +30 -0
  8. data/README.md +68 -0
  9. data/Rakefile +40 -0
  10. data/bin/uhwm +5 -0
  11. data/config/cucumber.yaml +1 -0
  12. data/features/actions/execute.feature +9 -0
  13. data/features/actions/layout_delegation.feature +31 -0
  14. data/features/actions/quit.feature +9 -0
  15. data/features/cli/debug.feature +5 -0
  16. data/features/cli/layout.feature +15 -0
  17. data/features/cli/require.feature +5 -0
  18. data/features/cli/run_control.feature +9 -0
  19. data/features/cli/usage.feature +11 -0
  20. data/features/cli/verbose.feature +5 -0
  21. data/features/cli/version.feature +6 -0
  22. data/features/cli/worker.feature +9 -0
  23. data/features/layout/manage.feature +12 -0
  24. data/features/layout/protocol.feature +24 -0
  25. data/features/layout/unmanage.feature +10 -0
  26. data/features/manager/check_other_wm.feature +8 -0
  27. data/features/manager/input_events.feature +8 -0
  28. data/features/manager/manage.feature +14 -0
  29. data/features/manager/unmanage.feature +13 -0
  30. data/features/manager/x_errors.feature +17 -0
  31. data/features/run_control/evaluation.feature +18 -0
  32. data/features/run_control/key.feature +33 -0
  33. data/features/run_control/modifier.feature +10 -0
  34. data/features/run_control/worker.feature +9 -0
  35. data/features/session/connection.feature +5 -0
  36. data/features/session/termination.feature +13 -0
  37. data/features/steps/filesystem_steps.rb +3 -0
  38. data/features/steps/output_steps.rb +44 -0
  39. data/features/steps/run_control_steps.rb +3 -0
  40. data/features/steps/run_steps.rb +41 -0
  41. data/features/steps/x_steps.rb +53 -0
  42. data/features/support/env.rb +33 -0
  43. data/lib/uh/wm.rb +8 -0
  44. data/lib/uh/wm/actions_handler.rb +46 -0
  45. data/lib/uh/wm/cli.rb +20 -13
  46. data/lib/uh/wm/client.rb +64 -0
  47. data/lib/uh/wm/dispatcher.rb +3 -1
  48. data/lib/uh/wm/env.rb +15 -9
  49. data/lib/uh/wm/env_logging.rb +8 -0
  50. data/lib/uh/wm/logger_formatter.rb +16 -0
  51. data/lib/uh/wm/manager.rb +96 -14
  52. data/lib/uh/wm/run_control.rb +8 -3
  53. data/lib/uh/wm/runner.rb +82 -14
  54. data/lib/uh/wm/testing/acceptance_helpers.rb +140 -18
  55. data/lib/uh/wm/version.rb +1 -1
  56. data/lib/uh/wm/workers.rb +21 -0
  57. data/lib/uh/wm/workers/base.rb +27 -0
  58. data/lib/uh/wm/workers/blocking.rb +11 -0
  59. data/lib/uh/wm/workers/mux.rb +18 -0
  60. data/spec/spec_helper.rb +26 -0
  61. data/spec/support/exit_helpers.rb +6 -0
  62. data/spec/support/filesystem_helpers.rb +11 -0
  63. data/spec/uh/wm/actions_handler_spec.rb +30 -0
  64. data/spec/uh/wm/cli_spec.rb +214 -0
  65. data/spec/uh/wm/client_spec.rb +133 -0
  66. data/spec/uh/wm/dispatcher_spec.rb +76 -0
  67. data/spec/uh/wm/env_spec.rb +145 -0
  68. data/spec/uh/wm/manager_spec.rb +355 -0
  69. data/spec/uh/wm/run_control_spec.rb +102 -0
  70. data/spec/uh/wm/runner_spec.rb +186 -0
  71. data/uh-wm.gemspec +25 -0
  72. metadata +112 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74533b8c4aea78f1fd611ad9a66f9003c7a70c78
4
- data.tar.gz: 31ab453643a6c06b22fc7182344564976c622a5a
3
+ metadata.gz: ba8fdd593aed4b5a3c017c9dba5f2bf97e180b90
4
+ data.tar.gz: 1bc9621e7454e1fd4aaf1370eaee472ec35281eb
5
5
  SHA512:
6
- metadata.gz: 32e9cdad0aecb15955af5dcebba0cdcb0424cc4cb7263e659dc96936c845cfba38de6007a972325b3e0e2b8e3ab16ebe6a611391f74c05009dcdd680d97f5f56
7
- data.tar.gz: e1d903145b302e5a6ec00c00fd3e4c4bde795565a3ce5d969a8875704ff700f197c86afdf184b775a882bfa95e5aea32c4aa4be51777b6cb3841dbb0567e5566
6
+ metadata.gz: b7a6b5b73f564fb63fcf89724307dd9a5934b9fd3210e90c6df722ed1159928638485706090e3c94d9cddb3db4578398f83efe3c997b86e4c126974b91c855ca
7
+ data.tar.gz: 40cbe74253fa28aa76cf0eb5cf762bd14c1fe4ddced31a4e6143fd6751bb6eac65974bc77b45f993828e109714ce34b33c304bf8096a1c5de758a992c1a3fcfa
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ /Gemfile-custom.rb
2
+ /Gemfile.lock
3
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,15 @@
1
+ language: ruby
2
+ cache: bundler
3
+ rvm:
4
+ - 2.2
5
+ - ruby-head
6
+ - 2.1
7
+ before_install:
8
+ - travis_retry sudo apt-get update -qq
9
+ - travis_retry sudo apt-get install -qq twm x11-utils xdotool
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: ruby-head
13
+ notifications:
14
+ email:
15
+ - tj+travis_uh_wm@a13.fr
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ eval File.read('Gemfile-custom.rb') if File.exist?('Gemfile-custom.rb')
data/Guardfile ADDED
@@ -0,0 +1,12 @@
1
+ directories %w[features lib spec]
2
+
3
+ guard :cucumber, cli: '--format pretty --quiet', all_on_start: false do
4
+ watch(%r{\Afeatures/.+\.feature\z})
5
+ end
6
+
7
+ guard :rspec, cmd: 'bundle exec rspec -f doc' do
8
+ watch(%r{\Aspec/.+_spec\.rb\z})
9
+ watch(%r{\Alib/(.+)\.rb\z}) { |m| "spec/#{m[1]}_spec.rb" }
10
+ watch('spec/spec_helper.rb') { 'spec' }
11
+ watch(%r{\Aspec/support/.+\.rb\z}) { 'spec' }
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ Copyright 2015 Thibault Jouan. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in
12
+ the documentation and/or other materials provided with the
13
+ distribution.
14
+
15
+ * Neither the name of the software nor the names of its contributors
16
+ may be used to endorse or promote products derived from this
17
+ software without specific prior written permission.
18
+
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS "AS IS" AND
21
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS
24
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ uh-wm
2
+ =====
3
+
4
+ uh-wm is a minimalistic tiling and stacking window manager for X. It
5
+ shares some similarities with dwm and wmii, but is written in ruby so
6
+ you can configure and extend features with ruby code.
7
+
8
+ The layout strategy is interchangeable, the default one being the
9
+ `uh-layout` ruby gem. A layout is a simple object obeying a defined
10
+ protocol.
11
+
12
+ Features:
13
+
14
+ * Xinerama support;
15
+ * Multiple event handling strategy: blocking or multiplexing
16
+ (`select()`);
17
+ * Configuration with a run control file;
18
+ * Key bindings with user defined code as callback;
19
+ * Configurable modifier key;
20
+ * Support user-defined layout strategy;
21
+ * Program execution via key binding.
22
+
23
+ * No re-parenting (so no window decoration either);
24
+ * No grabbing of the modifier key;
25
+ * No mouse handling;
26
+ * Very limited ICCCM support.
27
+
28
+
29
+ [![Version ][badge-version-img]][badge-version-uri]
30
+ [![Build status ][badge-build-img]][badge-build-uri]
31
+ [![Code Climate ][badge-cclimate-img]][badge-cclimate-uri]
32
+
33
+
34
+ Getting started
35
+ ---------------
36
+
37
+ ### Installation (requires ruby ~> 2.1 with rubygems)
38
+
39
+ ```
40
+ $ gem install uh-wm
41
+ ```
42
+
43
+
44
+ ### Usage
45
+
46
+ ```
47
+ Usage: uhwm [options]
48
+
49
+ options:
50
+ -v, --verbose enable verbose mode
51
+ -d, --debug enable debug mode
52
+ -f, --run-control PATH specify alternate run control file
53
+ -r, --require PATH require ruby feature
54
+ -l, --layout LAYOUT specify layout
55
+ -w, --worker WORKER specify worker
56
+
57
+ -h, --help print this message
58
+ -V, --version print version
59
+ ```
60
+
61
+
62
+
63
+ [badge-version-img]: https://img.shields.io/gem/v/uh-wm.svg?style=flat-square
64
+ [badge-version-uri]: https://rubygems.org/gems/uh-wm
65
+ [badge-build-img]: https://img.shields.io/travis/tjouan/uh-wm/master.svg?style=flat-square
66
+ [badge-build-uri]: https://travis-ci.org/tjouan/uh-wm
67
+ [badge-cclimate-img]: https://img.shields.io/codeclimate/github/tjouan/uh-wm.svg?style=flat-square
68
+ [badge-cclimate-uri]: https://codeclimate.com/github/tjouan/uh-wm
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ require 'tempfile'
2
+ require 'cucumber/rake/task'
3
+ require 'rspec/core/rake_task'
4
+
5
+ XEPHYR_DISPLAY = ':42'
6
+ XEPHYR_CMD = "$(command -v Xephyr) #{XEPHYR_DISPLAY} -ac -br -noreset".freeze
7
+ XEPHYR_SCREENS = '-screen 1436x400'.freeze
8
+ XEPHYR_SCREENS_XINERAMA =
9
+ '+xinerama -origin 0,0 -screen 1920x400 -origin 1920,0 -screen 1920x400'.freeze
10
+
11
+ task default: %i[features spec]
12
+
13
+ Cucumber::Rake::Task.new(:features)
14
+
15
+ RSpec::Core::RakeTask.new
16
+
17
+ desc 'Run uhwm in a Xephyr X server'
18
+ task :run do
19
+ uhwm_args = ARGV.include?('--') ?
20
+ ARGV.slice_after('--').to_a.last :
21
+ %w[-d]
22
+ Tempfile.create('uhwm_xinitrc') do |xinitrc|
23
+ xinitrc.write <<-eoh
24
+ [ -f $HOME/.Xdefaults ] && xrdb $HOME/.Xdefaults
25
+ #xkbcomp #{ENV['DISPLAY']} #{XEPHYR_DISPLAY}
26
+ xmodmap -display #{ENV['DISPLAY']} -pke | xmodmap -
27
+ xsetroot -solid SpringGreen
28
+ echo "######## UHWM START ########"
29
+ ./bin/uhwm #{uhwm_args.join ' '}
30
+ echo "######## UHWM END ##########"
31
+ eoh
32
+ xinitrc.flush
33
+ sh "xinit #{xinitrc.path} -- %s" % [
34
+ XEPHYR_CMD,
35
+ ENV.key?('UHWM_XINERAMA') ?
36
+ XEPHYR_SCREENS_XINERAMA :
37
+ XEPHYR_SCREENS
38
+ ].join(' ')
39
+ end
40
+ end
data/bin/uhwm ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'uh/wm'
4
+
5
+ Uh::WM::CLI.run(ARGV)
@@ -0,0 +1 @@
1
+ default: --require features/support --require features/steps
@@ -0,0 +1,9 @@
1
+ Feature: `execute' action keyword
2
+
3
+ Scenario: executes the given command in a shell with current standard output
4
+ Given uhwm is running with this run control file:
5
+ """
6
+ key(:f) { execute 'echo etucexe_tset | rev' }
7
+ """
8
+ When I press the alt+f keys
9
+ Then the output must contain "test_execute"
@@ -0,0 +1,31 @@
1
+ Feature: `layout_*' action keywords
2
+
3
+ Background:
4
+ Given a file named layout.rb with:
5
+ """
6
+ class Layout
7
+ def register _; end
8
+
9
+ def handle_some_action arg
10
+ puts arg
11
+ end
12
+ end
13
+ """
14
+
15
+ Scenario: delegates messages matching `layout_*' to `layout_handle_*'
16
+ Given a run control file with:
17
+ """
18
+ key(:f) { layout_some_action :testing_some_action }
19
+ """
20
+ And uhwm is running
21
+ When I press the alt+f keys
22
+ Then the output must contain ":testing_some_action"
23
+
24
+ Scenario: logs an error about unimplemented messages
25
+ Given a run control file with:
26
+ """
27
+ key(:f) { layout_unknown_action }
28
+ """
29
+ And uhwm is running
30
+ When I press the alt+f keys
31
+ Then the output must match /layout.+no.+implem.+handle_unknown_action/i
@@ -0,0 +1,9 @@
1
+ Feature: `quit' action keyword
2
+
3
+ Scenario: requests quit when invoked
4
+ Given uhwm is running with this run control file:
5
+ """
6
+ key(:f) { quit }
7
+ """
8
+ When I press the alt+f keys
9
+ Then uhwm must terminate successfully
@@ -0,0 +1,5 @@
1
+ Feature: debug CLI option
2
+
3
+ Scenario: raises the logger level to DEBUG
4
+ When I run uhwm with option -d
5
+ Then the output must match /log.+debug.+level/i
@@ -0,0 +1,15 @@
1
+ Feature: layout CLI option
2
+
3
+ Scenario: specifies the layout class
4
+ Given a file named layout.rb with:
5
+ """
6
+ class MyLayout
7
+ def register _; end
8
+ end
9
+ """
10
+ When I run uhwm with option -v -r./layout -l MyLayout
11
+ Then the output must match /layout.+mylayout/i
12
+
13
+ Scenario: resolves layout class from the root namespace
14
+ When I run uhwm with option -v -l Layout
15
+ Then the output must contain "uninitialized constant Layout"
@@ -0,0 +1,5 @@
1
+ Feature: require CLI option
2
+
3
+ Scenario: requires a ruby feature
4
+ When I run uhwm with option -v -r abbrev
5
+ Then the output must match /load.+abbrev.+ruby feature/i
@@ -0,0 +1,9 @@
1
+ Feature: run control file path CLI option
2
+
3
+ Scenario: specifies run control file path
4
+ Given a file named uhwmrc.rb with:
5
+ """
6
+ puts 'run control evaluation'
7
+ """
8
+ When I run uhwm with option -f uhwmrc.rb
9
+ Then the output must contain "run control evaluation"
@@ -0,0 +1,11 @@
1
+ Feature: CLI usage
2
+
3
+ Scenario: prints the usage when unknown option switch is given
4
+ When I run uhwm with option --unknown-option
5
+ Then the exit status must be 64
6
+ And the output must contain exactly the usage
7
+
8
+ Scenario: prints the help when -h option is given
9
+ When I run uhwm with option -h
10
+ Then uhwm must terminate successfully
11
+ And the output must contain exactly the usage
@@ -0,0 +1,5 @@
1
+ Feature: verbose CLI option
2
+
3
+ Scenario: raises the logger level to INFO
4
+ When I run uhwm with option -v
5
+ Then the output must match /log.+info.+level/i
@@ -0,0 +1,6 @@
1
+ Feature: version CLI option
2
+
3
+ Scenario: prints the current version on standard output
4
+ When I run uhwm with option --version
5
+ Then uhwm must terminate successfully
6
+ And the output must contain exactly the version
@@ -0,0 +1,9 @@
1
+ Feature: worker CLI option
2
+
3
+ Scenario: uses the blocking worker when `block' is given
4
+ When I run uhwm with option -v -w block
5
+ Then the output must match /work.+event.+block/i
6
+
7
+ Scenario: uses the multiplexing worker when `mux' is given
8
+ When I run uhwm with option -v -w mux
9
+ Then the output must match /work.+event.+mux/i
@@ -0,0 +1,12 @@
1
+ Feature: layout client management
2
+
3
+ Background:
4
+ Given uhwm is running
5
+
6
+ Scenario: maps new client window
7
+ When a window requests to be mapped
8
+ Then the window must be mapped
9
+
10
+ Scenario: focuses new client window
11
+ When a window requests to be mapped
12
+ Then the window must be focused
@@ -0,0 +1,24 @@
1
+ Feature: layout protocol
2
+
3
+ Background:
4
+ Given a file named layout.rb with:
5
+ """
6
+ class Layout
7
+ def register display
8
+ puts display
9
+ end
10
+
11
+ def << client
12
+ puts client
13
+ end
14
+ end
15
+ """
16
+
17
+ Scenario: tells the layout to register with #register message
18
+ When I run uhwm with option -r./layout -l Layout
19
+ Then the output must contain current display
20
+
21
+ Scenario: tells the layout to manage a client with #<< message
22
+ Given uhwm is running with options -v -r./layout -l Layout
23
+ When a window requests to be mapped
24
+ Then the output must contain the window name
@@ -0,0 +1,10 @@
1
+ Feature: layout client unmanagement
2
+
3
+ Background:
4
+ Given uhwm is running
5
+ And a first window is mapped
6
+ And a second window is mapped
7
+
8
+ Scenario: maps another window
9
+ When the second window requests to be unmapped
10
+ Then the first window must be mapped
@@ -0,0 +1,8 @@
1
+ Feature: checking if another window manager is running
2
+
3
+ @other_wm_running
4
+ Scenario: fails when another window manager is running
5
+ Given another window manager is running
6
+ When I start uhwm
7
+ Then the exit status must be 70
8
+ And the output must match /error.+other.+window.+manager/i
@@ -0,0 +1,8 @@
1
+ Feature: input events selection
2
+
3
+ Scenario: selects the appropriate input event mask for a window manager
4
+ Given uhwm is running
5
+ Then the input event mask must include StructureNotifyMask
6
+ And the input event mask must include SubstructureNotifyMask
7
+ And the input event mask must include SubstructureRedirectMask
8
+ And the input event mask must include PropertyChangeMask
@@ -0,0 +1,14 @@
1
+ Feature: manager client management
2
+
3
+ Background:
4
+ Given uhwm is running
5
+
6
+ Scenario: logs when a new client is managed
7
+ When a window requests to be mapped
8
+ Then the output must match /manag.+xclient/i
9
+
10
+ Scenario: manages a given client only once
11
+ When a window requests to be mapped 2 times
12
+ And I quit uhwm
13
+ Then the output must not match /manag.*\n.*manag/mi
14
+ And the output must not match /xerror/i
@@ -0,0 +1,13 @@
1
+ Feature: manager client unmanagement
2
+
3
+ Background:
4
+ Given uhwm is running
5
+ And a window is managed
6
+
7
+ Scenario: logs when a new client is unmanaged
8
+ When the window requests to be unmapped
9
+ Then the output must match /unmanag.+xclient/i
10
+
11
+ Scenario: unmanages client on destroy notify X events
12
+ When the window is destroyed
13
+ Then the output must match /unmanag.+xclient/i