Skip to content

Commit f93380d

Browse files
committed
Create better waybar config
1 parent 8c11848 commit f93380d

File tree

4 files changed

+47
-17
lines changed

4 files changed

+47
-17
lines changed

defaults/main.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sway__user_list:
44
- user: "{{ ansible_user_id }}"
55
home: "{{ ansible_env.HOME | default('/home/{{ ansible_user_id }}') }}"
66

7-
sway__dynamic_names: true
7+
sway__dynamic_names: false
88

99
# sway behavior and favorites
1010
sway__logo_key: 'Mod4'
@@ -17,6 +17,7 @@ sway__term_pkgs:
1717
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'
20+
sway__waybar: true
2021

2122
# version check for this role?
2223
submodules_versioncheck: true

tasks/dynamic_names.yml

+9
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@
1414
mode: "u=rwX,g=rX"
1515
owner: "{{ swayusr.user }}"
1616
group: "{{ swayusr.user }}"
17+
18+
- name: Deploy sway-dynamic-names config
19+
become: true
20+
ansible.builtin.template:
21+
src: "templates/sdn-config.yaml.j2"
22+
dest: '{{ swayusr.home }}/.config/sway/sdn-config.yaml'
23+
mode: '0640'
24+
owner: "{{ swayusr.user }}"
25+
group: "{{ swayusr.user }}"

templates/config.j2

+19-16
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
4141
#
4242
# Example configuration:
4343
#
44-
# exec swayidle -w \
45-
# timeout 300 'swaylock -f -c 000000' \
46-
# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
47-
# before-sleep 'swaylock -f -c 000000'
44+
exec swayidle -w \
45+
timeout 300 'swaylock -f -c 000000' \
46+
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
47+
before-sleep 'swaylock -f -c 000000'
4848
#
4949
# This will lock your screen after 300 seconds of inactivity, then turn off
5050
# your displays after another 300 seconds, and turn your screens back on when
@@ -132,6 +132,7 @@ input type:keyboard {
132132
#
133133

134134
# Switch to workspace
135+
bindsym $mod+0 workspace number 0
135136
bindsym $mod+1 workspace number 1
136137
bindsym $mod+2 workspace number 2
137138
bindsym $mod+3 workspace number 3
@@ -141,8 +142,8 @@ input type:keyboard {
141142
bindsym $mod+7 workspace number 7
142143
bindsym $mod+8 workspace number 8
143144
bindsym $mod+9 workspace number 9
144-
bindsym $mod+0 workspace number 10
145145
# Move focused container to workspace
146+
bindsym $mod+Shift+0 move container to workspace number 0
146147
bindsym $mod+Shift+1 move container to workspace number 1
147148
bindsym $mod+Shift+2 move container to workspace number 2
148149
bindsym $mod+Shift+3 move container to workspace number 3
@@ -152,16 +153,15 @@ input type:keyboard {
152153
bindsym $mod+Shift+7 move container to workspace number 7
153154
bindsym $mod+Shift+8 move container to workspace number 8
154155
bindsym $mod+Shift+9 move container to workspace number 9
155-
bindsym $mod+Shift+0 move container to workspace number 10
156156
# Note: workspaces can have any name you want, not just numbers.
157-
# We just use 1-10 as the default.
157+
# We just use 0-9 as the default.
158158

159159
# dynamic workspaces
160160
# https://pypi.org/project/sway-dynamic-names/
161161
{% if sway__dynamic_names %}
162162
exec_always --no-startup-id exec {{ swayusr.home }}/.config/sway/venv/bin/sway-dynamic-names
163163
{% else %}
164-
exec_always --no-startup-id exec {{ swayusr.home }}/.config/sway/venv/bin/sway-dynamic-names
164+
# exec_always --no-startup-id exec {{ swayusr.home }}/.config/sway/venv/bin/sway-dynamic-names
165165
{% endif %}
166166
#
167167
# Layout stuff:
@@ -228,20 +228,23 @@ bindsym $mod+r mode "resize"
228228
#
229229
# Status Bar:
230230
#
231+
{% if sway__waybar | bool %}
232+
exec waybar
233+
{% else %}
231234
# Read `man 5 sway-bar` for more information about this section.
232235
bar {
233236
position top
234237

235238
# When the status_command prints a new line to stdout, swaybar updates.
236239
# The default just shows the current date and time.
237-
# status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
238-
status_command waybar
239-
240-
# colors {
241-
# statusline #ffffff
242-
# background #323232
243-
# inactive_workspace #32323200 #32323200 #5c5c5c
244-
# }
240+
status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
241+
242+
colors {
243+
statusline #ffffff
244+
background #323232
245+
inactive_workspace #32323200 #32323200 #5c5c5c
246+
}
245247
}
248+
{% endif %}
246249

247250
include /etc/sway/config.d/*

templates/sdn-config.yaml.j2

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
{{ ansible_managed | comment }}
3+
clients:
4+
chromium: chrome
5+
{{ sway__term }}: terminal
6+
firefox: firefox
7+
x-terminal-emulator: terminal
8+
thunderbird: envelope
9+
nautilus: folder-open
10+
clementine: music
11+
vlc: play
12+
signal: comment
13+
gedit: code
14+
deliminator: " "
15+
default_icon: dot-circle
16+
default:
17+
new_desktop: true

0 commit comments

Comments
 (0)