From 7bcfa26f515c8f82a49510834fda0f029e33f48f Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 23 Mar 2019 16:31:59 +0000 Subject: Support shared, device-specific i3 configurations Separated i3/configuration since some of my devices support XFree86 keysyms while others do not. This introduced some cascading changes. - Removed ~/.config/i3/config from this repo. Since I will be switching between devices semi-regularly and that file will be generated each time I switch to a different device running an X session, I don't want the i3/config to spam my `gst` and `gd` when I haven't changed configuration in either config.shared or config.device. - Update aliases, variables, etc. to point to config.shared instead of the generated file. - Ensure that X sessions generate the i3/config file. - Ensure that i3 reload and restart command generate the i3/config file. --- configs/shared/misc/.config/i3/config | 273 --------------------------- configs/shared/misc/.config/i3/config.shared | 256 +++++++++++++++++++++++++ configs/shared/misc/.config/nvim/init.vim | 2 +- 3 files changed, 257 insertions(+), 274 deletions(-) delete mode 100644 configs/shared/misc/.config/i3/config create mode 100644 configs/shared/misc/.config/i3/config.shared (limited to 'configs/shared/misc') diff --git a/configs/shared/misc/.config/i3/config b/configs/shared/misc/.config/i3/config deleted file mode 100644 index 564cfa969d65..000000000000 --- a/configs/shared/misc/.config/i3/config +++ /dev/null @@ -1,273 +0,0 @@ -set $mod Mod1 -set $super Mod4 - -# Keymapping philosophy: -# When I feel it's appropriate, I try to borrow existing KBDs from OSX or -# Windows. For example, I use Ctrl+Alt+Del to start the screen lock, since this -# is a really well-known KBD. One notable difference is that when I'm borrowing -# OSX KBDs, I prefer using Alt instead of Super since the keyboard that I'm -# using has the Alt key in the same location as the Super key on my mac -# keyboard. I could rebind this, and I just may. But for now, that's worth -# pointing out. -# The reason behind borrowing from Windows and OSX is that some of these -# keybindings are hardwired into my muscle memory. I also tend to work between -# Linux and OSX quite often. Since OSX is much more difficult to remap KBDs -# than it is in Linux, I prefer to support the OSX KBDs to reduce the number of -# KBDs my feeble memory needs to store. - -# 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 8 - -# Use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -# gaps -# gaps inner 20 -# gaps outer 0 -# smart_gaps on - -# KBD Principles: -# $mod+Ctrl+ = starting an application vertically -# $mod+Ctrl+Shift+ = starting an application horizontally -# where is a reserved character for a commonly used application. -# -# definitions: -# terminal = t, Return -# emacs = e -# chrome = c -# spotify = s -# -# Vertical -bindsym $mod+Ctrl+t split v; exec st -bindsym $mod+Ctrl+Return split v; exec st -bindsym $mod+Ctrl+e split v; exec emacsclient --create-frame ~/programming -bindsym $mod+Ctrl+c split v; exec google-chrome -bindsym $mod+Ctrl+s split v; exec spotify -# Horizontal -bindsym $mod+Ctrl+Shift+t split h; exec st -bindsym $mod+Ctrl+Shift+Return split h; exec st -bindsym $mod+Ctrl+Shift+e split h; exec emacsclient --create-frame ~/programming -bindsym $mod+Ctrl+Shift+c split h; exec google-chrome -bindsym $mod+Ctrl+Shift+s split h; exec spotify - -# audio controls -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% # MBP Volume Up -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% # MBP Volume Down -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle # MBP Mute -bindsym F12 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% # same Fn keys as MBP -bindsym F11 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% # same Fn keys as MBP -bindsym F10 exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle # same Fn keys as MBP - -# pass integration -bindsym $mod+Ctrl+backslash exec ~/.config/i3/passmenu # mirroring the 1password KBD - -# screen brightness controls -bindsym XF86MonBrightnessUp exec light -A 10 -bindsym XF86MonBrightnessDown exec light -U 10 - -# integrate with Emacs's org-mode -bindsym $mod+o exec zsh -i -c org_capture -for_window [class="GoogleEmacs" instance="org-protocol-capture"] floating enable - -# ensure Spotify windows float -for_window [class="Spotify"] floating enable - -# ensure wallpaper -exec --no-startup-id feh --bg-scale ~/.local/share/wallpaper/cartoon-outdoors.jpg - -# ensure system service that run through XDG start -exec dex -ae i3 - -# dmenu configuration -bindsym $mod+space exec --no-startup-id dmenu_run -bindsym $mod+t exec --no-startup-id ~/.config/i3/dmenu_timer.sh ~/.local/share/sounds/gong.mp3 - -# file manager -bindsym $mod+x exec st -e lf - -# music player kbds -bindsym F9 exec --no-startup-id playerctl next # same Fn keys as MBP -bindsym F8 exec --no-startup-id playerctl play-pause # same Fn keys as MBP -bindsym F7 exec --no-startup-id playerctl previous # same Fn keys as MBP - -# Screenshot -bindsym $mod+s exec zsh -i -c snipit -bindsym Ctrl+Print exec scrot ~/Pictures/screenshots/%b-%d-%Y_%T.png # Windows style -# TODO: debug -bindsym $mod+Print exec scrot --focused ~/Pictures/screenshots/%b-%d-%Y_%T.png # Windows style -bindsym $mod+Shift+3 exec scrot ~/Pictures/screenshots/%b-%d-%Y_%T.png # OSX style -# TODO: debug -bindsym $mod+Shift+4 exec scrot --select ~/Pictures/screenshots/%b-%d-%Y_%T.png # OSX style -# Integration with Google's screenshot hosting server - -# online documentation -bindsym $mod+Shift+slash exec google-chrome https://i3wm.org/docs/userguide.html - -# no title bars -for_window [class="^.*"] border pixel 2 - -# disable mouse hover focus -focus_follows_mouse no - -# kill focused window -bindsym $mod+q kill - -# GTK Themes -exec --no-startup-id gnome-settings-daemon - -# wireless selection mechanism -exec --no-startup-id nm-applet - -# lock the screen (Window's famous Ctrl-Alt-Delete) -bindsym $mod+Ctrl+Delete exec "/usr/share/goobuntu-desktop-files/xsecurelock.sh" -bindsym $mod+Shift+q exec "/usr/share/goobuntu-desktop-files/xsecurelock.sh" - -# sound applet -exec --no-startup-id gnome-sound-applet - -# change focus -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# move focused window -bindsym $mod+Shift+h move left 100 -bindsym $mod+Shift+j move down 100 -bindsym $mod+Shift+k move up 100 -bindsym $mod+Shift+l move right 100 - -# enable duplicating the current window vertically or horizontally -# bindsym $mod+- split v exec terminator -# bindsym $mod+\ split h exec terminator - -# enter fullscreen mode for the focused container -bindsym $mod+z fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $super+e layout toggle split -bindsym $super+s layout stacking -bindsym $super+t layout tabbed - -# toggle tiling / floating -bindsym $mod+Shift+f floating toggle - -# toggle stickiness -bindsym $mod+Shift+s sticky toggle - -# change focus between tiling / floating windows -bindsym $mod+f focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# Define names for default workspaces for which we configure key bindings later on. -# We use variables to avoid repeating the names in multiple places. -set $ws1 "1" -set $ws2 "2" -set $ws3 "3" -set $ws4 "4" -set $ws5 "5" -set $ws6 "6" -set $ws7 "7" -set $ws8 "8" -set $ws9 "9" -set $ws10 "10" - -# jump to workspace -bindsym $mod+1 workspace $ws1 -bindsym $mod+2 workspace $ws2 -bindsym $mod+3 workspace $ws3 -bindsym $mod+4 workspace $ws4 -bindsym $mod+5 workspace $ws5 -bindsym $mod+6 workspace $ws6 -bindsym $mod+7 workspace $ws7 -bindsym $mod+8 workspace $ws8 -bindsym $mod+9 workspace $ws9 -bindsym $mod+0 workspace $ws10 - -# move and follow focused container to workspace -bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 -bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 -# bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 # commented out to support screenshot KBD -# bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4 # commented out to support screenshot KBD -bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 -bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 -bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 -bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 -bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 -bindsym $mod+Shift+0 move container to workspace $ws10; workspace $ws10 - -# move focused container to workspace -bindsym $mod+Ctrl+1 move container to workspace $ws1 -bindsym $mod+Ctrl+2 move container to workspace $ws2 -bindsym $mod+Ctrl+3 move container to workspace $ws3 -bindsym $mod+Ctrl+4 move container to workspace $ws4 -bindsym $mod+Ctrl+5 move container to workspace $ws5 -bindsym $mod+Ctrl+6 move container to workspace $ws6 -bindsym $mod+Ctrl+7 move container to workspace $ws7 -bindsym $mod+Ctrl+8 move container to workspace $ws8 -bindsym $mod+Ctrl+9 move container to workspace $ws9 -bindsym $mod+Ctrl+0 move container to workspace $ws10 - -# reload, restart i3 -bindsym $super+r reload -bindsym $super+Shift+r restart - - -# resize window (you can also use the mouse for that) -mode "resize" { - bindsym h resize shrink width 10 px or 10 ppt - bindsym j resize shrink height 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize grow width 10 px or 10 ppt - bindsym Return mode "default" - bindsym Caps_Lock mode "default" - bindsym $mod+Shift+r mode "default" -} -bindsym $mod+Shift+r mode "resize" - -# passthrough mode to support Emacs, Tmux, Vim KBDs for window and pane management -mode "passthrough" { - bindsym $mod+Escape mode "default" -} -bindsym $mod+Escape mode "passthrough" - -# Atom One Dark colors -set $black #1e2127 -set $red #e06c75 -set $green #98c379 -set $yellow #d19a66 -set $blue #61afef -set $magenta #c678dd -set $cyan #56b6c2 -set $white #abb2bf -set $bright_black #5c6370 -set $bright_red #e06c75 -set $bright_green #98c379 -set $bright_yellow #d19a66 -set $bright_white #ffffff -set $bright_blue #61afef -set $bright_magenta #c678dd -set $bright_cyan #56b6c2 -set $selection #3a3f4b - -# class # border # bg # text #indicator #child_border -client.focused $red $red $red $red $bright_cyan -client.focused_inactive $red $red $red $red $black -client.unfocused $red $red $red $red $black - -bar { - status_command i3status - position top - colors { - background $black - statusline $white - separator $yellow - focused_workspace $black $black $bright_cyan - active_workspace $red $bright_blue $blue - inactive_workspace $black $black $bright_black - urgent_workspace $bright_black $black $magenta - } -} diff --git a/configs/shared/misc/.config/i3/config.shared b/configs/shared/misc/.config/i3/config.shared new file mode 100644 index 000000000000..6e2c96ae0931 --- /dev/null +++ b/configs/shared/misc/.config/i3/config.shared @@ -0,0 +1,256 @@ +# Keymapping philosophy: +# When I feel it's appropriate, I try to borrow existing KBDs from OSX or +# Windows. For example, I use Ctrl+Alt+Del to start the screen lock, since this +# is a really well-known KBD. One notable difference is that when I'm borrowing +# OSX KBDs, I prefer using Alt instead of Super since the keyboard that I'm +# using has the Alt key in the same location as the Super key on my mac +# keyboard. I could rebind this, and I just may. But for now, that's worth +# pointing out. +# The reason behind borrowing from Windows and OSX is that some of these +# keybindings are hardwired into my muscle memory. I also tend to work between +# Linux and OSX quite often. Since OSX is much more difficult to remap KBDs +# than it is in Linux, I prefer to support the OSX KBDs to reduce the number of +# KBDs my feeble memory needs to store. + +set $mod Mod1 +set $super Mod4 + +# 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 8 + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# gaps +# gaps inner 20 +# gaps outer 0 +# smart_gaps on + +# KBD Principles: +# $mod+Ctrl+ = starting an application vertically +# $mod+Ctrl+Shift+ = starting an application horizontally +# where is a reserved character for a commonly used application. +# +# definitions: +# terminal = t, Return +# emacs = e +# chrome = c +# spotify = s +# +# Vertical +bindsym $mod+Ctrl+t split v; exec st +bindsym $mod+Ctrl+Return split v; exec st +bindsym $mod+Ctrl+e split v; exec emacsclient --create-frame ~/programming +bindsym $mod+Ctrl+c split v; exec google-chrome +bindsym $mod+Ctrl+s split v; exec spotify +# Horizontal +bindsym $mod+Ctrl+Shift+t split h; exec st +bindsym $mod+Ctrl+Shift+Return split h; exec st +bindsym $mod+Ctrl+Shift+e split h; exec emacsclient --create-frame ~/programming +bindsym $mod+Ctrl+Shift+c split h; exec google-chrome +bindsym $mod+Ctrl+Shift+s split h; exec spotify + +# pass integration +bindsym $mod+Ctrl+backslash exec ~/.config/i3/passmenu # mirroring the 1password KBD + +# integrate with Emacs's org-mode +bindsym $mod+o exec zsh -i -c org_capture +for_window [class="GoogleEmacs" instance="org-protocol-capture"] floating enable + +# ensure Spotify windows float +for_window [class="Spotify"] floating enable + +# ensure wallpaper +exec --no-startup-id feh --bg-scale ~/.local/share/wallpaper/cartoon-outdoors.jpg + +# ensure system service that run through XDG start +exec dex -ae i3 + +# dmenu configuration +bindsym $mod+space exec --no-startup-id dmenu_run +bindsym $mod+t exec --no-startup-id ~/.config/i3/dmenu_timer.sh ~/.local/share/sounds/gong.mp3 + +# file manager +bindsym $mod+n exec st -e lf + +# Screenshot +bindsym $mod+Shift+4 exec zsh -i -c snipit +bindsym Ctrl+Print exec scrot ~/Pictures/screenshots/%b-%d-%Y_%T.png # Windows style +bindsym $mod+Shift+3 exec scrot ~/Pictures/screenshots/%b-%d-%Y_%T.png # OSX style +# TODO: debug +# bindsym $mod+Print exec scrot --focused ~/Pictures/screenshots/%b-%d-%Y_%T.png # Windows style +# TODO: debug +# bindsym $mod+Shift+4 exec scrot --select ~/Pictures/screenshots/%b-%d-%Y_%T.png # OSX style +# Integration with Google's screenshot hosting server + +# online documentation +bindsym $mod+Shift+slash exec google-chrome https://i3wm.org/docs/userguide.html + +# no title bars +for_window [class="^.*"] border pixel 2 + +# disable mouse hover focus +focus_follows_mouse no + +# kill focused window +bindsym $mod+q kill + +# GTK Themes +exec --no-startup-id gnome-settings-daemon + +# wireless selection mechanism +exec --no-startup-id nm-applet + +# lock the screen (Window's famous Ctrl-Alt-Delete) +bindsym $mod+Ctrl+Delete exec "/usr/share/goobuntu-desktop-files/xsecurelock.sh" +bindsym $mod+Shift+q exec "/usr/share/goobuntu-desktop-files/xsecurelock.sh" + +# sound applet +exec --no-startup-id gnome-sound-applet + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# move focused window +bindsym $mod+Shift+h move left 100 +bindsym $mod+Shift+j move down 100 +bindsym $mod+Shift+k move up 100 +bindsym $mod+Shift+l move right 100 + +# enable duplicating the current window vertically or horizontally +# bindsym $mod+- split v exec terminator +# bindsym $mod+\ split h exec terminator + +# enter fullscreen mode for the focused container +bindsym $mod+z fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $super+e layout toggle split +bindsym $super+s layout stacking +bindsym $super+t layout tabbed + +# toggle tiling / floating +bindsym $mod+Shift+f floating toggle + +# toggle stickiness +bindsym $mod+Shift+s sticky toggle + +# change focus between tiling / floating windows +bindsym $mod+f focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# jump to workspace +bindsym $mod+1 workspace $ws1 +bindsym $mod+2 workspace $ws2 +bindsym $mod+3 workspace $ws3 +bindsym $mod+4 workspace $ws4 +bindsym $mod+5 workspace $ws5 +bindsym $mod+6 workspace $ws6 +bindsym $mod+7 workspace $ws7 +bindsym $mod+8 workspace $ws8 +bindsym $mod+9 workspace $ws9 +bindsym $mod+0 workspace $ws10 + +# move and follow focused container to workspace +bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1 +bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2 +# bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3 # commented out to support screenshot KBD +# bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4 # commented out to support screenshot KBD +bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5 +bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6 +bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7 +bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8 +bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9 +bindsym $mod+Shift+0 move container to workspace $ws10; workspace $ws10 + +# move focused container to workspace +bindsym $mod+Ctrl+1 move container to workspace $ws1 +bindsym $mod+Ctrl+2 move container to workspace $ws2 +bindsym $mod+Ctrl+3 move container to workspace $ws3 +bindsym $mod+Ctrl+4 move container to workspace $ws4 +bindsym $mod+Ctrl+5 move container to workspace $ws5 +bindsym $mod+Ctrl+6 move container to workspace $ws6 +bindsym $mod+Ctrl+7 move container to workspace $ws7 +bindsym $mod+Ctrl+8 move container to workspace $ws8 +bindsym $mod+Ctrl+9 move container to workspace $ws9 +bindsym $mod+Ctrl+0 move container to workspace $ws10 + +# reload, restart i3 +bindsym $super+r exec cat ~/.config/i3/config.shared ~/.config/i3/config.device >~/.config/i3/config; reload +bindsym $super+Shift+r exec cat ~/.config/i3/config.shared ~/.config/i3/config.device >~/.config/i3/config; restart + + +# resize window (you can also use the mouse for that) +mode "resize" { + bindsym h resize shrink width 10 px or 10 ppt + bindsym j resize shrink height 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize grow width 10 px or 10 ppt + bindsym Return mode "default" + bindsym Caps_Lock mode "default" + bindsym $mod+Shift+r mode "default" +} +bindsym $mod+Shift+r mode "resize" + +# passthrough mode to support Emacs, Tmux, Vim KBDs for window and pane management +mode "passthrough" { + bindsym $mod+Escape mode "default" +} +bindsym $mod+Escape mode "passthrough" + +# Atom One Dark colors +set $black #1e2127 +set $red #e06c75 +set $green #98c379 +set $yellow #d19a66 +set $blue #61afef +set $magenta #c678dd +set $cyan #56b6c2 +set $white #abb2bf +set $bright_black #5c6370 +set $bright_red #e06c75 +set $bright_green #98c379 +set $bright_yellow #d19a66 +set $bright_white #ffffff +set $bright_blue #61afef +set $bright_magenta #c678dd +set $bright_cyan #56b6c2 +set $selection #3a3f4b + +# class # border # bg # text #indicator #child_border +client.focused $red $red $red $red $bright_cyan +client.focused_inactive $red $red $red $red $black +client.unfocused $red $red $red $red $black + +bar { + status_command i3status + position top + colors { + background $black + statusline $white + separator $yellow + focused_workspace $black $black $bright_cyan + active_workspace $red $bright_blue $blue + inactive_workspace $black $black $bright_black + urgent_workspace $magenta $black $magenta + } +} diff --git a/configs/shared/misc/.config/nvim/init.vim b/configs/shared/misc/.config/nvim/init.vim index 148341a2c2ef..6e4122b40d39 100644 --- a/configs/shared/misc/.config/nvim/init.vim +++ b/configs/shared/misc/.config/nvim/init.vim @@ -267,7 +267,7 @@ nnoremap ea :vsplit ~/aliases.zsh nnoremap ef :vsplit ~/functions.zsh nnoremap el :vsplit ~/variables.zsh nnoremap ex :vsplit ~/.Xresources -nnoremap ei :vsplit ~/.config/i3/config +nnoremap ei :vsplit ~/.config/i3/config.shared " quickly source your vimrc nnoremap sv :source $MYVIMRC -- cgit 1.4.1