1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_i3wm.git synced 2024-08-16 10:09:53 +02:00
ansible_role_i3wm/templates/config.j2
2023-10-26 11:18:04 +02:00

208 lines
6.1 KiB
Django/Jinja
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

set $mod Mod4
set $term {{ i3_terminal }}
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace {{ i3_font_size }}
focus_follows_mouse {{ i3_focus_follows_mouse | ansible.builtin.ternary('yes', 'no' ) }}
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# startup apps and window decs
default_orientation horizontal
workspace_layout tabbed
# Hide borders
hide_edge_borders smart
# start a terminal
bindsym $mod+Return exec $term
bindsym $mod+Shift+Return exec $term -e tmux
# kill focused window
bindsym $mod+Shift+q kill
{% if ansible_distribution == 'Redhat' or ansible_distribution == 'CentOS' %}
# bindsym $mod+d exec dmenu_run (a program launcher)
bindsym $mod+d exec dmenu_run
{% else %}
bindsym $mod+d exec rofi -show run
# bindsym $mod+d exec rofi (a program launcher)
bindsym $mod+Shift+d exec rofi -show drun
bindsym $mod+Shift+y exec rofi -show window
bindsym $mod+Shift+s exec rofi -show ssh
{% endif %}
# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+odiaeresis focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+odiaeresis move right
# alternatively, you can use the cursor 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
# split in horizontal orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
# Custom Bindings
bindsym $mod+Shift+x exec {{ i3lock_options }}
# workspace variables
{% for workspace in i3_workspaces %}
set $workspace{{ workspace.id }} "{{ workspace.name }}"
{% endfor %}
# switch to workspace
{% for workspace in i3_workspaces %}
bindsym $mod+{{ workspace.id }} workspace $workspace{{ workspace.id }}
{% endfor %}
# toggle workspace
bindsym $mod+Tab workspace next_on_output
bindsym $mod+Shift+Tab workspace prev_on_output
# move focused container to workspace
{% for workspace in i3_workspaces %}
bindsym $mod+Shift+{{ workspace.id }} move container to workspace $workspace{{ workspace.id }}
{% endfor %}
{% for monitor in i3_monitors %}
{% for workspace in monitor.workspaces %}
workspace $workspace{{ workspace }} output {{ monitor.output }}
{% endfor %}
{% endfor %}
{% for application in i3_applications %}
assign [class="{{ application.class }}"] $workspace{{ application.workspace }}
{% endfor %}
for_window [instance="dropdown"] floating enable
for_window [instance="dropdown"] resize set 1024 800
for_window [instance="dropdown"] move position center
for_window [instance="dropdown"] move scratchpad
exec --no-startup-id $term -name dropdown -e tmux
bindsym $mod+t [instance="dropdown"] scratchpad show; move position center
# reload the configuration file
bindsym $mod+Shift+c reload
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym odiaeresis resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
bar {
font pango:mono {{ i3_font_size }}
status_command i3blocks
position top
mode dock
modifier None
}
# Setup Monitors
exec_always sleep 1 && xrandr \
{% for monitor in i3_monitors %} \
--output {{ monitor.output }} \
--mode {{ monitor.mode }} \
--pos {{ monitor.pos }} \
--rotate {{ monitor.rotate }}
{% endfor %}
# Background
{% if i3_desktop_background is defined %}
exec_always feh --bg-scale {{ i3_desktop_background }}
{% endif %}
{% if disable_screensaver | bool %}
# Disable screensaver by default
exec_always xset s off
exec xset -dpms
{% endif %}
{% if enable_lock_after_time | bool %}
exec xautolock -time {{ lock_after_time }} -locker 'maim /tmp/screen_locked.png; mogrify -scale 10% -scale 1000% /tmp/screen_locked.png; i3lock -i /tmp/screen_locked.png'
{% endif %}
# Start Default Applications
{% for application in i3_applications if application.on_startup %}
exec sleep 3 && {{ application.name }}
{% endfor %}
{% for app in i3_run_on_startup %}
exec sleep 4 && {{ app }}
{% endfor %}
# Register Keybindings
{% for keybinding in i3_keybindings %}
bindsym {{ keybinding.key }} exec {{ keybinding.exec }}
{% endfor %}