Skip to content

click_script of items on brackets doesnt work. #765

@gurg17

Description

@gurg17

I have items that are previously independent,

one of them is this switch input changer:

Keyboard.sh

#!/bin/bash

keyboard=(
	script="$PLUGIN_DIR/keyboard.sh"  
	label.drawing=off                   
	icon.padding_left=1              
	click_script="osascript -e 'tell application \"System Events\" to keystroke \" \" using {control down, option down}'" 
)

sketchybar --add item sensors.keyboard right											\
           --set sensors.keyboard "${keyboard[@]}"										\
		   --add event keyboard_change "AppleSelectedInputSourcesChangedNotification"	\
           --subscribe sensors.keyboard keyboard_change

the click script works before but when i moved it inside a bracket item still work fine except for the clicking:

Sensors.sh

#!/bin/bash

source "$CONFIG_DIR/colors.sh"
source "$ITEM_DIR/divider.sh"

# Array to track sensor scripts (sorted by prefix)
sensor_scripts=()

# Find and sort sensor scripts by their numeric prefix
SENSOR_DIR="$ITEM_DIR/sensors"
for sensor_script in $(find "$SENSOR_DIR" -name "*.sh" -type f | sort -V); do
    if [ -f "$sensor_script" ]; then
        sensor_scripts+=("$sensor_script")
    fi
done

# Source scripts and add dividers in reverse order (since we're adding to right)
total=${#sensor_scripts[@]}
for ((i=total-1; i>=0; i--)); do
    # Source the sensor script
    source "${sensor_scripts[$i]}"
    
    # Add divider after each sensor (except the last one when viewed left-to-right)
    if [ $i -gt 0 ]; then
        add_divider "sensors.divider.$i" right
    fi
done

# Create bracket for all sensor items and dividers using regex pattern
sketchybar --add bracket sensors '/sensors\..*/'

Colemak layout
Image

Qwerty Layout
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions