Project import generated by Copybara.
GitOrigin-RevId: 975161aa2f1036264c56d7a81b79ac74ba68b276
diff --git a/private_dot_config/sway/config.tmpl b/private_dot_config/sway/config.tmpl
new file mode 100644
index 0000000..65169ac
--- /dev/null
+++ b/private_dot_config/sway/config.tmpl
@@ -0,0 +1,348 @@
+# Read `man 5 sway` for a complete reference.
+
+### Variables
+#
+# Logo key. Use Mod1 for Alt.
+set $mod Mod4
+# Home row direction keys, like vim
+set $left h
+set $down j
+set $up k
+set $right l
+# Your preferred terminal emulator
+set $term foot
+# Your preferred application launcher
+# Note: pass the final command to swaymsg so that the resulting window can be opened
+# on the original workspace that the command was run on.
+#set $menu dmenu_path | wmenu | xargs swaymsg exec --
+set $menu rofi -show drun | xargs swaymsg exec --
+set $menuDrun rofi -show run | xargs swaymsg exec --
+set $menuSsh rofi -show ssh | xargs swaymsg exec --
+set $menuWindows rofi -show window | xargs swaymsg exec --
+set $menuPower rofi -show power-menu -modi power-menu:rofi-power-menu | xargs swaymsg exec --
+set $menuClipboard rofi -show clipboard -modi clipboard:~/bin/cliphist-rofi-img -show-icons | xargs swaymsg exec --
+
+{{ if eq .chezmoi.hostname "pixelbook" }}
+set $internalScreen "Sharp Corporation LQ123P1JX32 Unknown"
+set $auxScreen "LG Electronics LG Ultra HD 0x0000D4DC"
+
+set $internalKeyboard "4012:2782:keyd_virtual_keyboard"
+set $macKeyboard "1452:598:Apple_Wireless_Keyboard"
+{{ end }}
+
+### Output configuration
+#
+# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
+output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536.png fill
+#
+# Example configuration:
+#
+# output HDMI-A-1 resolution 1920x1080 position 1920,0
+#
+# You can get the names of your outputs by running: swaymsg -t get_outputs
+
+{{ if eq .chezmoi.hostname "pixelbook" -}}
+output $internalScreen {
+ mode 2400x1600@59.982Hz
+ pos 0 0
+}
+
+output $auxScreen {
+ mode 1920x1080@60.000Hz
+ pos 1200 -280
+}
+
+workspace 1 output $internalScreen
+workspace 10 output $auxScreen $internalScreen
+{{- end }}
+
+### Idle configuration
+#
+# Example configuration:
+#
+# exec swayidle -w \
+# timeout 300 'swaylock -f -c 000000' \
+# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power 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
+# resumed. It will also lock your screen before your computer goes to sleep.
+
+### Input configuration
+#
+# Example configuration:
+#
+# input "2:14:SynPS/2_Synaptics_TouchPad" {
+# dwt enabled
+# tap enabled
+# natural_scroll enabled
+# middle_emulation enabled
+# }
+#
+# You can get the names of your inputs by running: swaymsg -t get_inputs
+# Read `man 5 sway-input` for more information about this section.
+
+### Key bindings
+#
+# Basics:
+#
+ # Start a terminal
+ bindsym $mod+Return exec $term
+
+ # Kill focused window
+ bindsym $mod+Shift+q kill
+
+ # Start the launcher launcher
+ bindsym $mod+d exec $menu
+
+ # Other menus
+ bindsym $mod+Shift+d exec $menuDrun
+ bindsym $mod+g exec $menuSsh
+ bindsym $mod+Shift+g exec $menuWindows
+ bindsym $mod+c exec $menuClipboard
+ bindsym $mod+Shift+s exec $menuPower
+
+ # 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
+
+ # 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'
+#
+# 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 number 1
+ bindsym $mod+2 workspace number 2
+ bindsym $mod+3 workspace number 3
+ bindsym $mod+4 workspace number 4
+ bindsym $mod+5 workspace number 5
+ bindsym $mod+6 workspace number 6
+ 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+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
+ bindsym $mod+Shift+4 move container to workspace number 4
+ bindsym $mod+Shift+5 move container to workspace number 5
+ bindsym $mod+Shift+6 move container to workspace number 6
+ 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.
+#
+# 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+b 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
+
+#
+# Custom keybindings:
+#
+ bindsym Control+Shift+Comma exec flatpak run it.mijorus.smile
+
+# Sound
+ bindsym XF86AudioRaiseVolume exec wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+
+ bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
+ bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
+ bindsym XF86AudioPlay exec playerctl play-pause
+ bindsym XF86AudioPause exec playerctl play-pause
+ bindsym XF86AudioNext exec playerctl next
+ bindsym XF86AudioPrev exec playerctl previous
+
+# Brightness
+ bindsym XF86MonBrightnessDown exec brightnessctl set 5%-
+ bindsym XF86MonBrightnessUp exec brightnessctl set 5%+
+ bindsym Alt+XF86MonBrightnessDown exec brightnessctl --device='chromeos::kbd_backlight' set 5%-
+ bindsym Alt+XF86MonBrightnessUp exec brightnessctl --device='chromeos::kbd_backlight' set 5%+
+
+# Menu
+ bindsym XF86Tools exec $menu
+ bindsym XF86LaunchB exec $menu
+
+# Notifications
+ bindsym $mod+X exec makoctl dismiss
+ bindsym $mod+Shift+X exec makoctl restore
+ bindsym $mod+Z exec makoctl dismiss -a
+
+#
+# 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"
+
+#
+# Status Bar:
+#
+# Read `man 5 sway-bar` for more information about this section.
+bar {
+ position top
+
+ status_command SCRIPT_DIR=~/.config/i3blocks i3blocks
+
+ colors {
+ statusline #ffffff
+ background #323232
+ inactive_workspace #32323200 #32323200 #5c5c5c
+ }
+}
+
+include /etc/sway/config.d/*
+
+input type:touchpad {
+ tap enabled
+ natural_scroll enabled
+}
+
+input type:pointer {
+ natural_scroll enabled
+}
+
+{{ if eq .chezmoi.hostname "pixelbook" -}}
+input $internalKeyboard {
+ xkb_layout us,es
+ xkb_options grp:rctrl_toggle
+}
+
+input $macKeyboard {
+ xkb_layout es,us
+ xkb_options grp:rwin_toggle
+}
+
+input type:tablet_tool {
+ map_to_output $internalScreen
+}
+
+input type:touch {
+ map_to_output $internalScreen
+}
+{{- end }}
+
+font pango:monospace 10
+
+# @source: https://www.reddit.com/r/swaywm/comments/16nutle/comment/k1ig9b6/
+# @source: https://gitlab.com/that1communist/dotfiles/-/blob/master/.config/sway/modules/win-rules
+# NOTE: You can get app_id's with `swaymsg -t get_tree`
+for_window {
+ [window_role="pop-up"] floating enable
+ [window_role="About"] floating enable
+ [window_role="bubble"] floating enable
+ [window_role="dialog"] floating enable
+ [window_type="dialog"] floating enable
+
+ [title="(?:Open|Save) (?:File|Folder|As)"] floating enable, resize set width 1030 height 710
+
+ [app_id="org.gnome.Calculator"] floating enable
+ [app_id="it.mijorus.smile"] floating enable
+ # See https://wiki.archlinux.org/index.php?title=Flameshot&oldid=813985#Flameshot_does_not_work_on_all_monitors_of_a_multi-monitor_setup_in_Sway
+ [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0
+
+ [title=".* is sharing your screen"] move window to scratchpad
+ [app_id="chrome-pjibgclleladliembfgfagdaldikeohf-.*"] move window to workspace 10; workspace 10
+ [app_id="chrome-aoocenepihlidnmnheodnngihilbadfo-.*"] move window to workspace 10; workspace 10
+}
+
+exec mako
+
+# See https://github.com/emersion/xdg-desktop-portal-wlr/blob/d9ada849aeca6137915de2df69beaef4e272cc1d/README.md#running
+exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
+
+# See https://github.com/flameshot-org/flameshot/blob/14a136777cd82ab70f42c13b4bc9418c756d91d2/docs/Sway%20and%20wlroots%20support.md
+exec SDL_VIDEODRIVER=wayland _JAVA_AWT_WM_NONREPARENTING=1 QT_QPA_PLATFORM=wayland XDG_CURRENT_DESKTOP=sway XDG_SESSION_DESKTOP=sway flameshot
+
+exec wl-paste --watch cliphist store
+
+# See https://wiki.archlinux.org/title/Sway#Idle
+exec swayidle -w \
+ timeout 235 'swaymsg "output * power off"' \
+ resume 'swaymsg "output * power on"' \
+ timeout 240 'swaylock -f' \
+ timeout 300 'systemctl sleep' \
+ before-sleep 'playerctl pause; swaylock -f'