Uploaded Gio 16 Nov 2023 23:29:39 CET

This commit is contained in:
Federico Rossi 2023-11-16 23:29:39 +01:00
commit 0a6995de56
13 changed files with 2676 additions and 0 deletions

179
.skhdrc Normal file
View File

@ -0,0 +1,179 @@
# ################################################################ #
# THE FOLLOWING IS AN EXPLANATION OF THE GRAMMAR THAT SKHD PARSES. #
# FOR SIMPLE EXAMPLE MAPPINGS LOOK FURTHER DOWN THIS FILE.. #
# ################################################################ #
# A list of all built-in modifier and literal keywords can
# be found at https://github.com/koekeishiya/skhd/issues/1
#
# A hotkey is written according to the following rules:
#
# hotkey = <mode> '<' <action> | <action>
#
# mode = 'name of mode' | <mode> ',' <mode>
#
# action = <keysym> '[' <proc_map_lst> ']' | <keysym> '->' '[' <proc_map_lst> ']'
# <keysym> ':' <command> | <keysym> '->' ':' <command>
# <keysym> ';' <mode> | <keysym> '->' ';' <mode>
#
# keysym = <mod> '-' <key> | <key>
#
# mod = 'modifier keyword' | <mod> '+' <mod>
#
# key = <literal> | <keycode>
#
# literal = 'single letter or built-in keyword'
#
# keycode = 'apple keyboard kVK_<Key> values (0x3C)'
#
# proc_map_lst = * <proc_map>
#
# proc_map = <string> ':' <command> | <string> '~' |
# '*' ':' <command> | '*' '~'
#
# string = '"' 'sequence of characters' '"'
#
# command = command is executed through '$SHELL -c' and
# follows valid shell syntax. if the $SHELL environment
# variable is not set, it will default to '/bin/bash'.
# when bash is used, the ';' delimeter can be specified
# to chain commands.
#
# to allow a command to extend into multiple lines,
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
#
# -> = keypress is not consumed by skhd
#
# * = matches every application not specified in <proc_map_lst>
#
# ~ = application is unbound and keypress is forwarded per usual, when specified in a <proc_map>
#
# A mode is declared according to the following rules:
#
# mode_decl = '::' <name> '@' ':' <command> | '::' <name> ':' <command> |
# '::' <name> '@' | '::' <name>
#
# name = desired name for this mode,
#
# @ = capture keypresses regardless of being bound to an action
#
# command = command is executed through '$SHELL -c' and
# follows valid shell syntax. if the $SHELL environment
# variable is not set, it will default to '/bin/bash'.
# when bash is used, the ';' delimeter can be specified
# to chain commands.
#
# to allow a command to extend into multiple lines,
# prepend '\' at the end of the previous line.
#
# an EOL character signifies the end of the bind.
# ############################################################### #
# THE FOLLOWING SECTION CONTAIN SIMPLE MAPPINGS DEMONSTRATING HOW #
# TO INTERACT WITH THE YABAI WM. THESE ARE SUPPOSED TO BE USED AS #
# A REFERENCE ONLY, WHEN MAKING YOUR OWN CONFIGURATION.. #
# ############################################################### #
# focus window
shift + cmd - left: yabai -m window --focus west
# focus window
shift + cmd - right: yabai -m window --focus east
# focus window
shift + cmd - up: yabai -m window --focus north
# focus window
shift + cmd - down: yabai -m window --focus south
# swap managed window
# shift + alt - h : yabai -m window --swap north
# move managed window
# shift + cmd - h : yabai -m window --warp east
# balance size of windows
shift + alt - 0 : yabai -m space --balance
# make floating window fill screen
shift + alt - up : yabai -m window --grid 1:1:0:0:1:1
# make floating window fill left-half of screen
shift + alt - left : yabai -m window --grid 1:2:0:0:1:1
# create desktop, move window and follow focus - uses jq for parsing json (brew install jq)
# shift + cmd - n : yabai -m space --create && \
# index="$(yabai -m query --spaces --display | jq 'map(select(."is-native-fullscreen" == false))[-1].index')" && \
# yabai -m window --space "${index}" && \
# yabai -m space --focus "${index}"
# fast focus desktop
# cmd + alt - x : yabai -m space --focus recent
# cmd + alt - 1 : yabai -m space --focus 1
# send window to desktop and follow focus
# shift + cmd - z : yabai -m window --space next; yabai -m space --focus next
# shift + cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2
# focus monitor
# ctrl + alt - z : yabai -m display --focus prev
# ctrl + alt - 3 : yabai -m display --focus 3
# send window to monitor and follow focus
# ctrl + cmd - c : yabai -m window --display next; yabai -m display --focus next
# ctrl + cmd - 1 : yabai -m window --display 1; yabai -m display --focus 1
# move floating window
# shift + ctrl - a : yabai -m window --move rel:-20:0
# shift + ctrl - s : yabai -m window --move rel:0:20
# increase window size
shift + alt - a : yabai -m window --resize left:-20:0
shift + alt - l : yabai -m window --resize left:20:0
shift + alt - w : yabai -m window --resize top:0:-20
# decrease window size
# shift + cmd - s : yabai -m window --resize bottom:0:-20
# shift + cmd - w : yabai -m window --resize top:0:20
# set insertion point in focused container
ctrl + alt - h : yabai -m window --insert west
# toggle window zoom
# alt - d : yabai -m window --toggle zoom-parent
alt - f : yabai -m window --toggle zoom-fullscreen
# toggle window split type
# alt - e : yabai -m window --toggle split
# float / unfloat window and center on screen
alt - t : yabai -m window --toggle float --grid 4:4:1:1:2:2
# toggle sticky(+float), picture-in-picture
# alt - p : yabai -m window --toggle sticky --toggle pip
# launch kitty
cmd - return : /Applications/kitty.app/Contents/MacOS/kitty --single-instance -d ~
# restart yabai
shift + cmd - r: yabai --restart-service
# send to next display
cmd + shift - l : yabai -m window --display next; yabai -m display --focus next
# send to next display
cmd + shift - a : yabai -m window --display prev; yabai -m display --focus prev
# Go to next space
ctrl - right : yabai -m space --focus next;
# Go to prev space
ctrl - left : yabai -m space --focus prev;

46
.yabairc Executable file
View File

@ -0,0 +1,46 @@
#!/usr/bin/env sh
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
#
# see this wiki page for information:
# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition
#
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
sudo yabai --load-sa
#
# global settings
yabai -m config \
mouse_follows_focus on \
focus_follows_mouse autoraise \
window_origin_display default \
window_placement second_child \
window_zoom_persist on \
window_shadow off \
window_animation_duration 0.0 \
window_animation_frame_rate 120 \
window_opacity_duration 0.0 \
active_window_opacity 1.0 \
normal_window_opacity 0.90 \
window_opacity off \
insert_feedback_color 0xffd75f5f \
split_ratio 0.50 \
split_type auto \
auto_balance off \
top_padding 5 \
bottom_padding 15 \
left_padding 15 \
right_padding 15 \
window_gap 10 \
layout bsp \
mouse_modifier fn \
mouse_action1 move \
mouse_action2 resize \
mouse_drop_action swap \
yabai -m config external_bar all:32:0
borders active_color=0xff9fa7cf inactive_color=0xff494d64 width=5.0 2>/dev/null 1>&2 &
echo "yabai configuration loaded.."

2010
kitty.conf Normal file

File diff suppressed because it is too large Load Diff

104
sketchybar/#sketchybarrc# Executable file
View File

@ -0,0 +1,104 @@
# This is a demo config to show some of the most important commands more easily.
# This is meant to be changed and configured, as it is intentionally kept sparse.
# For a more advanced configuration example see my dotfiles:
# https://github.com/FelixKratz/dotfiles
CONFIG_DIR="/Users/federico/.config/sketchybar"
PLUGIN_DIR="$CONFIG_DIR/plugins"
##### Bar Appearance #####
# Configuring the general appearance of the bar, these are only some of the
# options available. For all options see:
# https://felixkratz.github.io/SketchyBar/config/bar
# If you are looking for other colors, see the color picker:
# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
sketchybar --bar height=32 \
sticky=off \
padding_left=10 \
padding_right=10 \
color=0x15ffffff
##### Changing Defaults #####
# We now change some default values that are applied to all further items
# For a full list of all available item properties see:
# https://felixkratz.github.io/SketchyBar/config/items
sketchybar --default icon.font="Hack Nerd Font:Bold:17.0" \
icon.color=0xffffffff \
label.font="Hack Nerd Font:Bold:14.0" \
label.color=0xffffffff \
padding_left=5 \
padding_right=5 \
label.padding_left=4 \
label.padding_right=4 \
icon.padding_left=4 \
icon.padding_right=4
##### Adding Mission Control Space Indicators #####
# Now we add some mission control spaces:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
# to indicate active and available mission control spaces
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}"
do
sid=$(($i+1))
sketchybar --add space space.$sid left \
--set space.$sid space=$sid \
icon=${SPACE_ICONS[i]} \
background.color=0x44ffffff \
background.corner_radius=5 \
background.height=20 \
background.drawing=off \
label.drawing=off \
script="$PLUGIN_DIR/space.sh" \
click_script="yabai -m space --focus $sid"
done
##### Adding Left Items #####
# We add some regular items to the left side of the bar
# only the properties deviating from the current defaults need to be set
sketchybar --add item space_separator left \
--set space_separator icon= \
padding_left=10 \
padding_right=10 \
label.drawing=off \
\
--add item front_app left \
--set front_app script="$PLUGIN_DIR/front_app.sh" \
icon.drawing=off \
--subscribe front_app front_app_switched
##### Adding Right Items #####
# In the same way as the left items we can add items to the right side.
# Additional position (e.g. center) are available, see:
# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
# Some items refresh on a fixed cycle, e.g. the clock runs its script once
# every 10s. Other items respond to events they subscribe to, e.g. the
# volume.sh script is only executed once an actual change in system audio
# volume is registered. More info about the event system can be found here:
# https://felixkratz.github.io/SketchyBar/config/events
sketchybar --add item clock right \
--set clock update_freq=10 \
icon= \
script="$PLUGIN_DIR/clock.sh" \
\
--add item volume right \
--set volume script="$PLUGIN_DIR/volume.sh" \
--subscribe volume volume_change \
\
--add item battery right \
--set battery script="$PLUGIN_DIR/battery.sh" \
update_freq=120 \
--subscribe battery system_woke power_source_change
##### Finalizing Setup #####
# The below command is only needed at the end of the initial configuration to
# force all scripts to run the first time, it should never be run in an item script.
sketchybar --update

View File

@ -0,0 +1,28 @@
#!/bin/sh
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
CHARGING=$(pmset -g batt | grep 'AC Power')
if [ $PERCENTAGE = "" ]; then
exit 0
fi
case ${PERCENTAGE} in
9[0-9]|100) ICON=""
;;
[6-8][0-9]) ICON=""
;;
[3-5][0-9]) ICON=""
;;
[1-2][0-9]) ICON=""
;;
*) ICON=""
esac
if [[ $CHARGING != "" ]]; then
ICON=""
fi
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set $NAME icon="$ICON" label="${PERCENTAGE}%"

28
sketchybar/plugins/battery.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
CHARGING=$(pmset -g batt | grep 'AC Power')
if [ $PERCENTAGE = "" ]; then
exit 0
fi
case ${PERCENTAGE} in
9[0-9]|100) ICON=""
;;
[6-8][0-9]) ICON=""
;;
[3-5][0-9]) ICON=""
;;
[1-2][0-9]) ICON=""
;;
*) ICON=""
esac
if [[ $CHARGING != "" ]]; then
ICON=""
fi
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set $NAME icon="$ICON" label="${PERCENTAGE}%"

8
sketchybar/plugins/clock.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
# The $NAME variable is passed from sketchybar and holds the name of
# the item invoking this script:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
sketchybar --set $NAME label="$(date '+%d/%m %H:%M')"

10
sketchybar/plugins/front_app.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Some events send additional information specific to the event in the $INFO
# variable. E.g. the front_app_switched event sends the name of the newly
# focused application in the $INFO variable:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
if [ "$SENDER" = "front_app_switched" ]; then
sketchybar --set $NAME label="$INFO"
fi

7
sketchybar/plugins/space.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# The $SELECTED variable is available for space components and indicates if
# the space invoking this script (with name: $NAME) is currently selected:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
sketchybar --set $NAME background.drawing=$SELECTED

View File

@ -0,0 +1,28 @@
#!/bin/sh
PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)
CHARGING=$(pmset -g batt | grep 'AC Power')
if [ $PERCENTAGE = "" ]; then
exit 0
fi
case ${PERCENTAGE} in
9[0-9]|100) ICON=""
;;
[6-8][0-9]) ICON=""
;;
[3-5][0-9]) ICON=""
;;
[1-2][0-9]) ICON=""
;;
*) ICON=""
esac
if [[ $CHARGING != "" ]]; then
ICON=""
fi
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set $NAME icon="$ICON" label="${PERCENTAGE}%"

20
sketchybar/plugins/volume.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# The volume_change event supplies a $INFO variable in which the current volume
# percentage is passed to the script.
if [ "$SENDER" = "volume_change" ]; then
VOLUME=$INFO
case $VOLUME in
[6-9][0-9]|100) ICON="󰕾"
;;
[3-5][0-9]) ICON="󰖀"
;;
[1-9]|[1-2][0-9]) ICON="󰕿"
;;
*) ICON="󰖁"
esac
sketchybar --set $NAME icon="$ICON" label="$VOLUME%"
fi

104
sketchybar/sketchybarrc Executable file
View File

@ -0,0 +1,104 @@
# This is a demo config to show some of the most important commands more easily.
# This is meant to be changed and configured, as it is intentionally kept sparse.
# For a more advanced configuration example see my dotfiles:
# https://github.com/FelixKratz/dotfiles
CONFIG_DIR="/Users/federico/.config/sketchybar"
PLUGIN_DIR="$CONFIG_DIR/plugins"
##### Bar Appearance #####
# Configuring the general appearance of the bar, these are only some of the
# options available. For all options see:
# https://felixkratz.github.io/SketchyBar/config/bar
# If you are looking for other colors, see the color picker:
# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
sketchybar --bar height=28 \
position=top \
sticky=off \
padding_left=10 \
padding_right=10 \
color=0x15ffffff
##### Changing Defaults #####
# We now change some default values that are applied to all further items
# For a full list of all available item properties see:
# https://felixkratz.github.io/SketchyBar/config/items
sketchybar --default icon.font="Hack Nerd Font:Bold:17.0" \
icon.color=0xffffffff \
label.font="Hack Nerd Font:Bold:14.0" \
label.color=0xffffffff \
padding_left=5 \
padding_right=5 \
label.padding_left=4 \
label.padding_right=4 \
icon.padding_left=4 \
icon.padding_right=4
##### Adding Mission Control Space Indicators #####
# Now we add some mission control spaces:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
# to indicate active and available mission control spaces
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}"
do
sid=$(($i+1))
sketchybar --add space space.$sid left \
--set space.$sid space=$sid \
icon=${SPACE_ICONS[i]} \
background.color=0x44ffffff \
background.corner_radius=5 \
background.height=20 \
background.drawing=off \
label.drawing=off \
script="$PLUGIN_DIR/space.sh" \
click_script="yabai -m space --focus $sid"
done
##### Adding Left Items #####
# We add some regular items to the left side of the bar
# only the properties deviating from the current defaults need to be set
sketchybar --add item space_separator left \
--set space_separator icon= \
padding_left=10 \
padding_right=10 \
label.drawing=off \
\
--add item front_app left \
--set front_app script="$PLUGIN_DIR/front_app.sh" \
icon.drawing=off \
--subscribe front_app front_app_switched
##### Adding Right Items #####
# In the same way as the left items we can add items to the right side.
# Additional position (e.g. center) are available, see:
# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
# Some items refresh on a fixed cycle, e.g. the clock runs its script once
# every 10s. Other items respond to events they subscribe to, e.g. the
# volume.sh script is only executed once an actual change in system audio
# volume is registered. More info about the event system can be found here:
# https://felixkratz.github.io/SketchyBar/config/events
sketchybar --add item clock right \
--set clock update_freq=10 \
icon= \
script="$PLUGIN_DIR/clock.sh" \
\
--add item volume right \
--set volume script="$PLUGIN_DIR/volume.sh" \
--subscribe volume volume_change \
\
--add item battery right \
--set battery script="$PLUGIN_DIR/battery.sh" \
update_freq=120 \
--subscribe battery system_woke power_source_change
##### Finalizing Setup #####
# The below command is only needed at the end of the initial configuration to
# force all scripts to run the first time, it should never be run in an item script.
sketchybar --update

104
sketchybar/sketchybarrc~ Executable file
View File

@ -0,0 +1,104 @@
# This is a demo config to show some of the most important commands more easily.
# This is meant to be changed and configured, as it is intentionally kept sparse.
# For a more advanced configuration example see my dotfiles:
# https://github.com/FelixKratz/dotfiles
CONFIG_DIR="/Users/federico/.config/sketchybar"
PLUGIN_DIR="$CONFIG_DIR/plugins"
##### Bar Appearance #####
# Configuring the general appearance of the bar, these are only some of the
# options available. For all options see:
# https://felixkratz.github.io/SketchyBar/config/bar
# If you are looking for other colors, see the color picker:
# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker
sketchybar --bar height=32 \
position=top \
sticky=off \
padding_left=10 \
padding_right=10 \
color=0x15ffffff
##### Changing Defaults #####
# We now change some default values that are applied to all further items
# For a full list of all available item properties see:
# https://felixkratz.github.io/SketchyBar/config/items
sketchybar --default icon.font="Hack Nerd Font:Bold:17.0" \
icon.color=0xffffffff \
label.font="Hack Nerd Font:Bold:14.0" \
label.color=0xffffffff \
padding_left=5 \
padding_right=5 \
label.padding_left=4 \
label.padding_right=4 \
icon.padding_left=4 \
icon.padding_right=4
##### Adding Mission Control Space Indicators #####
# Now we add some mission control spaces:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
# to indicate active and available mission control spaces
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}"
do
sid=$(($i+1))
sketchybar --add space space.$sid left \
--set space.$sid space=$sid \
icon=${SPACE_ICONS[i]} \
background.color=0x44ffffff \
background.corner_radius=5 \
background.height=20 \
background.drawing=off \
label.drawing=off \
script="$PLUGIN_DIR/space.sh" \
click_script="yabai -m space --focus $sid"
done
##### Adding Left Items #####
# We add some regular items to the left side of the bar
# only the properties deviating from the current defaults need to be set
sketchybar --add item space_separator left \
--set space_separator icon= \
padding_left=10 \
padding_right=10 \
label.drawing=off \
\
--add item front_app left \
--set front_app script="$PLUGIN_DIR/front_app.sh" \
icon.drawing=off \
--subscribe front_app front_app_switched
##### Adding Right Items #####
# In the same way as the left items we can add items to the right side.
# Additional position (e.g. center) are available, see:
# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar
# Some items refresh on a fixed cycle, e.g. the clock runs its script once
# every 10s. Other items respond to events they subscribe to, e.g. the
# volume.sh script is only executed once an actual change in system audio
# volume is registered. More info about the event system can be found here:
# https://felixkratz.github.io/SketchyBar/config/events
sketchybar --add item clock right \
--set clock update_freq=10 \
icon= \
script="$PLUGIN_DIR/clock.sh" \
\
--add item volume right \
--set volume script="$PLUGIN_DIR/volume.sh" \
--subscribe volume volume_change \
\
--add item battery right \
--set battery script="$PLUGIN_DIR/battery.sh" \
update_freq=120 \
--subscribe battery system_woke power_source_change
##### Finalizing Setup #####
# The below command is only needed at the end of the initial configuration to
# force all scripts to run the first time, it should never be run in an item script.
sketchybar --update