Skip to content

Instantly share code, notes, and snippets.

@jakob1379
Last active January 2, 2020 13:05
Show Gist options
  • Select an option

  • Save jakob1379/94d5d6f125a97a7ef709962afa2a31e8 to your computer and use it in GitHub Desktop.

Select an option

Save jakob1379/94d5d6f125a97a7ef709962afa2a31e8 to your computer and use it in GitHub Desktop.
A small script to migrate i3 keybinding to sxhkd
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# name: i32sxhkd
# converts i3-config syntas to sxhkd
# argument 1 - full path to config file
# expected input/output - i32sxhkd [FILE] -> converted output
# example suggested usage: i32sxhkd filename > outputfile
file=$1
perl -pe 's/(?<=[^\s])\+(?=[^\s])/ \+ /g;
s/bindsym //g;
s/--no-startup-id //g;
s/bindsym //g;
s/\$mod/super/g;
s/Shift/shift/g;
s/Control/ctrl/g;
s/Ctrl/ctrl/g;
s/Alt/alt/g;
s/Mod1/alt/g;
s/ exec /\n\t/g' \
"$file"
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment