From 5a357a7357b6c919fd850617952fb4a9d6423546 Mon Sep 17 00:00:00 2001 From: L3D Date: Tue, 23 Jul 2024 22:07:05 +0200 Subject: [PATCH] Improve monitor, bar and config --- defaults/main.yml | 9 ++++++++- tasks/waybar.yml | 1 + templates/config.j2 | 1 + templates/waybar.css.j2 | 4 ++-- templates/waybar.json.j2 | 36 +++++++++++++++++++++++++++--------- vars/main.yml | 2 +- 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index c235087..68f8042 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -18,7 +18,10 @@ sway__keyboard_settings: true sway__keyboard_lang: 'de' sway__lock: 'swaylock --color 000000 --image /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png' sway__waybar: true -sway__waybar_modules_right: ["idle_inhibitor", "custom/weather", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "clock", "tray"] +sway__waybar_modules_left: ["sway/workspaces", "sway/mode", "sway/scratchpad"] +sway__waybar_modules_center: ["sway/window"] +sway__waybar_modules_right: ["idle_inhibitor", "custom/weather", "pulseaudio", "network", "cpu", "memory", "disk", "temperature", "backlight", "keyboard-state", "sway/language", "battery", "clock", "tray"] +sway__waybar_font_size: '13px' sway__wlsunset: true sway__keybindings: @@ -62,6 +65,10 @@ sway__keybindings: name: lighter key: XF86MonBrightnessUp exec: --no-startup-id light -A 6 + - keybinding: + name: display settings + key: XF86WakeUp + exec: wdisplay sway__keybindings_extra: [] diff --git a/tasks/waybar.yml b/tasks/waybar.yml index 86ba5c3..c7628ff 100644 --- a/tasks/waybar.yml +++ b/tasks/waybar.yml @@ -6,6 +6,7 @@ become: true with_items: - 'waybar' + - 'wlogout' - name: Create waybar config folder become: true diff --git a/templates/config.j2 b/templates/config.j2 index a7b71d3..3a58b0d 100644 --- a/templates/config.j2 +++ b/templates/config.j2 @@ -227,6 +227,7 @@ bindsym $mod+r mode "resize" # Register default keybindings {% for keybinding in sway__keybindings %} +# keybinding {{ keybinding.name }} bindsym {{ keybinding.key }} exec {{ keybinding.exec }} {% endfor %} diff --git a/templates/waybar.css.j2 b/templates/waybar.css.j2 index faba9f1..cda9b91 100644 --- a/templates/waybar.css.j2 +++ b/templates/waybar.css.j2 @@ -1,9 +1,9 @@ -*/ {{ ansible_managed }} */ +/* {{ ansible_managed }} */ * { /* `otf-font-awesome` is required to be installed for icons */ font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif; - font-size: 13px; + font-size: {{ sway__waybar_font_size }}; } window#waybar { diff --git a/templates/waybar.json.j2 b/templates/waybar.json.j2 index 5eaff91..2c5182c 100644 --- a/templates/waybar.json.j2 +++ b/templates/waybar.json.j2 @@ -6,8 +6,8 @@ // "width": 1280, // Waybar width "spacing": 4, // Gaps between modules (4px) // Choose the order of the modules - "modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"], - "modules-center": ["sway/window"], + "modules-left": {{ sway__waybar_modules_left | tojson }}, + "modules-center": {{ sway__waybar_modules_center | tojson }}, "modules-right": {{ sway__waybar_modules_right | tojson }}, // Modules configuration "sway/workspaces": { @@ -76,6 +76,18 @@ "tooltip-format": "{:%Y %B}\n{calendar}", "format-alt": "{:%Y-%m-%d %H:%M %Z}" }, + "disk": { + "interval": 30, + "format": "{path}: {percentage_used}%", + "format-alt": "{used}/{total}", + "path": "/" + }, + "sway/language": { + "format": "{shortDescription}", + "tooltip-format": "{long} {variant}", + "on-click": "swaymsg input type:keyboard xkb_switch_layout next", + "on-click-right": "gnome-control-center region" + }, "cpu": { "format": "{usage}% ", "tooltip": false @@ -102,7 +114,7 @@ "critical": 15 }, "format": "{capacity}% {icon}", - "format-charging": "{capacity}% ", + "format-charging": "{capacity}% 🗲", "format-plugged": "{capacity}% ", "format-alt": "{time} {icon}", // "format-good": "", // An empty format will hide the module @@ -115,11 +127,12 @@ "network": { // "interface": "wlp2*", // (Optional) To force the use of this interface "format-wifi": "{essid} ({signalStrength}%) ", - "format-ethernet": "{ipaddr}/{cidr} ", - "tooltip-format": "{ifname} via {gwaddr} ", - "format-linked": "{ifname} (No IP) ", + "format-ethernet": "{ipaddr}/{cidr} 🖧", + "tooltip-format": "{ifname} via {gwaddr} 🔗", + "format-linked": "{ifname} (No IP) ⛒", "format-disconnected": "Disconnected ⚠", - "format-alt": "{ifname}: {ipaddr}/{cidr}" + "format-alt": "{ifname}: {ipaddr}/{cidr}", + "on-click": "gnome-control-center network" }, "pulseaudio": { // "scroll-step": 1, // %, can be a float @@ -131,8 +144,8 @@ "format-source-muted": "", "format-icons": { "headphone": "", - "hands-free": "", - "headset": "", + "hands-free": "🤙", + "headset": "🎧", "phone": "", "portable": "", "car": "", @@ -147,5 +160,10 @@ "exec": "{{ swayusr.home }}/.config/waybar/wttr.py", "return-type": "json" }, + "custom/power": { + "format": "", + "on-click": "wlogout", + "tooltip": false + } } diff --git a/vars/main.yml b/vars/main.yml index 34b6da2..a8c0421 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,3 +1,3 @@ --- -playbook_version_number: 6 # should be int +playbook_version_number: 7 # should be int playbook_version_path: 'role-roles-ansible.sway.version'