summaryrefslogtreecommitdiff
path: root/convert_sway_cfg_to_i3.sh
blob: 1f6604b5ce8c69d7d3bf8fd696c0a5c0333f602b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
sed -E -e '/(^\s*#.*$|^\s*$|^include|^xwayland|^input|swayidle|^bar )/d' \
	-e '/^seat.*hide_cursor.*/d' \
	-e '/^mode \"resize\".*$/d' \
	-e '/^floating_modifier.*/d' \
	-e '/^bindsym/s/\s--to-code//' \
	-e '/exec sway-smart-spawn-foot.sh$/s/sway-smart-spawn-foot.sh/termite/' \
	-e 's/foot sh -c/termite -e/' \
	-e '/exec/s/ exec / exec --no-startup-id /' \
	-e '/^exec /s/exec /exec --no-startup-id /' \
	-e '/app_id=/s/app_id=/class=/' \
	-e 's/^(bindsym Print exec).*(\/tmp.*png)/\1 --no-startup-id maim -s \2/' \
  -e '/grimshot save output/s/grimshot save output/scrot/' \
	-e '/swaymsg/s/swaymsg/i3-msg/' $SWAYRC > $I3RCTMP
printf "bar {\n" >> /tmp/.i3.rc
sed -En '/^bar/s/^bar //p' $SWAYRC | grep -vE '^colors' >> $I3RCTMP
printf "colors {\n" >> /tmp/.i3.rc
sed -En '/^bar colors/s/^bar colors //p' $SWAYRC >> $I3RCTMP
printf "} }\n" >> /tmp/.i3.rc
printf "mode \"resize\" {\n" >> /tmp/.i3.rc
sed -En '/^mode \"resize\".*--to-code.*/s/^mode \"resize\" (.*)--to-code(.*)$/\1 \2/p' $SWAYRC >> $I3RCTMP
sed -En '/^mode \"resize\".*default\"/s/^mode \"resize\"(.*)/\1/p' $SWAYRC >> $I3RCTMP
printf "}\n" >> /tmp/.i3.rc
i3 -C -c /tmp/.i3.rc