+ 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

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'