aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2019-10-08 21:59:31 -0400
committerLoic Guegan <manzerbredes@mailbox.org>2019-10-08 21:59:31 -0400
commit5ca2e63ea66095fbe64cdc441f6eec663fb28bd4 (patch)
tree52788dca42469677fdde10d70391db2ff07aa9e5
parent6ba370ea542c6d3ca06cabcf0d3295a2f5ec18b4 (diff)
Add simple integration test framework
-rwxr-xr-xsrc/i3-colors.py7
-rw-r--r--tests/data/config305
-rw-r--r--tests/data/google45
-rw-r--r--tests/data/seti58
-rw-r--r--tests/include.sh11
-rwxr-xr-xtests/run.sh53
-rw-r--r--tests/test-simple-apply.out613
-rw-r--r--tests/test-simple-apply.sh17
8 files changed, 1108 insertions, 1 deletions
diff --git a/src/i3-colors.py b/src/i3-colors.py
index f3e5834..9450c9c 100755
--- a/src/i3-colors.py
+++ b/src/i3-colors.py
@@ -12,7 +12,10 @@ def log(msg,title=""):
##### Apply Theme #####
def apply(args):
loaded_theme=theme.load(args.theme_path)
- config.apply(os.environ["HOME"]+"/.config/i3/config",loaded_theme)
+ config_file=os.environ["HOME"]+"/.config/i3/config"
+ if args.config_path:
+ config_file=args.config_path
+ config.apply(config_file,loaded_theme)
for meta_key,meta_value in loaded_theme["meta"].items():
log(meta_value,title=meta_key.title())
if args.restart:
@@ -36,6 +39,8 @@ argsApplyParser = argsSubParsers.add_parser("apply")
argsApplyParser.add_argument('theme_path', type=str, nargs='?',
help='I3 YAML theme path.')
argsApplyParser.add_argument('-r', '--restart' ,action='store_true', help='Restart i3 after applying theme.')
+argsApplyParser.add_argument('config_path', type=str, nargs='?',
+ help='I3 configuration file.')
argsApplyParser.set_defaults(func=apply)
argsExtractParser = argsSubParsers.add_parser("extract")
diff --git a/tests/data/config b/tests/data/config
new file mode 100644
index 0000000..d324e67
--- /dev/null
+++ b/tests/data/config
@@ -0,0 +1,305 @@
+##### Variables #####
+##### Define workspaces names
+set $ws1 "1 "
+set $ws2 "2"
+set $ws3 "3"
+set $ws4 "4"
+set $ws5 "5"
+set $ws6 "6"
+set $ws7 "7"
+set $ws8 "8"
+set $ws9 "9"
+set $ws10 "10"
+set $ws-firefox ""
+set $ws-org ""
+set $ws-tools ""
+set $ws-mutt ""
+set $ws-weechat ""
+set $ws-newsboat ""
+set $ws-R ""
+set $ws-signal "Signal"
+set $ws-cmus ""
+###### Define some default keys
+set $LEFT j
+set $DOWN k
+set $UP l
+set $RIGHT m
+##### Define shutter sound location (for screenshots)
+set $shutter_sound ~/.config/i3/shutter.mp3
+##### Define modifier
+set $mod Mod4
+set $jump Mod3
+#####################
+
+##### Appearence #####
+##### Define font
+font pango:DejaVu Sans Mono 12
+##### To gain a bit of space
+hide_edge_borders both
+######################
+
+##### I3 Behavior #####
+##### Disable cycle (like workspace) in a container with several windows
+focus_wrapping no
+##### Enable workspace auto back and forth (go back to the previous workspace with same keybinding)
+workspace_auto_back_and_forth yes
+##### Default workspace layout
+workspace_layout tabbed
+#######################
+
+##### Setup Mouse #####
+##### Disable mouse on hover focus
+focus_follows_mouse no
+##### Define mouse floating window size and move modifier
+floating_modifier $mod
+floating_minimum_size 200 x 200
+#######################
+
+##### Keys Bindings #####
+##### Volume
+bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+
+bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%-
+bindsym XF86AudioMute exec amixer -D pulse sset Master toggle
+##### Scratchpad
+bindsym $mod+asterisk scratchpad show
+bindsym $mod+Shift+asterisk move scratchpad
+##### Define brightness control
+bindcode 233 exec xbacklight -inc 5
+bindcode 232 exec xbacklight -dec 5
+##### Move workspace to next output
+bindsym $mod+ugrave move workspace to output right
+##### Define screenshot key
+bindsym Print exec scrot ~/Pictures/screenshots/%Y-%m-%d_%H:%M:%S.png && exec ffplay -nodisp -autoexit $shutter_sound
+bindsym $mod+Print exec scrot -e "ffplay -nodisp -autoexit $shutter_sound && gimp \$f" ~/Pictures/screenshots/%Y-%m-%d_%H:%M:%S.png
+##### Start terminal
+bindsym $mod+Shift+Return exec xterm
+##### Kill a window
+bindsym $mod+Shift+a kill
+##### Start dmenu
+bindsym $mod+d exec dmenu_run -b -i -sb "#CC0000" -nb "#4A4A4A" -fn "Deja Vu Sans Mono-14:bold"
+##### Configure password manager
+bindsym $mod+Shift+d exec pp
+##### Change focus
+bindsym $mod+$LEFT focus left
+bindsym $mod+$DOWN focus down
+bindsym $mod+$UP focus up
+bindsym $mod+$RIGHT focus right
+##### Move focused window
+bindsym $mod+Shift+$LEFT move left
+bindsym $mod+Shift+$DOWN move down
+bindsym $mod+Shift+$UP move up
+bindsym $mod+Shift+$RIGHT move right
+##### Layout Splits
+bindsym $mod+h split h
+bindsym $mod+v split v
+##### Toggle fullscreen
+bindsym $mod+f fullscreen toggle
+##### Change container layout (either stacked, tabbed or splitv/splith)
+bindsym $mod+s layout stacking
+bindsym $mod+z layout tabbed
+bindsym $mod+t layout toggle split
+##### Toggle tiling / floating
+bindsym $mod+Shift+space floating toggle
+##### Change focus between tiling / floating windows
+bindsym $mod+space focus mode_toggle
+##### Focus container
+bindsym $mod+q focus parent
+bindsym $mod+Shift+q focus child
+##### Workspace next and prev
+bindsym $mod+Right workspace next
+bindsym $mod+Left workspace prev
+##### Switch to workspace
+bindsym $mod+ampersand workspace $ws1
+bindsym $mod+eacute workspace $ws2
+bindsym $mod+quotedbl workspace $ws3
+bindsym $mod+apostrophe workspace $ws4
+bindsym $mod+parenleft workspace $ws5
+bindsym $mod+minus workspace $ws6
+bindsym $mod+egrave workspace $ws7
+bindsym $mod+underscore workspace $ws8
+bindsym $mod+ccedilla workspace $ws9
+bindsym $mod+agrave workspace $ws10
+bindsym $mod+exclam workspace $ws-tools
+##### Move focused container to workspace
+bindsym $mod+Shift+ampersand move container to workspace $ws1
+bindsym $mod+Shift+eacute move container to workspace $ws2
+bindsym $mod+Shift+quotedbl move container to workspace $ws3
+bindsym $mod+Shift+apostrophe move container to workspace $ws4
+bindsym $mod+Shift+5 move container to workspace $ws5
+bindsym $mod+Shift+minus move container to workspace $ws6
+bindsym $mod+Shift+egrave move container to workspace $ws7
+bindsym $mod+Shift+underscore move container to workspace $ws8
+bindsym $mod+Shift+ccedilla move container to workspace $ws9
+bindsym $mod+Shift+agrave move container to workspace $ws10
+bindsym $mod+Shift+exclam move container to workspace $ws-tools
+# Read 1 character and mark the current window with this character
+bindsym $mod+shift+w exec i3-input -F 'mark %s' -l 1 -P 'Mark: '
+##### Reload configuration file
+bindsym $mod+Shift+c reload
+##### Restart i3 inplace
+bindsym $mod+Shift+r restart
+##### Exit i3
+bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
+##### Resize window
+mode "resize" {
+ # Pressing left will shrink the window’s width.
+ bindsym $LEFT resize shrink width 10 px or 10 ppt
+ # Pressing down will grow the window’s height.
+ bindsym $UP resize grow height 10 px or 10 ppt
+ # Pressing up will shrink the window’s height.
+ bindsym $DOWN resize shrink height 10 px or 10 ppt
+ # Pressing right will grow the window’s width.
+ bindsym $RIGHT resize grow width 10 px or 10 ppt
+
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod+r mode "resize"
+##### Cmus control
+mode "cmus" {
+ # Toggle pause
+ bindsym c exec cmus-remote -u
+ # Next
+ bindsym b exec cmus-remote -n
+ # Previous
+ bindsym z exec cmus-remote -r
+ #Shuffle
+ bindsym s exec cmus-rand integrated
+ # Vol up
+ bindsym Shift + plus exec cmus-remote -v +5%
+ bindsym KP_Add exec cmus-remote -v +5%
+ # Vol down
+ bindsym minus exec cmus-remote -v -5%
+ bindsym KP_Subtract exec cmus-remote -v -5%
+ # Quit
+ bindsym x exec cmus-remote -C quit; mode "default"
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod c mode "cmus"
+##### App launcher keys
+mode "launcher" {
+ # Lancer terminal
+ bindsym t exec tmux_run; mode "default"
+ # Define lock control
+ bindsym F3 exec i3lock -f -i ~/.dotfiles-deps/i3/lock.png; mode "default"
+ # Open wicd
+ bindsym w exec xterm -e nmtui; mode "default"
+ # Open pavucontrol
+ bindsym p exec i3-pavucontrol; mode "default"
+ # Start weechat
+ bindsym Shift + w exec xterm -e weechat || notify-send -t 2000 "Weechat already launched"; mode "default"
+ # Open mc
+ bindsym m exec xterm -e mc; mode "default"
+ # Join cmus
+ bindsym c exec xterm -e cmus; mode "default"
+ # Start deluge
+ bindsym d exec xterm -e deluge-console ; mode "default"
+ # Open orgfiles
+ bindsym o exec org-session ; mode "default"
+ # Enable double screen
+ bindsym F1 exec ~/.config/i3/inria.sh; mode "default"
+ # Disable double screen
+ bindsym F2 exec ~/.config/i3/noinria.sh; mode "default"
+ bindsym F4 exec xrandr --output DP1-2 --same-as eDP1 ; mode "default"
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod+o mode "launcher"
+##### Quick window switching (maybe using i3-input will be more generic)
+bindsym $jump+m workspace $ws-mutt
+bindsym $jump+w workspace $ws-weechat
+bindsym $jump+n workspace $ws-newsboat
+bindsym $jump+r workspace $ws-R
+bindsym $jump+s workspace $ws-signal
+bindsym $jump+c workspace $ws-cmus
+bindsym $jump+f workspace $ws-firefox
+bindsym $jump+agrave workspace $ws-org
+#########################
+
+##### Startup #####
+##### Startup tools
+exec --no-startup-id xmodmap ~/.Xmodmap
+exec --no-startup-id xterm -T Mutt -e mutt
+exec --no-startup-id xterm -xrm "xterm*allowTitleOps: false" -T Weechat -e weechat # We should prevent Weechat to change xterm window title (with -xm ...)
+exec --no-startup-id xterm -xrm "xterm*allowTitleOps: false" -T Cmus -e cmus
+exec --no-startup-id pulseeffects
+exec --no-startup-id signal-desktop-disable-gpu
+exec --no-startup-id xterm -T "R Session" -e R
+exec --no-startup-id xterm -T "Newsboat" -e newsboat
+##### Startup applications
+exec --no-startup-id firefox
+exec --no-startup-id org-session
+exec --no-startup-id /usr/bin/emacs --daemon
+exec --no-startup-id xcompmgr
+exec --no-startup-id xrdb ~/.Xdefaults
+exec --no-startup-id clipit
+exec --no-startup-id redshift -l 48.1265:-1.6499 -t 5500:3600 -g 0.8 -m vidmode -v
+exec --no-startup-id dunst -conf ~/.dunstrc
+exec_always feh --bg-scale ~/.config/i3/background.jpg
+###################
+
+##### Workspaces Assignments #####
+##### Assign apps to workspace
+assign [class="^firefox$"] $ws-firefox
+assign [class="^Eclipse$"] $ws2
+assign [title="org-session"] $ws-org
+##### Assign tools workspaces
+assign [class="^Signal$"] $ws-signal
+assign [title="Mutt"] $ws-mutt
+assign [title="Weechat"] $ws-weechat
+assign [title="R Session"] $ws-R
+assign [title="Newsboat"] $ws-newsboat
+assign [class="Pulseeffects"] $ws-cmus
+assign [title="Cmus"] $ws-cmus
+##################################
+
+##### Configure Windows #####
+for_window [class="feh"] floating enable
+for_window [class="Geeqie"] floating enable, resize set 1700 900, move position center
+for_window [class="MPlayer"] floating enable
+for_window [title="^Tmux$"] floating enable, resize set 1700 900, move position center
+for_window [class="^Pavucontrol$"] floating enable, resize set 1700 900, move position center
+#############################
+
+##### Configure Outputs #####
+workspace $ws1 output eDP1 # Compilation
+workspace $ws2 output DP1-2 # Eclipse
+workspace $ws3 output DP1-2
+workspace $ws4 output DP1-2
+workspace $ws5 output DP1-2
+workspace $ws6 output DP1-2
+workspace $ws7 output DP1-2
+workspace $ws8 output DP1-2
+workspace $ws9 output DP1-1 # Web browser
+workspace $ws10 output DP1-2 # org-session signal
+#############################
+
+##### Theme #####
+bar {
+ #mode hide
+ position top
+ font pango:DejaVu Sans Mono 14
+ status_command i3status -c ~/.config/i3/i3status.conf
+ separator_symbol "|"
+ colors {
+ active_workspace #414141 #2d2d2d #ffffff
+ background #2d2d2d
+ focused_workspace #4183F6 #2d76f6 #ffffff
+ inactive_workspace #414141 #2d2d2d #bbbbbb
+ separator #bbbbbb
+ statusline #ffffff
+ urgent_workspace #FFCB21 #ffc609 #ffffff
+ }
+}
+#################
+client.focused #4183F6 #2d76f6 #ffffff #d8442e #4183F6
+client.focused_inactive #C1C1C1 #bbbbbb #ffffff #009c58 #C1C1C1
+client.unfocused #414141 #2d2d2d #ffffff #bbbbbb #414141
+client.urgent #FFCB21 #ffc609 #ffffff #d8442e #FFCB21
diff --git a/tests/data/google b/tests/data/google
new file mode 100644
index 0000000..73e7d8d
--- /dev/null
+++ b/tests/data/google
@@ -0,0 +1,45 @@
+bar_colors:
+ active_workspace:
+ background: '#2d2d2d'
+ border: '#414141'
+ text: '#ffffff'
+ background: '#2d2d2d'
+ focused_workspace:
+ background: '#2d76f6'
+ border: '#4183F6'
+ text: '#ffffff'
+ inactive_workspace:
+ background: '#2d2d2d'
+ border: '#414141'
+ text: '#bbbbbb'
+ separator: '#bbbbbb'
+ statusline: '#ffffff'
+ urgent_workspace:
+ background: '#ffc609'
+ border: '#FFCB21'
+ text: '#ffffff'
+meta:
+ author: lasers
+ url: https://github.com/okraits/j4-make-config
+window_colors:
+ focused:
+ background: '#2d76f6'
+ border: '#4183F6'
+ indicator: '#d8442e'
+ text: '#ffffff'
+ focused_inactive:
+ background: '#bbbbbb'
+ border: '#C1C1C1'
+ indicator: '#009c58'
+ text: '#ffffff'
+ unfocused:
+ background: '#2d2d2d'
+ border: '#414141'
+ indicator: '#bbbbbb'
+ text: '#ffffff'
+ urgent:
+ background: '#ffc609'
+ border: '#FFCB21'
+ indicator: '#d8442e'
+ text: '#ffffff'
+
diff --git a/tests/data/seti b/tests/data/seti
new file mode 100644
index 0000000..571dd34
--- /dev/null
+++ b/tests/data/seti
@@ -0,0 +1,58 @@
+# vim: filetype=yaml
+---
+meta:
+ description: 'seti theme by Jody Ribton - based on the seti Atom theme at https://atom.io/themes/seti-ui'
+colors:
+ blue: '#4F99D3'
+ green: '#9FCA56'
+ yellow: '#DCCD69'
+ red: '#CE4045'
+ orange: '#FF8315'
+ purple: '#A074C4'
+ grey: '#1f2326'
+ white: '#FFFFFF'
+ dull_white: '#AAAAAA'
+ base: '#151718'
+window_colors:
+ focused:
+ border: 'blue'
+ background: 'blue'
+ text: 'base'
+ indicator: 'green'
+ focused_inactive:
+ border: 'green'
+ background: 'green'
+ text: 'base'
+ indicator: 'purple'
+ unfocused:
+ border: 'grey'
+ background: 'grey'
+ text: 'dull_white'
+ indicator: 'purple'
+ urgent:
+ border: 'red'
+ background: 'red'
+ text: 'white'
+ indicator: 'yellow'
+bar_colors:
+ separator: 'dull_white'
+ background: 'grey'
+ statusline: 'white'
+ focused_workspace:
+ border: 'green'
+ background: 'green'
+ text: 'base'
+ active_workspace:
+ border: 'yellow'
+ background: 'yellow'
+ text: 'base'
+ inactive_workspace:
+ border: 'grey'
+ background: 'grey'
+ text: 'dull_white'
+ urgent_workspace:
+ border: 'red'
+ background: 'red'
+ text: 'white'
+
+
diff --git a/tests/include.sh b/tests/include.sh
new file mode 100644
index 0000000..773dd82
--- /dev/null
+++ b/tests/include.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+wai=$(dirname $(readlink -f $0))
+exec=${wai}/../src/i3-colors.py
+data=${wai}/data
+
+load() {
+ tmp=$(mktemp)
+ cp ${1} ${tmp}
+ echo ${tmp}
+}
diff --git a/tests/run.sh b/tests/run.sh
new file mode 100755
index 0000000..296eccf
--- /dev/null
+++ b/tests/run.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+wai=$(dirname $(readlink -f $0))
+out=$(mktemp)
+int=0
+
+passed(){
+ echo -e "$1 ===> \e[32mpassed :)\e[0m"
+}
+
+fail(){
+ echo -e "$1 ===> \e[5m\e[31mfail :(\e[0m"
+}
+
+[ $# -gt 0 ] && [ $1 == "-b" ] && int=1
+
+##### Run Integration Tests #####
+nb_pass=0
+nb_fail=0
+for test in $(find ${wai} -type f -name "test-*.sh")
+do
+ test_name=$(basename $test)
+ expectations="${test_name%.*}.out"
+ bash $test > $out 2>&1
+ log=$(diff -q "${out}" "${expectations}")
+
+ if [ ! -z "$log" ]
+ then
+ fail "${test_name}"
+ nb_fail=$(( nb_fail + 1 ))
+
+ if [ $int -eq 1 ]
+ then
+ echo "========== Diff =========="
+ diff "${out}" "${expectations}"
+ exit 1
+ fi
+ else
+ nb_pass=$(( nb_test + 1 ))
+ passed "${test_name}"
+ fi
+done
+#################################
+
+
+echo -e "\n===== STATS ====="
+echo "${nb_pass} pass"
+echo "${nb_fail} fails"
+
+##### Clear #####
+rm ${out}
+#################
+
diff --git a/tests/test-simple-apply.out b/tests/test-simple-apply.out
new file mode 100644
index 0000000..064868d
--- /dev/null
+++ b/tests/test-simple-apply.out
@@ -0,0 +1,613 @@
+Author: lasers
+Url: https://github.com/okraits/j4-make-config
+##### Variables #####
+##### Define workspaces names
+set $ws1 "1 "
+set $ws2 "2"
+set $ws3 "3"
+set $ws4 "4"
+set $ws5 "5"
+set $ws6 "6"
+set $ws7 "7"
+set $ws8 "8"
+set $ws9 "9"
+set $ws10 "10"
+set $ws-firefox ""
+set $ws-org ""
+set $ws-tools ""
+set $ws-mutt ""
+set $ws-weechat ""
+set $ws-newsboat ""
+set $ws-R ""
+set $ws-signal "Signal"
+set $ws-cmus ""
+###### Define some default keys
+set $LEFT j
+set $DOWN k
+set $UP l
+set $RIGHT m
+##### Define shutter sound location (for screenshots)
+set $shutter_sound ~/.config/i3/shutter.mp3
+##### Define modifier
+set $mod Mod4
+set $jump Mod3
+#####################
+
+##### Appearence #####
+##### Define font
+font pango:DejaVu Sans Mono 12
+##### To gain a bit of space
+hide_edge_borders both
+######################
+
+##### I3 Behavior #####
+##### Disable cycle (like workspace) in a container with several windows
+focus_wrapping no
+##### Enable workspace auto back and forth (go back to the previous workspace with same keybinding)
+workspace_auto_back_and_forth yes
+##### Default workspace layout
+workspace_layout tabbed
+#######################
+
+##### Setup Mouse #####
+##### Disable mouse on hover focus
+focus_follows_mouse no
+##### Define mouse floating window size and move modifier
+floating_modifier $mod
+floating_minimum_size 200 x 200
+#######################
+
+##### Keys Bindings #####
+##### Volume
+bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+
+bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%-
+bindsym XF86AudioMute exec amixer -D pulse sset Master toggle
+##### Scratchpad
+bindsym $mod+asterisk scratchpad show
+bindsym $mod+Shift+asterisk move scratchpad
+##### Define brightness control
+bindcode 233 exec xbacklight -inc 5
+bindcode 232 exec xbacklight -dec 5
+##### Move workspace to next output
+bindsym $mod+ugrave move workspace to output right
+##### Define screenshot key
+bindsym Print exec scrot ~/Pictures/screenshots/%Y-%m-%d_%H:%M:%S.png && exec ffplay -nodisp -autoexit $shutter_sound
+bindsym $mod+Print exec scrot -e "ffplay -nodisp -autoexit $shutter_sound && gimp \$f" ~/Pictures/screenshots/%Y-%m-%d_%H:%M:%S.png
+##### Start terminal
+bindsym $mod+Shift+Return exec xterm
+##### Kill a window
+bindsym $mod+Shift+a kill
+##### Start dmenu
+bindsym $mod+d exec dmenu_run -b -i -sb "#CC0000" -nb "#4A4A4A" -fn "Deja Vu Sans Mono-14:bold"
+##### Configure password manager
+bindsym $mod+Shift+d exec pp
+##### Change focus
+bindsym $mod+$LEFT focus left
+bindsym $mod+$DOWN focus down
+bindsym $mod+$UP focus up
+bindsym $mod+$RIGHT focus right
+##### Move focused window
+bindsym $mod+Shift+$LEFT move left
+bindsym $mod+Shift+$DOWN move down
+bindsym $mod+Shift+$UP move up
+bindsym $mod+Shift+$RIGHT move right
+##### Layout Splits
+bindsym $mod+h split h
+bindsym $mod+v split v
+##### Toggle fullscreen
+bindsym $mod+f fullscreen toggle
+##### Change container layout (either stacked, tabbed or splitv/splith)
+bindsym $mod+s layout stacking
+bindsym $mod+z layout tabbed
+bindsym $mod+t layout toggle split
+##### Toggle tiling / floating
+bindsym $mod+Shift+space floating toggle
+##### Change focus between tiling / floating windows
+bindsym $mod+space focus mode_toggle
+##### Focus container
+bindsym $mod+q focus parent
+bindsym $mod+Shift+q focus child
+##### Workspace next and prev
+bindsym $mod+Right workspace next
+bindsym $mod+Left workspace prev
+##### Switch to workspace
+bindsym $mod+ampersand workspace $ws1
+bindsym $mod+eacute workspace $ws2
+bindsym $mod+quotedbl workspace $ws3
+bindsym $mod+apostrophe workspace $ws4
+bindsym $mod+parenleft workspace $ws5
+bindsym $mod+minus workspace $ws6
+bindsym $mod+egrave workspace $ws7
+bindsym $mod+underscore workspace $ws8
+bindsym $mod+ccedilla workspace $ws9
+bindsym $mod+agrave workspace $ws10
+bindsym $mod+exclam workspace $ws-tools
+##### Move focused container to workspace
+bindsym $mod+Shift+ampersand move container to workspace $ws1
+bindsym $mod+Shift+eacute move container to workspace $ws2
+bindsym $mod+Shift+quotedbl move container to workspace $ws3
+bindsym $mod+Shift+apostrophe move container to workspace $ws4
+bindsym $mod+Shift+5 move container to workspace $ws5
+bindsym $mod+Shift+minus move container to workspace $ws6
+bindsym $mod+Shift+egrave move container to workspace $ws7
+bindsym $mod+Shift+underscore move container to workspace $ws8
+bindsym $mod+Shift+ccedilla move container to workspace $ws9
+bindsym $mod+Shift+agrave move container to workspace $ws10
+bindsym $mod+Shift+exclam move container to workspace $ws-tools
+# Read 1 character and mark the current window with this character
+bindsym $mod+shift+w exec i3-input -F 'mark %s' -l 1 -P 'Mark: '
+##### Reload configuration file
+bindsym $mod+Shift+c reload
+##### Restart i3 inplace
+bindsym $mod+Shift+r restart
+##### Exit i3
+bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
+##### Resize window
+mode "resize" {
+ # Pressing left will shrink the window’s width.
+ bindsym $LEFT resize shrink width 10 px or 10 ppt
+ # Pressing down will grow the window’s height.
+ bindsym $UP resize grow height 10 px or 10 ppt
+ # Pressing up will shrink the window’s height.
+ bindsym $DOWN resize shrink height 10 px or 10 ppt
+ # Pressing right will grow the window’s width.
+ bindsym $RIGHT resize grow width 10 px or 10 ppt
+
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod+r mode "resize"
+##### Cmus control
+mode "cmus" {
+ # Toggle pause
+ bindsym c exec cmus-remote -u
+ # Next
+ bindsym b exec cmus-remote -n
+ # Previous
+ bindsym z exec cmus-remote -r
+ #Shuffle
+ bindsym s exec cmus-rand integrated
+ # Vol up
+ bindsym Shift + plus exec cmus-remote -v +5%
+ bindsym KP_Add exec cmus-remote -v +5%
+ # Vol down
+ bindsym minus exec cmus-remote -v -5%
+ bindsym KP_Subtract exec cmus-remote -v -5%
+ # Quit
+ bindsym x exec cmus-remote -C quit; mode "default"
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod c mode "cmus"
+##### App launcher keys
+mode "launcher" {
+ # Lancer terminal
+ bindsym t exec tmux_run; mode "default"
+ # Define lock control
+ bindsym F3 exec i3lock -f -i ~/.dotfiles-deps/i3/lock.png; mode "default"
+ # Open wicd
+ bindsym w exec xterm -e nmtui; mode "default"
+ # Open pavucontrol
+ bindsym p exec i3-pavucontrol; mode "default"
+ # Start weechat
+ bindsym Shift + w exec xterm -e weechat || notify-send -t 2000 "Weechat already launched"; mode "default"
+ # Open mc
+ bindsym m exec xterm -e mc; mode "default"
+ # Join cmus
+ bindsym c exec xterm -e cmus; mode "default"
+ # Start deluge
+ bindsym d exec xterm -e deluge-console ; mode "default"
+ # Open orgfiles
+ bindsym o exec org-session ; mode "default"
+ # Enable double screen
+ bindsym F1 exec ~/.config/i3/inria.sh; mode "default"
+ # Disable double screen
+ bindsym F2 exec ~/.config/i3/noinria.sh; mode "default"
+ bindsym F4 exec xrandr --output DP1-2 --same-as eDP1 ; mode "default"
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod+o mode "launcher"
+##### Quick window switching (maybe using i3-input will be more generic)
+bindsym $jump+m workspace $ws-mutt
+bindsym $jump+w workspace $ws-weechat
+bindsym $jump+n workspace $ws-newsboat
+bindsym $jump+r workspace $ws-R
+bindsym $jump+s workspace $ws-signal
+bindsym $jump+c workspace $ws-cmus
+bindsym $jump+f workspace $ws-firefox
+bindsym $jump+agrave workspace $ws-org
+#########################
+
+##### Startup #####
+##### Startup tools
+exec --no-startup-id xmodmap ~/.Xmodmap
+exec --no-startup-id xterm -T Mutt -e mutt
+exec --no-startup-id xterm -xrm "xterm*allowTitleOps: false" -T Weechat -e weechat # We should prevent Weechat to change xterm window title (with -xm ...)
+exec --no-startup-id xterm -xrm "xterm*allowTitleOps: false" -T Cmus -e cmus
+exec --no-startup-id pulseeffects
+exec --no-startup-id signal-desktop-disable-gpu
+exec --no-startup-id xterm -T "R Session" -e R
+exec --no-startup-id xterm -T "Newsboat" -e newsboat
+##### Startup applications
+exec --no-startup-id firefox
+exec --no-startup-id org-session
+exec --no-startup-id /usr/bin/emacs --daemon
+exec --no-startup-id xcompmgr
+exec --no-startup-id xrdb ~/.Xdefaults
+exec --no-startup-id clipit
+exec --no-startup-id redshift -l 48.1265:-1.6499 -t 5500:3600 -g 0.8 -m vidmode -v
+exec --no-startup-id dunst -conf ~/.dunstrc
+exec_always feh --bg-scale ~/.config/i3/background.jpg
+###################
+
+##### Workspaces Assignments #####
+##### Assign apps to workspace
+assign [class="^firefox$"] $ws-firefox
+assign [class="^Eclipse$"] $ws2
+assign [title="org-session"] $ws-org
+##### Assign tools workspaces
+assign [class="^Signal$"] $ws-signal
+assign [title="Mutt"] $ws-mutt
+assign [title="Weechat"] $ws-weechat
+assign [title="R Session"] $ws-R
+assign [title="Newsboat"] $ws-newsboat
+assign [class="Pulseeffects"] $ws-cmus
+assign [title="Cmus"] $ws-cmus
+##################################
+
+##### Configure Windows #####
+for_window [class="feh"] floating enable
+for_window [class="Geeqie"] floating enable, resize set 1700 900, move position center
+for_window [class="MPlayer"] floating enable
+for_window [title="^Tmux$"] floating enable, resize set 1700 900, move position center
+for_window [class="^Pavucontrol$"] floating enable, resize set 1700 900, move position center
+#############################
+
+##### Configure Outputs #####
+workspace $ws1 output eDP1 # Compilation
+workspace $ws2 output DP1-2 # Eclipse
+workspace $ws3 output DP1-2
+workspace $ws4 output DP1-2
+workspace $ws5 output DP1-2
+workspace $ws6 output DP1-2
+workspace $ws7 output DP1-2
+workspace $ws8 output DP1-2
+workspace $ws9 output DP1-1 # Web browser
+workspace $ws10 output DP1-2 # org-session signal
+#############################
+
+##### Theme #####
+bar {
+ #mode hide
+ position top
+ font pango:DejaVu Sans Mono 14
+ status_command i3status -c ~/.config/i3/i3status.conf
+ separator_symbol "|"
+ colors {
+ active_workspace #414141 #2d2d2d #ffffff
+ background #2d2d2d
+ focused_workspace #4183F6 #2d76f6 #ffffff
+ inactive_workspace #414141 #2d2d2d #bbbbbb
+ separator #bbbbbb
+ statusline #ffffff
+ urgent_workspace #FFCB21 #ffc609 #ffffff
+ }
+}
+#################
+client.focused #4183F6 #2d76f6 #ffffff #d8442e #4183F6
+client.focused_inactive #C1C1C1 #bbbbbb #ffffff #009c58 #C1C1C1
+client.unfocused #414141 #2d2d2d #ffffff #bbbbbb #414141
+client.urgent #FFCB21 #ffc609 #ffffff #d8442e #FFCB21
+Description: seti theme by Jody Ribton - based on the seti Atom theme at https://atom.io/themes/seti-ui
+##### Variables #####
+##### Define workspaces names
+set $ws1 "1 "
+set $ws2 "2"
+set $ws3 "3"
+set $ws4 "4"
+set $ws5 "5"
+set $ws6 "6"
+set $ws7 "7"
+set $ws8 "8"
+set $ws9 "9"
+set $ws10 "10"
+set $ws-firefox ""
+set $ws-org ""
+set $ws-tools ""
+set $ws-mutt ""
+set $ws-weechat ""
+set $ws-newsboat ""
+set $ws-R ""
+set $ws-signal "Signal"
+set $ws-cmus ""
+###### Define some default keys
+set $LEFT j
+set $DOWN k
+set $UP l
+set $RIGHT m
+##### Define shutter sound location (for screenshots)
+set $shutter_sound ~/.config/i3/shutter.mp3
+##### Define modifier
+set $mod Mod4
+set $jump Mod3
+#####################
+
+##### Appearence #####
+##### Define font
+font pango:DejaVu Sans Mono 12
+##### To gain a bit of space
+hide_edge_borders both
+######################
+
+##### I3 Behavior #####
+##### Disable cycle (like workspace) in a container with several windows
+focus_wrapping no
+##### Enable workspace auto back and forth (go back to the previous workspace with same keybinding)
+workspace_auto_back_and_forth yes
+##### Default workspace layout
+workspace_layout tabbed
+#######################
+
+##### Setup Mouse #####
+##### Disable mouse on hover focus
+focus_follows_mouse no
+##### Define mouse floating window size and move modifier
+floating_modifier $mod
+floating_minimum_size 200 x 200
+#######################
+
+##### Keys Bindings #####
+##### Volume
+bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+
+bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%-
+bindsym XF86AudioMute exec amixer -D pulse sset Master toggle
+##### Scratchpad
+bindsym $mod+asterisk scratchpad show
+bindsym $mod+Shift+asterisk move scratchpad
+##### Define brightness control
+bindcode 233 exec xbacklight -inc 5
+bindcode 232 exec xbacklight -dec 5
+##### Move workspace to next output
+bindsym $mod+ugrave move workspace to output right
+##### Define screenshot key
+bindsym Print exec scrot ~/Pictures/screenshots/%Y-%m-%d_%H:%M:%S.png && exec ffplay -nodisp -autoexit $shutter_sound
+bindsym $mod+Print exec scrot -e "ffplay -nodisp -autoexit $shutter_sound && gimp \$f" ~/Pictures/screenshots/%Y-%m-%d_%H:%M:%S.png
+##### Start terminal
+bindsym $mod+Shift+Return exec xterm
+##### Kill a window
+bindsym $mod+Shift+a kill
+##### Start dmenu
+bindsym $mod+d exec dmenu_run -b -i -sb "#CC0000" -nb "#4A4A4A" -fn "Deja Vu Sans Mono-14:bold"
+##### Configure password manager
+bindsym $mod+Shift+d exec pp
+##### Change focus
+bindsym $mod+$LEFT focus left
+bindsym $mod+$DOWN focus down
+bindsym $mod+$UP focus up
+bindsym $mod+$RIGHT focus right
+##### Move focused window
+bindsym $mod+Shift+$LEFT move left
+bindsym $mod+Shift+$DOWN move down
+bindsym $mod+Shift+$UP move up
+bindsym $mod+Shift+$RIGHT move right
+##### Layout Splits
+bindsym $mod+h split h
+bindsym $mod+v split v
+##### Toggle fullscreen
+bindsym $mod+f fullscreen toggle
+##### Change container layout (either stacked, tabbed or splitv/splith)
+bindsym $mod+s layout stacking
+bindsym $mod+z layout tabbed
+bindsym $mod+t layout toggle split
+##### Toggle tiling / floating
+bindsym $mod+Shift+space floating toggle
+##### Change focus between tiling / floating windows
+bindsym $mod+space focus mode_toggle
+##### Focus container
+bindsym $mod+q focus parent
+bindsym $mod+Shift+q focus child
+##### Workspace next and prev
+bindsym $mod+Right workspace next
+bindsym $mod+Left workspace prev
+##### Switch to workspace
+bindsym $mod+ampersand workspace $ws1
+bindsym $mod+eacute workspace $ws2
+bindsym $mod+quotedbl workspace $ws3
+bindsym $mod+apostrophe workspace $ws4
+bindsym $mod+parenleft workspace $ws5
+bindsym $mod+minus workspace $ws6
+bindsym $mod+egrave workspace $ws7
+bindsym $mod+underscore workspace $ws8
+bindsym $mod+ccedilla workspace $ws9
+bindsym $mod+agrave workspace $ws10
+bindsym $mod+exclam workspace $ws-tools
+##### Move focused container to workspace
+bindsym $mod+Shift+ampersand move container to workspace $ws1
+bindsym $mod+Shift+eacute move container to workspace $ws2
+bindsym $mod+Shift+quotedbl move container to workspace $ws3
+bindsym $mod+Shift+apostrophe move container to workspace $ws4
+bindsym $mod+Shift+5 move container to workspace $ws5
+bindsym $mod+Shift+minus move container to workspace $ws6
+bindsym $mod+Shift+egrave move container to workspace $ws7
+bindsym $mod+Shift+underscore move container to workspace $ws8
+bindsym $mod+Shift+ccedilla move container to workspace $ws9
+bindsym $mod+Shift+agrave move container to workspace $ws10
+bindsym $mod+Shift+exclam move container to workspace $ws-tools
+# Read 1 character and mark the current window with this character
+bindsym $mod+shift+w exec i3-input -F 'mark %s' -l 1 -P 'Mark: '
+##### Reload configuration file
+bindsym $mod+Shift+c reload
+##### Restart i3 inplace
+bindsym $mod+Shift+r restart
+##### Exit i3
+bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
+##### Resize window
+mode "resize" {
+ # Pressing left will shrink the window’s width.
+ bindsym $LEFT resize shrink width 10 px or 10 ppt
+ # Pressing down will grow the window’s height.
+ bindsym $UP resize grow height 10 px or 10 ppt
+ # Pressing up will shrink the window’s height.
+ bindsym $DOWN resize shrink height 10 px or 10 ppt
+ # Pressing right will grow the window’s width.
+ bindsym $RIGHT resize grow width 10 px or 10 ppt
+
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod+r mode "resize"
+##### Cmus control
+mode "cmus" {
+ # Toggle pause
+ bindsym c exec cmus-remote -u
+ # Next
+ bindsym b exec cmus-remote -n
+ # Previous
+ bindsym z exec cmus-remote -r
+ #Shuffle
+ bindsym s exec cmus-rand integrated
+ # Vol up
+ bindsym Shift + plus exec cmus-remote -v +5%
+ bindsym KP_Add exec cmus-remote -v +5%
+ # Vol down
+ bindsym minus exec cmus-remote -v -5%
+ bindsym KP_Subtract exec cmus-remote -v -5%
+ # Quit
+ bindsym x exec cmus-remote -C quit; mode "default"
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod c mode "cmus"
+##### App launcher keys
+mode "launcher" {
+ # Lancer terminal
+ bindsym t exec tmux_run; mode "default"
+ # Define lock control
+ bindsym F3 exec i3lock -f -i ~/.dotfiles-deps/i3/lock.png; mode "default"
+ # Open wicd
+ bindsym w exec xterm -e nmtui; mode "default"
+ # Open pavucontrol
+ bindsym p exec i3-pavucontrol; mode "default"
+ # Start weechat
+ bindsym Shift + w exec xterm -e weechat || notify-send -t 2000 "Weechat already launched"; mode "default"
+ # Open mc
+ bindsym m exec xterm -e mc; mode "default"
+ # Join cmus
+ bindsym c exec xterm -e cmus; mode "default"
+ # Start deluge
+ bindsym d exec xterm -e deluge-console ; mode "default"
+ # Open orgfiles
+ bindsym o exec org-session ; mode "default"
+ # Enable double screen
+ bindsym F1 exec ~/.config/i3/inria.sh; mode "default"
+ # Disable double screen
+ bindsym F2 exec ~/.config/i3/noinria.sh; mode "default"
+ bindsym F4 exec xrandr --output DP1-2 --same-as eDP1 ; mode "default"
+ # Back to normal
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+ bindsym q mode "default"
+}
+bindsym $mod+o mode "launcher"
+##### Quick window switching (maybe using i3-input will be more generic)
+bindsym $jump+m workspace $ws-mutt
+bindsym $jump+w workspace $ws-weechat
+bindsym $jump+n workspace $ws-newsboat
+bindsym $jump+r workspace $ws-R
+bindsym $jump+s workspace $ws-signal
+bindsym $jump+c workspace $ws-cmus
+bindsym $jump+f workspace $ws-firefox
+bindsym $jump+agrave workspace $ws-org
+#########################
+
+##### Startup #####
+##### Startup tools
+exec --no-startup-id xmodmap ~/.Xmodmap
+exec --no-startup-id xterm -T Mutt -e mutt
+exec --no-startup-id xterm -xrm "xterm*allowTitleOps: false" -T Weechat -e weechat # We should prevent Weechat to change xterm window title (with -xm ...)
+exec --no-startup-id xterm -xrm "xterm*allowTitleOps: false" -T Cmus -e cmus
+exec --no-startup-id pulseeffects
+exec --no-startup-id signal-desktop-disable-gpu
+exec --no-startup-id xterm -T "R Session" -e R
+exec --no-startup-id xterm -T "Newsboat" -e newsboat
+##### Startup applications
+exec --no-startup-id firefox
+exec --no-startup-id org-session
+exec --no-startup-id /usr/bin/emacs --daemon
+exec --no-startup-id xcompmgr
+exec --no-startup-id xrdb ~/.Xdefaults
+exec --no-startup-id clipit
+exec --no-startup-id redshift -l 48.1265:-1.6499 -t 5500:3600 -g 0.8 -m vidmode -v
+exec --no-startup-id dunst -conf ~/.dunstrc
+exec_always feh --bg-scale ~/.config/i3/background.jpg
+###################
+
+##### Workspaces Assignments #####
+##### Assign apps to workspace
+assign [class="^firefox$"] $ws-firefox
+assign [class="^Eclipse$"] $ws2
+assign [title="org-session"] $ws-org
+##### Assign tools workspaces
+assign [class="^Signal$"] $ws-signal
+assign [title="Mutt"] $ws-mutt
+assign [title="Weechat"] $ws-weechat
+assign [title="R Session"] $ws-R
+assign [title="Newsboat"] $ws-newsboat
+assign [class="Pulseeffects"] $ws-cmus
+assign [title="Cmus"] $ws-cmus
+##################################
+
+##### Configure Windows #####
+for_window [class="feh"] floating enable
+for_window [class="Geeqie"] floating enable, resize set 1700 900, move position center
+for_window [class="MPlayer"] floating enable
+for_window [title="^Tmux$"] floating enable, resize set 1700 900, move position center
+for_window [class="^Pavucontrol$"] floating enable, resize set 1700 900, move position center
+#############################
+
+##### Configure Outputs #####
+workspace $ws1 output eDP1 # Compilation
+workspace $ws2 output DP1-2 # Eclipse
+workspace $ws3 output DP1-2
+workspace $ws4 output DP1-2
+workspace $ws5 output DP1-2
+workspace $ws6 output DP1-2
+workspace $ws7 output DP1-2
+workspace $ws8 output DP1-2
+workspace $ws9 output DP1-1 # Web browser
+workspace $ws10 output DP1-2 # org-session signal
+#############################
+
+##### Theme #####
+bar {
+ #mode hide
+ position top
+ font pango:DejaVu Sans Mono 14
+ status_command i3status -c ~/.config/i3/i3status.conf
+ separator_symbol "|"
+ colors {
+ separator #AAAAAA
+ background #1f2326
+ statusline #FFFFFF
+ focused_workspace #9FCA56 #9FCA56 #151718
+ active_workspace #DCCD69 #DCCD69 #151718
+ inactive_workspace #1f2326 #1f2326 #AAAAAA
+ urgent_workspace #CE4045 #CE4045 #FFFFFF
+ }
+}
+#################
+client.focused #4F99D3 #4F99D3 #151718 #9FCA56 #4F99D3
+client.focused_inactive #9FCA56 #9FCA56 #151718 #A074C4 #9FCA56
+client.unfocused #1f2326 #1f2326 #AAAAAA #A074C4 #1f2326
+client.urgent #CE4045 #CE4045 #FFFFFF #DCCD69 #CE4045
diff --git a/tests/test-simple-apply.sh b/tests/test-simple-apply.sh
new file mode 100644
index 0000000..e5ab960
--- /dev/null
+++ b/tests/test-simple-apply.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+wai=$(dirname $(readlink -f $0))
+source "${wai}/include.sh"
+
+##### Load config file
+config_file=$(load ${data}/config)
+
+##### Test apply on theme with no variables
+$exec apply ${data}/google ${config_file}
+cat $config_file
+##### Test apply on theme with variables
+$exec apply ${data}/seti ${config_file}
+cat $config_file
+
+##### Clear temporary file
+rm $config_file