diff --git a/home/linux/i3/config b/home/linux/i3/config index 9a91192c..f6e6ae63 100644 --- a/home/linux/i3/config +++ b/home/linux/i3/config @@ -45,7 +45,7 @@ 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 +bindsym $mod+0 workspace $ws0 # switch to workspace with numpad keys bindcode $mod+87 workspace 1 @@ -57,7 +57,7 @@ bindcode $mod+85 workspace 6 bindcode $mod+79 workspace 7 bindcode $mod+80 workspace 8 bindcode $mod+81 workspace 9 -bindcode $mod+90 workspace 10 +bindcode $mod+90 workspace 0 # move focused container to workspace 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+8 move container to workspace $ws8 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): 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) 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 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)%" @@ -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+m exec ~/.config/i3/scripts/restore-idols-monitor.sh + + ########################################## # configuration for workspace behaviour: # ########################################## # 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" +set $ws1 "1: " +set $ws2 "2: " +# visual studio code +set $ws3 "3: " +set $ws4 "4: " +set $ws5 "5: " +set $ws6 "6: " +set $ws7 "7: " +set $ws8 "8:" +set $ws9 "9:" +set $ws0 "10: " # use workspaces on different 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 exec_always --no-startup-id autotiling -# Autostart apps as you like -exec --no-startup-id sleep 1 && Terminal +exec --no-startup-id i3-msg "workspace $ws1; exec alacritty" +exec --no-startup-id i3-msg "workspace $ws2; exec firefox" + +exec --no-startup-id ~/.config/i3/scripts/restore-idols-monitor.sh ################## # floating rules # diff --git a/home/linux/i3/default.nix b/home/linux/i3/default.nix index 2f68976b..8ab078d1 100644 --- a/home/linux/i3/default.nix +++ b/home/linux/i3/default.nix @@ -18,6 +18,10 @@ recursive = true; executable = true; # make all scripts executable }; + home.file.".config/i3/layouts" = { + source = ./layouts; + recursive = true; + }; # rofi is a application launcher and dmenu replacement home.file.".config/rofi" = { diff --git a/home/linux/i3/i3blocks.conf b/home/linux/i3/i3blocks.conf index ebd56811..b713e229 100644 --- a/home/linux/i3/i3blocks.conf +++ b/home/linux/i3/i3blocks.conf @@ -65,6 +65,11 @@ border_bottom=0 border_left=0 +[cpu_stats] +full_text= +command=~/.config/i3/scripts/restore-idols-monitor.sh + + [cpu_stats] command=(mpstat 1 1 | grep Average | awk '{ printf "%04.1f%", (100 - $12) }') && (sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*' -o | awk '{ printf "%s°C\n", $2 }') interval=2 diff --git a/home/linux/i3/layouts/README.md b/home/linux/i3/layouts/README.md new file mode 100644 index 00000000..c087a93f --- /dev/null +++ b/home/linux/i3/layouts/README.md @@ -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. diff --git a/home/linux/i3/layouts/idols-monitor.json b/home/linux/i3/layouts/idols-monitor.json new file mode 100644 index 00000000..cf956469 --- /dev/null +++ b/home/linux/i3/layouts/idols-monitor.json @@ -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" + } + ] +} \ No newline at end of file diff --git a/home/linux/i3/scripts/README.md b/home/linux/i3/scripts/README.md old mode 100644 new mode 100755 diff --git a/home/linux/i3/scripts/restore-idols-monitor.sh b/home/linux/i3/scripts/restore-idols-monitor.sh new file mode 100755 index 00000000..cb28d5a5 --- /dev/null +++ b/home/linux/i3/scripts/restore-idols-monitor.sh @@ -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'"