Skip to content

Commit 170a73c

Browse files
authored
Merge branch 'master' into spr
2 parents f65a4e1 + a2ddf12 commit 170a73c

File tree

4 files changed

+330
-8
lines changed

4 files changed

+330
-8
lines changed

docs/CONFIG.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [Kerberos TGT (krbtgt)](#Kerberos-TGT---up)
2323
- [kubernetes-context](#kubernetes-context---up)
2424
- [libreview](#libreview---up)
25+
- [mac-player](#mac-player---up)
2526
- [mpc](#mpc---up)
2627
- [network](#network---up)
2728
- [network-bandwidth](#network-bandwidth---up)
@@ -379,6 +380,12 @@ Show remote tracking branch together with diverge/sync state
379380
set -g @dracula-git-show-remote-status true
380381
```
381382

383+
Show the current repository name in the status bar
384+
```bash
385+
# default is false
386+
set -g @dracula-git-show-repo-name true
387+
```
388+
382389
### gpu-info - [up](#table-of-contents)
383390

384391
These widgets display the current computational, ram, and power usage of installed graphics cards.
@@ -510,6 +517,68 @@ set -g @dracula-kubernetes-eks-extract-account true
510517
This script retrieves and displays continuous glucose monitoring (CGM) data from the LibreView API.
511518
It caches the data to minimize API requests and displays the latest glucose level along with a trend indicator in a Tmux status bar.
512519

520+
521+
### mac-player - [up](#table-of-contents)
522+
523+
This widget and script displays music information provided by the native macOS players.
524+
525+
The current supported apps are:
526+
527+
- Native Players:
528+
- Spotify
529+
- Music - Apple Music
530+
- Browser Players (active tab must match one of these URLs and requires Google Chrome or Safari):
531+
- youtube.com/watch
532+
- open.spotify.com
533+
534+
It also has a remote-player feature.
535+
The supported remote players are:
536+
537+
- Spotify
538+
- Music - Apple Music
539+
540+
NOTE: `set -g @dracula-refresh-rate 5` affects this widget
541+
542+
To change player icons:
543+
544+
```bash
545+
set -g @dracula-mac-player-play-icon ""
546+
set -g @dracula-mac-player-pause-icon "❚❚ "
547+
548+
```
549+
550+
To change length of the widget (length 25 by default):
551+
552+
```bash
553+
set -g @dracula-mac-player-length 25
554+
```
555+
556+
To activate the remote:
557+
558+
```bash
559+
set -g @dracula-mac-player-remote true
560+
```
561+
562+
To specify the app to use(`"Music"` or `"Spotify"`):
563+
564+
```bash
565+
set -g @dracula-mac-player-app "Music"
566+
```
567+
568+
The default keybinds are:
569+
570+
- `<prefix> + P` - Play/Pause
571+
- `<prefix> + R` - Back to position 0/previous track
572+
- `<prefix> + N` - Next track
573+
574+
To change the keybinds:
575+
576+
```bash
577+
set -g @dracula-mac-player-remote-play-pause "P"
578+
set -g @dracula-mac-player-remote-back "R"
579+
set -g @dracula-mac-player-remote-next "N"
580+
```
581+
513582
### mpc - [up](#table-of-contents)
514583

515584
This widget displays music information provided by mpc.
@@ -594,6 +663,7 @@ This widget tries to display whether a vpn is connected.
594663
Tailscale exit nodes are fully supported for Linux and MacOS.
595664

596665
Set verbose to true in order to see the VPNs IP or name of Tailscale exit node.
666+
597667
```bash
598668
set -g @dracula-network-vpn-verbose true
599669
```
@@ -645,6 +715,7 @@ To limit the maximum length (0 means unlimited length):
645715
set -g @dracula-spotify-tui-max-len 30
646716
```
647717

718+
648719
`set remote-g @dracula-refresh-rate 5` affects this widget
649720

650721
### spr - [up](#table-of-contents)
@@ -684,6 +755,9 @@ set -g @dracula-spr-remote-back "R"
684755
set -g @dracula-spr-remote-next "N"
685756
```
686757

758+
`set -g @dracula-refresh-rate 5` affects this widget
759+
760+
687761
### ssh-session - [up](#table-of-contents)
688762

689763
This widget displays the current username@host combination, both of the local machine as well as when connected via ssh.

scripts/dracula.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ main() {
5656
green="#50fa7b"
5757
orange="#ffb86c"
5858
red="#ff5555"
59+
purple="#b166cc"
5960
pink="#ff79c6"
6061
yellow="#f1fa8c"
6162

@@ -268,6 +269,11 @@ main() {
268269
IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-attached-clients-colors" "cyan dark_gray")
269270
script="#($current_dir/attached_clients.sh)"
270271

272+
273+
elif [ $plugin = "mac-player" ]; then
274+
IFS=' ' read -r -a colors <<< $(get_tmux_option "@dracula-mac-player-colors" "purple dark_gray")
275+
script="#($current_dir/mac-player.sh)"
276+
271277
elif [ $plugin = "mpc" ]; then
272278
IFS=' ' read -r -a colors <<<$(get_tmux_option "@dracula-mpc-colors" "green dark_gray")
273279
script="#($current_dir/mpc.sh)"

scripts/git.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ IFS=' ' read -r -a diff_symbol <<< $(get_tmux_option "@dracula-git-show-diff-sym
99
IFS=' ' read -r -a no_repo_message <<< $(get_tmux_option "@dracula-git-no-repo-message" "")
1010
IFS=' ' read -r -a no_untracked_files <<< $(get_tmux_option "@dracula-git-no-untracked-files" "false")
1111
IFS=' ' read -r -a show_remote_status <<< $(get_tmux_option "@dracula-git-show-remote-status" "false")
12+
show_repo_name="$(get_tmux_option "@dracula-git-show-repo-name" "false")"
1213

1314
# Get added, modified, updated and deleted files from git status
1415
getChanges()
@@ -129,36 +130,45 @@ getRemoteInfo()
129130
echo "$out"
130131
}
131132

133+
getRepoName()
134+
{
135+
if [ "$show_repo_name" = "true" ] && [ "$(checkForGitDir)" = "true" ]; then
136+
repo="$(basename "$(git -C "$path" --no-optional-locks rev-parse --show-toplevel 2>/dev/null)")"
137+
echo "$repo | "
138+
fi
139+
}
140+
132141
# return the final message for the status bar
133142
getMessage()
134143
{
135144
if [ $(checkForGitDir) == "true" ]; then
136145
branch="$(getBranch)"
146+
repo_name="$(getRepoName)"
137147
output=""
138148

139149
if [ $(checkForChanges) == "true" ]; then
140150

141151
changes="$(getChanges)"
142152

143153
if [ "${hide_status}" == "false" ]; then
144-
if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then
145-
output=$(echo "${changes} $branch")
154+
if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then
155+
output="$repo_name${changes:+ ${changes}} $branch"
146156
else
147-
output=$(echo "$diff_symbol ${changes} $branch")
157+
output="$repo_name${diff_symbol[0]} ${changes:+$changes }$branch"
148158
fi
149159
else
150-
if [ $(checkEmptySymbol $diff_symbol) == "true" ]; then
151-
output=$(echo "$branch")
160+
if [ "$(checkEmptySymbol "${diff_symbol[0]}")" = "true" ]; then
161+
output=$(echo "$repo_name$branch")
152162
else
153-
output=$(echo "$diff_symbol $branch")
163+
output=$(echo "$repo_name$diff_symbol $branch")
154164
fi
155165
fi
156166

157167
else
158168
if [ $(checkEmptySymbol $current_symbol) == "true" ]; then
159-
output=$(echo "$branch")
169+
output=$(echo "$repo_name$branch")
160170
else
161-
output=$(echo "$current_symbol $branch")
171+
output="$repo_name${current_symbol[0]} $branch"
162172
fi
163173
fi
164174

0 commit comments

Comments
 (0)