mirror of
https://github.com/Ahwxorg/nixos-config.git
synced 2026-03-19 15:50:30 +01:00
feat: adds sketchybar configuration
This commit is contained in:
parent
d8cdb130b5
commit
4b0e72ec7a
9 changed files with 226 additions and 0 deletions
15
modules/home/sketchybar/plugins/battery.sh
Executable file
15
modules/home/sketchybar/plugins/battery.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
|
||||
PERCENTAGE="$(pmset -g batt | grep -Eo "...%" | awk '{print $1}')"
|
||||
CHARGING="$(pmset -g batt | grep 'AC Power')"
|
||||
|
||||
# The item invoking this script (name $NAME) will get its icon and label
|
||||
# updated with the current battery status
|
||||
|
||||
if [[ "$CHARGING" != "" ]]; then
|
||||
STATE="CHAR:"
|
||||
else
|
||||
STATE="BATT:"
|
||||
fi
|
||||
|
||||
sketchybar --set "$NAME" label="$STATE $PERCENTAGE"
|
||||
7
modules/home/sketchybar/plugins/clock.sh
Executable file
7
modules/home/sketchybar/plugins/clock.sh
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
#!/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 '+%Z'): $(date '+%H:%M')"
|
||||
10
modules/home/sketchybar/plugins/front_app.sh
Executable file
10
modules/home/sketchybar/plugins/front_app.sh
Executable 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
|
||||
13
modules/home/sketchybar/plugins/memory.sh
Executable file
13
modules/home/sketchybar/plugins/memory.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
hw_pagesize="$(sysctl -n hw.pagesize)"
|
||||
mem_total="$(($(sysctl -n hw.memsize) / 1024 / 1024))"
|
||||
mem_total_gb="$(($(sysctl -n hw.memsize) / 1024 / 1024 / 1024))"
|
||||
pages_app="$(($(sysctl -n vm.page_pageable_internal_count) - $(sysctl -n vm.page_purgeable_count)))"
|
||||
pages_wired="$(vm_stat | awk '/ wired/ { print $4 }')"
|
||||
pages_compressed="$(vm_stat | awk '/ occupied/ { printf $5 }')"
|
||||
pages_compressed="${pages_compressed:-0}"
|
||||
mem_used="$(((${pages_app} + ${pages_wired//./} + ${pages_compressed//./}) * hw_pagesize / 1024 / 1024))"
|
||||
mem_used_gb="$((${mem_used} / 1024))"
|
||||
|
||||
sketchybar --set "$NAME" label="RAM: $mem_used_gb GiB/$mem_total_gb GiB"
|
||||
3
modules/home/sketchybar/plugins/nowplaying.sh
Executable file
3
modules/home/sketchybar/plugins/nowplaying.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
sketchybar --set "$NAME" label="$(nowplaying-cli get title) - $(nowplaying-cli get artist)"
|
||||
7
modules/home/sketchybar/plugins/space.sh
Executable file
7
modules/home/sketchybar/plugins/space.sh
Executable 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"
|
||||
26
modules/home/sketchybar/plugins/volume.sh
Executable file
26
modules/home/sketchybar/plugins/volume.sh
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/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"
|
||||
|
||||
CURRENT="$(SwitchAudioSource -c)"
|
||||
|
||||
#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="$CURRENT: $VOLUME%"
|
||||
sketchybar --set "$NAME" label="VOL: $CURRENT: $VOLUME%"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue