From 12f0c7dbe7228bedc0f43234601c5c8baa424475 Mon Sep 17 00:00:00 2001 From: Alex Kelly Date: Tue, 30 Aug 2022 12:43:21 -0400 Subject: [PATCH] Add included conf.d for i3 --- conf.d/assign.conf | 4 ++ conf.d/bar.conf | 17 +++++++ conf.d/colors.conf | 15 +++++++ conf.d/key_bindings.conf | 89 +++++++++++++++++++++++++++++++++++++ conf.d/mode_audio.conf | 18 ++++++++ conf.d/mode_brightness.conf | 19 ++++++++ conf.d/mode_mouse.conf | 10 +++++ conf.d/mode_resize.conf | 25 +++++++++++ conf.d/mode_restore.conf | 20 +++++++++ conf.d/mode_save.conf | 20 +++++++++ conf.d/prt_scr.conf | 10 +++++ conf.d/window_rules.conf | 6 +++ 12 files changed, 253 insertions(+) create mode 100644 conf.d/assign.conf create mode 100644 conf.d/bar.conf create mode 100644 conf.d/colors.conf create mode 100644 conf.d/key_bindings.conf create mode 100644 conf.d/mode_audio.conf create mode 100644 conf.d/mode_brightness.conf create mode 100644 conf.d/mode_mouse.conf create mode 100644 conf.d/mode_resize.conf create mode 100644 conf.d/mode_restore.conf create mode 100644 conf.d/mode_save.conf create mode 100644 conf.d/prt_scr.conf create mode 100644 conf.d/window_rules.conf diff --git a/conf.d/assign.conf b/conf.d/assign.conf new file mode 100644 index 0000000..58bb434 --- /dev/null +++ b/conf.d/assign.conf @@ -0,0 +1,4 @@ +# 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 $ws4 +assign [class="^Clementine$"] number $ws5 +assign [class="^strawberry$"] number $ws5 diff --git a/conf.d/bar.conf b/conf.d/bar.conf new file mode 100644 index 0000000..0bb4f65 --- /dev/null +++ b/conf.d/bar.conf @@ -0,0 +1,17 @@ +# i3bar config +bar { + mode dock + status_command ~/.local/bin/py3status + strip_workspace_numbers yes + position bottom + font pango:Font Awesome 5 Free Solid 10 + separator_symbol "⸽" + colors { + statusline #686f9a + separator #5ccc96 +# background #2f343f +# background #30365FCF + background #30365F90 + } + +} diff --git a/conf.d/colors.conf b/conf.d/colors.conf new file mode 100644 index 0000000..81aad1b --- /dev/null +++ b/conf.d/colors.conf @@ -0,0 +1,15 @@ +# class border backgr. text indicator child_border +client.focused #686f9a #30365FCF #fdf6e3 #859900 +client.focused_inactive #333333 #5f676aCF #ffffff #484e50 #5f676a +client.unfocused #333333 #222222CF #888888 #292d2e #222222 +client.placeholder #2f343f #2f343fi #d8dee8 #2f343f #2f343f + + +# Defaults +#client.focused #4c7899 #285577 #ffffff #2e9ef4 #285577 +#client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a +#client.unfocused #333333 #222222 #888888 #292d2e #222222 +#client.urgent #2f343a #900000 #ffffff #900000 #900000 +#client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c +# +#client.background #ffffff diff --git a/conf.d/key_bindings.conf b/conf.d/key_bindings.conf new file mode 100644 index 0000000..c6b613e --- /dev/null +++ b/conf.d/key_bindings.conf @@ -0,0 +1,89 @@ +# Keybindings +# Note, this is for more of a "global" keybindings. Modes will have their own mode_whatever.conf keybinding + +bindsym $mod+Return exec kitty + +bindsym Control+$alt+l exec xsecurelock + +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 --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 XF86AudioPause exec --no-startup-id mpc toggle + +# display clipboard contents via rofi +bindsym Control+$alt+h exec rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}' + +# kill active window +bindsym $mod+q kill +# reload i3 config +bindsym $mod+Shift+c reload +# restart i3 +bindsym $mod+Shift+r restart +# quit i3 +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+b bar mode hide +bindsym $mod+Shift+b bar mode dock + +# change window focus, vim binding +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right +# change window focus, arrows +bindsym $mod+Left focus left +bindsym $mod+Right focus right + +# move active window, vim binding +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right +# move active window, arrows +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 + +# bind up and down arrows to volume script +bindsym $mod+Up exec "~/bin/volume.sh up" +bindsym $mod+Down exec "~/bin/volume.sh down" +bindsym $mod+backslash exec "~/bin/volume.sh mtoggle" + +# $mod 0-9 to change 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 active containers to workspace number +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 diff --git a/conf.d/mode_audio.conf b/conf.d/mode_audio.conf new file mode 100644 index 0000000..ebe2fcd --- /dev/null +++ b/conf.d/mode_audio.conf @@ -0,0 +1,18 @@ +# switch to audio mode +bindsym $mod+m mode "audio" +# output chooser, outside of mode +bindsym $mod+o exec --no-startup-id rofi -show rofi-sound -modi "rofi-sound:~/.local/bin/rofi-sound-output-chooser" +mode "audio" { + bindsym m exec "~/bin/volume.sh mute" + bindsym j exec "~/bin/volume.sh down" + bindsym k exec "~/bin/volume.sh up" + bindsym t exec "~/bin/volume.sh mtoggle" + bindsym p exec "playerctl play-pause" + bindsym h exec "playerctl previous" + bindsym l exec "playerctl next" + bindsym o exec --no-startup-id rofi -show rofi-sound -modi "rofi-sound:~/.local/bin/rofi-sound-output-chooser" + + bindsym backslash exec "~/bin/volume.sh mtoggle" + bindsym Return mode "default" + bindsym Escape mode "default" +} diff --git a/conf.d/mode_brightness.conf b/conf.d/mode_brightness.conf new file mode 100644 index 0000000..23443fc --- /dev/null +++ b/conf.d/mode_brightness.conf @@ -0,0 +1,19 @@ +bindsym $mod+x mode "brightness" +mode "brightness" { + bindsym j exec "brightnessctl s +10%" + bindsym k exec "brightnessctl s 10%-" + bindsym 1 exec "brightnessctl s 10%" + bindsym 2 exec "brightnessctl s 20%" + bindsym 3 exec "brightnessctl s 30%" + bindsym 4 exec "brightnessctl s 40%" + bindsym 5 exec "brightnessctl s 50%" + bindsym 6 exec "brightnessctl s 60%" + bindsym 7 exec "brightnessctl s 70%" + bindsym 8 exec "brightnessctl s 80%" + bindsym 9 exec "brightnessctl s 90%" + bindsym 0 exec "brightnessctl s 1000%" + + + bindsym Return mode "default" + bindsym Escape mode "default" +} diff --git a/conf.d/mode_mouse.conf b/conf.d/mode_mouse.conf new file mode 100644 index 0000000..886e6be --- /dev/null +++ b/conf.d/mode_mouse.conf @@ -0,0 +1,10 @@ +# use keyboard as mouse with warpd +bindsym $mod+semicolon mode "mouse" +mode "mouse" { + bindsym x mode default, exec warpd --hint + bindsym c mode default, exec warpd --normal + bindsym g mode default, exec warpd --grid + + bindsym Return mode "default" + bindsym Escape mode "default" +} diff --git a/conf.d/mode_resize.conf b/conf.d/mode_resize.conf new file mode 100644 index 0000000..260211d --- /dev/null +++ b/conf.d/mode_resize.conf @@ -0,0 +1,25 @@ +# window resizing mode +bindsym $mod+r mode "resize" +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s 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" +} diff --git a/conf.d/mode_restore.conf b/conf.d/mode_restore.conf new file mode 100644 index 0000000..6763072 --- /dev/null +++ b/conf.d/mode_restore.conf @@ -0,0 +1,20 @@ +# Restore workspace mode. +bindsym $mod+n mode "restore" +mode "restore" { + bindsym 1 exec "i3-msg 'workspace $ws1; append_layout ~/.config/i3/layout/w1.json'" + bindsym 2 exec "i3-msg 'workspace $ws2; append_layout ~/.config/i3/layout/w2.json'" + bindsym 3 exec "i3-msg 'workspace $ws3; append_layout ~/.config/i3/layout/w3.json'" + bindsym 4 exec "i3-msg 'workspace $ws4; append_layout ~/.config/i3/layout/w4.json'" + bindsym 5 exec "i3-msg 'workspace $ws5; append_layout ~/.config/i3/layout/w5.json'" + bindsym 6 exec "i3-msg 'workspace $ws6; append_layout ~/.config/i3/layout/w6.json'" + bindsym 7 exec "i3-msg 'workspace $ws7; append_layout ~/.config/i3/layout/w7.json'" + bindsym 8 exec "i3-msg 'workspace $ws8; append_layout ~/.config/i3/layout/w8.json'" + bindsym 9 exec "i3-msg 'workspace $ws9; append_layout ~/.config/i3/layout/w9.json'" + bindsym 0 exec "i3-msg 'workspace $ws0; append_layout ~/.config/i3/layout/w10.json'" + + # Back to normal: Enter, Escape, or n + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym n mode "default" + bindsym $mod+n mode "default" +} diff --git a/conf.d/mode_save.conf b/conf.d/mode_save.conf new file mode 100644 index 0000000..c29d065 --- /dev/null +++ b/conf.d/mode_save.conf @@ -0,0 +1,20 @@ +# Save workspace mode. +bindsym $mod+s mode "save" +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" +} diff --git a/conf.d/prt_scr.conf b/conf.d/prt_scr.conf new file mode 100644 index 0000000..072ab80 --- /dev/null +++ b/conf.d/prt_scr.conf @@ -0,0 +1,10 @@ +# Screenshots +# Even though gnome-screenshot names are horrible, mimic them so the path matches +bindsym Print exec --no-startup-id maim "/home/$USER/Pictures/Screenshots/Screenshot from $(date +%Y-%m-%d_%H-%M-%S).png" +bindsym $mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) "/home/$USER/Pictures/Screenshots/Screenshot from $(date +%Y-%m-%d_%H-%M-%S).png" +bindsym Shift+Print exec --no-startup-id maim --select "/home/$USER/Pictures/Screenshots/Screenshot from $(date +%Y-%m-%d_%H-%M-%S).png" + +## Clipboard Screenshots +bindsym Ctrl+Print exec --no-startup-id maim | xclip -selection clipboard -t image/png +bindsym Ctrl+$mod+Print exec --no-startup-id maim --window $(xdotool getactivewindow) | xclip -selection clipboard -t image/png +bindsym Ctrl+Shift+Print exec --no-startup-id maim --select | xclip -selection clipboard -t image/png diff --git a/conf.d/window_rules.conf b/conf.d/window_rules.conf new file mode 100644 index 0000000..086a5c4 --- /dev/null +++ b/conf.d/window_rules.conf @@ -0,0 +1,6 @@ +# specify window display rules + +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