| ... | @@ -0,0 +1,150 @@ |
| 1 | {pkgs, ...}: { |
| 2 | services.sketchybar = { |
| 3 | enable = true; |
| 4 | config = '' |
| 5 | # This is a demo config to showcase some of the most important commands. |
| 6 | # It is meant to be changed and configured, as it is intentionally kept sparse. |
| 7 | # For a (much) more advanced configuration example see my dotfiles: |
| 8 | # https://github.com/FelixKratz/dotfiles |
| 9 | |
| 10 | PLUGIN_DIR="$CONFIG_DIR/plugins" |
| 11 | |
| 12 | ##### Bar Appearance ##### |
| 13 | # Configuring the general appearance of the bar. |
| 14 | # These are only some of the options available. For all options see: |
| 15 | # https://felixkratz.github.io/SketchyBar/config/bar |
| 16 | # If you are looking for other colors, see the color picker: |
| 17 | # https://felixkratz.github.io/SketchyBar/config/tricks#color-picker |
| 18 | |
| 19 | sketchybar --bar position=top height=40 blur_radius=30 color=0x04313244 |
| 20 | |
| 21 | # Colours |
| 22 | SURFACE=0xff313244 |
| 23 | |
| 24 | ##### Changing Defaults ##### |
| 25 | # We now change some default values, which are applied to all further items. |
| 26 | # For a full list of all available item properties see: |
| 27 | # https://felixkratz.github.io/SketchyBar/config/items |
| 28 | |
| 29 | default=( |
| 30 | padding_left=5 |
| 31 | padding_right=5 |
| 32 | icon.font="Hack Nerd Font:Bold:17.0" |
| 33 | label.font="Hack Nerd Font:Bold:14.0" |
| 34 | icon.color=0xffcdd6f4 |
| 35 | label.color=0xffcdd6f4 |
| 36 | icon.padding_left=8 |
| 37 | icon.padding_right=4 |
| 38 | label.padding_left=4 |
| 39 | label.padding_right=8 |
| 40 | background.padding_left=2 |
| 41 | background.padding_right=2 |
| 42 | background.color=$SURFACE \ |
| 43 | background.corner_radius=10 \ |
| 44 | background.height=30 \ |
| 45 | background.border_width=1 \ |
| 46 | ) |
| 47 | sketchybar --default "$\{default[@]}" |
| 48 | |
| 49 | sketchybar --add event aerospace_workspace_change |
| 50 | |
| 51 | for sid in $(aerospace list-workspaces --all); do |
| 52 | sketchybar --add item space.$sid left \ |
| 53 | --subscribe space.$sid aerospace_workspace_change \ |
| 54 | --set space.$sid \ |
| 55 | background.border_width=1 \ |
| 56 | background.border_color=0xffb4befe \ |
| 57 | background.corner_radius=5 \ |
| 58 | background.height=20 \ |
| 59 | icon.padding_left=0 \ |
| 60 | icon.padding_right=0 \ |
| 61 | label.padding_right=6 \ |
| 62 | label="$sid" \ |
| 63 | click_script="aerospace workspace $sid" \ |
| 64 | script="$CONFIG_DIR/plugins/aerospace.sh $sid" |
| 65 | done |
| 66 | |
| 67 | ##### Adding Left Items ##### |
| 68 | # We add some regular items to the left side of the bar, where |
| 69 | # only the properties deviating from the current defaults need to be set |
| 70 | |
| 71 | sketchybar --add item chevron left \ |
| 72 | --set chevron icon= label.drawing=off background.drawing=off \ |
| 73 | icon.color=0xfff5e0dc \ |
| 74 | --add item front_app left \ |
| 75 | --set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \ |
| 76 | label.color=0xff94e2d5 \ |
| 77 | label.padding_left=8 \ |
| 78 | background.border_color=0xff94e2d5 \ |
| 79 | --subscribe front_app front_app_switched |
| 80 | |
| 81 | ##### Adding Right Items ##### |
| 82 | # In the same way as the left items we can add items to the right side. |
| 83 | # Additional position (e.g. center) are available, see: |
| 84 | # https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar |
| 85 | |
| 86 | # Some items refresh on a fixed cycle, e.g. the clock runs its script once |
| 87 | # every 10s. Other items respond to events they subscribe to, e.g. the |
| 88 | # volume.sh script is only executed once an actual change in system audio |
| 89 | # volume is registered. More info about the event system can be found here: |
| 90 | # https://felixkratz.github.io/SketchyBar/config/events |
| 91 | |
| 92 | sketchybar --add item clock right \ |
| 93 | --set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \ |
| 94 | icon.color=0xfffab387 \ |
| 95 | label.color=0xffcdd6f4 \ |
| 96 | background.color=$SURFACE \ |
| 97 | background.corner_radius=10 \ |
| 98 | background.height=30 \ |
| 99 | --add item volume right \ |
| 100 | --set volume script="$PLUGIN_DIR/volume.sh" \ |
| 101 | label.color=0xffcdd6f4 \ |
| 102 | background.color=$SURFACE \ |
| 103 | background.corner_radius=10 \ |
| 104 | background.height=30 \ |
| 105 | --subscribe volume volume_change \ |
| 106 | --add item battery right \ |
| 107 | --set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \ |
| 108 | label.color=0xffcdd6f4 \ |
| 109 | background.color=$SURFACE \ |
| 110 | background.corner_radius=10 \ |
| 111 | background.height=30 \ |
| 112 | --subscribe battery system_woke power_source_change |
| 113 | |
| 114 | sketchybar -m --add item mullvad right \ |
| 115 | --set mullvad icon= \ |
| 116 | icon.color=0xfff38ba8 \ |
| 117 | background.color=$SURFACE \ |
| 118 | background.corner_radius=10 \ |
| 119 | background.height=30 \ |
| 120 | background.border_width=1 \ |
| 121 | background.border_color=0xfff38ba8 \ |
| 122 | label.padding_left=0 \ |
| 123 | label.padding_right=0 \ |
| 124 | icon.padding_left=6 \ |
| 125 | update_freq=5 \ |
| 126 | script="$PLUGIN_DIR/mullvad.sh" |
| 127 | |
| 128 | # Add event |
| 129 | sketchybar -m --add event song_update com.apple.iTunes.playerInfo |
| 130 | |
| 131 | # Add Music Item |
| 132 | sketchybar -m --add item music right \ |
| 133 | --set music script="$PLUGIN_DIR/music.sh" \ |
| 134 | click_script="$PLUGIN_DIR/music_click.sh" \ |
| 135 | label.padding_right=10 \ |
| 136 | label.color=0xffcdd6f4 \ |
| 137 | background.color=$SURFACE \ |
| 138 | background.corner_radius=10 \ |
| 139 | background.height=30 \ |
| 140 | background.border_width=1 \ |
| 141 | background.border_color=0xfff38ba8 \ |
| 142 | drawing=off \ |
| 143 | --subscribe music song_update |
| 144 | |
| 145 | ##### Force all scripts to run the first time (never do this in a script) ##### |
| 146 | sketchybar --update |
| 147 | |
| 148 | ''; |
| 149 | }; |
| 150 | } |