1
0
mirror of https://github.com/balkian/dotfiles.git synced 2024-11-23 04:32:29 +00:00

Several improvements.

* Tmux is not started by default anymore
* Added functions for i3 - Awesome!!
* zsh to start tmux
This commit is contained in:
J. Fernando Sánchez 2013-07-12 19:19:52 +02:00
parent a134c2210f
commit 7bbcb17419
9 changed files with 117 additions and 34 deletions

View File

@ -42,7 +42,7 @@ URxvt.scrollBar: false
! Perl extensions
URxvt.perl-ext-common: default,matcher
URxvt.matcher.button: 1
URxvt.urlLauncher: google-chrome
URxvt.url-launcher: google-chrome
! Cursor
URxvt.cursorBlink: true

View File

@ -1,7 +1,7 @@
#!/bin/zsh
python2 $HOME/.bin/i3-wm-scripts/nextmatch.py urxvt
python2 $HOME/.bin/i3-wm-scripts/nextmatch.py tmux
if [ $? -gt 0 ]; then
urxvt & sleep 0.1 && python2 $HOME/.bin/i3-wm-scripts/nextmatch.py urxvt
urxvt -e tmux attach & sleep 0.1 && python2 $HOME/.bin/i3-wm-scripts/nextmatch.py tmux
fi
if [ "$#" -gt 0 ]; then
eval "tmux neww"

61
bin/i3-winmenu.py Executable file
View File

@ -0,0 +1,61 @@
#!/usr/bin/env python
# dmenu script to jump to windows in i3.
#
# using ziberna's i3-py library: https://github.com/ziberna/i3-py
# depends: dmenu (vertical patch), i3.
# released by joepd under WTFPLv2-license:
# http://sam.zoy.org/wtfpl/COPYING
#
# edited by Jure Ziberna for i3-py's examples section
import i3
import subprocess
def i3clients():
"""
Returns a dictionary of key-value pairs of a window text and window id.
Each window text is of format "[workspace] window title (instance number)"
"""
clients = {}
for ws_num in range(1, 11):
workspace = i3.filter(num=ws_num)
if not workspace:
continue
workspace = workspace[0]
windows = i3.filter(workspace, nodes=[])
instances = {}
# Adds windows and their ids to the clients dictionary
for window in windows:
win_str = '[%s] %s' % (workspace['name'], window['name'])
# Appends an instance number if other instances are present
if win_str in instances:
instances[win_str] += 1
win_str = '%s (%d)' % (win_str, instances[win_str])
else:
instances[win_str] = 1
clients[win_str] = window['id']
return clients
def win_menu(clients, l=10):
"""
Displays a window menu using dmenu. Returns window id.
"""
dmenu = subprocess.Popen(['/usr/bin/dmenu', '-i', '-l', str(l),
'-fn', '"-*-cure-medium-*-*-*-11-*-*-*-*-*-*-*"',
'-nb', '#101010', '-nf', '#5f5f5f', '-sb', '#191919',
'-sf', '#b72f62'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
menu_str = '\n'.join(sorted(clients.keys()))
# Popen.communicate returns a tuple stdout, stderr
win_str = dmenu.communicate(menu_str.encode('utf-8'))[0].decode('utf-8')\
.rstrip()
return clients.get(win_str, None)
if __name__ == '__main__':
clients = i3clients()
win_id = win_menu(clients)
if win_id:
i3.focus(con_id=win_id)

View File

@ -21,12 +21,14 @@ floating_modifier $mod
#/exec
# start a terminal
bindsym $mod+Return exec i3-one-tmux
bindsym Control+Mod1+t exec urxvt
# start lock
bindsym Control+Mod1+l exec i3lock
bindsym Control+Mod1+l exec i3lock -c 000000 -t -i ~/Pictures/Wallpapers/Game\ Over\ Hacker.png
bindsym Control+Mod1+w exec i3-one-instance google-chrome
bindsym Control+Mod1+g exec i3-one-instance gvim
bindsym $mod+o exec i3-winmenu.py
bindsym Control+Mod1+f exec pcmanfm
# Spotify
@ -34,6 +36,11 @@ bindsym XF86AudioPlay exec spotify-remote.py -a playPause
bindsym XF86AudioNext exec spotify-remote.py -a next
bindsym XF86AudioPrev exec spotify-remote.py -a previous
# Volume
bindsym XF86AudioRaiseVolume exec volume-up.sh
bindsym XF86AudioLowerVolume exec volume-down.sh
bindsym XF86AudioMute exec volume-toggle-mute.sh
# kill focused window
bindsym $mod+q kill
@ -96,29 +103,29 @@ bindsym $mod+a focus parent
bindsym $mod+d focus child
# 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+1 workspace 1: Term
bindsym $mod+2 workspace 2: Web
bindsym $mod+3 workspace 3: Edit
bindsym $mod+4 workspace 4: Viewer
bindsym $mod+5 workspace 5: Files
bindsym $mod+6 workspace 6: Music
bindsym $mod+7 workspace 7: Chat
bindsym $mod+8 workspace 8: Misc Big
bindsym $mod+9 workspace 9: Misc Small
bindsym $mod+0 workspace number 10
bindsym $mod+Control+h workspace prev
bindsym $mod+Control+l workspace next
# move focused container to workspace
bindsym $mod+Shift+exclam move container to workspace number 1
bindsym $mod+Shift+at move container to workspace number 2
bindsym $mod+Shift+numbersign move container to workspace number 3
bindsym $mod+Shift+dollar move container to workspace number 4
bindsym $mod+Shift+percent move container to workspace number 5
bindsym $mod+Shift+asciicircum move container to workspace number 6
bindsym $mod+Shift+ampersand move container to workspace number 7
bindsym $mod+Shift+asterisk move container to workspace number 8
bindsym $mod+Shift+parenleft move container to workspace number 9
bindsym $mod+Shift+exclam move container to workspace 1: Term
bindsym $mod+Shift+at move container to workspace 2: Web
bindsym $mod+Shift+numbersign move container to workspace 3: Edit
bindsym $mod+Shift+dollar move container to workspace 4: Viewer
bindsym $mod+Shift+percent move container to workspace 5: Files
bindsym $mod+Shift+asciicircum move container to workspace 6: Music
bindsym $mod+Shift+ampersand move container to workspace 7: Chat
bindsym $mod+Shift+asterisk move container to workspace 8: Misc Big
bindsym $mod+Shift+parenleft move container to workspace 9: Misc Small
bindsym $mod+Shift+parenright move container to workspace number 10
# reload the configuration file
@ -186,11 +193,13 @@ client.urgent #2f343a #101010 #93a1a1 #900000
for_window [class="^Google-chrome$"] border none
assign [class="Google-chrome" window_role="browser"] 2: Web
for_window [class="^URxvt$"] border 1px
assign [class="^URxvt$"] 1: Term
assign [title="^tmux$"] 1: Term
assign [class="^Gvim$"] 3: Edit
assign [class="^Evince$"] 4: Viewer
assign [class="^Spotify$"] 6: Music
assign [class="^Audacious$"] 6: Music
assign [class="^Audacious$"] 6: Music
assign [class="^Xchat$"] 7: Chat
workspace "1: Term" output DP1
workspace "2: Web" output DP1
@ -198,7 +207,13 @@ workspace "3: Edit" output DP1
workspace "4: Viewer" output eDP1
workspace "5: Files" output eDP1
workspace "6: Music" output eDP1
workspace "7: Misc Big" output DP1
workspace "8: Misc Small" output eDP1
workspace "7: Chat" output eDP1
workspace "8: Misc Big" output DP1
workspace "9: Misc Small" output eDP1
exec --no-startup-id nm-applet
exec --no-startup-id dropbox start
exec --no-startup-id volti
exec --no-startup-id clipit
exec xautolock -time 10 -locker 'i3lock -t -c 000000 -i ~/Pictures/Wallpapers/Game\ Over\ Hacker.png' &
exec urxvt -e tmux attach

9
not_dots/clipboard Normal file
View File

@ -0,0 +1,9 @@
#! /usr/bin/perl
# /usr/lib/urxvt/perl/clipboard
sub on_sel_grab {
my $query=quotemeta $_[0]->selection;
$query=~ s/\n/\\n/g;
$query=~ s/\r/\\r/g;
system( "echo " . $query . " | xsel -i -b -p" );
}

View File

@ -1,3 +1,4 @@
#!/bin/zsh
# TMUX
# if [[ -z "$KONSOLE_DBUS_SERVICE" & `which tmux` ]]; then
# if no session is started, start a new session

View File

@ -19,10 +19,6 @@ bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# use vim motion keys while in copy mode
setw -g mode-keys vi
# use the vim resize keys.
@ -83,8 +79,9 @@ unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-selection
bind-key -t vi-copy C-v rectangle-toggle
unbind C-s
# copy tmux buffer to clipboard
#bind-key Y save-buffer ~/.tmux/buffer \; run-shell "xsel -i -p <~/.tmux/buffer && rm ~/.tmux/buffer"

2
vimrc
View File

@ -76,7 +76,7 @@ noremap \ ,
" noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
" noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
"
imap <C-v> <C-O>"+gp
imap <C-v> <C-O>"+gP
noremap <C-S> :w<CR>
imap <C-S> <C-O>:w<CR>

2
zshrc
View File

@ -2,7 +2,7 @@ export PATH="$PATH:$HOME/.bin/"
# Only update the path if not running interactively
[ -z "$PS1" ] && return
source ~/.starttmux
#source ~/.starttmux
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh