| ... | @@ -1,5 +1,6 @@ | ... | @@ -1,5 +1,6 @@ |
| 1 | { | 1 | { |
| 2 | pkgs, | 2 | pkgs, |
| | 3 | lib, |
| 3 | config, | 4 | config, |
| 4 | ... | 5 | ... |
| 5 | }: let | 6 | }: let |
| ... | @@ -7,393 +8,396 @@ | ... | @@ -7,393 +8,396 @@ |
| 7 | # folder = "~/.dotfiles/files/sketchybar"; | 8 | # folder = "~/.dotfiles/files/sketchybar"; |
| 8 | folder = ../../../files/sketchybar; | 9 | folder = ../../../files/sketchybar; |
| 9 | in { | 10 | in { |
| 10 | home.file = { | 11 | home.file = |
| 11 | sketchybarrc = { | 12 | lib.attrsets.mapAttrs (file: value: ( |
| 12 | executable = true; | 13 | lib.attrsets.overrideExisting value {enable = config.shared.darwin.tiling.enable;} |
| 13 | target = ".config/sketchybar/sketchybarrc"; | 14 | )) { |
| 14 | text = '' | 15 | sketchybarrc = { |
| 15 | #!/usr/bin/env sh | 16 | executable = true; |
| | 17 | target = ".config/sketchybar/sketchybarrc"; |
| | 18 | text = '' |
| | 19 | #!/usr/bin/env sh |
| 16 | | 20 | |
| 17 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | 21 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors |
| 18 | source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons | 22 | source "$HOME/.config/sketchybar/icons.sh" # Loads all defined icons |
| 19 | | 23 | |
| 20 | ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured | 24 | ITEM_DIR="$HOME/.config/sketchybar/items" # Directory where the items are configured |
| 21 | PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored | 25 | PLUGIN_DIR="$HOME/.config/sketchybar/plugins" # Directory where all the plugin scripts are stored |
| 22 | | 26 | |
| 23 | FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants | 27 | FONT="SF Pro" # Needs to have Regular, Bold, Semibold, Heavy and Black variants |
| 24 | PADDINGS=3 # All paddings use this value (icon, label, background) | 28 | PADDINGS=3 # All paddings use this value (icon, label, background) |
| 25 | | 29 | |
| 26 | # Setting up and starting the helper process | 30 | # Setting up and starting the helper process |
| 27 | HELPER=git.felix.helper | 31 | HELPER=git.felix.helper |
| 28 | killall helper | 32 | killall helper |
| 29 | cd $HOME/.config/sketchybar/helper && make | 33 | cd $HOME/.config/sketchybar/helper && make |
| 30 | $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 & | 34 | $HOME/.config/sketchybar/helper/helper $HELPER > /dev/null 2>&1 & |
| 31 | | 35 | |
| 32 | # Unload the macOS on screen indicator overlay for volume change | 36 | # Unload the macOS on screen indicator overlay for volume change |
| 33 | # launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 & | 37 | # launchctl unload -F /System/Library/LaunchAgents/com.apple.OSDUIHelper.plist > /dev/null 2>&1 & |
| 34 | | 38 | |
| 35 | # Setting up the general bar appearance and default values | 39 | # Setting up the general bar appearance and default values |
| 36 | ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \ | 40 | ${pkgs.sketchybar}/bin/sketchybar --bar height=40 \ |
| 37 | color=$BAR_COLOR \ | 41 | color=$BAR_COLOR \ |
| 38 | shadow=off \ | 42 | shadow=off \ |
| 39 | position=top \ | 43 | position=top \ |
| 40 | sticky=on \ | 44 | sticky=on \ |
| 41 | padding_right=0 \ | 45 | padding_right=0 \ |
| 42 | padding_left=0 \ | 46 | padding_left=0 \ |
| 43 | corner_radius=12 \ | 47 | corner_radius=12 \ |
| 44 | y_offset=0 \ | 48 | y_offset=0 \ |
| 45 | margin=2 \ | 49 | margin=2 \ |
| 46 | blur_radius=0 \ | 50 | blur_radius=0 \ |
| 47 | notch_width=0 \ | 51 | notch_width=0 \ |
| 48 | --default updates=when_shown \ | 52 | --default updates=when_shown \ |
| 49 | icon.font="$FONT:Bold:14.0" \ | 53 | icon.font="$FONT:Bold:14.0" \ |
| 50 | icon.color=$ICON_COLOR \ | 54 | icon.color=$ICON_COLOR \ |
| 51 | icon.padding_left=$PADDINGS \ | 55 | icon.padding_left=$PADDINGS \ |
| 52 | icon.padding_right=$PADDINGS \ | 56 | icon.padding_right=$PADDINGS \ |
| 53 | label.font="$FONT:Semibold:13.0" \ | 57 | label.font="$FONT:Semibold:13.0" \ |
| 54 | label.color=$LABEL_COLOR \ | 58 | label.color=$LABEL_COLOR \ |
| 55 | label.padding_left=$PADDINGS \ | 59 | label.padding_left=$PADDINGS \ |
| 56 | label.padding_right=$PADDINGS \ | 60 | label.padding_right=$PADDINGS \ |
| 57 | background.padding_right=$PADDINGS \ | 61 | background.padding_right=$PADDINGS \ |
| 58 | background.padding_left=$PADDINGS \ | 62 | background.padding_left=$PADDINGS \ |
| 59 | background.height=26 \ | 63 | background.height=26 \ |
| 60 | background.corner_radius=9 \ | 64 | background.corner_radius=9 \ |
| 61 | popup.background.border_width=2 \ | 65 | popup.background.border_width=2 \ |
| 62 | popup.background.corner_radius=11 \ | 66 | popup.background.corner_radius=11 \ |
| 63 | popup.background.border_color=$POPUP_BORDER_COLOR \ | 67 | popup.background.border_color=$POPUP_BORDER_COLOR \ |
| 64 | popup.background.color=$POPUP_BACKGROUND_COLOR \ | 68 | popup.background.color=$POPUP_BACKGROUND_COLOR \ |
| 65 | popup.background.shadow.drawing=on | 69 | popup.background.shadow.drawing=on |
| 66 | | 70 | |
| 67 | # Left | 71 | # Left |
| 68 | source "$ITEM_DIR/apple.sh" | 72 | source "$ITEM_DIR/apple.sh" |
| 69 | source "$ITEM_DIR/spaces.sh" | 73 | source "$ITEM_DIR/spaces.sh" |
| 70 | source "$ITEM_DIR/front_app.sh" | 74 | source "$ITEM_DIR/front_app.sh" |
| 71 | | 75 | |
| 72 | # Center | 76 | # Center |
| 73 | # source "$ITEM_DIR/spotify.sh" | 77 | # source "$ITEM_DIR/spotify.sh" |
| 74 | source "$ITEM_DIR/calendar.sh" | 78 | source "$ITEM_DIR/calendar.sh" |
| 75 | | 79 | |
| 76 | # Right | 80 | # Right |
| 77 | # source "$ITEM_DIR/brew.sh" | 81 | # source "$ITEM_DIR/brew.sh" |
| 78 | # source "$ITEM_DIR/github.sh" | 82 | # source "$ITEM_DIR/github.sh" |
| 79 | source "$ITEM_DIR/volume.sh" | 83 | source "$ITEM_DIR/volume.sh" |
| 80 | # source "$ITEM_DIR/divider.sh" | 84 | # source "$ITEM_DIR/divider.sh" |
| 81 | # source "$ITEM_DIR/cpu.sh" | 85 | # source "$ITEM_DIR/cpu.sh" |
| 82 | | 86 | |
| 83 | # Forcing all item scripts to run (never do this outside of sketchybarrc) | 87 | # Forcing all item scripts to run (never do this outside of sketchybarrc) |
| 84 | ${pkgs.sketchybar}/bin/sketchybar --update | 88 | ${pkgs.sketchybar}/bin/sketchybar --update |
| 85 | | 89 | |
| 86 | echo "sketchybar configuation loaded.." | 90 | echo "sketchybar configuation loaded.." |
| 87 | ''; | 91 | ''; |
| 88 | }; | 92 | }; |
| 89 | icons = { | 93 | icons = { |
| 90 | executable = true; | 94 | executable = true; |
| 91 | target = ".config/sketchybar/icons.sh"; | 95 | target = ".config/sketchybar/icons.sh"; |
| 92 | source = folder + /icons.sh; | 96 | source = folder + /icons.sh; |
| 93 | }; | 97 | }; |
| 94 | colors = { | 98 | colors = { |
| 95 | executable = true; | 99 | executable = true; |
| 96 | target = ".config/sketchybar/colors.sh"; | 100 | target = ".config/sketchybar/colors.sh"; |
| 97 | text = '' | 101 | text = '' |
| 98 | #!/usr/bin/env sh | 102 | #!/usr/bin/env sh |
| 99 | # Color Palette | 103 | # Color Palette |
| 100 | export BLACK=0xff4c4f69 | 104 | export BLACK=0xff4c4f69 |
| 101 | export WHITE=0xffeff1f5 | 105 | export WHITE=0xffeff1f5 |
| 102 | export RED=0xffd20f39 | 106 | export RED=0xffd20f39 |
| 103 | export GREEN=0xff40a02b | 107 | export GREEN=0xff40a02b |
| 104 | export BLUE=0xff1e66f5 | 108 | export BLUE=0xff1e66f5 |
| 105 | export YELLOW=0xffdf8e1d | 109 | export YELLOW=0xffdf8e1d |
| 106 | export ORANGE=0xfffe640b | 110 | export ORANGE=0xfffe640b |
| 107 | export MAGENTA=0xffea76cb | 111 | export MAGENTA=0xffea76cb |
| 108 | export GREY=0xff9ca0b0 | 112 | export GREY=0xff9ca0b0 |
| 109 | export TRANSPARENT=0xff000000 | 113 | export TRANSPARENT=0xff000000 |
| 110 | export BLUE2=0xff7287fd | 114 | export BLUE2=0xff7287fd |
| 111 | export FLAMINGO=0xffdd7878 | 115 | export FLAMINGO=0xffdd7878 |
| 112 | | 116 | |
| 113 | # General bar colors | 117 | # General bar colors |
| 114 | export BAR_COLOR=0xeff1f5ff # Color of the bar | 118 | export BAR_COLOR=0xeff1f5ff # Color of the bar |
| 115 | export ICON_COLOR=0xff4c4f69 | 119 | export ICON_COLOR=0xff4c4f69 |
| 116 | export LABEL_COLOR=0xff4c4f69 # Color of all labels | 120 | export LABEL_COLOR=0xff4c4f69 # Color of all labels |
| 117 | export BACKGROUND_1=0xffbcc0cc | 121 | export BACKGROUND_1=0xffbcc0cc |
| 118 | export BACKGROUND_2=0xffbcc0cc | 122 | export BACKGROUND_2=0xffbcc0cc |
| 119 | | 123 | |
| 120 | export POPUP_BACKGROUND_COLOR=$BLACK | 124 | export POPUP_BACKGROUND_COLOR=$BLACK |
| 121 | export POPUP_BORDER_COLOR=$WHITE | 125 | export POPUP_BORDER_COLOR=$WHITE |
| 122 | | 126 | |
| 123 | export SHADOW_COLOR=$BLACK | 127 | export SHADOW_COLOR=$BLACK |
| 124 | ''; | 128 | ''; |
| 125 | }; | 129 | }; |
| 126 | items_apple = { | 130 | items_apple = { |
| 127 | executable = true; | 131 | executable = true; |
| 128 | target = ".config/sketchybar/items/apple.sh"; | 132 | target = ".config/sketchybar/items/apple.sh"; |
| 129 | source = folder + /items/executable_apple.sh; | 133 | source = folder + /items/executable_apple.sh; |
| 130 | }; | 134 | }; |
| 131 | items_brew = { | 135 | items_brew = { |
| 132 | executable = true; | 136 | executable = true; |
| 133 | target = ".config/sketchybar/items/brew.sh"; | 137 | target = ".config/sketchybar/items/brew.sh"; |
| 134 | source = folder + /items/executable_brew.sh; | 138 | source = folder + /items/executable_brew.sh; |
| 135 | }; | 139 | }; |
| 136 | items_calendar = { | 140 | items_calendar = { |
| 137 | executable = true; | 141 | executable = true; |
| 138 | target = ".config/sketchybar/items/calendar.sh"; | 142 | target = ".config/sketchybar/items/calendar.sh"; |
| 139 | text = '' | 143 | text = '' |
| 140 | #!/usr/bin/env sh | 144 | #!/usr/bin/env sh |
| 141 | | 145 | |
| 142 | sketchybar --add item calendar center \ | 146 | sketchybar --add item calendar center \ |
| 143 | --set calendar icon=cal \ | 147 | --set calendar icon=cal \ |
| 144 | display=1 \ | 148 | display=1 \ |
| 145 | icon.font="$FONT:Black:12.0" \ | 149 | icon.font="$FONT:Black:12.0" \ |
| 146 | icon.padding_right=0 \ | 150 | icon.padding_right=0 \ |
| 147 | label.width=50 \ | 151 | label.width=50 \ |
| 148 | label.align=right \ | 152 | label.align=right \ |
| 149 | background.padding_left=15 \ | 153 | background.padding_left=15 \ |
| 150 | update_freq=30 \ | 154 | update_freq=30 \ |
| 151 | script="$PLUGIN_DIR/calendar.sh" \ | 155 | script="$PLUGIN_DIR/calendar.sh" \ |
| 152 | click_script="$PLUGIN_DIR/zen.sh" | 156 | click_script="$PLUGIN_DIR/zen.sh" |
| 153 | ''; | 157 | ''; |
| 154 | }; | 158 | }; |
| 155 | items_cpu = { | 159 | items_cpu = { |
| 156 | executable = true; | 160 | executable = true; |
| 157 | target = ".config/sketchybar/items/cpu.sh"; | 161 | target = ".config/sketchybar/items/cpu.sh"; |
| 158 | source = folder + /items/executable_cpu.sh; | 162 | source = folder + /items/executable_cpu.sh; |
| 159 | }; | 163 | }; |
| 160 | items_divider = { | 164 | items_divider = { |
| 161 | executable = true; | 165 | executable = true; |
| 162 | target = ".config/sketchybar/items/divider.sh"; | 166 | target = ".config/sketchybar/items/divider.sh"; |
| 163 | source = folder + /items/executable_divider.sh; | 167 | source = folder + /items/executable_divider.sh; |
| 164 | }; | 168 | }; |
| 165 | items_front_app = { | 169 | items_front_app = { |
| 166 | executable = true; | 170 | executable = true; |
| 167 | target = ".config/sketchybar/items/front_app.sh"; | 171 | target = ".config/sketchybar/items/front_app.sh"; |
| 168 | text = '' | 172 | text = '' |
| 169 | #!/usr/bin/env sh | 173 | #!/usr/bin/env sh |
| 170 | FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"' | 174 | FRONT_APP_SCRIPT='sketchybar --set $NAME label="$INFO"' |
| 171 | sketchybar --add event window_focus \ | 175 | sketchybar --add event window_focus \ |
| 172 | --add event windows_on_spaces \ | 176 | --add event windows_on_spaces \ |
| 173 | --add item system.aerospace left \ | 177 | --add item system.aerospace left \ |
| 174 | --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \ | 178 | --set system.aerospace script="$PLUGIN_DIR/aerospace.sh" \ |
| 175 | icon.font="$FONT:Bold:16.0" \ | 179 | icon.font="$FONT:Bold:16.0" \ |
| 176 | label.drawing=off \ | 180 | label.drawing=off \ |
| 177 | icon.width=30 \ | 181 | icon.width=30 \ |
| 178 | icon=$YABAI_GRID \ | 182 | icon=$YABAI_GRID \ |
| 179 | icon.color=$BLACK \ | 183 | icon.color=$BLACK \ |
| 180 | updates=on \ | 184 | updates=on \ |
| 181 | display=active \ | 185 | display=active \ |
| 182 | --subscribe system.aerospace window_focus \ | 186 | --subscribe system.aerospace window_focus \ |
| 183 | windows_on_spaces \ | 187 | windows_on_spaces \ |
| 184 | mouse.clicked \ | 188 | mouse.clicked \ |
| 185 | --add item front_app left \ | 189 | --add item front_app left \ |
| 186 | --set front_app script="$FRONT_APP_SCRIPT" \ | 190 | --set front_app script="$FRONT_APP_SCRIPT" \ |
| 187 | icon.drawing=off \ | 191 | icon.drawing=off \ |
| 188 | background.padding_left=0 \ | 192 | background.padding_left=0 \ |
| 189 | background.padding_right=10 \ | 193 | background.padding_right=10 \ |
| 190 | label.color=$BLACK \ | 194 | label.color=$BLACK \ |
| 191 | label.font="$FONT:Black:12.0" \ | 195 | label.font="$FONT:Black:12.0" \ |
| 192 | display=active \ | 196 | display=active \ |
| 193 | --subscribe front_app front_app_switched | 197 | --subscribe front_app front_app_switched |
| 194 | ''; | 198 | ''; |
| 195 | }; | 199 | }; |
| 196 | items_github = { | 200 | items_github = { |
| 197 | executable = true; | 201 | executable = true; |
| 198 | target = ".config/sketchybar/items/github.sh"; | 202 | target = ".config/sketchybar/items/github.sh"; |
| 199 | source = folder + /items/executable_github.sh; | 203 | source = folder + /items/executable_github.sh; |
| 200 | }; | 204 | }; |
| 201 | items_spaces = { | 205 | items_spaces = { |
| 202 | executable = true; | 206 | executable = true; |
| 203 | target = ".config/sketchybar/items/spaces.sh"; | 207 | target = ".config/sketchybar/items/spaces.sh"; |
| 204 | # label.background.color=$BACKGROUND_2 | 208 | # label.background.color=$BACKGROUND_2 |
| 205 | text = '' | 209 | text = '' |
| 206 | ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change | 210 | ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_workspace_change |
| 207 | ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change | 211 | ${pkgs.sketchybar}/bin/sketchybar --add event aerospace_mode_change |
| 208 | for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do | 212 | for sid in $(${pkgs.aerospace}/bin/aerospace list-workspaces --all); do |
| 209 | ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \ | 213 | ${pkgs.sketchybar}/bin/sketchybar --add item space.$sid left \ |
| 210 | --subscribe space.$sid aerospace_workspace_change \ | 214 | --subscribe space.$sid aerospace_workspace_change \ |
| 211 | --subscribe space.$sid aerospace_mode_change \ | 215 | --subscribe space.$sid aerospace_mode_change \ |
| 212 | --set space.$sid \ | 216 | --set space.$sid \ |
| 213 | icon=$sid \ | 217 | icon=$sid \ |
| 214 | icon.padding_left=22 \ | 218 | icon.padding_left=22 \ |
| 215 | icon.padding_right=22 \ | 219 | icon.padding_right=22 \ |
| 216 | icon.highlight_color=$WHITE \ | 220 | icon.highlight_color=$WHITE \ |
| 217 | icon.highlight=off \ | 221 | icon.highlight=off \ |
| 218 | icon.color=0xff4c566a \ | 222 | icon.color=0xff4c566a \ |
| 219 | background.padding_left=-8 \ | 223 | background.padding_left=-8 \ |
| 220 | background.padding_right=-8 \ | 224 | background.padding_right=-8 \ |
| 221 | background.color=$BACKGROUND_1 \ | 225 | background.color=$BACKGROUND_1 \ |
| 222 | background.drawing=on \ | 226 | background.drawing=on \ |
| 223 | script="$PLUGIN_DIR/aerospace.sh $sid" \ | 227 | script="$PLUGIN_DIR/aerospace.sh $sid" \ |
| 224 | click_script="aerospace workspace $sid" \ | 228 | click_script="aerospace workspace $sid" \ |
| 225 | label.font="Iosevka Nerd Font:Regular:16.0" \ | 229 | label.font="Iosevka Nerd Font:Regular:16.0" \ |
| 226 | label.padding_right=33 \ | 230 | label.padding_right=33 \ |
| 227 | label.background.height=26 \ | 231 | label.background.height=26 \ |
| 228 | label.background.drawing=on \ | 232 | label.background.drawing=on \ |
| 229 | label.background.corner_radius=9 \ | 233 | label.background.corner_radius=9 \ |
| 230 | label.drawing=off | 234 | label.drawing=off |
| 231 | done | 235 | done |
| 232 | ${pkgs.sketchybar}/bin/sketchybar --add item separator left \ | 236 | ${pkgs.sketchybar}/bin/sketchybar --add item separator left \ |
| 233 | --set separator icon= \ | 237 | --set separator icon= \ |
| 234 | icon.font="Iosevka Nerd Font:Regular:16.0" \ | 238 | icon.font="Iosevka Nerd Font:Regular:16.0" \ |
| 235 | background.padding_left=26 \ | 239 | background.padding_left=26 \ |
| 236 | background.padding_right=15 \ | 240 | background.padding_right=15 \ |
| 237 | label.drawing=off \ | 241 | label.drawing=off \ |
| 238 | display=active \ | 242 | display=active \ |
| 239 | icon.color=$GREEN | 243 | icon.color=$GREEN |
| 240 | ''; | 244 | ''; |
| 241 | }; | 245 | }; |
| 242 | items_spotify = { | 246 | items_spotify = { |
| 243 | executable = true; | 247 | executable = true; |
| 244 | target = ".config/sketchybar/items/spotify.sh"; | 248 | target = ".config/sketchybar/items/spotify.sh"; |
| 245 | source = folder + /items/executable_spotify.sh; | 249 | source = folder + /items/executable_spotify.sh; |
| 246 | }; | 250 | }; |
| 247 | items_volume = { | 251 | items_volume = { |
| 248 | executable = true; | 252 | executable = true; |
| 249 | target = ".config/sketchybar/items/volume.sh"; | 253 | target = ".config/sketchybar/items/volume.sh"; |
| 250 | text = '' | 254 | text = '' |
| 251 | INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)') | 255 | INITIAL_WIDTH=$(osascript -e 'set ovol to output volume of (get volume settings)') |
| 252 | ${pkgs.sketchybar}/bin/sketchybar --add item volume right \ | 256 | ${pkgs.sketchybar}/bin/sketchybar --add item volume right \ |
| 253 | --subscribe volume volume_change \ | 257 | --subscribe volume volume_change \ |
| 254 | --set volume script="$PLUGIN_DIR/volume.sh" \ | 258 | --set volume script="$PLUGIN_DIR/volume.sh" \ |
| 255 | updates=on \ | 259 | updates=on \ |
| 256 | icon.background.drawing=on \ | 260 | icon.background.drawing=on \ |
| 257 | icon.background.color=$FLAMINGO \ | 261 | icon.background.color=$FLAMINGO \ |
| 258 | icon.background.height=8 \ | 262 | icon.background.height=8 \ |
| 259 | icon.background.corner_radius=3 \ | 263 | icon.background.corner_radius=3 \ |
| 260 | icon.width=$INITIAL_WIDTH \ | 264 | icon.width=$INITIAL_WIDTH \ |
| 261 | width=100 \ | 265 | width=100 \ |
| 262 | icon.align=right \ | 266 | icon.align=right \ |
| 263 | label.drawing=off \ | 267 | label.drawing=off \ |
| 264 | background.drawing=on \ | 268 | background.drawing=on \ |
| 265 | background.color=$BACKGROUND_2 \ | 269 | background.color=$BACKGROUND_2 \ |
| 266 | background.height=8 \ | 270 | background.height=8 \ |
| 267 | background.corner_radius=3 \ | 271 | background.corner_radius=3 \ |
| 268 | align=left | 272 | align=left |
| 269 | | 273 | |
| 270 | ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \ | 274 | ${pkgs.sketchybar}/bin/sketchybar --add alias "Control Center,Sound" right \ |
| 271 | --rename "Control Center,Sound" volume_alias \ | 275 | --rename "Control Center,Sound" volume_alias \ |
| 272 | --set volume_alias icon.drawing=off \ | 276 | --set volume_alias icon.drawing=off \ |
| 273 | label.drawing=off \ | 277 | label.drawing=off \ |
| 274 | alias.color=$BLUE2 \ | 278 | alias.color=$BLUE2 \ |
| 275 | background.padding_right=0 \ | 279 | background.padding_right=0 \ |
| 276 | background.padding_left=5 \ | 280 | background.padding_left=5 \ |
| 277 | width=50 \ | 281 | width=50 \ |
| 278 | align=right \ | 282 | align=right \ |
| 279 | click_script="$PLUGIN_DIR/volume_click.sh" | 283 | click_script="$PLUGIN_DIR/volume_click.sh" |
| 280 | | 284 | |
| 281 | ''; | 285 | ''; |
| 282 | }; | 286 | }; |
| 283 | plugins_brew = { | 287 | plugins_brew = { |
| 284 | executable = true; | 288 | executable = true; |
| 285 | target = ".config/sketchybar/plugins/brew.sh"; | 289 | target = ".config/sketchybar/plugins/brew.sh"; |
| 286 | source = folder + /plugins/executable_brew.sh; | 290 | source = folder + /plugins/executable_brew.sh; |
| 287 | }; | 291 | }; |
| 288 | plugins_calendar = { | 292 | plugins_calendar = { |
| 289 | executable = true; | 293 | executable = true; |
| 290 | target = ".config/sketchybar/plugins/calendar.sh"; | 294 | target = ".config/sketchybar/plugins/calendar.sh"; |
| 291 | source = folder + /plugins/executable_calendar.sh; | 295 | source = folder + /plugins/executable_calendar.sh; |
| 292 | }; | 296 | }; |
| 293 | plugins_github = { | 297 | plugins_github = { |
| 294 | executable = true; | 298 | executable = true; |
| 295 | target = ".config/sketchybar/plugins/github.sh"; | 299 | target = ".config/sketchybar/plugins/github.sh"; |
| 296 | source = folder + /plugins/executable_github.sh; | 300 | source = folder + /plugins/executable_github.sh; |
| 297 | }; | 301 | }; |
| 298 | plugins_icon_map = { | 302 | plugins_icon_map = { |
| 299 | executable = true; | 303 | executable = true; |
| 300 | target = ".config/sketchybar/plugins/icon_map.sh"; | 304 | target = ".config/sketchybar/plugins/icon_map.sh"; |
| 301 | source = folder + /plugins/executable_icon_map.sh; | 305 | source = folder + /plugins/executable_icon_map.sh; |
| 302 | }; | 306 | }; |
| 303 | plugins_space = { | 307 | plugins_space = { |
| 304 | executable = true; | 308 | executable = true; |
| 305 | target = ".config/sketchybar/plugins/space.sh"; | 309 | target = ".config/sketchybar/plugins/space.sh"; |
| 306 | source = folder + /plugins/executable_space.sh; | 310 | source = folder + /plugins/executable_space.sh; |
| 307 | }; | 311 | }; |
| 308 | plugins_spotify = { | 312 | plugins_spotify = { |
| 309 | executable = true; | 313 | executable = true; |
| 310 | target = ".config/sketchybar/plugins/spotify.sh"; | 314 | target = ".config/sketchybar/plugins/spotify.sh"; |
| 311 | source = folder + /plugins/executable_spotify.sh; | 315 | source = folder + /plugins/executable_spotify.sh; |
| 312 | }; | 316 | }; |
| 313 | plugins_volume = { | 317 | plugins_volume = { |
| 314 | executable = true; | 318 | executable = true; |
| 315 | target = ".config/sketchybar/plugins/volume.sh"; | 319 | target = ".config/sketchybar/plugins/volume.sh"; |
| 316 | text = '' | 320 | text = '' |
| 317 | #!/usr/bin/env sh | 321 | #!/usr/bin/env sh |
| 318 | WIDTH=100 | 322 | WIDTH=100 |
| 319 | | 323 | |
| 320 | volume_change() { | 324 | volume_change() { |
| 321 | # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width") | 325 | # INITIAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width") |
| 322 | # if [ "$INITIAL_WIDTH" -eq "0" ]; then | 326 | # if [ "$INITIAL_WIDTH" -eq "0" ]; then |
| 323 | # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO | 327 | # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=$WIDTH icon.width=$INFO |
| 324 | # else | 328 | # else |
| 325 | # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH | 329 | # ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO width=$WIDTH |
| 326 | # fi | 330 | # fi |
| 327 | ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO | 331 | ${pkgs.sketchybar}/bin/sketchybar --set $NAME icon.width=$INFO |
| 328 | | 332 | |
| 329 | | 333 | |
| 330 | # sleep 5 | 334 | # sleep 5 |
| 331 | # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width") | 335 | # FINAL_WIDTH=$(${pkgs.sketchybar}/bin/sketchybar --query $NAME | ${pkgs.jq}/bin/jq ".icon.width") |
| 332 | # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then | 336 | # if [ "$FINAL_WIDTH" -eq "$INFO" ]; then |
| 333 | # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0 | 337 | # ${pkgs.sketchybar}/bin/sketchybar --animate tanh 30 --set $NAME width=0 icon.width=0 |
| 334 | # fi | 338 | # fi |
| 335 | } | 339 | } |
| 336 | | | |
| 337 | case "$SENDER" in | | |
| 338 | "volume_change") volume_change | | |
| 339 | ;; | | |
| 340 | esac | | |
| 341 | ''; | | |
| 342 | }; | | |
| 343 | plugins_volume_click = { | | |
| 344 | executable = true; | | |
| 345 | target = ".config/sketchybar/plugins/volume_click.sh"; | | |
| 346 | text = '' | | |
| 347 | #!/usr/bin/env sh | | |
| 348 | MUTED=$(osascript -e 'output muted of (get volume settings)') | | |
| 349 | if [ "$MUTED" = "false" ]; then | | |
| 350 | osascript -e 'set volume output muted true' | | |
| 351 | else | | |
| 352 | osascript -e 'set volume output muted false' | | |
| 353 | fi | | |
| 354 | ''; | | |
| 355 | }; | | |
| 356 | plugins_zen = { | | |
| 357 | executable = true; | | |
| 358 | target = ".config/sketchybar/plugins/zen.sh"; | | |
| 359 | source = folder + /plugins/executable_zen.sh; | | |
| 360 | }; | | |
| 361 | plugins_aerospace = { | | |
| 362 | executable = true; | | |
| 363 | target = ".config/sketchybar/plugins/aerospace.sh"; | | |
| 364 | text = '' | | |
| 365 | #!/usr/bin/env bash | | |
| 366 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors | | |
| 367 | | 340 | |
| 368 | highlight_focused_workspace() { | 341 | case "$SENDER" in |
| 369 | if [[ "$1" = "$FOCUSED_WORKSPACE" ]] | 342 | "volume_change") volume_change |
| 370 | then | 343 | ;; |
| 371 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0 | 344 | esac |
| | 345 | ''; |
| | 346 | }; |
| | 347 | plugins_volume_click = { |
| | 348 | executable = true; |
| | 349 | target = ".config/sketchybar/plugins/volume_click.sh"; |
| | 350 | text = '' |
| | 351 | #!/usr/bin/env sh |
| | 352 | MUTED=$(osascript -e 'output muted of (get volume settings)') |
| | 353 | if [ "$MUTED" = "false" ]; then |
| | 354 | osascript -e 'set volume output muted true' |
| 372 | else | 355 | else |
| 373 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic | 356 | osascript -e 'set volume output muted false' |
| 374 | fi | 357 | fi |
| 375 | } | 358 | ''; |
| | 359 | }; |
| | 360 | plugins_zen = { |
| | 361 | executable = true; |
| | 362 | target = ".config/sketchybar/plugins/zen.sh"; |
| | 363 | source = folder + /plugins/executable_zen.sh; |
| | 364 | }; |
| | 365 | plugins_aerospace = { |
| | 366 | executable = true; |
| | 367 | target = ".config/sketchybar/plugins/aerospace.sh"; |
| | 368 | text = '' |
| | 369 | #!/usr/bin/env bash |
| | 370 | source "$HOME/.config/sketchybar/colors.sh" # Loads all defined colors |
| 376 | | 371 | |
| 377 | illuminate_mode() { | 372 | highlight_focused_workspace() { |
| 378 | if [[ "$mode" = "service" ]] | 373 | if [[ "$1" = "$FOCUSED_WORKSPACE" ]] |
| 379 | then | 374 | then |
| 380 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE | 375 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=on label.width=0 |
| 381 | elif [[ "$mode" = "resize" ]] | 376 | else |
| 382 | then | 377 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME icon.highlight=off label.width=dynamic |
| 383 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN | 378 | fi |
| 384 | else | 379 | } |
| 385 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1 | 380 | |
| 386 | fi | 381 | illuminate_mode() { |
| 387 | } | 382 | if [[ "$mode" = "service" ]] |
| 388 | case "$SENDER" in | 383 | then |
| 389 | "aerospace_workspace_change") | 384 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$ORANGE |
| 390 | highlight_focused_workspace $1 | 385 | elif [[ "$mode" = "resize" ]] |
| 391 | ;; | 386 | then |
| 392 | "aerospace_mode_change") | 387 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$GREEN |
| 393 | illuminate_mode | 388 | else |
| 394 | ;; | 389 | ${pkgs.sketchybar}/bin/sketchybar --animate tanh 20 --set $NAME background.color=$BACKGROUND_1 |
| 395 | esac | 390 | fi |
| 396 | ''; | 391 | } |
| | 392 | case "$SENDER" in |
| | 393 | "aerospace_workspace_change") |
| | 394 | highlight_focused_workspace $1 |
| | 395 | ;; |
| | 396 | "aerospace_mode_change") |
| | 397 | illuminate_mode |
| | 398 | ;; |
| | 399 | esac |
| | 400 | ''; |
| | 401 | }; |
| 397 | }; | 402 | }; |
| 398 | }; | | |
| 399 | } | 403 | } |