aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2018-03-31 20:24:53 -0700
committerJakob Odersky <jakob@odersky.com>2018-03-31 20:24:53 -0700
commit186501c9d9a78686ea492e48172c27d40e1a3f84 (patch)
treec6745923637e661884d11b0768f50fc6268b5b90
parent25ea926b955bde66f2618c591d05a4e77549fc91 (diff)
downloaddotfiles-186501c9d9a78686ea492e48172c27d40e1a3f84.tar.gz
dotfiles-186501c9d9a78686ea492e48172c27d40e1a3f84.tar.bz2
dotfiles-186501c9d9a78686ea492e48172c27d40e1a3f84.zip
Update i3 config
-rw-r--r--home/.config/i3/config2
-rwxr-xr-xhome/.config/i3/status/load13
-rwxr-xr-xhome/bin/open-project25
-rwxr-xr-xhome/bin/setup22
4 files changed, 44 insertions, 18 deletions
diff --git a/home/.config/i3/config b/home/.config/i3/config
index 84f52bd..f47247c 100644
--- a/home/.config/i3/config
+++ b/home/.config/i3/config
@@ -237,6 +237,7 @@ bindsym $mod+r mode "resize"
bindsym $mod+y exec ~/bin/passmenu --type, mode "default"
bindsym $mod+u exec emacsclient --alternate-editor='' --create-frame --no-wait , mode "default"
bindsym $mod+i exec google-chrome
+ bindsym $mod+p exec --no-startup-id ~/bin/open-project
bindsym $mod+Shift+i exec google-chrome --incognito
#
# Quick launch menu
@@ -265,6 +266,7 @@ bindsym $mod+r mode "resize"
bindsym 0 exec --no-startup-id ~/bin/setup mirror
bindsym 1 exec --no-startup-id ~/bin/setup single
bindsym 2 exec --no-startup-id ~/bin/setup double
+ bindsym 3 exec --no-startup-id ~/bin/setup triple
bindsym Return mode "default"
bindsym Escape mode "default"
}
diff --git a/home/.config/i3/status/load b/home/.config/i3/status/load
index 5518e2f..2701bce 100755
--- a/home/.config/i3/status/load
+++ b/home/.config/i3/status/load
@@ -24,17 +24,6 @@ awk -v cpus=$cpus -v cpuload=$load '
load_percent=(cpuload*100)/cpus
print cpuload
print cpuload
- if (load_percent < 10) {
- exit 0;
- } else if (load_percent < 50) {
- print "#00ff00";
- exit 0;
- } else if (load_percent < 80) {
- print "#ffff00";
- exit 0;
- } else {
- print "#ff0000";
- exit 0;
- }
+ exit 0
}
'
diff --git a/home/bin/open-project b/home/bin/open-project
new file mode 100755
index 0000000..bb98946
--- /dev/null
+++ b/home/bin/open-project
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+kind="$1"
+root="$HOME/src/driver"
+projects=$(find "$root" -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | sort)
+project=$(echo "$projects" | dmenu -p "Open project:")
+[ "$?" -eq 0 ] || exit 1
+dir=$(realpath "$root/$project")
+
+# Rename workspace
+i3-msg rename workspace to \
+ "$(i3-msg -t get_workspaces | jq '.[] | select(.focused==true).num'):$project" > /dev/null
+
+case "$kind" in
+ intellij|"")
+ idea "$dir" &
+ sakura -d "$dir" &
+ sakura -d "$dir" &
+ ;;
+ *)
+ echo "unknown project kind $kind"
+ exit 1
+esac
+
+#i3-msg "append_layout ~/layout.json; exec emacsclient --alternate-editor=\"\" --create-frame \"$dir\"; exec gnome-terminal --working-directory=\"$dir\" -x sh -c sbt; exec gnome-terminal --working-directory=\"$dir\""
diff --git a/home/bin/setup b/home/bin/setup
index c22c905..310b01e 100755
--- a/home/bin/setup
+++ b/home/bin/setup
@@ -1,25 +1,28 @@
#!/bin/bash
internal=eDP-1
-external=$(xrandr | grep -w connected | grep -v "$internal" | cut -d ' ' -f 1)
+externals=($(xrandr | grep -w connected | grep -v "$internal" | cut -d ' ' -f 1))
+
move_workspaces() {
local primary=$(i3-msg -t get_outputs | jq '.[]|select(.primary==true)|.name')
for workspace_number in $(i3-msg -t get_workspaces | jq .[].num); do
i3-msg workspace number "$workspace_number", move workspace to output "$primary"
done
- return 0
}
-export -f move_workspace
+# export -f move_workspace
case "$1" in
single)
- xrandr --output "$internal" --auto --primary --output "$external" --off
+ xrandr --output "$internal" --auto --primary
+ for external in "${externals[@]}"; do
+ xrandr --output "$external" --off
+ done
#xrandr --dpi 172
#gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <1>}"
;;
double)
- xrandr --output "$internal" --auto --output "$external" --auto --primary --above "$internal"
+ xrandr --output "$internal" --auto --output "${externals[0]}" --auto --primary --above "$internal"
# current_workspace="$(i3-msg -t get_workspaces \
# | jq '.[] | select(.focused==true).name' \
# | cut -d"\"" -f2)"
@@ -30,8 +33,14 @@ case "$1" in
#gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <1>}"
;;
+ triple)
+ xrandr \
+ --output "$internal" --auto \
+ --output "${externals[0]}" --auto --primary --above "$internal" \
+ --output "${externals[1]}" --auto --right-of "${externals[0]}" --rotate left
+ ;;
mirror)
- xrandr --output "$internal" --auto --output "$external" --auto --same-as "$internal"
+ xrandr --output "$internal" --primary --auto --output "${externals[0]}" --auto --scale-from 1920x1080
#gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gdk/WindowScalingFactor': <1>}"
;;
*)
@@ -41,6 +50,7 @@ case "$1" in
esac
xmodmap ~/.Xmodmap
+move_workspaces
i3-msg restart
exit 0