Move all keybindings and modes out of config, into conf.d

This commit is contained in:
Alex Kelly 2022-06-27 16:26:33 -04:00
parent 438a9f2f05
commit 85bbfd3cd1
6 changed files with 113 additions and 199 deletions

3
conf.d/assign.conf Normal file
View file

@ -0,0 +1,3 @@
# Assign apps to specific workspaces. This avoids having a placeholder window/desktop open all the time, but still forces it to the workspace it's supposed to be stuck to
assign [class="^jetbrains-pycharm$"] number "4:code"
assign [class="^Plexamp$"] number "5:music"

View file

@ -1,4 +1,68 @@
# Keybindings
# Note, this is for more of a "global" keybindings. Modes will have their own mode_whatever.conf keybinding
# Also, I haven't moved everything out of config yet either
bindsym $mod+m mode "audio"
bindsym $mod+s mode "save"
bindsym $mod+n mode "restore"
bindsym $mod+o exec --no-startup-id rofi -show rofi-sound -modi "rofi-sound:~/.local/bin/rofi-sound-output-chooser"
bindsym Control+$alt+l exec xsecurelock
bindsym --release button2 kill
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym $mod+Shift+d exec i3-dmenu-desktop --dmenu="dmenu -i -fn 'Noto Sans:size=8'"
bindsym $mod+d exec rofi -lines 12 -padding 18 -width 60 -location 0 -show drun -sidebar-mode -columns 3 -font 'Noto Sans 8'
bindsym Control+$alt+h exec rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
bindsym $mod+Return exec kitty
bindsym $mod+q kill
bindsym $mod+b bar mode hide
bindsym $mod+Shift+b bar mode dock
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
bindsym $mod+Left focus left
bindsym $mod+Right focus right
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
bindsym $mod+v split v
bindsym $mod+f fullscreen toggle
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
bindsym $mod+a focus parent
bindsym $mod+Up exec "~/bin/volume.sh up"
bindsym $mod+Down exec "~/bin/volume.sh down"
bindsym $mod+backslash exec "~/bin/volume.sh mtoggle"
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
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'"
bindsym $mod+r mode "resize"

23
conf.d/mode_resize.conf Normal file
View file

@ -0,0 +1,23 @@
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 semicolon 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 or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}

19
conf.d/mode_save.conf Normal file
View file

@ -0,0 +1,19 @@
# Save workspace mode.
mode "save" {
bindsym 1 exec "i3-save-tree --workspace=1 > $HOME/.config/i3/layout/w1.json"
bindsym 2 exec "i3-save-tree --workspace=2 > $HOME/.config/i3/layout/w2.json"
bindsym 3 exec "i3-save-tree --workspace=3 > $HOME/.config/i3/layout/w3.json"
bindsym 4 exec "i3-save-tree --workspace=4 > $HOME/.config/i3/layout/w4.json"
bindsym 5 exec "i3-save-tree --workspace=5 > $HOME/.config/i3/layout/w5.json"
bindsym 6 exec "i3-save-tree --workspace=6 > $HOME/.config/i3/layout/w6.json"
bindsym 7 exec "i3-save-tree --workspace=7 > $HOME/.config/i3/layout/w7.json"
bindsym 8 exec "i3-save-tree --workspace=8 > $HOME/.config/i3/layout/w8.json"
bindsym 9 exec "i3-save-tree --workspace=9 > $HOME/.config/i3/layout/w9.json"
bindsym 0 exec "i3-save-tree --workspace=0 > $HOME/.config/i3/layout/w10.json"
# Back to normal: Enter, Escape, or s
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym s mode "default"
bindsym $mod+s mode "default"
}

171
config
View file

@ -1,14 +1,5 @@
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
# This configuration has been modified. Mostly global config is in this config, everything else
# is in conf.d
set $mod Mod4
set $alt Mod1
@ -44,8 +35,6 @@ exec --no-startup-id /home/kellya/projects/public/gnome-keyring-yubikey-unlock /
# Set screen lock
exec xset s 300 5
exec xss-lock -n /usr/libexec/xsecurelock/dimmer -l -- xsecurelock
bindsym Control+$alt+l exec xsecurelock
bindsym --release button2 kill
workspace_layout tabbed
exec --no-startup-id "i3-msg 'workspace $ws1; append_layout ~/.config/i3/layout/w1.json'"
exec --no-startup-id "i3-msg 'workspace $ws2; append_layout ~/.config/i3/layout/w2.json'"
@ -67,169 +56,13 @@ exec --no-startup-id nm-applet
# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start dmenu (a program launcher)
bindsym $mod+Shift+d exec i3-dmenu-desktop --dmenu="dmenu -i -fn 'Noto Sans:size=8'"
bindsym $mod+d exec rofi -lines 12 -padding 18 -width 60 -location 0 -show drun -sidebar-mode -columns 3 -font 'Noto Sans 8'
bindsym Control+$alt+h exec rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
# I think this needs to be bound to middle click to pretend its a normal x copy-and-paste thing
#rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}' ; sleep 0.5; xdotool type $(xclip -o -selection clipboard)
# start a terminal
#bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Return exec kitty
# kill focused window
bindsym $mod+q kill
bindsym $mod+b bar mode hide
bindsym $mod+Shift+b bar mode dock
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l 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+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l 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
bindsym $mod+Up exec "~/bin/volume.sh up"
bindsym $mod+Down exec "~/bin/volume.sh down"
bindsym $mod+backslash exec "~/bin/volume.sh mtoggle"
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# reload the configuration file
bindsym $mod+Shift+c reload
# 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'"
# 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 semicolon 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 or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
for_window [all] title_window_icon on
for_window [all] title_window_icon padding 1px
for_window [all] title_format "%class"
for_window [class="gnome-calculator"] floating enable
# Save workspace mode.
mode "save" {
bindsym 1 exec "i3-save-tree --workspace=1 > $HOME/.config/i3/layout/w1.json"
bindsym 2 exec "i3-save-tree --workspace=2 > $HOME/.config/i3/layout/w2.json"
bindsym 3 exec "i3-save-tree --workspace=3 > $HOME/.config/i3/layout/w3.json"
bindsym 4 exec "i3-save-tree --workspace=4 > $HOME/.config/i3/layout/w4.json"
bindsym 5 exec "i3-save-tree --workspace=5 > $HOME/.config/i3/layout/w5.json"
bindsym 6 exec "i3-save-tree --workspace=6 > $HOME/.config/i3/layout/w6.json"
bindsym 7 exec "i3-save-tree --workspace=7 > $HOME/.config/i3/layout/w7.json"
bindsym 8 exec "i3-save-tree --workspace=8 > $HOME/.config/i3/layout/w8.json"
bindsym 9 exec "i3-save-tree --workspace=9 > $HOME/.config/i3/layout/w9.json"
bindsym 0 exec "i3-save-tree --workspace=0 > $HOME/.config/i3/layout/w10.json"
# Back to normal: Enter, Escape, or s
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym s mode "default"
bindsym $mod+s mode "default"
}
include conf.d/*.conf

View file

@ -1,31 +1,3 @@
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"marks": [],
"percent": 1,
"type": "con",
"nodes": [
{
"border": "none",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1057,
"width": 1920,
"x": 0,
"y": 0
},
"marks": [],
"name": "Plexamp",
"percent": null,
"swallows": [
{
"class": "^Plexamp$"
}
],
"type": "con"
}
]
}