From 0ff8f3030e7237922525cb0634dea8cae5514195 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 1 Feb 2016 14:40:21 -0500 Subject: [PATCH] Use Rofi for workspace management, simplify config --- .config/i3/config | 12 +++++------- .config/i3/get_workspace_options.py | 10 ---------- .config/i3/go_to_workspace.py | 6 ------ .config/i3/move_to_workspace.sh | 9 +++++++++ .config/i3/switch_workspace.sh | 9 +++++++++ 5 files changed, 23 insertions(+), 23 deletions(-) delete mode 100755 .config/i3/get_workspace_options.py delete mode 100755 .config/i3/go_to_workspace.py create mode 100755 .config/i3/move_to_workspace.sh create mode 100755 .config/i3/switch_workspace.sh diff --git a/.config/i3/config b/.config/i3/config index 3df3e33..8c5fadc 100644 --- a/.config/i3/config +++ b/.config/i3/config @@ -34,11 +34,7 @@ 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 - -set $rofiOptions -i -bg '#222222' -fg '#cccccc' -fg-active '#ffffff' - bindsym $mod+p exec --no-startup-id ~/.bin/killPanel.sh -bindsym $mod+space exec --no-startup-id "rofi $rofiOptions -modi 'drun,run,workspace:/home/adam/.bin/i3_switch_workspace.sh,window' -sidebar-mode -show drun" mode "launch" { bindsym e exec /home/adam/.bin/emacsclient-tmpFix; mode "default" @@ -50,9 +46,11 @@ mode "launch" { } bindsym $mod+x mode "launch" -# 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 +# Rofi +set $rofiOptions -i -bg '#222222' -fg '#cccccc' -fg-active '#ffffff' -modi 'drun,run,sworkspace:/home/adam/.config/i3/switch_workspace.sh,mworkspace:/home/adam/.config/i3/move_to_workspace.sh,window' -sidebar-mode +bindsym $mod+space exec --no-startup-id "rofi $rofiOptions -show drun" +bindsym $mod+t exec --no-startup-id "rofi $rofiOptions -show sworkspace" +bindsym $mod+Shift+t exec --no-startup-id "rofi $rofiOptions -show mworkspace" bindsym $mod+n exec ~/.config/i3/rename_workspace.sh # Brighness Control diff --git a/.config/i3/get_workspace_options.py b/.config/i3/get_workspace_options.py deleted file mode 100755 index 52a8ce2..0000000 --- a/.config/i3/get_workspace_options.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/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 deleted file mode 100755 index 9155794..0000000 --- a/.config/i3/go_to_workspace.py +++ /dev/null @@ -1,6 +0,0 @@ -#!/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/move_to_workspace.sh b/.config/i3/move_to_workspace.sh new file mode 100755 index 0000000..3119282 --- /dev/null +++ b/.config/i3/move_to_workspace.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -z "$1" ] +then + i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n +else + i3-msg move to workspace "$1" 1>2 +fi + diff --git a/.config/i3/switch_workspace.sh b/.config/i3/switch_workspace.sh new file mode 100755 index 0000000..c147b9f --- /dev/null +++ b/.config/i3/switch_workspace.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ -z "$1" ] +then + i3-msg -t get_workspaces | tr ',' '\n' | grep "name" | sed 's/"name":"\(.*\)"/\1/g' | sort -n +else + i3-msg workspace "$1" 1>2 +fi +