+ Edited shell config, separate hotkeys from qtile's config.py

This commit is contained in:
ziro 2020-04-13 10:49:01 +07:00
parent c732fd66cc
commit 03bd767041
6 changed files with 296 additions and 247 deletions

16
.bashrc
View file

@ -60,7 +60,7 @@ function _myps1() {
local __git_status='`parse_git_dirty`'
local __ps1end="\[\033[00m\]$> $__space"
local __dir="\[\033[38;5;7m\]\w"
PS1="$__name_hostname $__space$__dir$__git_branch $__ps1end"
PS1=" $__dir$__git_branch $__ps1end"
}
_myps1
@ -98,13 +98,15 @@ ex ()
fi
}
#Aliases
#Default
export EDITOR="nvim"
export BROWSER='firefox'
export TERMINAL='urxvt'
#Askpass
export SUDO_ASKPASS=/usr/bin/rofi-askpass
#XDG
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
@ -113,12 +115,20 @@ export XDG_CONFIG_HOME="$HOME/.config"
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
#Aliases
alias nano='nvim'
alias vim='nvim'
alias vi='nvim'
alias weather='curl wttr.in'
alias pac='sudo pacman'
alias pacS='sudo pacman -S'
alias pacSy='sudo pacman -Sy'
alias pacSyu='sudo pacman -Syu'
alias pacR='sudo pacman -R'
alias aur='yay'
alias aurS='yay -S'
alias aurSy='yay -Sy'
alias aurSyu='yay -Syu'
alias aurR='yay -R'
alias spotifyrip='spotify-ripper -u palembani@gmail.com'
alias xreload='xrdb ~/.Xresources'
alias ytv='youtube-viewer'
@ -134,12 +144,14 @@ alias cls='clear'
alias classprop='xprop WM_CLASS'
alias storagelist='lsblk -f'
alias ..='cd ..'
alias ...='cd ../..'
alias ls='exa --color=always'
alias ll='ls -alF'
alias l='ls -CF'
alias la='ls -a'
alias cfvim='vim $XDG_CONFIG_HOME/vim/vimrc'
alias cfbash='vim $HOME/.bashrc'
alias cfzsh='vim $HOME/.zshrc'
alias cfbsp='vim $XDG_CONFIG_HOME/bspwm/bspwmrc'
alias cfpoly='vim $XDG_CONFIG_HOME/polybar/config'
alias cfkeys='vim $XDG_CONFIG_HOME/sxhkd/sxhkdrc'

View file

@ -22,6 +22,7 @@ import os
import re
import socket
import subprocess
from keys import keys
from libqtile.config import Key, Screen, Group, Drag, Click, Match
from libqtile.command import lazy
from libqtile import layout, bar, widget, hook
@ -44,213 +45,10 @@ def dbus_register():
'string:' + id])
##### DEFINING SOME WINDOW FUNCTIONS #####
@lazy.function
def window_to_prev_group(qtile):
if qtile.currentWindow is not None:
i = qtile.groups.index(qtile.currentGroup)
qtile.currentWindow.togroup(qtile.groups[i - 1].name)
@lazy.function
def window_to_next_group(qtile):
if qtile.currentWindow is not None:
i = qtile.groups.index(qtile.currentGroup)
qtile.currentWindow.togroup(qtile.groups[i + 1].name)
##### LAUNCH APPS IN SPECIFIED GROUPS #####
def app_or_group(group, app):
def f(qtile):
if qtile.groupMap[group].windows:
qtile.groupMap[group].cmd_toscreen()
else:
qtile.groupMap[group].cmd_toscreen()
qtile.cmd_spawn(app)
return f
##### KEYBINDINGS #####
def init_keys():
keys = [
Key(
[mod, 'control'], 'q',
lazy.spawn('sh /home/ziro/.scripts/prompt')
),
Key(
[mod], "Return",
lazy.spawn(myTerm) # Open terminal
),
Key(
[mod], "Tab",
lazy.next_layout() # Toggle through layouts
),
Key(
[mod], "q",
lazy.window.kill() # Kill active window
),
Key(
[mod, "shift"], "r",
lazy.restart() # Restart Qtile
),
Key(
[mod, "shift"], "q",
lazy.shutdown() # Shutdown Qtile
),
Key([mod], "w",
lazy.to_screen(0) # Keyboard focus screen(0)
),
Key([mod], "e",
lazy.to_screen(1) # Keyboard focus screen(1)
),
Key([mod], "r",
lazy.to_screen(2) # Keyboard focus screen(2)
),
# Key([mod, "control"], "k",
# lazy.layout.section_up() # Move up a section in treetab
# ),
# Key([mod, "control"], "j",
# lazy.layout.section_down() # Move down a section in treetab
# ),
### Window controls
Key(
[mod], "k",
lazy.layout.down() # Switch between windows in current stack pane
),
Key(
[mod], "i",
lazy.layout.up() # Switch between windows in current stack pane
),
Key(
[mod], "j",
lazy.layout.left() # Switch between windows in current stack pane
),
Key(
[mod], "l",
lazy.layout.right() # Switch between windows in current stack pane
),
Key(
[mod, "shift"], "k",
lazy.layout.shuffle_down() # Move windows down in current stack
),
Key(
[mod, "shift"], "i",
lazy.layout.shuffle_up() # Move windows up in current stack
),
Key(
[mod, "shift"], "j",
lazy.layout.shuffle_left() # Move windows down in current stack
),
Key(
[mod, "shift"], "l",
lazy.layout.shuffle_right() # Move windows up in current stack
),
Key(
[mod, "shift"], "period",
lazy.layout.grow(), # Grow size of current window (XmonadTall)
lazy.layout.increase_nmaster(), # Increase number in master pane (Tile)
),
Key(
[mod, "shift"], "comma",
lazy.layout.shrink(), # Shrink size of current window (XmonadTall)
lazy.layout.decrease_nmaster(), # Decrease number in master pane (Tile)
),
Key(
[mod, "shift"], "Left", # Move window to workspace to the left
window_to_prev_group
),
Key(
[mod, "shift"], "Right",
window_to_next_group
),
Key(
[mod], "n",
lazy.layout.normalize()
),
Key(
[mod], "m",
lazy.layout.maximize()
),
Key(
[mod, "shift"], "p",
lazy.window.toggle_floating()
),
Key(
[mod, "shift"], "space",
lazy.layout.rotate(),
lazy.layout.flip()
),
### Stack controls
Key(
["mod1"], "space",
lazy.layout.next()
),
Key(
[mod, "control"], "Return",
lazy.layout.toggle_split()
),
### Dmenu Run Launcher
Key(
["mod4"], "space",
lazy.spawn("dmenu_run -fn 'Google Sans:size=8' -nb '#282a36' -nf '#ffffff' -sb '#00a8ff' -sf '#282a36' -p 'dmenu:'")
),
### Application Launch Shortcuts
Key(
[mod, "mod1"], "k",
lazy.spawn("passmenu")
),
Key(
[mod, "mod1"], "Print",
lazy.spawn("gnome-screenshot")
),
Key(
[mod, "mod1"], "p",
lazy.spawn("sh /home/ziro/.scripts/play.sh")
),
Key(
[mod, "mod1"], "m",
lazy.spawn("sh /home/ziro/.scripts/musicplayer.sh")
),
Key(
[mod, "mod1"], "v",
lazy.spawn("sh /home/ziro/.scripts/video.sh")
),
Key(
[mod, "mod1"], "c",
lazy.spawn(myTerm+" -e calcurse")
),
Key(
[mod, "mod1"], "u",
lazy.spawn("sh /home/ziro/.scripts/dmenumount")
),
Key(
[mod, "mod1"], "y",
lazy.spawn(myTerm+" -e youtube-viewer")
),
Key(
[mod, "mod1"], "b",
lazy.spawn("firefox")
),
Key(
[mod, "mod1"], "g",
lazy.spawn("/home/ziro/my\ Files/Gravit/GravitDesigner.AppImage")
),
Key(
[mod, "mod1"], "o",
lazy.spawn("obs")
),
#myCustom Stuff
Key(
[mod], "leftarrow",
lazy.screen.next_group()
),
Key(
[mod], "rightarrow",
lazy.screen.prev_group()
),
]
keys
return keys
##### BAR COLORS #####

208
.config/qtile/keys.py Executable file
View file

@ -0,0 +1,208 @@
from libqtile.config import key, screen, group, drag, click, match
from libqtile.command import lazy
mod = 'mod4'
mod = "mod4" # Sets mod key to SUPER/WINDOWS
myTerm = "urxvt" # My terminal of choice
myConfig = "/home/ziro/.config/qtile/config.py" # Qtile config file location
def app_or_group(group, app):
def f(qtile):
if qtile.groupMap[group].windows:
qtile.groupMap[group].cmd_toscreen()
else:
qtile.groupMap[group].cmd_toscreen()
qtile.cmd_spawn(app)
return f
@lazy.function
def window_to_prev_group(qtile):
if qtile.currentWindow is not None:
i = qtile.groups.index(qtile.currentGroup)
qtile.currentWindow.togroup(qtile.groups[i - 1].name)
@lazy.function
def window_to_next_group(qtile):
if qtile.currentWindow is not None:
i = qtile.groups.index(qtile.currentGroup)
qtile.currentWindow.togroup(qtile.groups[i + 1].name)
keys = [
Key(
[mod, 'control'], 'q',
lazy.spawn('sh /home/ziro/.scripts/prompt')
),
Key(
[mod], "Return",
lazy.spawn(myTerm) # Opn terminal
),
Key(
[mod], "Tab",
lazy.next_layout() # Toggle through layouts
),
Key(
[mod], "q",
lazy.window.kill() # Kill active window
),
Key(
[mod, "shift"], "r",
lazy.restart() # Restart Qtile
),
Key(
[mod, "shift"], "q",
lazy.shutdown() # Shutdown Qtile
),
Key([mod], "w",
lazy.to_screen(0) # Keyboard focus screen(0)
),
Key([mod], "e",
lazy.to_screen(1) # Keyboard focus screen(1)
),
Key([mod], "r",
lazy.to_screen(2) # Keyboard focus screen(2)
),
# Key([mod, "control"], "k",
# lazy.layout.section_up() # Move up a section in treetab
# ),
# Key([mod, "control"], "j",
# lazy.layout.section_down() # Move down a section in treetab
# ),
### Window controls
Key(
[mod], "k",
lazy.layout.down() # Switch between windows in current stack pane
),
Key(
[mod], "i",
lazy.layout.up() # Switch between windows in current stack pane
),
Key(
[mod], "j",
lazy.layout.left() # Switch between windows in current stack pane
),
Key(
[mod], "l",
lazy.layout.right() # Switch between windows in current stack pane
),
Key(
[mod, "shift"], "k",
lazy.layout.shuffle_down() # Move windows down in current stack
),
Key(
[mod, "shift"], "i",
lazy.layout.shuffle_up() # Move windows up in current stack
),
Key(
[mod, "shift"], "j",
lazy.layout.shuffle_left() # Move windows down in current stack
),
Key(
[mod, "shift"], "l",
lazy.layout.shuffle_right() # Move windows up in current stack
),
Key(
[mod, "shift"], "period",
lazy.layout.grow(), # Grow size of current window (XmonadTall)
lazy.layout.increase_nmaster(), # Increase number in master pane (Tile)
),
Key(
[mod, "shift"], "comma",
lazy.layout.shrink(), # Shrink size of current window (XmonadTall)
lazy.layout.decrease_nmaster(), # Decrease number in master pane (Tile)
),
Key(
[mod, "shift"], "Left", # Move window to workspace to the left
window_to_prev_group
),
Key(
[mod, "shift"], "Right",
window_to_next_group
),
Key(
[mod], "n",
lazy.layout.normalize()
),
Key(
[mod], "m",
lazy.layout.maximize()
),
Key(
[mod, "shift"], "p",
lazy.window.toggle_floating()
),
Key(
[mod, "shift"], "space",
lazy.layout.rotate(),
lazy.layout.flip()
),
### Stack controls
Key(
["mod1"], "space",
lazy.layout.next()
),
Key(
[mod, "control"], "Return",
lazy.layout.toggle_split()
),
### Dmenu Run Launcher
Key(
["mod4"], "space",
lazy.spawn("dmenu_run -fn 'Google Sans:size=8' -nb '#282a36' -nf '#ffffff' -sb '#00a8ff' -sf '#282a36' -p 'dmenu:'")
),
### Application Launch Shortcuts
Key(
[mod, "mod1"], "k",
lazy.spawn("passmenu")
),
Key(
[mod, "mod1"], "Print",
lazy.spawn("gnome-screenshot")
),
Key(
[mod, "mod1"], "p",
lazy.spawn("sh /home/ziro/.scripts/play.sh")
),
Key(
[mod, "mod1"], "m",
lazy.spawn("sh /home/ziro/.scripts/musicplayer.sh")
),
Key(
[mod, "mod1"], "v",
lazy.spawn("sh /home/ziro/.scripts/video.sh")
),
Key(
[mod, "mod1"], "c",
lazy.spawn(myTerm+" -e calcurse")
),
Key(
[mod, "mod1"], "u",
lazy.spawn("sh /home/ziro/.scripts/dmenumount")
),
Key(
[mod, "mod1"], "y",
lazy.spawn(myTerm+" -e youtube-viewer")
),
Key(
[mod, "mod1"], "b",
lazy.spawn("firefox")
),
Key(
[mod, "mod1"], "g",
lazy.spawn("/home/ziro/my\ Files/Gravit/GravitDesigner.AppImage")
),
Key(
[mod, "mod1"], "o",
lazy.spawn("obs")
),
#myCustom Stuff
Key(
[mod], "leftarrow",
lazy.screen.next_group()
),
Key(
[mod], "rightarrow",
lazy.screen.prev_group()
),
]

View file

@ -7,23 +7,29 @@ set viminfo+='1000,n$XDG_DATA_HOME/vim/viminfo
set runtimepath=$XDG_CONFIG_HOME/vim,$VIMRUNTIME,$XDG_CONFIG_HOME/vim/after
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"
"
set encoding=UTF-8
"
" - Mapping + Settings
noremap <C-y> "*y
noremap <C-p> "*p
noremap <C-Y> "+y
noremap <C-P> "+p
noremap <C-/> NERDCommenterToggle
noremap <C-/> :NERDCommenterToggle
:set mouse=a
autocmd FileType python map <buffer> <F9> :w<CR>:exec '!clear; python3' shellescape(@%, 1)<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!clear; python3' shellescape(@%, 1)<CR>
autocmd FileType python map <buffer> <F9> :w<CR>:!clear; python3 %<CR>
autocmd FileType python imap <buffer> <F9> <esc>:w<CR>:exec '!clear; python3 %'<CR>
set number
autocmd FileType plaintex command! -nargs=0 Lw w !pdflatex % > /dev/null
autocmd FileType tex command! -nargs=0 Lw w !pdflatex % > /dev/null
set ignorecase
set smartcase
map <C-n> :NERDTreeToggle<CR>
" Sw (sudo w) to save as root
command! -nargs=0 W w !sudo tee % > /dev/null
cmap w!! w !sudo tee > /dev/null %
" - Auto refresh vimrc
augroup myvimrc
@ -53,19 +59,22 @@ Plug 'autozimu/LanguageClient-neovim', {
\ }
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
"if has('nvim')
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
"else
" Plug 'Shougo/deoplete.nvim'
" Plug 'roxma/nvim-yarp'
" Plug 'roxma/vim-hug-neovim-rpc'
"endif
Plug 'preservim/nerdcommenter'
Plug 'ycm-core/YouCompleteMe'
Plug 'preservim/nerdtree'
Plug 'ryanoasis/vim-devicons'
call plug#end()
" - deoplete
let g:deoplete#enable_at_startup = 1
" - YouCompleteMe
let g:ycm_autoclose_preview_window_after_completion = 1
" - Powerline Integraton
let g:airline_powerline_fonts = 1
@ -75,7 +84,7 @@ let g:airline_theme='onedark'
" - Snippet
let g:UltiSnipsExpandTrigger="<Tab>"
let g:UltiSnipsJumpForwardTrigger="<Tab>"
let g:UltiSnipsExpandTrigger="<C-Tab>"
let g:UltiSnipsJumpForwardTrigger="<C-Tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
let g:UltiSnipsEditSplit="vertical"

View file

@ -1,5 +1,8 @@
#!/usr/bin/env bash
#sudo
alias sudo='sudo '
#vim
alias nano='nvim'
alias vim='nvim'
@ -39,6 +42,7 @@ alias classprop='xprop WM_CLASS'
alias storagelist='lsblk -f'
alias ..='cd ..'
alias ...='cd ../..'
alias q='exit'
alias ls='exa --color=always'
alias ll='ls -alF'
alias l='ls -CF'
@ -56,6 +60,9 @@ alias htop='htop -t'
alias rm='rm -i'
alias mv='mv -i'
alias cp='cp -i'
alias mntfd='sudo mount -o gid=users,fmask=113,dmask=002'
alias umntfd='sudo umount'
alias cmatrix='unimatrix -n -s 96 -l 'o''
#Git Aliases
alias gs='git status'

31
.zshrc
View file

@ -1,5 +1,7 @@
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# colors
autoload -U colors && colors
# XDG
export XDG_CACHE_HOME="$HOME/.cache"
@ -14,7 +16,8 @@ PATH="$HOME/.local/bin${PATH:+:${PATH}}"
# Path to your oh-my-zsh installation.
export ZSH="$XDG_DATA_HOME/oh-my-zsh"
export ZSH_CUSTOM="$ZSH"
export ZSH_CUSTOM="$ZSH/custom"
export PLUGINS="$XDG_DATA_HOME/zsh/plugins"
# History in cache directory
HISTFILE=~/.cache/zsh/zsh_history
@ -22,14 +25,15 @@ HISTSIZE=1000
SAVEHIST=1000
# Theme
ZSH_THEME="spaceship"
ZSH_THEME="zi"
# Plugins
plugins=(
git
)
source $ZSH/oh-my-zsh.sh
# Completion (from Luke Smith)
# Basic auto/tab complete:
autoload -U compinit
zstyle ':completion:*' menu select
zmodload zsh/complist
compinit
_comp_options+=(globdots) # Include hidden files.
# Default
if [[ -n $SSH_CONNECTION ]]; then
@ -46,5 +50,16 @@ export SUDO_ASKPASS=/usr/bin/rofi-askpass
#vim
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
#binding/alias
[ -f ~/.config/zsh/aliases ] && source ~/.config/zsh/aliases
# vi mode
#bindkey -v
#export KEYTIMEOUT=1
# Plugins
plugins=(
git
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh