Skip to content

Commit

Permalink
Create better waybar config
Browse files Browse the repository at this point in the history
  • Loading branch information
DO1JLR committed Jul 18, 2024
1 parent 8c11848 commit f93380d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sway__user_list:
- user: "{{ ansible_user_id }}"
home: "{{ ansible_env.HOME | default('/home/{{ ansible_user_id }}') }}"

sway__dynamic_names: true
sway__dynamic_names: false

# sway behavior and favorites
sway__logo_key: 'Mod4'
Expand All @@ -17,6 +17,7 @@ sway__term_pkgs:
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

# version check for this role?
submodules_versioncheck: true
Expand Down
9 changes: 9 additions & 0 deletions tasks/dynamic_names.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,12 @@
mode: "u=rwX,g=rX"
owner: "{{ swayusr.user }}"
group: "{{ swayusr.user }}"

- name: Deploy sway-dynamic-names config
become: true
ansible.builtin.template:
src: "templates/sdn-config.yaml.j2"
dest: '{{ swayusr.home }}/.config/sway/sdn-config.yaml'
mode: '0640'
owner: "{{ swayusr.user }}"
group: "{{ swayusr.user }}"
35 changes: 19 additions & 16 deletions templates/config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
#
# Example configuration:
#
# exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \
# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
# before-sleep 'swaylock -f -c 000000'
exec swayidle -w \
timeout 300 'swaylock -f -c 000000' \
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
Expand Down Expand Up @@ -132,6 +132,7 @@ input type:keyboard {
#

# Switch to workspace
bindsym $mod+0 workspace number 0
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
Expand All @@ -141,8 +142,8 @@ input type:keyboard {
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+0 move container to workspace number 0
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
Expand All @@ -152,16 +153,15 @@ input type:keyboard {
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
# We just use 0-9 as the default.

# dynamic workspaces
# https://pypi.org/project/sway-dynamic-names/
{% if sway__dynamic_names %}
exec_always --no-startup-id exec {{ swayusr.home }}/.config/sway/venv/bin/sway-dynamic-names
{% else %}
exec_always --no-startup-id exec {{ swayusr.home }}/.config/sway/venv/bin/sway-dynamic-names
# exec_always --no-startup-id exec {{ swayusr.home }}/.config/sway/venv/bin/sway-dynamic-names
{% endif %}
#
# Layout stuff:
Expand Down Expand Up @@ -228,20 +228,23 @@ bindsym $mod+r mode "resize"
#
# Status Bar:
#
{% if sway__waybar | bool %}
exec waybar
{% else %}
# Read `man 5 sway-bar` for more information about this section.
bar {
position top

# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
# status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
status_command waybar

# colors {
# statusline #ffffff
# background #323232
# inactive_workspace #32323200 #32323200 #5c5c5c
# }
status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done

colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}
{% endif %}

include /etc/sway/config.d/*
17 changes: 17 additions & 0 deletions templates/sdn-config.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
{{ ansible_managed | comment }}
clients:
chromium: chrome
{{ sway__term }}: terminal
firefox: firefox
x-terminal-emulator: terminal
thunderbird: envelope
nautilus: folder-open
clementine: music
vlc: play
signal: comment
gedit: code
deliminator: " "
default_icon: dot-circle
default:
new_desktop: true

0 comments on commit f93380d

Please sign in to comment.