From f5f69473d853c4370af2f0e7a41b0de66306a6ad Mon Sep 17 00:00:00 2001 From: binaryDiv Date: Mon, 22 Aug 2022 22:50:12 +0200 Subject: [PATCH] i3 config: Add new move&resize mode and stuff --- _local/roxy/.config/i3/config | 121 +++++++++++++++++++++++++--- _local/roxy/.config/i3status/config | 1 + 2 files changed, 113 insertions(+), 9 deletions(-) diff --git a/_local/roxy/.config/i3/config b/_local/roxy/.config/i3/config index 170c08c..ace7b26 100644 --- a/_local/roxy/.config/i3/config +++ b/_local/roxy/.config/i3/config @@ -5,6 +5,9 @@ # Host-specific config for: roxy # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# TODO: i3 finally supports includes! \o/ +# -> Split config file to shared and host specific stuff, unify configs + # COMMON VARIABLES # ~~~~~~~~~~~~~~~~ @@ -13,6 +16,10 @@ set $mod Mod4 # ~~ Define output displays (primary, secondary monitor) +# TODO: Use Xresources to reconfigure displays after dock changes: +# https://i3wm.org/docs/userguide.html#xresources +# Alternatively, use includes for this :) + #set $OUTPUT1 eDP-1 set $OUTPUT1 DP-1-3 set $OUTPUT2 DP-1-2 @@ -24,8 +31,9 @@ set $OUTPUT_RIGHT DP-1-2 #set $OUTPUT_RIGHT eDP-1 # Bedroom -#set $OUTPUT_LEFT eDP1 -#set $OUTPUT_CENTER DP1 +#set $OUTPUT_LEFT eDP-1 +#set $OUTPUT_CENTER DP-1 +#set $OUTPUT_RIGHT eDP-1 # GENERAL SETTINGS @@ -37,10 +45,16 @@ floating_modifier $mod # ~~ No auto focussing via mouseover focus_follows_mouse no +# ~~ When switching to the currently focused workspace, switch to the previous one +workspace_auto_back_and_forth yes + # APPEARANCE # ~~~~~~~~~~ +# ~~ Hide window borders on workspaces with only one window +hide_edge_borders smart + # ~~ Define font font pango:Liberation Sans 11 @@ -164,12 +178,82 @@ bindsym $mod+space focus mode_toggle bindsym $mod+f fullscreen toggle # ~~ Define resize mode -mode "resize" { - # Resize window with [hjkl] - bindsym h resize shrink width 10 px or 10 ppt - bindsym j resize grow height 10 px or 10 ppt - bindsym k resize shrink height 10 px or 10 ppt - bindsym l resize grow width 10 px or 10 ppt +mode "move & resize" { + # Set move and resize rates + set $MOVE_NORMAL 40 px + set $MOVE_SLOW 10 px + set $MOVE_FAST 120 px + set $RESIZE_NORMAL 40 px or 5 ppt + set $RESIZE_SLOW 10 px or 1 ppt + set $RESIZE_FAST 120 px or 10 ppt + + # Change window focus with mod key (like in regular mode) + bindsym Mod1+h focus left + bindsym Mod1+j focus down + bindsym Mod1+k focus up + bindsym Mod1+l focus right + + # Move focused window with Alt + hjkl + bindsym $mod+h move left $MOVE_NORMAL + bindsym $mod+j move down $MOVE_NORMAL + bindsym $mod+k move up $MOVE_NORMAL + bindsym $mod+l move right $MOVE_NORMAL + + # Move focused window faster with Shift + Alt + hjkl + bindsym $mod+Shift+h move left $MOVE_FAST + bindsym $mod+Shift+j move down $MOVE_FAST + bindsym $mod+Shift+k move up $MOVE_FAST + bindsym $mod+Shift+l move right $MOVE_FAST + + # Move focused window slower with Ctrl + Alt + hjkl + bindsym $mod+Ctrl+h move left $MOVE_SLOW + bindsym $mod+Ctrl+j move down $MOVE_SLOW + bindsym $mod+Ctrl+k move up $MOVE_SLOW + bindsym $mod+Ctrl+l move right $MOVE_SLOW + + # Resize window with hjkl + bindsym h resize shrink width $RESIZE_NORMAL + bindsym j resize grow height $RESIZE_NORMAL + bindsym k resize shrink height $RESIZE_NORMAL + bindsym l resize grow width $RESIZE_NORMAL + + # Resize window faster with Shift + hjkl + bindsym Shift+h resize shrink width $RESIZE_FAST + bindsym Shift+j resize grow height $RESIZE_FAST + bindsym Shift+k resize shrink height $RESIZE_FAST + bindsym Shift+l resize grow width $RESIZE_FAST + + # Resize window more precisely with Ctrl + hjkl + bindsym Ctrl+h resize shrink width $RESIZE_SLOW + bindsym Ctrl+j resize grow height $RESIZE_SLOW + bindsym Ctrl+k resize shrink height $RESIZE_SLOW + bindsym Ctrl+l resize grow width $RESIZE_SLOW + + # Set defined sizes for windows + bindsym 1 resize set width 25 ppt + bindsym 2 resize set width 33 ppt + bindsym 3 resize set width 50 ppt + bindsym 4 resize set width 67 ppt + bindsym 5 resize set width 75 ppt + bindsym 6 resize set width 100 ppt + + bindsym Shift+1 resize set height 25 ppt + bindsym Shift+2 resize set height 33 ppt + bindsym Shift+3 resize set height 50 ppt + bindsym Shift+4 resize set height 67 ppt + bindsym Shift+5 resize set height 75 ppt + bindsym Shift+6 resize set height 100 ppt + + bindsym $mod+1 resize set 25 ppt 25 ppt; move position center + bindsym $mod+2 resize set 33 ppt 33 ppt; move position center + bindsym $mod+3 resize set 50 ppt 50 ppt; move position center + bindsym $mod+4 resize set 67 ppt 67 ppt; move position center + bindsym $mod+5 resize set 75 ppt 75 ppt; move position center + bindsym $mod+6 resize set 95 ppt 95 ppt; move position center + + # Center window with c + bindsym c move position center + bindsym $mod+c move position center # Exit to default mode bindsym Return mode "default" @@ -177,7 +261,7 @@ mode "resize" { bindsym $mod+r mode "default" } -bindsym $mod+r mode "resize" +bindsym $mod+r mode "move & resize" # ~~ Picom: Change transparency of window with $mod + scroll wheel on window bar bindsym $mod+button4 exec --no-startup-id "picom-trans -c +10" @@ -334,6 +418,8 @@ for_window [workspace=$WS_com] floating enable assign [class="^(Water|Fire)fox$"] number $WS_www for_window [class="^(Water|Fire)fox$"] layout tabbed +# TODO: use "workspace_layout" tabbed for workspace 1? + # ~~ Thunderbird assign [class="^Thunderbird$"] number $WS_mail for_window [class="^Thunderbird$"] layout tabbed @@ -352,6 +438,10 @@ for_window [class="^Gajim$"] floating enable assign [class="^Zulip$"] number $WS_com for_window [class="^Zulip$"] floating enable +# ~~ Discord +assign [class="^discord$"] number $WS_com +for_window [class="^discord$"] floating enable + # ~~ VS Code for_window [class="^code-oss$"] layout tabbed @@ -362,6 +452,7 @@ for_window [class="^jetbrains-" title="Commit Changes"] floating disable # ~~ Steam for_window [class="^Steam$"] layout tabbed for_window [title="^Friends List"] floating disable +# TODO: use no_focus to avoid focus grabbing by the update window # ~~ Misc other apps for_window [class="^Pavucontrol$"] floating enable @@ -369,6 +460,13 @@ for_window [class="^Pavucontrol$"] floating enable # ~~ Flameshot for_window [class="^flameshot$"] floating enable +# ~~ Game development +#for_window [title="\(DEBUG\)$" instance="^(?!MultiplayerSpaceThing).*$"] floating enable + +# ~~ Others +# The Sims 4 Origin launcher +#for_window [class="^steam_app_1182480$"] floating enable + # DESKTOP AND APPLICATION KEYBINDINGS # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -392,6 +490,9 @@ bindsym Scroll_Lock exec --no-startup-id "volctl up" bindsym Shift+Scroll_Lock exec --no-startup-id "volctl up 1%" bindsym Pause exec --no-startup-id "volctl mute toggle" +# ~~ Autodetect screen layout +bindsym $mod+p exec --no-startup-id "autorandr -c -f" + # ~~ Toggling touchpad # TODO ? #bindsym XF86LaunchA exec --no-startup-id touchpad-toggle @@ -409,3 +510,5 @@ bindsym $mod+Print exec flameshot gui # ~~ Run background applications exec --no-startup-id redshift-gtk exec --no-startup-id nextcloud + +# TODO: Use exec_always to set keyboard layout etc.? diff --git a/_local/roxy/.config/i3status/config b/_local/roxy/.config/i3status/config index 1378a46..5e2dab8 100644 --- a/_local/roxy/.config/i3status/config +++ b/_local/roxy/.config/i3status/config @@ -87,6 +87,7 @@ cpu_temperature 0 { format_above_threshold = "🔥 %degrees °C" max_threshold = 70 #path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon1/temp1_input" + path = "/sys/class/thermal/thermal_zone5/temp" } # ~~ CPU average load