Browse Source

~/.config/{sway,waybar}: Switch to waybar

It's a bit croweded for now, but has quite a few neat features.

Also contains ~/.bin/tasks, a simplistic current task tracker.  The
current task is also displayed in the statusbar.
Luna Stadler 4 years ago
parent
commit
d3466066d5
4 changed files with 348 additions and 9 deletions
  1. 13 0
      .bin/tasks
  2. 1 9
      .config/sway/config
  3. 108 0
      .config/waybar/config
  4. 226 0
      .config/waybar/style.css

+ 13 - 0
.bin/tasks

@ -0,0 +1,13 @@
1
#!/bin/bash
2
3
if [ "$1" = "clear" ]; then
4
	echo >> ~/.tasks.txt
5
	exit 0
6
fi
7
8
if [ "$#" = "0" ]; then
9
	grep '[a-z]' ~/.tasks.txt | tail -n1
10
	exit 0
11
fi
12
13
echo "$*" >> ~/.tasks.txt

+ 1 - 9
.config/sway/config

@ -252,15 +252,7 @@ for_window [title="PICO-8"] {
252 252
bar {
253 253
    position top
254 254
255
    # When the status_command prints a new line to stdout, swaybar updates.
256
    # The default just shows the current date and time.
257
    status_command while ~/.config/dwm/status.sh || true; do sleep 15; done
258
259
    colors {
260
        statusline #ffffff
261
        background #323232
262
        inactive_workspace #32323200 #32323200 #5c5c5c
263
    }
255
    swaybar_command waybar
264 256
}
265 257
266 258
include /etc/sway/config.d/*

+ 108 - 0
.config/waybar/config

@ -0,0 +1,108 @@
1
{
2
    // "layer": "top", // Waybar at top layer
3
    // "position": "bottom", // Waybar position (top|bottom|left|right)
4
    "height": 22, // Waybar height (to be removed for auto height)
5
    // "width": 1280, // Waybar width
6
    // Choose the order of the modules
7
    "modules-left": ["sway/workspaces", "sway/mode", "sway/window"],
8
    "modules-center": ["custom/media"],
9
    "modules-right": ["custom/task", "custom/work", "custom/pacman", "pulseaudio", "network", "cpu", "memory", "temperature", "battery", "clock"],
10
    "sway/mode": {
11
        "format": "<span style=\"italic\">{}</span>"
12
    },
13
    "tray": {
14
        // "icon-size": 21,
15
        "spacing": 10
16
    },
17
    "clock": {
18
        "today-format": "<b>{}</b>",
19
        "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
20
        "format-alt": "{:%Y-%m-%d}"
21
    },
22
    "cpu": {
23
        "format": "{usage:00d}% ",
24
    },
25
    "memory": {
26
        "format": "{used:0.1f}G "
27
    },
28
    "temperature": {
29
        // "thermal-zone": 2,
30
        // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
31
        "critical-threshold": 80,
32
        // "format-critical": "{temperatureC}°C {icon}",
33
        "format": "{temperatureC}°C",
34
    },
35
    "battery": {
36
        "states": {
37
            // "good": 95,
38
            "warning": 30,
39
            "critical": 15
40
        },
41
        "format": "{capacity}% {icon}",
42
        "format-charging": "{capacity}% ",
43
        "format-plugged": "{capacity}% ",
44
        "format-alt": "{time} {icon}",
45
        // "format-good": "", // An empty format will hide the module
46
        "format-full": "",
47
        "format-icons": ["", "", "", "", ""]
48
    },
49
    "network": {
50
        // "interface": "wlp2*", // (Optional) To force the use of this interface
51
        "format-wifi": "{essid} ({signalStrength}%) ",
52
        "format-ethernet": "{ifname}: {ipaddr}/{cidr} ",
53
        "format-linked": "{ifname} (No IP) ",
54
        "format-disconnected": "Disconnected ⚠",
55
        "format-alt": "{ifname}: {ipaddr}/{cidr}"
56
    },
57
    "pulseaudio": {
58
        // "scroll-step": 1, // %, can be a float
59
        "format": "{volume}% {icon} {format_source}",
60
        "format-bluetooth": "{volume}% {icon} {format_source}",
61
        "format-bluetooth-muted": " {icon} {format_source}",
62
        "format-muted": " {format_source}",
63
        "format-source": "{volume}% ",
64
        "format-source-muted": "",
65
        "format-icons": {
66
            "headphone": "",
67
            "hands-free": "",
68
            "headset": "",
69
            "phone": "",
70
            "portable": "",
71
            "car": "",
72
            "default": ["", "", ""]
73
        },
74
        "on-click": "pavucontrol"
75
    },
76
    "custom/media": {
77
        "format": "{icon}{}",
78
        "return-type": "json",
79
        "format-icons": {
80
            "Playing": " ",
81
            "Paused": " ",
82
        },
83
        "max-length":70,
84
        "exec": "playerctl metadata --format '{\"text\": \"{{markup_escape(title)}}\", \"tooltip\": \"{{playerName}} : {{markup_escape(title)}}\", \"alt\": \"{{status}}\", \"class\": \"{{status}}\"}' -F",
85
        "on-click": "playerctl play-pause",
86
    },
87
    "custom/pacman": {
88
        "format": " {} ",
89
        "interval": "600",
90
        "exec": "pacman -Sup | wc -l",
91
    },
92
    //"custom/weather": {
93
    //    "format": " {} ",
94
    //    "exec": "curl -sf https://wttr.in/Leipzig?format=1",
95
    //    "on-click": "xdg-open https://wttr.in/Leipzig?format=v2",
96
    //    "interval": 3600,
97
    //},
98
    "custom/work": {
99
        "format": " {} ",
100
        "exec": "working-time",
101
        "interval": 60,
102
    },
103
    "custom/task": {
104
      "format": "{} ",
105
      "exec": "tail -n1 -f ~/.tasks.txt",
106
      "on-click": "~/.bin/tasks clear",
107
    },
108
}

+ 226 - 0
.config/waybar/style.css

@ -0,0 +1,226 @@
1
* {
2
    border: none;
3
    border-radius: 0;
4
    /* `otf-font-awesome` is required to be installed for icons */
5
    /*font-family: Roboto, Helvetica, Arial, sans-serif;*/
6
    font-family: monospace;
7
    font-size: 12px;
8
    min-height: 0;
9
}
10
11
window#waybar {
12
    background-color: rgba(0, 0, 0, 0.3);
13
    border-bottom: 1px solid rgba(100, 114, 125, 0.5);
14
    color: #ffffff;
15
    transition-property: background-color;
16
    transition-duration: .1s;
17
}
18
19
window#waybar.hidden {
20
    opacity: 0.2;
21
}
22
23
/*
24
window#waybar.empty {
25
    background-color: transparent;
26
}
27
window#waybar.solo {
28
    background-color: #FFFFFF;
29
}
30
*/
31
32
window#waybar.termite {
33
    background-color: #3F3F3F;
34
}
35
36
window#waybar.chromium {
37
    background-color: #000000;
38
    border: none;
39
}
40
41
#workspaces button {
42
    padding: 0;
43
    background-color: transparent;
44
    color: #ffffff;
45
    /* Use box-shadow instead of border so the text isn't offset */
46
    box-shadow: inset 0 -3px transparent;
47
}
48
49
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
50
#workspaces button:hover {
51
    background: rgba(0, 0, 0, 0.2);
52
    box-shadow: inset 0 -3px #ffffff;
53
}
54
55
#workspaces button.focused {
56
    background-color: #64727D;
57
    box-shadow: inset 0 -3px #ffffff;
58
}
59
60
#workspaces button.urgent {
61
    background-color: #eb4d4b;
62
}
63
64
#mode {
65
    background-color: #64727D;
66
    border-bottom: 3px solid #ffffff;
67
}
68
69
#clock,
70
#battery,
71
#cpu,
72
#memory,
73
#temperature,
74
#backlight,
75
#network,
76
#pulseaudio,
77
#custom-media,
78
#tray,
79
#mode,
80
#idle_inhibitor,
81
#mpd {
82
    padding: 0 5px;
83
    margin: 0 4px;
84
    color: #ffffff;
85
}
86
87
#window,
88
#workspaces {
89
    margin: 0 4px;
90
}
91
92
/* If workspaces is the leftmost module, omit left margin */
93
.modules-left > widget:first-child > #workspaces {
94
    margin-left: 0;
95
}
96
97
/* If workspaces is the rightmost module, omit right margin */
98
.modules-right > widget:last-child > #workspaces {
99
    margin-right: 0;
100
}
101
102
#clock {
103
    /*background-color: #64727D;*/
104
}
105
106
#battery {
107
    /*background-color: #ffffff;*/
108
    color: #fff;
109
}
110
111
#battery.charging {
112
    color: #ffffff;
113
    /*background-color: #26A65B;*/
114
}
115
116
@keyframes blink {
117
    to {
118
        background-color: #ffffff;
119
        color: #000000;
120
    }
121
}
122
123
#battery.critical:not(.charging) {
124
    background-color: #f53c3c;
125
    color: #ffffff;
126
    animation-name: blink;
127
    animation-duration: 0.5s;
128
    animation-timing-function: linear;
129
    animation-iteration-count: infinite;
130
    animation-direction: alternate;
131
}
132
133
label:focus {
134
    background-color: #000000;
135
}
136
137
#cpu {
138
    /*background-color: #2ecc71;*/
139
    color: #fff;
140
}
141
142
#memory {
143
    /*background-color: #9b59b6;*/
144
}
145
146
#backlight {
147
    /*background-color: #90b1b1;*/
148
}
149
150
#network {
151
    /*background-color: #2980b9;*/
152
}
153
154
#network.disconnected {
155
    background-color: #f53c3c;
156
}
157
158
#pulseaudio {
159
    /*background-color: #f1c40f;*/
160
    /*color: #000000;*/
161
}
162
163
#pulseaudio.muted {
164
    /*background-color: #90b1b1;
165
    color: #2a5c45;*/
166
}
167
168
#custom-media {
169
    /*background-color: #66cc99;
170
    color: #2a5c45;*/
171
    min-width: 100px;
172
}
173
174
#custom-media.custom-spotify {
175
    background-color: #66cc99;
176
}
177
178
#custom-media.custom-vlc {
179
    background-color: #ffa000;
180
}
181
182
#temperature {
183
    /*background-color: #f0932b;*/
184
}
185
186
#temperature.critical {
187
    background-color: #eb4d4b;
188
}
189
190
#tray {
191
    background-color: #2980b9;
192
}
193
194
#idle_inhibitor {
195
    background-color: #2d3436;
196
}
197
198
#idle_inhibitor.activated {
199
    background-color: #ecf0f1;
200
    color: #2d3436;
201
}
202
203
#mpd {
204
    background-color: #66cc99;
205
    color: #2a5c45;
206
}
207
208
#mpd.disconnected {
209
    background-color: #f53c3c;
210
}
211
212
#mpd.stopped {
213
    background-color: #90b1b1;
214
}
215
216
#mpd.paused {
217
    background-color: #51a37a;
218
}
219
220
#language {
221
    background: #00b093;
222
    color: #740864;
223
    padding: 0 5px;
224
    margin: 0 5px;
225
    min-width: 16px;
226
}