From f93380d8721e54b84a4e1c8f28251c8a77615913 Mon Sep 17 00:00:00 2001 From: L3D Date: Thu, 18 Jul 2024 20:48:07 +0200 Subject: [PATCH] Create better waybar config --- defaults/main.yml | 3 ++- tasks/dynamic_names.yml | 9 +++++++++ templates/config.j2 | 33 ++++++++++++++++++--------------- templates/sdn-config.yaml.j2 | 17 +++++++++++++++++ 4 files changed, 46 insertions(+), 16 deletions(-) create mode 100644 templates/sdn-config.yaml.j2 diff --git a/defaults/main.yml b/defaults/main.yml index d4d517c..77256e8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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' @@ -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 diff --git a/tasks/dynamic_names.yml b/tasks/dynamic_names.yml index a3fcd82..8c7e949 100644 --- a/tasks/dynamic_names.yml +++ b/tasks/dynamic_names.yml @@ -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 }}" diff --git a/templates/config.j2 b/templates/config.j2 index e8de261..41a61ae 100644 --- a/templates/config.j2 +++ b/templates/config.j2 @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 + 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 - # } + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } } +{% endif %} include /etc/sway/config.d/* diff --git a/templates/sdn-config.yaml.j2 b/templates/sdn-config.yaml.j2 new file mode 100644 index 0000000..0046da3 --- /dev/null +++ b/templates/sdn-config.yaml.j2 @@ -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