aboutsummaryrefslogtreecommitdiff
path: root/modules/home/i3wm/polybar.nix
blob: 95130cf3ba4026253382fcf41282724dfbb158ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
{ config, pkgs, lib, ... }:


{
  services.polybar = {
        enable = true;

        extraConfig = let
          colors = {
            background = "#1c182d";
            background-alt = "#2b1b3d";
            foreground = "#d0b6fd";
            primary = "#cfb5fd";
            secondary = "#8a78b0";
            alert = "#7b91fc";
            disabled = "#707880";
          };
        in ''
          [bar/example]
          width = 98%
          height = 30pt
          radius = 15
          offset-x = 1%
          offset-y = 1%
          override-redirect = true
          fixed-center = true
          enable-ipc = true

          background = ${colors.background}
          foreground = ${colors.foreground}

          line-size = 4pt
          border-size = Opt
          border-color = #00000000

          padding-left = 1
          padding-right = 1
          module-margin = 1

          separator = |
          separator-foreground = ${colors.disabled}

          font-0 = fira code;2

          modules-left = xworkspaces spotify spotify-prev spotify-play-pause spotify-next
          modules-center = date
          modules-right = filesystem memory cpu pulseaudio-devices wlan xkeyboard battery

          [module/systray]
          type = internal/tray
          format-margin = 8pt
          tray-spacing = 16pt

          [module/xworkspaces]
          type = internal/xworkspaces
          label-active = %name%
          label-active-background = ${colors.background-alt}
          label-active-underline = ${colors.primary}
          label-active-padding = 1
          label-occupied = %name%
          label-occupied-padding = 1
          label-urgent = %name%
          label-urgent-background = ${colors.alert}
          label-urgent-padding = 1
          label-empty = %name%
          label-empty-foreground = ${colors.disabled}
          label-empty-padding = 1

          [module/xwindow]
          type = internal/xwindow
          label = %title:0:60:...%

          [module/filesystem]
          type = internal/fs
          interval = 25
          mount-0 = /
          label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%%
          label-unmounted = %mountpoint% not mounted
          label-unmounted-foreground = ${colors.disabled}

          [module/pulseaudio]
          type = internal/pulseaudio
          format-volume-prefix = "VOL "
          format-volume-prefix-foreground = ${colors.primary}
          format-volume = <label-volume>
          label-volume = %percentage%%
          label-muted = muted
          label-muted-foreground = ${colors.disabled}

          [module/xkeyboard]
          type = internal/xkeyboard
          blacklist-0 = num lock
          label-layout = %layout%
          label-layout-foreground = ${colors.primary}
          label-indicator-padding = 2
          label-indicator-margin = 1
          label-indicator-foreground = ${colors.background}
          label-indicator-background = ${colors.secondary}

          [module/memory]
          type = internal/memory
          interval = 2
          format-prefix = "RAM "
          format-prefix-foreground = ${colors.primary}
          label = %percentage_used:2%%

          [module/cpu]
          type = internal/cpu
          interval = 2
          format-prefix = "CPU "
          format-prefix-foreground = ${colors.primary}
          label = %percentage:2%%

          [network-base]
          type = internal/network
          interval = 5
          format-connected = <label-connected>
          format-disconnected = <label-disconnected>
          label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected

          [module/wlan]
          inherit = network-base
          interface-type = wireless
          label-connected = %{F#F0C674}%ifname%%{F-} %essid%

          [module/eth]
          inherit = network-base
          interface-type = wired
          label-connected = %{F#F0C674}%ifname%%{F-}

          [module/date]
          type = internal/date
          interval = 1
          date = %H:%M
          date-alt = %Y-%m-%d %H:%M:%S
          label = %date%
          label-foreground = ${colors.primary}

          [settings]
          screenchange-reload = true
          pseudo-transparency = true

          [module/battery]
          type = internal/battery
          full-at = 100
          low-at = 15
          battery = BAT0
          adapter = ADP1
          poll-interval = 5

          [module/spotify]
          type = custom/script
          tail = true
          interval = 1
          format-prefix = "♫"
          format = <label>
          exec = get-spotify-status

          [module/spotify-prev]
          type = custom/script
          exec = echo "◀◀"
          format = <label>
          click-left = playerctl previous -p spotify

          [module/spotify-play-pause]
          type = custom/ipc
          hook-0 = echo "▶"
          hook-1 = echo "▶"
          initial = 1
          click-left = playerctl play-pause -p spotify

          [module/spotify-next]
          type = custom/script
          exec = echo "▶▶"
          format = <label>
          click-left = playerctl next -p spotify
        '';

    script = "polybar example --config=~/.config/polybar/config.ini &";
  };
}