From ae1a4cf34d12c2c7c23503f2b71efb96a28356da Mon Sep 17 00:00:00 2001 From: alina sireneva Date: Wed, 1 May 2024 21:51:02 +0300 Subject: [PATCH] feat(teidesu): added karabiner config --- users/teidesu/assets/karabiner.json | 138 ++++++++++++++++++ .../teidesu/assets/new-alacritty-window.scpt | 12 ++ users/teidesu/darwin.nix | 2 + 3 files changed, 152 insertions(+) create mode 100644 users/teidesu/assets/karabiner.json create mode 100644 users/teidesu/assets/new-alacritty-window.scpt diff --git a/users/teidesu/assets/karabiner.json b/users/teidesu/assets/karabiner.json new file mode 100644 index 0000000..4198e58 --- /dev/null +++ b/users/teidesu/assets/karabiner.json @@ -0,0 +1,138 @@ +{ + "global": { + "ask_for_confirmation_before_quitting": true, + "check_for_updates_on_startup": true, + "show_in_menu_bar": false, + "show_profile_name_in_menu_bar": false, + "unsafe_ui": false + }, + "profiles": [ + { + "complex_modifications": { + "parameters": { + "basic.simultaneous_threshold_milliseconds": 50, + "basic.to_delayed_action_delay_milliseconds": 500, + "basic.to_if_alone_timeout_milliseconds": 1000, + "basic.to_if_held_down_threshold_milliseconds": 500, + "mouse_motion_to_scroll.speed": 100 + }, + "rules": [ + { + "description": "caps_lock to russian <-> english", + "manipulators": [ + { + "conditions": [ + { + "input_sources": [ + { + "input_source_id": "^com\\.apple\\.keylayout\\.RussianWin$" + } + ], + "type": "input_source_if" + } + ], + "from": { + "key_code": "caps_lock" + }, + "to": [ + { + "select_input_source": { + "input_source_id": "^com\\.apple\\.keylayout\\.US$" + } + } + ], + "type": "basic" + }, + { + "conditions": [ + { + "input_sources": [ + { + "input_source_id": "^com\\.apple\\.keylayout\\.US$" + } + ], + "type": "input_source_if" + } + ], + "from": { + "key_code": "caps_lock" + }, + "to": [ + { + "select_input_source": { + "input_source_id": "^com\\.apple\\.keylayout\\.RussianWin$" + } + } + ], + "type": "basic" + } + ] + }, + { + "description": "New Alacritty Window", + "manipulators": [ + { + "from": { + "key_code": "return_or_enter", + "modifiers": { + "mandatory": [ + "command" + ] + } + }, + "to": [ + { + "shell_command": "osascript /Users/teidesu/.config/new-alacritty-window.scpt" + } + ], + "type": "basic" + } + ] + } + ] + }, + "name": "Default profile", + "parameters": { + "delay_milliseconds_before_open_device": 1000 + }, + "selected": true, + "simple_modifications": [ + { + "from": { + "apple_vendor_top_case_key_code": "keyboard_fn" + }, + "to": [ + { + "key_code": "right_option" + } + ] + }, + { + "from": { + "key_code": "left_option" + }, + "to": [ + { + "apple_vendor_top_case_key_code": "keyboard_fn" + } + ] + }, + { + "from": { + "key_code": "right_option" + }, + "to": [ + { + "apple_vendor_top_case_key_code": "keyboard_fn" + } + ] + } + ], + "virtual_hid_keyboard": { + "country_code": 0, + "indicate_sticky_modifier_keys_state": false, + "mouse_key_xy_scale": 100 + } + } + ] +} \ No newline at end of file diff --git a/users/teidesu/assets/new-alacritty-window.scpt b/users/teidesu/assets/new-alacritty-window.scpt new file mode 100644 index 0000000..7fbb8bf --- /dev/null +++ b/users/teidesu/assets/new-alacritty-window.scpt @@ -0,0 +1,12 @@ +on count_windows_on_current_space(process_name) + tell application "System Events" + tell process process_name + return count of windows + end tell + end tell +end count_windows_on_current_space + +if application "Alacritty" is running and count_windows_on_current_space("Alacritty") = 0 then + do shell script "/Applications/Alacritty.app/Contents/MacOS/alacritty msg create-window" +end if +activate application "Alacritty" diff --git a/users/teidesu/darwin.nix b/users/teidesu/darwin.nix index 392e978..db6f9d4 100644 --- a/users/teidesu/darwin.nix +++ b/users/teidesu/darwin.nix @@ -41,5 +41,7 @@ ]; home.file.".config/alacritty/alacritty.toml".source = ./assets/alacritty.toml; + home.file.".config/new-alacritty-window.scpt".source = ./assets/new-alacritty-window.scpt; # todo: reference this directly from store + home.file.".config/karabiner/karabiner.json".source = ./assets/karabiner.json; }; } \ No newline at end of file