From 582b43c27830ad48f789b212190fd3d33415f221 Mon Sep 17 00:00:00 2001 From: lanxu Date: Tue, 3 Jul 2018 23:04:46 +0300 Subject: [PATCH] Updated dotfiles with new vimrc and restic config. Added hubic cloud config. --- .config/awesome/hubic.lua | 23 ++++ .config/awesome/lanxu/cloudstatus.lua | 80 +++++++++++++ .config/awesome/rc.lua | 8 +- .config/awesome/widgets.lua | 15 ++- .vimrc | 156 ++++++-------------------- .zshrc | 2 +- 6 files changed, 157 insertions(+), 127 deletions(-) create mode 100644 .config/awesome/hubic.lua create mode 100644 .config/awesome/lanxu/cloudstatus.lua diff --git a/.config/awesome/hubic.lua b/.config/awesome/hubic.lua new file mode 100644 index 0000000..50b01d9 --- /dev/null +++ b/.config/awesome/hubic.lua @@ -0,0 +1,23 @@ +-- {{{ Grab environment +local setmetatable = setmetatable +-- }}} + +local temp = {}; + +-- {{{ Date widget type +local function worker(format, warg) + + local f = io.popen("hubic.py") + + temp[0] = ""; + for line in f:lines() do + temp[0] = temp[0] .. line + end + + io.close(f) + + return temp +end +-- }}} + +return setmetatable(temp, { __call = function(_, ...) return worker(...) end }) diff --git a/.config/awesome/lanxu/cloudstatus.lua b/.config/awesome/lanxu/cloudstatus.lua new file mode 100644 index 0000000..ce5b585 --- /dev/null +++ b/.config/awesome/lanxu/cloudstatus.lua @@ -0,0 +1,80 @@ +local naughty = require("naughty") +local wibox = require("wibox") +local gears = require("gears") +local focused = require("awful.screen").focused +local easy_async = require("awful.spawn").easy_async + +local function factory(args) + local args = args or {} + local timeout = args.timeout or 5 + local status_cmd = args.status_cmd or "hubic status" + local full_cmd = args.full_cmd or "hubic status" + local cloud = { widget = wibox.widget.textbox() } + local settings = args.settings or function() end + local followtag = args.followtag or true + local notification_preset = args.notification_preset or { font = "Monospace 10" } + + cloud.widget:set_markup("N/A") + + function cloud.show(tout) + cloud.hide() + + if followtag then + notification_preset.screen = focused() + end + + cloud.notification = naughty.notify({ + text = cloud.notification_text, + -- icon = cloud.icon + timeout = 0, + preset = notification_preset, + }) + end + + function cloud.hide() + if cloud.notification then + naughty.destroy(cloud.notification) + end + end + + function cloud.attach(obj) + obj:connect_signal("mouse::enter", function() + cloud.show() + end) + + obj:connect_signal("mouse::leave", function() + cloud.hide() + end) + + obj:connect_signal("button::press", function() + cloud.update() + cloud.show() + end) + end + + function cloud.update() + local cmd = string.format(full_cmd) + easy_async(cmd, function(response, stderr, reason, exit_code) + local res = string.match(response, 'State: (.-)Up') + res = res:gsub("%s+", "") + res = string.gsub(res, "%s+", "") + currentstatus = res or "No" + cloud.notification_text = response + widget = cloud.widget + settings() + end) + end + + cloud.attach(cloud.widget) + gears.timer { + timeout = timeout, + autostart = true, + callback = cloud.update + } + + cloud.update() + + return cloud +end + +return factory diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 617ae26..6e0fec6 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -256,6 +256,8 @@ awful.screen.connect_for_each_screen(function(s) spacer, mydpmsstatus, spacer, + mycloudstatus, + spacer, mycpu, spacer, mymem, @@ -592,9 +594,9 @@ awful.rules.rules = { properties = { screen = primary_screen, tag = "GFX" } }, { rule = { class = "Blender" }, properties = { screen = primary_screen, tag = "GFX" } }, - { rule = { class = "Steam", name = "Friends" }, - properties = { screen = secondary_screen, tag = "Other", width = 200 } }, - { rule = { class = "Steam" }, + { rule = { class = "Steam", name = "Friends List" }, + properties = { screen = secondary_screen, tag = "Other", width = 300 } }, + { rule = { class = "Steam", name = "Steam" }, properties = { screen = secondary_screen, tag = "Other" } }, } -- }}} diff --git a/.config/awesome/widgets.lua b/.config/awesome/widgets.lua index 88c77f4..65b7c01 100644 --- a/.config/awesome/widgets.lua +++ b/.config/awesome/widgets.lua @@ -1,4 +1,5 @@ local gputemp = require("gputemp") +local hubic = require("hubic") local dpmsstatus = require("dpmsstatus") local lain = require("lain") local vicious = require("vicious") -- Custom @@ -41,6 +42,10 @@ mymem = lain.widget.mem({ mygputemp = wibox.widget.textbox() vicious.register(mygputemp, gputemp, create_markup("GPU", "$0", "℃", valuecolor), 15, "AMD") +-- Hubic +myhubic = wibox.widget.textbox() +vicious.register(myhubic, hubic, create_markup("CLOUD", "$0", "", valuecolor), 15, "HUBIC") + -- Volume volume = lain.widget.pulse({ scallback = function() @@ -65,7 +70,8 @@ lain.widget.calendar({ }) -- CPU temperature -local tempfile = "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A03:00/device:14/ATK0110:00/hwmon/hwmon1/temp1_input" +local tempfile = "/sys/bus/pci/drivers/k10temp/0000:00:18.3/hwmon/hwmon2/temp1_input" + if file_exists(tempfile) == false then tempfile = "/sys/class/thermal/thermal_zone0/temp" end @@ -107,3 +113,10 @@ myserverstatus = mcstatus({ end }) +local cloudstatus = require("lanxu/cloudstatus") +mycloudstatus = cloudstatus({ + settings = function() + widget.markup = create_markup("CLOUD", currentstatus, "", valuecolor) + end +}) + diff --git a/.vimrc b/.vimrc index 57760f7..5bd4e1d 100644 --- a/.vimrc +++ b/.vimrc @@ -3,18 +3,18 @@ " Start plugins call plug#begin('~/.vim/plugged') +" Sensible defaults +Plug 'tpope/vim-sensible' + " Javascript Plug 'heavenshell/vim-jsdoc', {'for': 'javascript'} -"Plug 'moll/vim-node', {'for': 'javascript'} Plug 'sheerun/vim-polyglot' " C/C++ -"Plug 'majutsushi/tagbar' Plug 'vim-scripts/DoxygenToolkit.vim', {'for': 'cpp'} " Syntax checking -"Plug 'Valloric/YouCompleteMe' +"Plug 'Valloric/YouCompleteMe' " alternative #1, full-blown Plug 'w0rp/ale', -"Plug 'scrooloose/syntastic' " Useful plugins Plug 'Raimondi/delimitMate' @@ -48,116 +48,55 @@ let g:airline_powerline_fonts = 1 call plug#end() filetype plugin indent on -" Other +" Magical color setup set t_Co=256 set background=dark syntax on let base16colorspace=256 colorscheme base16-default-dark -"colorscheme solarized -"colorscheme gruvbox -"colorscheme molokai -"let g:molokai_original = 1 -"let g:rehash256 = 1 -"colorscheme distinguished -"colorscheme ir_black -"colorscheme summerfruit256 + +" Other set autoindent " Automatically indent -syntax on set cindent " Indentation for c set number " Add line numbers set hlsearch " Highlight search -set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos -"set autochdir " Change directory automatically +"set sessionoptions=blank,buffers,curdir,folds,globals,help,localoptions,options,resize,tabpages,winsize,winpos +set autochdir " Change directory automatically "set backupdir=~/.vim/temp/ " Save temporary backups to temp dir "set directory=~/.vim/temp/ " Save temporary files to temp dir -set hidden " Allow changing buffers eventhough they're not saved +"set hidden " Allow changing buffers eventhough they're not saved "set autowrite " Automatically save the buffer when changing to another buffers "set autowriteall " Automatically save ALL buffers when changing to another buffers -set wildchar= wildmenu wildmode=full " Show possible commands by pressing TAB -set wildcharm= " This will allow you to access bufferlist with wildcard by pressing F10 -nnoremap :b +"set wildchar= wildmenu wildmode=full " Show possible commands by pressing TAB +"set wildcharm= " This will allow you to access bufferlist with wildcard by pressing F10 +set colorcolumn=80 +" Set GUI parameters +if has("gui_running") + " GUI options. + set guioptions-=m " remove menu bar + set guioptions-=T " remove toolbar + set guioptions-=r " remove right-hand scroll bar + set guioptions-=L " remove left-hand scroll bar + set guifont=Fura\ Code\ Nerd\ Font\ 10 + set guiheadroom=0 +endif +" Keybindings +" Long list following " Indentation map mzgg=G`z map %s + " NerdTree map :NERDTreeToggle imap :NERDTreeTogglei + " NerdCommenter map ci -au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery - -"augroup vimrc -" au BufReadPre * setlocal foldmethod=indent -" au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif -"augroup END - inoremap za nnoremap za onoremap za vnoremap zf -set nocp -filetype plugin on -filetype plugin indent on - -" configure tags - add additional tags here or comment out not-used ones -"set tags+=~/.vim/tags/cpp -"set tags+=~/.vim/tags/gl -"set tags+=~/.vim/tags/sdl -"set tags+=~/.vim/tags/boost -"set tags+=~/.vim/tags/opencv2 -"set tags+=~/.vim/tags/mesa - -" build tags of your own project with Ctrl-F12 -"map :!ctags -R --sort=yes --c++-kinds=+p --fields=+iaS --extra=+q ../src/ -" OmniCppComplete -"let OmniCpp_NamespaceSearch = 1 -"let OmniCpp_GlobalScopeSearch = 1 -"let OmniCpp_ShowAccess = 1 -"let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters -"let OmniCpp_MayCompleteDot = 1 " autocomplete after . -"let OmniCpp_MayCompleteArrow = 1 " autocomplete after -> -"let OmniCpp_MayCompleteScope = 1 " autocomplete after :: -"let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD", "cv", "boost"] -"au BufNewFile,BufRead,BufEnter *.cpp,*.hpp,*.cc,*.hh set omnifunc=omni#cpp#complete#Main -"" automatically open and close the popup menu / preview window -"au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif -"set completeopt=menuone,menu,longest,preview -"map :e %:p:s,.h$,.X123X,:s,.cpp$,.h,:s,.X123X$,.cpp, -"map :e %:p:s,.hh$,.X123X,:s,.cc$,.hh,:s,.X123X$,.cc, - -" Uncomment the following to have Vim jump to the last position when -" reopening a file -if has("autocmd") - au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g'\"" | endif - -endif - -if has("gui_running") - " GUI is running or is about to start. - " Maximize gvim window. - " set lines=999 columns=999 - "set lines=50 columns=100 - "set guifont=Source\ Code\ Pro\ 11\ -1\ 5\ 50\ 0\ 0\ 0\ 1\ 0 - "set guifont=Source\ Code\ Pro\ Medium\ 11 - " GUI options. - set guioptions-=m "remove menu bar - set guioptions-=T "remove toolbar - set guioptions-=r "remove right-hand scroll bar - set guioptions-=L "remove left-hand scroll bar - - "set guifont=DejaVu\ Sans\ Mono\ 10 - set guifont=Fura\ Code\ Nerd\ Font\ 10 - "set guifont=Fira\ Mono\ 10 - "set guifont=Source\ Code\ Pro\ 10 - "set guifont=Terminus\ 11 - set guiheadroom=0 -endif - -" thesaurus and dictionary stuff -"set dictionary+=/usr/share/dict/words -"set thesaurus+=/home/julankin/.vim/mthes10/mthesaur.txt " tab navigation like firefox nnoremap :tabprevious @@ -167,41 +106,15 @@ inoremap :tabpreviousi inoremap :tabnexti inoremap :tabnew -"set colorcolumn=80 - -" YouCompleteMe -let g:ycm_add_preview_to_completeopt=0 -let g:ycm_confirm_extra_conf=0 -let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py' - -set completeopt-=preview +" Session parameters set ssop-=options " do not store global and local values in a session set ssop-=folds " do not store folds -" Fix backspace -"set backspace=indent,eol,start - -" Syntastic -"set statusline+=%#warningmsg# -"set statusline+=%{SyntasticStatuslineFlag()} -"set statusline+=%* -"set laststatus=2 - -"let g:syntastic_always_populate_loc_list = 1 -"let g:syntastic_auto_loc_list = 0 -"let g:syntastic_check_on_open = 1 -"let g:syntastic_check_on_wq = 0 -"let g:syntastic_javascript_checkers = ['eslint'] - -map :GoTo - " Toggle number :nmap :set invnumber " Toggle hlsearch :nnoremap :nohlsearch:echo -autocmd BufRead,BufNewFile *.es6 setfiletype javascript -"map :%!tidy -q --tidy-mark 0 2>/dev/null " Configure for jsdoc let g:jsdoc_enable_es6 = 1 @@ -210,16 +123,15 @@ let g:jsdoc_enable_es6 = 1 autocmd BufWritePre *.js %s/\s\+$//e autocmd BufWritePre *.cpp %s/\s\+$//e -" Indentation -set tabstop=4 -set softtabstop=0 -set expandtab -set shiftwidth=2 -set smarttab - +" Set sane defaults for tabs autocmd Filetype python setlocal ts=4 sw=4 sts=0 expandtab autocmd Filetype cpp setlocal ts=4 sw=4 sts=0 expandtab +autocmd Filetype javascript setlocal ts=2 sw=2 sts=0 expandtab +autocmd Filetype vue setlocal ts=2 sw=2 sts=0 expandtab +autocmd Filetype json setlocal ts=2 sw=2 sts=0 expandtab +autocmd Filetype html setlocal ts=4 sw=4 sts=0 expandtab +" ultisnips let g:UltiSnipsExpandTrigger="" let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsJumpBackwardTrigger="" diff --git a/.zshrc b/.zshrc index c728302..41914c8 100644 --- a/.zshrc +++ b/.zshrc @@ -52,7 +52,7 @@ alias runsteam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /us alias steamgamesdir='cd ~/.local/share/Steam/SteamApps/common' alias emsdksetup='source $EMSDK/emsdk_env.sh' alias runwinesteam="MESA_GL_VERSION_OVERRIDE=3.3COMPAT PULSE_LATENCY_MSEC=60 run-desktop.py ~/.local/share/applications/wine/Programs/Steam/Steam.desktop" - +alias rbackup="restic -r rclone:hubic:default/Backups/ChimeraLinux" # https://github.com/chriskempson/base16-shell # git clone https://github.com/chriskempson/base16-shell.git ~/.config/base16-shell source $HOME/.config/base16-shell/scripts/base16-default-dark.sh