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

209 lines
6.1 KiB
Text
Raw Normal View History

2017-12-31 00:56:01 +01:00
set $mod Mod4
2020-10-14 13:18:44 +02:00
set $term {{ i3_terminal }}
2017-12-31 00:56:01 +01:00
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
2019-06-11 09:19:11 +02:00
font pango:monospace {{ i3_font_size }}
2023-10-26 01:42:03 +02:00
focus_follows_mouse {{ i3_focus_follows_mouse | ansible.builtin.ternary('yes', 'no' ) }}
2017-12-31 00:56:01 +01:00
# 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
2017-12-31 00:56:01 +01:00
# start a terminal
bindsym $mod+Return exec $term
bindsym $mod+Shift+Return exec $term -e tmux
# kill focused window
bindsym $mod+Shift+q kill
2019-07-01 00:32:37 +02:00
{% if ansible_distribution == 'Redhat' or ansible_distribution == 'CentOS' %}
# bindsym $mod+d exec dmenu_run (a program launcher)
bindsym $mod+d exec dmenu_run
2023-10-23 00:23:12 +02:00
{% else %}
2019-07-01 00:32:37 +02:00
bindsym $mod+d exec rofi -show run
2017-12-31 00:56:01 +01:00
# bindsym $mod+d exec rofi (a program launcher)
2020-10-14 13:18:44 +02:00
bindsym $mod+Shift+d exec rofi -show drun
bindsym $mod+Shift+y exec rofi -show window
2017-12-31 00:56:01 +01:00
bindsym $mod+Shift+s exec rofi -show ssh
{% endif %}
2017-12-31 00:56:01 +01:00
# 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
2018-11-18 00:48:16 +01:00
bindsym $mod+Shift+x exec {{ i3lock_options }}
2017-12-31 00:56:01 +01:00
# 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 %}
2020-10-14 13:18:44 +02:00
# toggle workspace
bindsym $mod+Tab workspace next_on_output
bindsym $mod+Shift+Tab workspace prev_on_output
2017-12-31 00:56:01 +01:00
# 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 %}
2023-10-23 00:23:12 +02:00
{% for workspace in monitor.workspaces %}
2017-12-31 00:56:01 +01:00
workspace $workspace{{ workspace }} output {{ monitor.output }}
2023-10-23 00:23:12 +02:00
{% endfor %}
2017-12-31 00:56:01 +01:00
{% 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 {
2020-10-14 13:18:44 +02:00
font pango:mono {{ i3_font_size }}
status_command i3blocks
position top
mode dock
modifier None
2017-12-31 00:56:01 +01:00
}
# Setup Monitors
2023-10-23 00:23:12 +02:00
exec_always sleep 1 && xrandr \
{% for monitor in i3_monitors %} \
--output {{ monitor.output }} \
--mode {{ monitor.mode }} \
--pos {{ monitor.pos }} \
--rotate {{ monitor.rotate }}
{% endfor %}
2017-12-31 00:56:01 +01:00
# Background
2019-06-11 09:19:11 +02:00
{% if i3_desktop_background is defined %}
exec_always feh --bg-scale {{ i3_desktop_background }}
2017-12-31 00:56:01 +01:00
{% endif %}
2019-06-24 14:46:40 +02:00
{% if disable_screensaver | bool %}
# Disable screensaver by default
2019-06-24 15:33:51 +02:00
exec_always xset s off
2019-06-24 14:46:40 +02:00
exec xset -dpms
{% endif %}
2017-12-31 00:56:01 +01:00
2019-06-24 15:33:51 +02:00
{% if enable_lock_after_time | bool %}
2021-02-26 17:47:30 +01:00
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'
2019-06-24 15:33:51 +02:00
{% endif %}
2017-12-31 00:56:01 +01:00
# Start Default Applications
{% for application in i3_applications if application.on_startup %}
exec sleep 3 && {{ application.name }}
2017-12-31 00:56:01 +01:00
{% endfor %}
2019-02-20 21:02:06 +01:00
{% for app in i3_run_on_startup %}
exec sleep 4 && {{ app }}
2019-02-20 21:02:06 +01:00
{% endfor %}
2017-12-31 00:56:01 +01:00
# Register Keybindings
{% for keybinding in i3_keybindings %}
bindsym {{ keybinding.key }} exec {{ keybinding.exec }}
2023-10-23 00:23:12 +02:00
{% endfor %}