Skip to content

Commit 5a357a7

Browse files
committed
Improve monitor, bar and config
1 parent 425993d commit 5a357a7

File tree

6 files changed

+40
-13
lines changed

6 files changed

+40
-13
lines changed

defaults/main.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ sway__keyboard_settings: true
1818
sway__keyboard_lang: 'de'
1919
sway__lock: 'swaylock --color 000000 --image /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png'
2020
sway__waybar: true
21-
sway__waybar_modules_right: ["idle_inhibitor", "custom/weather", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "clock", "tray"]
21+
sway__waybar_modules_left: ["sway/workspaces", "sway/mode", "sway/scratchpad"]
22+
sway__waybar_modules_center: ["sway/window"]
23+
sway__waybar_modules_right: ["idle_inhibitor", "custom/weather", "pulseaudio", "network", "cpu", "memory", "disk", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "clock", "tray"]
24+
sway__waybar_font_size: '13px'
2225
sway__wlsunset: true
2326

2427
sway__keybindings:
@@ -62,6 +65,10 @@ sway__keybindings:
6265
name: lighter
6366
key: XF86MonBrightnessUp
6467
exec: --no-startup-id light -A 6
68+
- keybinding:
69+
name: display settings
70+
key: XF86WakeUp
71+
exec: wdisplay
6572

6673
sway__keybindings_extra: []
6774

tasks/waybar.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
become: true
77
with_items:
88
- 'waybar'
9+
- 'wlogout'
910

1011
- name: Create waybar config folder
1112
become: true

templates/config.j2

+1
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ bindsym $mod+r mode "resize"
227227

228228
# Register default keybindings
229229
{% for keybinding in sway__keybindings %}
230+
# keybinding {{ keybinding.name }}
230231
bindsym {{ keybinding.key }} exec {{ keybinding.exec }}
231232
{% endfor %}
232233

templates/waybar.css.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
*/ {{ ansible_managed }} */
1+
/* {{ ansible_managed }} */
22

33
* {
44
/* `otf-font-awesome` is required to be installed for icons */
55
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
6-
font-size: 13px;
6+
font-size: {{ sway__waybar_font_size }};
77
}
88

99
window#waybar {

templates/waybar.json.j2

+27-9
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// "width": 1280, // Waybar width
77
"spacing": 4, // Gaps between modules (4px)
88
// Choose the order of the modules
9-
"modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"],
10-
"modules-center": ["sway/window"],
9+
"modules-left": {{ sway__waybar_modules_left | tojson }},
10+
"modules-center": {{ sway__waybar_modules_center | tojson }},
1111
"modules-right": {{ sway__waybar_modules_right | tojson }},
1212
// Modules configuration
1313
"sway/workspaces": {
@@ -76,6 +76,18 @@
7676
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
7777
"format-alt": "{:%Y-%m-%d %H:%M %Z}"
7878
},
79+
"disk": {
80+
"interval": 30,
81+
"format": "{path}: {percentage_used}%",
82+
"format-alt": "{used}/{total}",
83+
"path": "/"
84+
},
85+
"sway/language": {
86+
"format": "{shortDescription}",
87+
"tooltip-format": "{long} {variant}",
88+
"on-click": "swaymsg input type:keyboard xkb_switch_layout next",
89+
"on-click-right": "gnome-control-center region"
90+
},
7991
"cpu": {
8092
"format": "{usage}% ",
8193
"tooltip": false
@@ -102,7 +114,7 @@
102114
"critical": 15
103115
},
104116
"format": "{capacity}% {icon}",
105-
"format-charging": "{capacity}% ",
117+
"format-charging": "{capacity}% 🗲",
106118
"format-plugged": "{capacity}% ",
107119
"format-alt": "{time} {icon}",
108120
// "format-good": "", // An empty format will hide the module
@@ -115,11 +127,12 @@
115127
"network": {
116128
// "interface": "wlp2*", // (Optional) To force the use of this interface
117129
"format-wifi": "{essid} ({signalStrength}%) ",
118-
"format-ethernet": "{ipaddr}/{cidr} ",
119-
"tooltip-format": "{ifname} via {gwaddr} ",
120-
"format-linked": "{ifname} (No IP) ",
130+
"format-ethernet": "{ipaddr}/{cidr} 🖧",
131+
"tooltip-format": "{ifname} via {gwaddr} 🔗",
132+
"format-linked": "{ifname} (No IP) ",
121133
"format-disconnected": "Disconnected ⚠",
122-
"format-alt": "{ifname}: {ipaddr}/{cidr}"
134+
"format-alt": "{ifname}: {ipaddr}/{cidr}",
135+
"on-click": "gnome-control-center network"
123136
},
124137
"pulseaudio": {
125138
// "scroll-step": 1, // %, can be a float
@@ -131,8 +144,8 @@
131144
"format-source-muted": "",
132145
"format-icons": {
133146
"headphone": "",
134-
"hands-free": "",
135-
"headset": "",
147+
"hands-free": "🤙",
148+
"headset": "🎧",
136149
"phone": "",
137150
"portable": "",
138151
"car": "",
@@ -147,5 +160,10 @@
147160
"exec": "{{ swayusr.home }}/.config/waybar/wttr.py",
148161
"return-type": "json"
149162
},
163+
"custom/power": {
164+
"format": "",
165+
"on-click": "wlogout",
166+
"tooltip": false
167+
}
150168
}
151169

vars/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
2-
playbook_version_number: 6 # should be int
2+
playbook_version_number: 7 # should be int
33
playbook_version_path: 'role-roles-ansible.sway.version'

0 commit comments

Comments
 (0)