mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-10 22:52:41 +02:00
feat: save i3 layout and auto load it
This commit is contained in:
+21
-21
@@ -45,7 +45,7 @@ bindsym $mod+6 workspace $ws6
|
|||||||
bindsym $mod+7 workspace $ws7
|
bindsym $mod+7 workspace $ws7
|
||||||
bindsym $mod+8 workspace $ws8
|
bindsym $mod+8 workspace $ws8
|
||||||
bindsym $mod+9 workspace $ws9
|
bindsym $mod+9 workspace $ws9
|
||||||
bindsym $mod+0 workspace $ws10
|
bindsym $mod+0 workspace $ws0
|
||||||
|
|
||||||
# switch to workspace with numpad keys
|
# switch to workspace with numpad keys
|
||||||
bindcode $mod+87 workspace 1
|
bindcode $mod+87 workspace 1
|
||||||
@@ -57,7 +57,7 @@ bindcode $mod+85 workspace 6
|
|||||||
bindcode $mod+79 workspace 7
|
bindcode $mod+79 workspace 7
|
||||||
bindcode $mod+80 workspace 8
|
bindcode $mod+80 workspace 8
|
||||||
bindcode $mod+81 workspace 9
|
bindcode $mod+81 workspace 9
|
||||||
bindcode $mod+90 workspace 10
|
bindcode $mod+90 workspace 0
|
||||||
|
|
||||||
# move focused container to workspace
|
# move focused container to workspace
|
||||||
bindsym $mod+Shift+1 move container to workspace $ws1
|
bindsym $mod+Shift+1 move container to workspace $ws1
|
||||||
@@ -69,7 +69,7 @@ bindsym $mod+Shift+6 move container to workspace $ws6
|
|||||||
bindsym $mod+Shift+7 move container to workspace $ws7
|
bindsym $mod+Shift+7 move container to workspace $ws7
|
||||||
bindsym $mod+Shift+8 move container to workspace $ws8
|
bindsym $mod+Shift+8 move container to workspace $ws8
|
||||||
bindsym $mod+Shift+9 move container to workspace $ws9
|
bindsym $mod+Shift+9 move container to workspace $ws9
|
||||||
bindsym $mod+Shift+0 move container to workspace $ws10
|
bindsym $mod+Shift+0 move container to workspace $ws0
|
||||||
|
|
||||||
# resize window (you can also use the mouse for that):
|
# resize window (you can also use the mouse for that):
|
||||||
bindsym $mod+r mode "resize"
|
bindsym $mod+r mode "resize"
|
||||||
@@ -100,12 +100,6 @@ bindsym $mod+Shift+c reload
|
|||||||
# restart i3 inplace (preserves your layout/session, can be used to update i3)
|
# restart i3 inplace (preserves your layout/session, can be used to update i3)
|
||||||
bindsym $mod+Shift+r restart
|
bindsym $mod+Shift+r restart
|
||||||
|
|
||||||
# keybinding in fancy rofi (automated):
|
|
||||||
bindsym F1 exec ~/.config/i3/scripts/keyhint-2
|
|
||||||
# alternative
|
|
||||||
# keybinding list in editor:
|
|
||||||
# bindsym $mod+F1 exec xed ~/.config/i3/keybindings
|
|
||||||
|
|
||||||
# Backlight control
|
# Backlight control
|
||||||
bindsym XF86MonBrightnessUp exec xbacklight +10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
|
bindsym XF86MonBrightnessUp exec xbacklight +10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
|
||||||
bindsym XF86MonBrightnessDown exec xbacklight -10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
|
bindsym XF86MonBrightnessDown exec xbacklight -10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
|
||||||
@@ -191,22 +185,26 @@ bindsym Print exec scrot ~/%Y-%m-%d-%T-screenshot.png && notify-send "Screenshot
|
|||||||
bindsym $mod+Shift+p exec ~/.config/i3/scripts/power-profiles
|
bindsym $mod+Shift+p exec ~/.config/i3/scripts/power-profiles
|
||||||
|
|
||||||
|
|
||||||
|
bindsym $mod+Shift+m exec ~/.config/i3/scripts/restore-idols-monitor.sh
|
||||||
|
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# configuration for workspace behaviour: #
|
# configuration for workspace behaviour: #
|
||||||
##########################################
|
##########################################
|
||||||
|
|
||||||
# Define names for default workspaces for which we configure key bindings later on.
|
# Define names for default workspaces for which we configure key bindings later on.
|
||||||
# We use variables to avoid repeating the names in multiple places.
|
# We use variables to avoid repeating the names in multiple places.
|
||||||
set $ws1 "1:"
|
set $ws1 "1: "
|
||||||
set $ws2 "2:"
|
set $ws2 "2: "
|
||||||
set $ws3 "3:"
|
# visual studio code
|
||||||
set $ws4 "4:"
|
set $ws3 "3: "
|
||||||
set $ws5 "5:"
|
set $ws4 "4: "
|
||||||
set $ws6 "6"
|
set $ws5 "5: "
|
||||||
set $ws7 "7"
|
set $ws6 "6: "
|
||||||
set $ws8 "8"
|
set $ws7 "7: "
|
||||||
set $ws9 "9"
|
set $ws8 "8:"
|
||||||
set $ws10 "10"
|
set $ws9 "9:"
|
||||||
|
set $ws0 "10: "
|
||||||
|
|
||||||
# use workspaces on different displays:
|
# use workspaces on different displays:
|
||||||
# where you have to replace VGA-0/HDMI-0 with the names for your displays
|
# where you have to replace VGA-0/HDMI-0 with the names for your displays
|
||||||
@@ -282,8 +280,10 @@ exec --no-startup-id flameshot
|
|||||||
# https://github.com/nwg-piotr/autotiling
|
# https://github.com/nwg-piotr/autotiling
|
||||||
exec_always --no-startup-id autotiling
|
exec_always --no-startup-id autotiling
|
||||||
|
|
||||||
# Autostart apps as you like
|
exec --no-startup-id i3-msg "workspace $ws1; exec alacritty"
|
||||||
exec --no-startup-id sleep 1 && Terminal
|
exec --no-startup-id i3-msg "workspace $ws2; exec firefox"
|
||||||
|
|
||||||
|
exec --no-startup-id ~/.config/i3/scripts/restore-idols-monitor.sh
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# floating rules #
|
# floating rules #
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
recursive = true;
|
recursive = true;
|
||||||
executable = true; # make all scripts executable
|
executable = true; # make all scripts executable
|
||||||
};
|
};
|
||||||
|
home.file.".config/i3/layouts" = {
|
||||||
|
source = ./layouts;
|
||||||
|
recursive = true;
|
||||||
|
};
|
||||||
|
|
||||||
# rofi is a application launcher and dmenu replacement
|
# rofi is a application launcher and dmenu replacement
|
||||||
home.file.".config/rofi" = {
|
home.file.".config/rofi" = {
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ border_bottom=0
|
|||||||
border_left=0
|
border_left=0
|
||||||
|
|
||||||
|
|
||||||
|
[cpu_stats]
|
||||||
|
full_text=
|
||||||
|
command=~/.config/i3/scripts/restore-idols-monitor.sh
|
||||||
|
|
||||||
|
|
||||||
[cpu_stats]
|
[cpu_stats]
|
||||||
command=(mpstat 1 1 | grep Average | awk '{ printf "%04.1f<span color=\"#ff5555\">%</span>", (100 - $12) }') && (sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*' -o | awk '{ printf "%s<span color=\"#ff5555\">°C</span>\n", $2 }')
|
command=(mpstat 1 1 | grep Average | awk '{ printf "%04.1f<span color=\"#ff5555\">%</span>", (100 - $12) }') && (sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*' -o | awk '{ printf "%s<span color=\"#ff5555\">°C</span>\n", $2 }')
|
||||||
interval=2
|
interval=2
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# I3 Layouts
|
||||||
|
|
||||||
|
This directory contains the layouts for i3.
|
||||||
|
|
||||||
|
The are generated using the `i3-save-tree` command, and need to customized to make it work.
|
||||||
|
|
||||||
|
See the [i3 user guide](https://i3wm.org/docs/layout-saving.html) for more information.
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
// vim:ts=4:sw=4:et
|
||||||
|
{
|
||||||
|
// splitv split container with 2 children
|
||||||
|
"border": "pixel",
|
||||||
|
"floating": "auto_off",
|
||||||
|
"layout": "splitv",
|
||||||
|
"marks": [],
|
||||||
|
"percent": 0.5,
|
||||||
|
"type": "con",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"border": "pixel",
|
||||||
|
"current_border_width": 2,
|
||||||
|
"floating": "auto_off",
|
||||||
|
"geometry": {
|
||||||
|
"height": 600,
|
||||||
|
"width": 800,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"marks": [],
|
||||||
|
"name": "Alacritty",
|
||||||
|
"percent": 0.5,
|
||||||
|
"swallows": [
|
||||||
|
{
|
||||||
|
"class": "^Alacritty$",
|
||||||
|
"instance": "^Alacritty$",
|
||||||
|
"machine": "^ai$",
|
||||||
|
"title": "^ai$"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "con"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"border": "pixel",
|
||||||
|
"current_border_width": 2,
|
||||||
|
"floating": "auto_off",
|
||||||
|
"geometry": {
|
||||||
|
"height": 600,
|
||||||
|
"width": 800,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"marks": [],
|
||||||
|
"name": "Alacritty",
|
||||||
|
"percent": 0.5,
|
||||||
|
"swallows": [
|
||||||
|
{
|
||||||
|
"class": "^Alacritty$",
|
||||||
|
"instance": "^Alacritty$",
|
||||||
|
"machine": "^ai$",
|
||||||
|
"title": "^ruby$"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "con"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// splitv split container with 2 children
|
||||||
|
"border": "pixel",
|
||||||
|
"floating": "auto_off",
|
||||||
|
"layout": "splitv",
|
||||||
|
"marks": [],
|
||||||
|
"percent": 0.5,
|
||||||
|
"type": "con",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"border": "pixel",
|
||||||
|
"current_border_width": 2,
|
||||||
|
"floating": "auto_off",
|
||||||
|
"geometry": {
|
||||||
|
"height": 600,
|
||||||
|
"width": 800,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"marks": [],
|
||||||
|
"name": "Alacritty",
|
||||||
|
"percent": 0.5,
|
||||||
|
"swallows": [
|
||||||
|
{
|
||||||
|
"class": "^Alacritty$",
|
||||||
|
"instance": "^Alacritty$",
|
||||||
|
"machine": "^ai$",
|
||||||
|
"title": "^aquamarine$"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "con"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"border": "pixel",
|
||||||
|
"current_border_width": 2,
|
||||||
|
"floating": "auto_off",
|
||||||
|
"geometry": {
|
||||||
|
"height": 600,
|
||||||
|
"width": 800,
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"marks": [],
|
||||||
|
"name": "Alacritty",
|
||||||
|
"percent": 0.5,
|
||||||
|
"swallows": [
|
||||||
|
{
|
||||||
|
"class": "^Alacritty$",
|
||||||
|
"instance": "^Alacritty$",
|
||||||
|
"machine": "^ai$",
|
||||||
|
"title": "^kana$"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "con"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Regular → Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# load the ssh key for idols first
|
||||||
|
ssh-add ~/.ssh/ai-idols
|
||||||
|
|
||||||
|
# restore the layout of workspace 1
|
||||||
|
i3-msg "workspace 10: ; append_layout ~/.config/i3/layouts/idols-monitor.json"
|
||||||
|
# open applications, note that --command must be the last option
|
||||||
|
i3-msg -t command "exec alacritty --title 'ai' --command 'btop'"
|
||||||
|
i3-msg -t command "exec alacritty --title 'aquamarine' --command ssh -t ryan@aquamarine 'btop'"
|
||||||
|
i3-msg -t command "exec alacritty --title 'ruby' --command ssh -t ryan@ruby 'btop'"
|
||||||
|
i3-msg -t command "exec alacritty --title 'kana' --command ssh -t ryan@kana 'btop'"
|
||||||
Reference in New Issue
Block a user