feat(karabiner,yabai): hide bar unless CMD is held

This commit is contained in:
winston 2022-11-22 05:45:58 +01:00
parent 05c93ea2ad
commit d96a2f8f72
Signed by: winston
GPG key ID: 3786770EDBC2B481
4 changed files with 334 additions and 9 deletions

View file

@ -19,6 +19,7 @@ README.md
{{- end }}
{{- if ne .chezmoi.os "darwin" }}
# ignore macOS configuration
.config/karabiner/
.config/sketchybar/
.config/skhd/
.config/yabai/

View file

@ -0,0 +1,321 @@
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"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": "Show Sketchybar while Command is held",
"manipulators": [
{
"from": {
"key_code": "left_command"
},
"to": [
{
"shell_command": "/opt/homebrew/bin/sketchybar --bar hidden=false"
},
{
"key_code": "left_command"
}
],
"to_after_key_up": [
{
"key_code": "left_command"
},
{
"shell_command": "/opt/homebrew/bin/sketchybar --bar hidden=true"
}
],
"type": "basic"
}
]
},
{
"description": "Shift + Esc to ~",
"manipulators": [
{
"from": {
"key_code": "escape",
"modifiers": {
"mandatory": ["shift"]
}
},
"to": [
{
"key_code": "grave_accent_and_tilde",
"modifiers": ["left_shift"],
"repeat": true
}
],
"type": "basic"
}
]
},
{
"description": "Control + Esc to `",
"manipulators": [
{
"from": {
"key_code": "escape",
"modifiers": {
"mandatory": ["control"]
}
},
"to": [
{
"key_code": "grave_accent_and_tilde",
"modifiers": []
}
],
"type": "basic"
}
]
}
]
},
"devices": [
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 834,
"vendor_id": 1452
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": false,
"is_pointing_device": true,
"product_id": 834,
"vendor_id": 1452
},
"ignore": true,
"manipulate_caps_lock_led": false,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": true,
"product_id": 273,
"vendor_id": 13364
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 273,
"vendor_id": 13364
},
"ignore": false,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": true,
"product_id": 45091,
"vendor_id": 1133
},
"ignore": true,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
},
{
"disable_built_in_keyboard_if_exists": false,
"fn_function_keys": [],
"identifiers": {
"is_keyboard": true,
"is_pointing_device": false,
"product_id": 1031,
"vendor_id": 4176
},
"ignore": true,
"manipulate_caps_lock_led": true,
"simple_modifications": [],
"treat_as_built_in_keyboard": false
}
],
"fn_function_keys": [
{
"from": {
"key_code": "f1"
},
"to": [
{
"consumer_key_code": "display_brightness_decrement"
}
]
},
{
"from": {
"key_code": "f2"
},
"to": [
{
"consumer_key_code": "display_brightness_increment"
}
]
},
{
"from": {
"key_code": "f3"
},
"to": [
{
"apple_vendor_keyboard_key_code": "mission_control"
}
]
},
{
"from": {
"key_code": "f4"
},
"to": [
{
"apple_vendor_keyboard_key_code": "spotlight"
}
]
},
{
"from": {
"key_code": "f5"
},
"to": [
{
"consumer_key_code": "dictation"
}
]
},
{
"from": {
"key_code": "f6"
},
"to": [
{
"key_code": "f6"
}
]
},
{
"from": {
"key_code": "f7"
},
"to": [
{
"consumer_key_code": "rewind"
}
]
},
{
"from": {
"key_code": "f8"
},
"to": [
{
"consumer_key_code": "play_or_pause"
}
]
},
{
"from": {
"key_code": "f9"
},
"to": [
{
"consumer_key_code": "fast_forward"
}
]
},
{
"from": {
"key_code": "f10"
},
"to": [
{
"consumer_key_code": "mute"
}
]
},
{
"from": {
"key_code": "f11"
},
"to": [
{
"consumer_key_code": "volume_decrement"
}
]
},
{
"from": {
"key_code": "f12"
},
"to": [
{
"consumer_key_code": "volume_increment"
}
]
}
],
"name": "Default profile",
"parameters": {
"delay_milliseconds_before_open_device": 1000
},
"selected": true,
"simple_modifications": [
{
"from": {
"key_code": "caps_lock"
},
"to": [
{
"key_code": "left_control"
}
]
}
],
"virtual_hid_keyboard": {
"country_code": 0,
"indicate_sticky_modifier_keys_state": true,
"mouse_key_xy_scale": 100
}
}
]
}

View file

@ -5,10 +5,11 @@ PLUGIN_DIR="$HOME/.config/sketchybar/plugins"
## bar appearance {{{
sketchybar --bar \
height=32 \
blur_radius=10 \
position=top \
padding_left=0 \
padding_right=4
padding_right=0 \
hidden=on \
topmost=on
# colors are managed seperately in the colordummy,
# which listens to theme_changed events,
@ -70,6 +71,7 @@ sketchybar \
script="$PLUGIN_DIR/clock.sh" \
update_freq=10 \
lazy=true \
background.padding_right=4 \
\
--add alias "Mullvad VPN" right

View file

@ -26,6 +26,7 @@ yabai -m config \
window_border on \
window_border_width 2 \
window_border_blur on \
window_border_radius 0 \
window_opacity on \
window_opacity_duration 0.1 \
normal_window_opacity 1.0 \
@ -33,13 +34,13 @@ yabai -m config \
auto_balance off \
split_ratio 0.50 \
layout bsp \
top_padding 2 \
bottom_padding 2 \
left_padding 2 \
right_padding 2 \
window_gap 2 \
window_animation_duration 0.1 \
external_bar all:32:0
top_padding 0 \
bottom_padding 0 \
left_padding 0 \
right_padding 0 \
window_gap 0 \
window_animation_duration 0.1
# external_bar all:32:0
APPS_ABOVE=(
"JetBrains Toolbox"