diff --git a/ansible/playbook.yaml b/ansible/playbook.yaml index 5f47f64..6e9ca02 100644 --- a/ansible/playbook.yaml +++ b/ansible/playbook.yaml @@ -10,7 +10,7 @@ - network - sshd - base - - firewall + # - firewall - cpu - ntp - build diff --git a/ansible/roles/sway/defaults/main.yaml b/ansible/roles/sway/defaults/main.yaml new file mode 100644 index 0000000..39d5c67 --- /dev/null +++ b/ansible/roles/sway/defaults/main.yaml @@ -0,0 +1,9 @@ +sway_conf_files: + - background + - framework_input + - base_hotkeys + - movement + - windows + - screenshots + - notifications + - disable_focus_follows_mouse diff --git a/ansible/roles/sway/files/style.css b/ansible/roles/sway/files/style.css new file mode 100644 index 0000000..45f73d6 --- /dev/null +++ b/ansible/roles/sway/files/style.css @@ -0,0 +1,186 @@ +/* ----------------------------------------------------------------------------- + * Keyframes + * -------------------------------------------------------------------------- */ + +@keyframes blink-warning { + 70% { + color: white; + } + + to { + color: white; + background-color: orange; + } +} + +@keyframes blink-critical { + 70% { + color: white; + } + + to { + color: white; + background-color: red; + } +} + + +/* ----------------------------------------------------------------------------- + * Base styles + * -------------------------------------------------------------------------- */ + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; +} + +/* The whole bar */ +#waybar { + background: #323232; + color: white; + font-family: Cascadia Mono, monospace; + font-size: 10px; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#custom-keyboard-layout, +#memory, +#mode, +#network, +#pulseaudio, +#temperature, +#tray { + padding-left: 10px; + padding-right: 10px; +} + + +/* ----------------------------------------------------------------------------- + * Module styles + * -------------------------------------------------------------------------- */ + +#battery { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#battery.warning { + color: orange; +} + +#battery.critical { + color: red; +} + +#battery.warning.discharging { + animation-name: blink-warning; + animation-duration: 3s; +} + +#battery.critical.discharging { + animation-name: blink-critical; + animation-duration: 2s; +} + +#clock { + font-weight: bold; +} + +#cpu { + /* No styles */ +} + +#cpu.warning { + color: orange; +} + +#cpu.critical { + color: red; +} + +#memory { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +#memory.warning { + color: orange; +} + +#memory.critical { + color: red; + animation-name: blink-critical; + animation-duration: 2s; +} + +#mode { + background: #64727D; + border-top: 2px solid white; + /* To compensate for the top border and still have vertical centering */ + padding-bottom: 2px; +} + +#network { + /* No styles */ +} + +#network.disconnected { + color: orange; +} + +#pulseaudio { + /* No styles */ +} + +#pulseaudio.muted { + /* No styles */ +} + +#custom-spotify { + color: rgb(102, 220, 105); +} + +#temperature { + /* No styles */ +} + +#temperature.critical { + color: red; +} + +#tray { + /* No styles */ +} + +#window { + font-weight: bold; +} + +#workspaces button { + border-top: 2px solid transparent; + /* To compensate for the top border and still have vertical centering */ + padding-bottom: 2px; + padding-left: 10px; + padding-right: 10px; + color: #888888; +} + +#workspaces button.focused { + border-color: #4c7899; + color: white; + background-color: #285577; +} + +#workspaces button.urgent { + border-color: #c9545d; + color: #c9545d; +} diff --git a/ansible/roles/sway/files/sway_config_files/background.conf b/ansible/roles/sway/files/sway_config_files/background.conf new file mode 100644 index 0000000..65354c9 --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/background.conf @@ -0,0 +1,4 @@ +### Output configuration +# +# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/) +output * bg ~/.config/sway/bliss.jpg fill diff --git a/ansible/roles/sway/files/sway_config_files/base_hotkeys.conf b/ansible/roles/sway/files/sway_config_files/base_hotkeys.conf new file mode 100644 index 0000000..9dc0794 --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/base_hotkeys.conf @@ -0,0 +1,25 @@ +### Key bindings +# +# Basics: +# + # kill focused window + bindsym $mod+Shift+q kill + + # start your launcher + bindsym $mod+Return exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # Hotkey to lock screen, relies on swayidle running + bindsym $mod+l exec pkill -USR1 swayidle + + # reload the configuration file + bindsym $mod+Shift+c reload + + # exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' diff --git a/ansible/roles/sway/files/sway_config_files/disable_focus_follows_mouse.conf b/ansible/roles/sway/files/sway_config_files/disable_focus_follows_mouse.conf new file mode 100644 index 0000000..243a937 --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/disable_focus_follows_mouse.conf @@ -0,0 +1,2 @@ +# Disable focus following mouse +focus_follows_mouse no diff --git a/ansible/roles/sway/files/sway_config_files/framework_input.conf b/ansible/roles/sway/files/sway_config_files/framework_input.conf new file mode 100644 index 0000000..4ddbb28 --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/framework_input.conf @@ -0,0 +1,8 @@ +input * xkb_rules "evdev" + +# Framework Touchpad +input "2362:628:PIXA3854:01_093A:0274_TouchPad" { + dwt enabled + click_method clickfinger + tap enabled +} diff --git a/ansible/roles/sway/files/sway_config_files/movement.conf b/ansible/roles/sway/files/sway_config_files/movement.conf new file mode 100644 index 0000000..4c089a8 --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/movement.conf @@ -0,0 +1,51 @@ +# +# Moving around: +# + # Move your focus around + # bindsym $mod+$left focus left + # bindsym $mod+$down focus down + # bindsym $mod+$up focus up + # bindsym $mod+$right focus right + # or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # _move_ the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # switch to workspace + bindsym $mod+1 workspace 1 + bindsym $mod+2 workspace 2 + bindsym $mod+3 workspace 3 + bindsym $mod+4 workspace 4 + bindsym $mod+5 workspace 5 + bindsym $mod+6 workspace 6 + bindsym $mod+7 workspace 7 + bindsym $mod+8 workspace 8 + bindsym $mod+9 workspace 9 + bindsym $mod+0 workspace 10 + # move focused container to workspace + bindsym $mod+Shift+1 move container to workspace 1 + bindsym $mod+Shift+2 move container to workspace 2 + bindsym $mod+Shift+3 move container to workspace 3 + bindsym $mod+Shift+4 move container to workspace 4 + bindsym $mod+Shift+5 move container to workspace 5 + bindsym $mod+Shift+6 move container to workspace 6 + bindsym $mod+Shift+7 move container to workspace 7 + bindsym $mod+Shift+8 move container to workspace 8 + bindsym $mod+Shift+9 move container to workspace 9 + bindsym $mod+Shift+0 move container to workspace 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. diff --git a/ansible/roles/sway/files/sway_config_files/notifications.conf b/ansible/roles/sway/files/sway_config_files/notifications.conf new file mode 100644 index 0000000..0ee63b9 --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/notifications.conf @@ -0,0 +1,2 @@ +bindsym $mod+Escape exec makoctl dismiss +bindsym $mod+Shift+Escape exec makoctl invoke diff --git a/ansible/roles/sway/files/sway_config_files/screenshots.conf b/ansible/roles/sway/files/sway_config_files/screenshots.conf new file mode 100644 index 0000000..e9b154b --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/screenshots.conf @@ -0,0 +1,7 @@ +# Screenshots +#bindsym $mod+print exec --no-startup-id slurp | grim -g - $(xdg-user-dir PICTURES)/$(date +'screenshot_%Y-%m-%d-%H%M%S.png') +bindsym $mod+print exec --no-startup-id bash -c "slurp | grim -g - ~/$(date +'screenshot_%Y-%m-%d-%H%M%S.png')" +bindsym print exec --no-startup-id bash -c "grim ~/$(date +'screenshot_%Y-%m-%d-%H%M%S.png')" +# bindsym $mod+Shift+print exec --no-startup-id bash -c "wf-recorder -g $(slurp) -o ~/$(date +'screencast_%Y-%m-%d-%H%M%S.mp4')" +# bindsym Shift+print exec --no-startup-id bash -c "wf-recorder -o ~/$(date +'screencast_%Y-%m-%d-%H%M%S.mp4')" +# Need to make a hotkey to end the recording diff --git a/ansible/roles/sway/files/sway_config_files/windows.conf b/ansible/roles/sway/files/sway_config_files/windows.conf new file mode 100644 index 0000000..c477ff8 --- /dev/null +++ b/ansible/roles/sway/files/sway_config_files/windows.conf @@ -0,0 +1,61 @@ +# +# Layout stuff: +# + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+h splith + bindsym $mod+v splitv + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # move focus to the parent container + bindsym $mod+a focus parent +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" diff --git a/ansible/roles/sway/files/waybar_config.json b/ansible/roles/sway/files/waybar_config.json new file mode 100644 index 0000000..773f391 --- /dev/null +++ b/ansible/roles/sway/files/waybar_config.json @@ -0,0 +1,80 @@ +{ + // "height": 10, // Waybar height (to be removed for auto height) + "modules-left": ["sway/workspaces", "sway/mode"], + "modules-right": ["idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "custom/temperature", "backlight", "custom/battery", "custom/clock", "tray"], + "sway/workspaces": { + "disable-scroll": true, + }, + "sway/mode": { + "format": "{}" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + "tray": { + // "icon-size": 21, + "spacing": 10 + }, + "custom/clock": { + "exec": "$HOME/.bin/.waybar_date", + "return-type": "json", + "restart-interval": 30 + }, + "cpu": { + "format": "{usage}% ", + "tooltip": false + }, + "memory": { + "format": "{}% " + }, + "custom/temperature": { + "exec": "$HOME/.bin/.waybar_temperature", + "return-type": "json", + "restart-interval": 30 + }, + "temperature": { + "critical-threshold": 80, + "format": "{temperatureC}°C {icon}", + "format-icons": ["", "", ""] + }, + "backlight": { + "format": "{percent}% {icon}", + "format-icons": ["", ""] + }, + "custom/battery": { + "exec": "$HOME/.bin/.waybar_battery", + "return-type": "json", + "restart-interval": 30 + }, + "network": { + "format-wifi": "{essid} ({signalStrength}%) ", + "format-ethernet": "{ifname}: {ipaddr}/{cidr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "format-alt": "{ifname}: {ipaddr}/{cidr}" + }, + "pulseaudio": { + "format": "{volume}% {icon} {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "format-source": "{volume}% ", + "format-source-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", "", ""] + }, + "on-click": "pavucontrol", + "on-scroll-up": "", + "on-scroll-down": "" + } +} diff --git a/ansible/roles/sway/tasks/peruser.yaml b/ansible/roles/sway/tasks/peruser.yaml index df9563c..6527d27 100644 --- a/ansible/roles/sway/tasks/peruser.yaml +++ b/ansible/roles/sway/tasks/peruser.yaml @@ -42,7 +42,7 @@ - name: Configure dotfiles (conf directory) copy: - src: "files/{{ item }}.conf" + src: "files/sway_config_files/{{ item }}.conf" dest: "{{ account_homedir.stdout }}/.config/sway/config.d/{{ item }}.conf" mode: 0600 owner: "{{ account_name.stdout }}"