From 8dbd2cb9a267340531799ccfae69ba4e00d62f5c Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sun, 6 Sep 2015 10:21:17 -0400 Subject: [PATCH] Initial commit --- .config/i3/config | 241 ++++++++++++++++++++++++++++ .config/i3/get_workspace_options.py | 10 ++ .config/i3/go_to_workspace.py | 6 + .config/i3/rename_workspace.sh | 13 ++ 4 files changed, 270 insertions(+) create mode 100644 .config/i3/config create mode 100755 .config/i3/get_workspace_options.py create mode 100755 .config/i3/go_to_workspace.py create mode 100755 .config/i3/rename_workspace.sh diff --git a/.config/i3/config b/.config/i3/config new file mode 100644 index 0000000..b23d3da --- /dev/null +++ b/.config/i3/config @@ -0,0 +1,241 @@ +# i3 config file (v4) +# +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +## Startup Applications ## +exec --no-startup-id ~/.fehbg +exec --no-startup-id xfce4-panel -d +exec --no-startup-id nm-applet +exec --no-startup-id redshift-gtk -l 43:-72 +exec --no-startup-id insync start +exec --no-startup-id syncthing-gtk +exec --no-startup-id start-pulseaudio-x11 && sleep 10 && volumeicon +exec --no-startup-id xss-lock -l /home/adam/.bin/i3lock-wrapper.sh +exec --no-startup-id udiskie --tray -2 +exec --no-startup-id caffeine +exec --no-startup-id thunderbird + +# keyboard settings +exec --no-startup-id setxkbmap -option 'ctrl:nocaps' +exec --no-startup-id setxkbmap -option "shift:both_capslock" + +#exec --no-startup-id compton --backend glx --vsync opengl + +# $mod variable for use later +set $mod Mod4 + +## Keybindings! ## +bindsym $mod+Return exec mate-terminal # start a terminal +bindsym $mod+e exec /home/adam/.bin/emacsclient-tmpFix # start emacs +bindsym $mod+Shift+e exec thunderbird + +bindsym Mod1+Mod4+s exec /home/adam/.bin/lock.sh suspend # suspend +bindsym Mod1+Control+l exec /home/adam/.bin/lock.sh lock # lock screen +bindsym Mod1+Control+Delete exec /home/adam/.bin/lock.sh pick # power menu + +bindsym $mod+space exec --no-startup-id j4-dmenu-desktop --dmenu="rofi -dmenu -i -bg '#222' -fg '#ccc' -fg-active '#fff' -p 'Apps:'" # start rofi with only .desktop files +bindsym $mod+d exec --no-startup-id rofi -show run -bg '#222' -fg '#ccc' -fg-active '#fff' # start rofi +bindsym $mod+p exec --no-startup-id ~/.bin/killPanel.sh + +# Workspace Mangement +bindsym $mod+t exec ~/.config/i3/get_workspace_options.py | dmenu -i -dim 0.7 | ~/.config/i3/go_to_workspace.py +bindsym $mod+Shift+t exec ~/.config/i3/get_workspace_options.py | dmenu -i -dim 0.7 | ~/.config/i3/move_to_workspace.py +bindsym $mod+n exec ~/.config/i3/rename_workspace.sh + +# Brighness Control +bindsym XF86MonBrightnessUp exec light -A 10 +bindsym XF86MonBrightnessDown exec light -U 10 +bindsym Mod1+XF86MonBrightnessUp exec light -A 1 +bindsym Mod1+XF86MonBrightnessDown exec light -U 1 + +# Screen Rotation +bindsym $mod+Mod1+Down exec /home/adam/.bin/rotate.sh 0 +bindsym $mod+Mod1+Right exec /home/adam/.bin/rotate.sh 1 +bindsym $mod+Mod1+Up exec /home/adam/.bin/rotate.sh 2 +bindsym $mod+Mod1+Left exec /home/adam/.bin/rotate.sh 3 + +## Actual i3 Config ## + +# Floating windows +for_window [class="Wrapper-1.0"] floating enable + +# Font for window titles. +font pango:DejaVu Sans Mono 10 + +# i3 options +focus_follows_mouse false +new_window pixel 2 +workspace_auto_back_and_forth yes +focus_on_window_activation urgent + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# kill focused window +bindsym $mod+Shift+q kill + +# toggle border style +bindsym $mod+b border toggle + +# change focus +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+semicolon focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+semicolon move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+Shift+s layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+Control+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +bindsym $mod+z focus child + +bindsym $mod+Tab workspace back_and_forth + +# bind workspaces 1-10 to monitor 1, 11-20 to monitor 2 +workspace 1 output LVDS-0 +workspace 2 output LVDS-0 +workspace 3 output LVDS-0 +workspace 4 output LVDS-0 +workspace 5 output LVDS-0 +workspace 6 output LVDS-0 +workspace 7 output LVDS-0 +workspace 8 output LVDS-0 +workspace 9 output LVDS-0 +workspace 10 output LVDS-0 + +workspace 11 output DP-0 +workspace 12 output DP-0 +workspace 13 output DP-0 +workspace 14 output DP-0 +workspace 15 output DP-0 +workspace 16 output DP-0 +workspace 17 output DP-0 +workspace 18 output DP-0 +workspace 19 output DP-0 +workspace 20 output DP-0 + +# switch to workspace +bindsym $mod+1 workspace number 1 +bindsym $mod+2 workspace number 2 +bindsym $mod+3 workspace number 3 +bindsym $mod+4 workspace number 4 +bindsym $mod+5 workspace number 5 +bindsym $mod+6 workspace number 6 +bindsym $mod+7 workspace number 7 +bindsym $mod+8 workspace number 8 +bindsym $mod+9 workspace number 9 +bindsym $mod+0 workspace number 10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number 1 +bindsym $mod+Shift+2 move container to workspace number 2 +bindsym $mod+Shift+3 move container to workspace number 3 +bindsym $mod+Shift+4 move container to workspace number 4 +bindsym $mod+Shift+5 move container to workspace number 5 +bindsym $mod+Shift+6 move container to workspace number 6 +bindsym $mod+Shift+7 move container to workspace number 7 +bindsym $mod+Shift+8 move container to workspace number 8 +bindsym $mod+Shift+9 move container to workspace number 9 +bindsym $mod+Shift+0 move container to workspace number 10 + +# switch to workspace set 2 +bindsym $mod+Mod1+1 workspace number 11 +bindsym $mod+Mod1+2 workspace number 12 +bindsym $mod+Mod1+3 workspace number 13 +bindsym $mod+Mod1+4 workspace number 14 +bindsym $mod+Mod1+5 workspace number 15 +bindsym $mod+Mod1+6 workspace number 16 +bindsym $mod+Mod1+7 workspace number 17 +bindsym $mod+Mod1+8 workspace number 18 +bindsym $mod+Mod1+9 workspace number 19 +bindsym $mod+Mod1+0 workspace number 20 + +# move focused container to workspace set 2 +bindsym $mod+Mod1+Shift+1 move container to workspace number 11 +bindsym $mod+Mod1+Shift+2 move container to workspace number 12 +bindsym $mod+Mod1+Shift+3 move container to workspace number 13 +bindsym $mod+Mod1+Shift+4 move container to workspace number 14 +bindsym $mod+Mod1+Shift+5 move container to workspace number 15 +bindsym $mod+Mod1+Shift+6 move container to workspace number 16 +bindsym $mod+Mod1+Shift+7 move container to workspace number 17 +bindsym $mod+Mod1+Shift+8 move container to workspace number 18 +bindsym $mod+Mod1+Shift+9 move container to workspace number 19 +bindsym $mod+Mod1+Shift+0 move container to workspace number 20 + + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +#bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +# resize window +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym semicolon resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +#bar { +# status_command i3status +#} diff --git a/.config/i3/get_workspace_options.py b/.config/i3/get_workspace_options.py new file mode 100755 index 0000000..52a8ce2 --- /dev/null +++ b/.config/i3/get_workspace_options.py @@ -0,0 +1,10 @@ +#!/usr/bin/python3 +import subprocess +import json + +test = subprocess.Popen(["i3-msg","-t","get_workspaces"], stdout=subprocess.PIPE) +output = test.communicate()[0] +data = json.loads(output.decode()) +data = sorted(data, key=lambda k: k['name']) +for i in data: + print(i['name']) \ No newline at end of file diff --git a/.config/i3/go_to_workspace.py b/.config/i3/go_to_workspace.py new file mode 100755 index 0000000..9155794 --- /dev/null +++ b/.config/i3/go_to_workspace.py @@ -0,0 +1,6 @@ +#!/usr/bin/python3 +import subprocess +import sys + +data = sys.stdin.readlines()[0] +test = subprocess.Popen(["i3-msg","workspace "+data], stdout=subprocess.PIPE) \ No newline at end of file diff --git a/.config/i3/rename_workspace.sh b/.config/i3/rename_workspace.sh new file mode 100755 index 0000000..a34389a --- /dev/null +++ b/.config/i3/rename_workspace.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +num=`i3-msg -t get_workspaces | jq 'map(select(.focused == true))[0].num'` +i3-input -F "rename workspace to \"$num:%s\"" -P 'New name: ' + +name=`i3-msg -t get_workspaces | jq 'map(select(.focused == true))[0].name'` +# If empty name was set +echo "$name" +if [[ "$name" =~ ^\"[0-9]+:\ *\"$ ]] +then + # Remove trailing comma and whitespace + i3-msg "rename workspace to \"$num\"" +fi