feat: added sway configs for loki

This commit is contained in:
fedora 2020-06-16 00:35:28 +02:00
parent d303fe27be
commit 77b4672df8
Signed by: wanderer
GPG Key ID: 7B28D8DC28BD2388
14 changed files with 1239 additions and 0 deletions

394
.config/sway/config Normal file

@ -0,0 +1,394 @@
set
{
$mod Mod4
$left h
$down j
$up k
$right l
$lock exec ~/utils/bin/swaylock-wrapper
$lockt exec ~/utils/bin/sway-locker -t
$term kitty #qterminal alacritty
$menu rofi -show drun
# $bg "~/Pictures/apod/2019-October-20-Pluto-at-Night.jpg fill #000000"
# $bg "~/Pictures/apod/2019-January-2-The-Orion-Nebula-in-Infrared-from-WISE.jpg fit #000000"
$bg "~/Pictures/apod/2020-April-29-The-Ion-Tail-of-New-Comet-SWAN.jpg fit #000000"
$gtk_theme "Mint-Y-Dark-Blue"
$icon_theme "Flat-Remix-Blue-Dark"
$pri LVDS-1
#$sec HDMI-A-1
$sec DP-2
}
default_border pixel 2
default_floating_border pixel 2
#smart_gaps on
gaps outer 8
gaps inner 5
font pango:Cantarell 14px
exec_always --no-startup-id
{
#pkill fusuma
pkill waybar
pkill swayidle
#pkill "docker-tray"
waybar
swaymsg output "*" bg $bg
dbus-update-activation-environment DISPLAY XAUTHORITY
eval $(/usr/bin/gnome-keyring-daemon --start --components=ssh)
mako
#fusuma -d -c ~/.config/fusuma/config-wl.yml
gsettings set org.gnome.desktop.interface gtk-theme '$gtk_theme'
gsettings set org.gnome.desktop.interface icon-theme '$icon_theme'
#~/utils/docker-tray/docker-tray
swayidle -w timeout 3600 "$lock" \
timeout 3610 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep "$lockt"
}
bindsym ctrl+alt+l exec --no-startup-id $lock
bindsym $mod+grave exec --no-startup-id $lock
bindswitch lid:on exec --no-startup-id $lock
output $sec pos 1920 0 res 1920x1200
#--- Window Decorations
set
{
$nofocus #202020
$focus #202020
$titletxt #FFFFE8
$titlepad 10 center #000000
$gaps_change 20
}
#--- Notifications
set
{
$n_anchor top-center
$n_layer overlay
$n_dim 600
$n_margin 20
$n_padding 10
$n_border 3
$n_bg #202020
$n_fg #FFFFE8
}
bindsym
{
$mod+Shift+e exec swaynag -t error -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
$mod+Return exec $term
$mod+t exec $term
$mod+Shift+t exec alacritty
$mod+Shift+q kill
alt+F1 exec $menu
}
input *
{
xkb_layout gb,sk
xkb_options grp:win_space_toggle,compose:ralt
xkb_variant ",qwerty"
repeat_delay 280
repeat_rate 30
tap enabled
natural_scroll enabled
scroll_method two_finger
tap_button_map lrm
}
focus_follows_mouse yes
focus_wrapping false
popup_during_fullscreen leave_fullscreen
#--- Floating Windows ------------------------------------------------------
for_window [class="pop-up"] floating enable; border normal $border
for_window [window_role="pop-up"] floating enable; border normal $border
for_window [window_role="task_dialog"] floating enable; border normal $border
for_window [class="MEGAsync"] floating enable; border pixel 0
for_window [title=".*JetBrains.*"] floating enable; border pixel 1
for_window [class="matplotlib"] floating enable; border normal $border
for_window [class="dosbox"] floating enable; border normal $border
for_window [title="ImageMagick.*"]
{
floating enable;
border normal $border
title_format " %title"
}
for_window [app_id="nm-connection-editor"]
{
floating enable
resize set width 882px
resize set height 600px
}
for_window [app_id="pavucontrol"]
{
floating enable
resize set width 882px
resize set height 600px
}
#--- Applications with CSD -------------------------------------------------
for_window [app_id="glade"] border pixel 2
for_window [app_id="baobab"] border pixel 2
for_window [title=".*eston.*"] border pixel 0
for_window [app_id="wdisplays"] border pixel 0
for_window [app_id="gnome-.*"] border pixel 1
for_window [app_id="qterminal"] border pixel 2
for_window [app_id="xterm"] border pixel 2
for_window [title=".*Brave.*"] border pixel 1 inhibit_idle fullscreen
for_window [title=".*Firefox.*"] border pixel 2 inhibit_idle fullscreen
for_window [class="vlc"] border pixel 2 inhibit_idle fullscreen
for_window [app_id="vlc"] border pixel 2 inhibit_idle fullscreen
for_window [app_id="nautilus"] border pixel 1
#--- Xtk Applications ------------------------------------------------------
for_window [title="xclock"] floating enable
for_window [title="Calculator"] floating enable
assign [app_id="telegram"] C
assign [title="Ferdi"] C
assign [class="vlc"] M
bindsym
{
print exec grim $(xdg-user-dir PICTURES)/grim-$(date +'%Y-%m-%dT%H-%M-%S').png
Shift+print exec grim -g "$(slurp)" - | wl-copy
$mod+c exec gnome-calculator
$mod+n exec nemo
$mod+m exec QT_QPA_PLATFORMTHEME=wayland vlc
$mod+Shift+b exec brave-browser-beta --incognito
$mod+Shift+w exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 ~/Downloads/firefox-dev/firefox --private-window
$mod+Shift+g exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 firefox --private-window
$mod+Shift+v exec ferdi
$mod+Shift+a exec chromium-freeworld --incognito
--locked $mod+Escape exec systemctl suspend -i
$mod+Shift+o exec alacritty -e bash -c 'sudo cpupower frequency-set -g powersave;figlet powersave;sleep 2'
$mod+Shift+p exec alacritty -e bash -c 'sudo cpupower frequency-set -g performance;figlet performance;sleep 2'
$mod+ctrl+Shift+a exec ~/.local/bin/keepmenu
}
# Notifications
bindsym Control+Space exec makoctl dismiss
bindsym Control+Shift+Space exec makoctl dismiss --all
#
# Moving around:
#
bindsym
{
# Move your focus around
$mod+$left focus left
$mod+$down focus down
$mod+$up focus up
$mod+$right focus right
# Or use $mod+[up|down|left|right]
$mod+Left focus left
$mod+Down focus down
$mod+Up focus up
$mod+Right focus right
# Move the focused window with the same, but add Shift
$mod+Shift+$left move left
$mod+Shift+$down move down
$mod+Shift+$up move up
$mod+Shift+$right move right
# Ditto, with arrow keys
$mod+Shift+Left move left
$mod+Shift+Down move down
$mod+Shift+Up move up
$mod+Shift+Right move right
$mod+Shift+c move position center
}
#
# Workspaces:
#
# Switch to workspace
bindsym --to-code
{
$mod+Shift+comma workspace prev_on_output
$mod+Shift+period workspace next_on_output
$mod+Shift+tab workspace back_and_forth
$mod+comma focus output right
$mod+period focus output left
$mod+0 exec ~/.local/bin/swws.py 0
$mod+1 exec ~/.local/bin/swws.py 1
$mod+2 exec ~/.local/bin/swws.py 2
$mod+3 exec ~/.local/bin/swws.py 3
$mod+4 exec ~/.local/bin/swws.py 4
$mod+5 exec ~/.local/bin/swws.py 5
$mod+6 exec ~/.local/bin/swws.py 6
$mod+7 exec ~/.local/bin/swws.py 7
$mod+8 exec ~/.local/bin/swws.py 8
$mod+9 exec ~/.local/bin/swws.py 9
$mod+F2 workspace C
$mod+F3 workspace M
}
# Switch directly to workspace of another monitor
bindsym --to-code
{
$mod+ctrl+0 exec "~/.local/bin/swws.py 0 -c"
$mod+ctrl+1 exec "~/.local/bin/swws.py 1 -c"
$mod+ctrl+2 exec "~/.local/bin/swws.py 2 -c"
$mod+ctrl+3 exec "~/.local/bin/swws.py 3 -c"
$mod+ctrl+4 exec "~/.local/bin/swws.py 4 -c"
$mod+ctrl+5 exec "~/.local/bin/swws.py 5 -c"
$mod+ctrl+6 exec "~/.local/bin/swws.py 6 -c"
$mod+ctrl+7 exec "~/.local/bin/swws.py 7 -c"
$mod+ctrl+8 exec "~/.local/bin/swws.py 8 -c"
$mod+ctrl+9 exec "~/.local/bin/swws.py 9 -c"
}
# Move focused container to workspace
bindsym --to-code
{
$mod+Shift+0 exec "~/.local/bin/swws.py 0 -s"
$mod+Shift+1 exec "~/.local/bin/swws.py 1 -s"
$mod+Shift+2 exec "~/.local/bin/swws.py 2 -s"
$mod+Shift+3 exec "~/.local/bin/swws.py 3 -s"
$mod+Shift+4 exec "~/.local/bin/swws.py 4 -s"
$mod+Shift+5 exec "~/.local/bin/swws.py 5 -s"
$mod+Shift+6 exec "~/.local/bin/swws.py 6 -s"
$mod+Shift+7 exec "~/.local/bin/swws.py 7 -s"
$mod+Shift+8 exec "~/.local/bin/swws.py 8 -s"
$mod+Shift+9 exec "~/.local/bin/swws.py 9 -s"
$mod+Shift+F2 move container to workspace C
$mod+Shift+F3 move container to workspace M
}
# Move focused container to workspace of another monitor
bindsym --to-code
{
ctrl+$mod+Shift+0 exec "~/.local/bin/swws.py 0 -t"
ctrl+$mod+Shift+1 exec "~/.local/bin/swws.py 1 -t"
ctrl+$mod+Shift+2 exec "~/.local/bin/swws.py 2 -t"
ctrl+$mod+Shift+3 exec "~/.local/bin/swws.py 3 -t"
ctrl+$mod+Shift+4 exec "~/.local/bin/swws.py 4 -t"
ctrl+$mod+Shift+5 exec "~/.local/bin/swws.py 5 -t"
ctrl+$mod+Shift+6 exec "~/.local/bin/swws.py 6 -t"
ctrl+$mod+Shift+7 exec "~/.local/bin/swws.py 7 -t"
ctrl+$mod+Shift+8 exec "~/.local/bin/swws.py 8 -t"
ctrl+$mod+Shift+9 exec "~/.local/bin/swws.py 9 -t"
}
#
# Workspace-monitor assignments
#
workspace 0 output $pri
workspace 1 output $pri
workspace 2 output $pri
workspace 3 output $pri
workspace 4 output $pri
workspace 5 output $pri
workspace 6 output $pri
workspace 7 output $pri
workspace 8 output $pri
workspace 9 output $pri
workspace C output $pri
workspace M output $pri
workspace 10 output $sec
workspace 11 output $sec
workspace 12 output $sec
workspace 13 output $sec
workspace 14 output $sec
workspace 15 output $sec
workspace 16 output $sec
workspace 17 output $sec
workspace 18 output $sec
workspace 19 output $sec
#
# Layout stuff:
#
bindsym
{
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
$mod+b splith
$mod+v splitv
# Switch the current container between different layout styles
$mod+s layout stacking
$mod+w layout tabbed
$mod+e layout toggle split
# Make the current focus fullscreen
$mod+f fullscreen
# Toggle the current focus between tiling and floating mode
#bindsym $mod+Shift+space floating toggle
$mod+Shift+d floating toggle
# Swap focus between the tiling area and the floating area
#bindsym $mod+space focus mode_toggle
$mod+d focus mode_toggle
# Move focus to the parent container
$mod+a focus parent
}
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
bindsym --to-code
{
# Move the currently focused window to the scratchpad
$mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
$mod+minus scratchpad show
}
#
# Resizing containers:
#
mode "resize"
{
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym
{
$left resize shrink width 10px
$down resize grow height 10px
$up resize shrink height 10px
$right resize grow width 10px
# Ditto, with arrow keys
Left resize shrink width 10px
Down resize grow height 10px
Up resize shrink height 10px
Right resize grow width 10px
# Return to default mode
Return mode "default"
Escape mode "default"
$mod+r mode "default"
}
}
bindsym $mod+r mode "resize"
bindsym $mod+Shift+r reload
#
# media keys
#
bindsym
{
--locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
--locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
--locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
--locked XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
--locked XF86MonBrightnessUp exec light -A 5
--locked XF86MonBrightnessDown exec light -U 5
}
include /etc/sway/config.d/*

106
.config/waybar/config Normal file

@ -0,0 +1,106 @@
{
"layer": "top",
"position": "top",
"height": 28,
"modules-left": ["sway/workspaces", "sway/mode"],
"modules-center": ["sway/window"],
"modules-right": ["tray", "pulseaudio", "network", "custom/storage", "memory", "cpu", "idle_inhibitor", "battery", "clock#date", "clock#time"],
"sway/workspaces": {
"format": "{name}",
"disable-scroll": true,
"disable-markup" : false
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>", // Icon: expand-arrows-alt
"tooltip": false
},
"sway/window": {
"max-length": 120,
"tooltip": false
},
"clock#time": {
"interval": 1,
"format": "{:%H:%M:%S} ",
"tooltip": false
},
"clock#date": {
"interval": 10,
"format": " {:%a %d %b} ",
"tooltip": false
},
"memory": {
"interval": 5,
"format": "{}% ",
"on-click": "exec alacritty -e ytop"
},
"cpu": {
"interval": 5,
"format": "{usage:2}% "
},
"battery": {
"format": "{capacity}% {icon}",
"format-alt": "{time} {icon}",
"format-icons": ["", "", "", "", ""],
"format-charging": "~{capacity}%",
"interval": 30,
"states": {
"warning": 25,
"critical": 10
},
"tooltip": false
},
"network": {
"format-wifi": "{icon} {essid} ({signalStrength}%) ",
"format-ethernet": "{icon} {ifname}: {ipaddr}/{cidr}",
"format-linked": "{ifname} (No IP)",
"format-icons": {
"wifi": [""],
"ethernet": ["🖧"],
"disconnected": ["disconnected"]
},
"on-click": "nm-connection-editor",
"on-click-right": "exec kitty nmtui",
"rotate": true,
"tooltip": false
},
"pulseaudio": {
"format": "{icon} {volume}% {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": "🔇 {icon} {format_source}",
"format-muted": "✖ {format_source}",
"format-source": " {volume}%",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"scroll-step": 1,
"on-click": "pavucontrol",
"tooltip": false
},
"custom/storage": {
"format": "{percentage}% ",
"format-alt": "{} ",
"format-alt-click": "click",
"return-type": "json",
"interval": 60,
"exec": "~/.config/waybar/modules/storage.sh"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
},
"tooltip": false
},
"tray": {
"icon-size": 18
}
}

@ -0,0 +1,23 @@
#!/bin/sh
mount="/"
warning=20
critical=10
df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical '
/\/.*/ {
text=$4
use=$5
exit 0
}
END {
class=""
gsub(/%$/,"",use)
if ((100 - use) < critical) {
class="critical"
} else if ((100 - use) < warning) {
class="warning"
}
print "{\"text\":\""text"\", \"percentage\":"use", \"class\":\""class"\"}"
}
'

137
.config/waybar/style.css Normal file

@ -0,0 +1,137 @@
* {
border: none;
border-radius: 0;
font-family: DejaVu Sans;
font-size: 13px;
box-shadow: none;
text-shadow: none;
transition-duration: 0s;
}
/* The whole bar */
#waybar {
background: #323232;
color: white;
font-family: Cantarell, Noto Sans, sans-serif;
font-size: 13px;
}
window {
color: rgba(217, 216, 216, 1);
background: rgba(35, 31, 32, 0.00);
}
window#waybar.solo {
color: rgba(217, 216, 216, 1);
}
#mode {
background: #791455;
padding: .1em .2em;
}
#workspaces {
margin: 0 0px;
}
#workspaces button {
border-top: 2px solid transparent;
/* To compensate for the top border and still have vertical centering */
padding: .1em .2em;
color: #888888;
}
#workspaces button.visible {
color: rgba(217, 216, 216, 1);
}
#workspaces button.focused {
border-color: #4c7899;
color: white;
background-color: #285577;
}
#workspaces button.urgent {
border-color: #c9545d;
color: #c9545d;
}
#mode, #battery, #cpu, #memory, #network, #pulseaudio, #idle_inhibitor, #backlight, #custom-storage, #custom-spotify, #custom-weather, #custom-mail {
margin: 0px 5px 0px 5px;
min-width: 25px;
}
#clock.date {
margin: 0px 0px 0px 10px;
}
#clock.time {
margin: 0px 10px 0px 0px
}
@keyframes blink {
to {
color: white;
}
}
#battery.warning {
color: rgba(255, 210, 4, 1);
}
#battery.critical {
color: rgba(238, 46, 36, 1);
animation: blink .7s linear infinite alternate;
}
#battery.charging {
color: rgba(59, 176, 216, 1);
font-weight: bold;
animation: blink 1s linear infinite alternate;
}
#network.disconnected {
color: red;
}
#custom-storage.warning {
color: rgba(255, 210, 4, 1);
}
#custom-storage.critical {
color: rgba(238, 46, 36, 1);
}
#custom-storage {
margin: 0 0 0 10px;
}
#memory {
/* color: #859900; */
}
#cpu {
/* color: #6c71c4; */
margin: 0 5px 0 0;
}
#tray {
margin: 0 5px 0 10px;
}
#pulseaudio {
margin: 0 5px 0 5px;
}
/* dark theme */
/*#mode {
background: #64727D;
padding: .1em .2em;
}*/
/*#workspaces button {
padding: 0 2px;
color: rgba(217, 216, 216, 0.4);
}*/
/*#workspaces button.focused {
border-top: 2px solid rgba(217, 216, 216, 1);
border-bottom: 2px solid rgba(217, 216, 216, 0);
}*/
/*#workspaces button.urgent {
color: rgba(238, 46, 36, 1);
}*/

298
.vim/vimrc Normal file

@ -0,0 +1,298 @@
" try not to put any lines in your vimrc that you don't understand :)
set nocompatible
filetype off "required
filetype plugin on " required
" Enable heavy omni completion.
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'drewtempelmeyer/palenight.vim', { 'as': 'palenight' }
Plug 'jacoborus/tender.vim'
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'lervag/vimtex', { 'for': 'tex' }
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'justmao945/vim-clang'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'gorodinskiy/vim-coloresque'
Plug 'rhysd/git-messenger.vim'
Plug 'Yggdroot/indentLine'
Plug 'cespare/vim-toml'
Plug 'preservim/nerdcommenter'
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'mfukar/robotframework-vim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'vim-syntastic/syntastic'
"Plug 'rust-lang/rust.vim', { 'for': 'rust' }
call plug#end()
let g:airline_powerline_fonts = 1
let g:Powerline_symbols = "fancy" " sth like this probably set as a default but won't hurt here
let g:airline_highlighting_cache = 1
" let g:airline_theme = 'dracula'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:gitgutter_terminal_reports_focus=0
let g:gitgutter_async = 1
let g:gitgutter_sign_allow_clobber=0
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_ignore_case = 1
let g:livepreview_cursorhold_recompile = 0
let g:livepreview_previewer = 'evince'
let g:livepreview_engine = 'pdflatex -shell-escape -interaction=nonstopmode'
let g:vimtex_compiler_progname = 'pdflatex -shell-escape --interaction=nonstopmode'
let g:tex_flavor = 'latex'
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
"""" Enable NERDCommenterToggle to check all selected lines is commented or not
"""let g:NERDToggleCheckAllLines = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'vim': { 'left': '"','right': '' }, 'c': { 'left': '/**','right': '*/' } }
let g:indentLine_setColors = 1
let g:indentLine_char_list = ['|', '¦', '┆', '┊', ':']
let g:git_messenger_close_on_cursor_moved = v:false
let g:git_messenger_always_into_popup = v:true
let g:syntastic_always_populate_loc_list = 0
let g:syntastic_auto_loc_list = 2
let g:syntastic_loc_list_height = 8
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggregate_errors = 1
let g:syntastic_id_checkers = 1
let g:syntastic_error_symbol = "✗"
let g:syntastic_warning_symbol = "⚠"
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_javascript_checkers = ['jsl']
let g:syntastic_python_checkers = ['pylint']
let g:syntastic_c_compiler = 'clang'
let g:syntastic_c_check_header = 1
let g:syntastic_c_auto_refresh_includes = 1
let g:syntastic_cpp_check_header = 1
let g:syntastic_cpp_auto_refresh_includes = 1
let g:syntastic_c_cpplint_exec = 'cppcheck'
" change cursor shape for different editing modes, neovim does this by default
if !has('nvim')
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
let &t_SR = "\<Esc>Ptmux;\<Esc>\e[4 q\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
else
let &t_SI = "\e[6 q"
let &t_SR = "\e[4 q"
let &t_EI = "\e[2 q"
endif
endif
command! W execute 'silent w !sudo tee % >/dev/null' | edit!
command! -nargs=* Make write | make! <args> | cwindow
" open a terminal in $PWD
nnoremap <silent> <Leader>tt :terminal<CR>
" toggle showing whitespace
noremap <F5> :set list!<CR>
" make shortcut
nnoremap <F4> :make!<cr>
" NERDTree
nmap <Leader>nt :NERDTreeToggle<CR>
vmap gb :<C-U>!git blame % -L<C-R>=line("'<") <CR>,<C-R>=line("'>") <CR><CR>
nmap gb :!git blame %<CR>
nmap <silent> <Leader>ll :w! !pdflatex -shell-escape -interaction=nonstopmode $PWD/*.tex<CR><CR>
" ------ wayland copy
xnoremap "+y y:call system("wl-copy", @")<cr>
nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" ------ autocmd ------
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
" automatically open NERDTree if vim is open on it's own (argc() ==0 )
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Reload changes if file changed outside of vim requires autoread
augroup load_changed_file
autocmd!
autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif
autocmd FileChangedShellPost * echo "Changes loaded from source file"
augroup END
" when quitting a file, save the cursor position
augroup save_cursor_position
autocmd!
autocmd BufReadPost * call setpos(".", getpos("'\""))
augroup END
" when not running in a console or a terminal that doesn't support 256 colors
" enable cursorline in the currently active window and disable it in inactive ones
if $DISPLAY !=? '' && &t_Co == 256
augroup cursorline
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
endif
" when entering insert mode, relative line
" numbers are turned off, leaving absolute line numbers turned on
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set number relativenumber
autocmd BufLeave,FocusLost,InsertEnter * set number norelativenumber
augroup END
hi clear CursorLine
augroup CLClear
autocmd! ColorScheme * hi clear CursorLine
augroup END
hi CursorLineNR cterm=bold
augroup CLNRSet
set cursorline
autocmd! ColorScheme * hi CursorLineNR cterm=bold
augroup END
" define indent-based folding, after loading a file switch to manual folding
augroup vimrc
au BufReadPre * setlocal foldmethod=indent
au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
augroup END
""" autosave and load views
au BufWinLeave ?* mkview
au BufWinEnter ?* silent loadview
au FileType xml setlocal shiftwidth=4 tabstop=4
au FileType html setlocal shiftwidth=4 tabstop=4
au BufNewFile,BufRead *.js
\ setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab autoindent fileformat=unix
au FileType c setl ofu=ccomplete#CompleteCpp
au BufNewFile,BufRead *.py,*.pyw,*.pyx,?akefil*
\ setlocal tabstop=4 shiftwidth=4 noexpandtab autoindent
\ fileformat=unix
" Linux kernel style tabs
au BufNewFile,BufRead *.c,*.h,*.cpp
\ setlocal tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent
\ textwidth=79 fileformat=unix
" ------ adv maps ------
" strip trailing whitespace, ss (strip space)
nnoremap <silent> <Leader>ss
\ :let b:_p = getpos(".") <Bar>
\ let b:_s = (@/ != '') ? @/ : '' <Bar>
\ %s/\s\+$//e <Bar>
\ let @/ = b:_s <Bar>
\ nohlsearch <Bar>
\ unlet b:_s <Bar>
\ call setpos('.', b:_p) <Bar>
\ unlet b:_p <CR>
match Todo /\s\+$/
set softtabstop=4
set tabstop=4
set shiftwidth=4
set expandtab
set smarttab
set errorformat+=%.%#PHP:\ %m\ \(in\ %f\ on\ line\ %l\)%.%#,
\%E%[0-9]%#.%m:%f?rev=%.%##L%l\ %.%#,%C%.%#
set tags=.tags;
set incsearch " incrimental search
set hlsearch " highlighting when searching
filetype indent plugin on
set autoindent
set backspace=2
set splitbelow splitright " splits open at bottom and right
set lazyredraw " don't redraw while executing macros (good performance config)
set listchars=trail:•,tab:>-
set list " show/hide tabs and EOL chars (hidden characters)
set confirm " ask confirmation like save before quit.
set wildmenu " Tab completion menu when using command mode
set scrolloff=5 " scroll offset, min lines above/below cursor
"set scrolljump=5 " jump 5 lines when running out of the screen - NO
set sidescroll=10 " minimum columns to scroll horizontally
set showcmd " show command status
set showmatch " flashes matching parenthese when cursor over the other one
set mat=2 " how many tenths of a second to blink when matching brackets
set noshowmode " show editing mode in status (-- INSERT --)
set ruler " show cursor position
set noerrorbells " bells in vim
set undolevels=1000 " number of undos stored
set viminfo='50,"50 " '=marks for x files, "=registers for x files
set nofoldenable
"set foldmethod=indent " indent based folding
set encoding=utf-8 " important for powerline besides others
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
set noscrollbind
set updatetime=1000
syntax enable
colo palenight " new fav highlighting
set conceallevel=0 " for jsons
set ttymouse= " tmux mouse behaviour
set mouse=a " enable mouse in n,v,i,c,h modes
set laststatus=2 " show powerline status bar
set t_Co=256
set notermguicolors

@ -1,5 +1,7 @@
# dotfiles
> loki
This is just my desperate attempt to keep track of all the changes I perform onto my dearest dot-files
> **Warning:** Check the files before use

83
bin/apod Executable file

@ -0,0 +1,83 @@
#!/bin/bash
# apod.sh largely based on
# https://gist.github.com/mtking2/c38948f731d9017fee4edb36667c2a70
http_proxy=""
green="\033[32m"
white="\033[0m"
blue="\033[34m"
path="$HOME/.cache/apod"
mkdir -p $path
rm -f $path/*.html
echo -e "$(date "+%Y-%m-%d %H:%M:%S") get apod started ${green}✓${white}"
wget -q https://apod.nasa.gov/apod/ap$(date +%y%m%d).html --content-on-error -P $path
index=$(find $path -type f -name "*.html")
echo -e "${blue}try \"\$(grep -i \"IMG SRC=\" $index | cut -d\\\" -f2)\":${white} $(grep -i "IMG SRC=" $index || echo "is null")"
echo -e "${blue}try \"\$(grep -i \"a href=\"image\" $index | cut -d\\\" -f2)\":${white} $(grep -i "a href=\"image" $index || echo "is null")"
get_img() {
img="$(grep -i "a href=\"image" $index | cut -d\" -f2 | head -1 | xargs)"
if [[ -z "$img" ]]; then
img="$(grep -i "IMG SRC=" $index | cut -d\" -f2 | head -1 | xargs)"
fi
}
get_img
# sometimes the APOD is an iframe containing a video/flash/js element
# this condition should detect the absence of an image and use the previous APOD
if [[ -z "$img" ]]; then
yesterday="https://apod.nasa.gov/apod/ap$(date --date yesterday +%y%m%d).html"
echo -e "${blue}Using yesterday's image:${white} $yesterday"
wget -q $yesterday -O $index
get_img
fi
img_name="$(echo "$img" | grep image | head -1 | cut -d\/ -f3)"
# deal with external images
if [[ $img =~ ^https?://.*$ ]]; then
url=$img
else
url="https://apod.nasa.gov/apod/$img"
fi
apod_title=$(grep "APOD:" $index | sed 's/<\/\?[^>]\+>//g' | sed 's/ APOD: //' | head -1)
if [[ "$apod_title" =~ ^Astronomy.*$ ]]; then
apod_title=$(echo $img_name | sed 's/....$//' )
fi
apod_date=$(grep "^$(date +%Y\ %B)" $index | xargs | head -1 | sed 's/ /-/g')
echo -e "${blue}path:${white} $path"
echo -e "${blue}apod_title:${white} $apod_title"
echo -e "${blue}img:${white} $img"
echo -e "${blue}img_name:${white} "$img_name""
echo -e "${blue}url:${white} $url"
echo -e "${blue}apod_date:${white} $apod_date"
filename=$(echo $apod_title | xargs | sed 's/- //g' | sed "s/ /-/g").jpg
wget -q $url -O "$path/$filename"
# GNOME
# possible values for gsettings: "wallpaper", "centered", "scaled", "stretched", "zoom", "spanned"
# gsettings set org.gnome.desktop.background picture-uri "File://$path/wallpaper.jpg"
# gsettings set org.gnome.desktop.background picture-options zoom
# Cinnamon
#gsettings set org.cinnamon.desktop.background picture-uri "file://$path/$apod_date-$short_title-$img_name"
# gsettings set org.cinnamon.desktop.background picture-uri "file://$path/$filename"
# gsettings set org.cinnamon.desktop.background picture-options scaled
# Xfce
# xfconf-query --channel xfce4-desktop --property /backdrop/screen0/monitor0/image-path --set $path/wallpaper.jpg
# feh
# feh --bg-scale $path/wallpaper.jpg
xdg-open "$path/$filename" 2>&1 >/dev/null &
rm -f $index
echo -e "$(date "+%Y-%m-%d %H:%M:%S") done ${green}✓${white}" && \
notify-send -u critical -i ~/.icons/Flat-Remix-Blue-Dark/apps/scalable/weather-widget.svg "apod just changed ✓" "...to $apod_title"

23
bin/gethugo Executable file

@ -0,0 +1,23 @@
#!/bin/bash
if [ -z $1 ]; then
echo "[x] HUGO_VERSION is not set, pass it as \$1"
exit 9001
else
HUGO_VERSION=$1
fi
nutmp=$(mktemp -d);cd "$nutmp";unset nutmp
WORKDIR=$(pwd)
HOMEBIN="/home/$USER/.local/bin"
mkdir -pv $HOMEBIN
echo "[*] downloading hugo version \"$HUGO_VERSION\""
curl -sL https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz | bsdtar xfv -
mv -vf hugo ${HOMEBIN}
cd ..
rm -rfv $WORKDIR
echo "[*] hugo updated to version $HUGO_VERSION"

19
bin/getnebulaconfigs Executable file

@ -0,0 +1,19 @@
#!/bin/bash
# simple config backup script for nebula
remote="root@dotya.ml"
myrsync="rsync -auvP"
$myrsync $remote:/etc/gitea/app.ini ~/utils/nebula &
$myrsync $remote:/etc/nginx/nginx.conf ~/utils/nebula &
$myrsync $remote:/etc/smtpd/{smtpd.conf,mailname,aliases,vdoms,vusers,creds} ~/utils/nebula/smtpd &
$myrsync $remote:/etc/ssh/sshd_config ~/utils/nebula &
$myrsync $remote:/etc/fstab ~/utils/nebula &
$myrsync $remote:/etc/crypttab ~/utils/nebula &
$myrsync $remote:/etc/lvm/lvm.conf ~/utils/nebula &
$myrsync $remote:/root/.zshrc ~/utils/nebula/root/zshrc &
$myrsync $remote:/root/.ssh/ ~/utils/nebula/root/ssh &
$myrsync $remote:/home/vis/.ssh/ ~/utils/nebula/vis/ssh &
$myrsync $remote:/home/vis/.config/ --exclude="*Bittorrent-data*" ~/utils/nebula/vis/config &

27
bin/qst_up Executable file

@ -0,0 +1,27 @@
#!/bin/bash
BUILDDIR="/tmp/makepkg/QSyncthingTray/cmake-build"
src="$HOME/utils/QSyncthingTray"
echo "** QSyncthingTray updater **"
cd $src
git fetch --all
mkdir -pv $BUILDDIR
cd $BUILDDIR
if [ $(pgrep '[Q]Sync') ]; then
echo "[*] killing QSyncthingTray..."
pkill -9 QSyncthingTray
fi
cmake -S$src ..
cmake --build . -- -j $(nproc)
cd $src
mv -vf $BUILDDIR/QSyncthingTray ~/.local/bin
rm -rf $BUILDDIR
echo "[*] starting QSyncthingTray..."
QSyncthingTray & > /dev/null 2>&1
git clean -fd --quiet

42
bin/sway-locker Executable file

@ -0,0 +1,42 @@
#!/bin/bash
# Inhibit screen locker when media players are running
# Cheap method, add missing players to regex
isrunning=1
player=`ps -u $USER | grep -Ec "(rhythmbox|totem|mpv|vlc|*mplayer)"`
if [ "$player" -ge "$isrunning" ]; then
if [ "$1" == "-t" ]; then
dbus-send --type=method_call --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause
else
if [ "$1" != "-f" ]; then
exit 1
fi
fi
fi
revert() {
swaymsg "output * dpms on"
rm -Rf $HOME/.tmp
}
wdir=$HOME/.tmp/lckr
screen1=$wdir/l1.png
icon=/usr/share/pixmaps/fedora-logo-sprite.png # with style
lwaucj=$wdir/nuvdsp.png
mkdir -p $wdir && chmod 1700 $wdir
grim -o eDP-1 $screen1 # take a screenshot
convert $screen1 -scale 10% -scale 1000% $screen1
convert $screen1 $icon -gravity center -composite -matte $lwaucj && rm $screen1
# Lock screen using swaylock showing number of failed attempts, not forking,
# ignoring empty password (possibly without unlock indicator (-u))
swaylock -f -n -e -i "$lwaucj" || swaylock -f -e -n -c 141414 # just dark-grey
trap revert exit
# EXIT HUP INT TERM - 0 1 3 15
revert
notify-send 'Welcome back!'

17
bin/swaylock-wrapper Executable file

@ -0,0 +1,17 @@
#!/bin/bash
lock="swaylock --screenshots --clock --indicator --indicator-radius 100 --indicator-thickness 7 --effect-blur 7x5 --effect-vignette 0.5:0.5 --ring-color 451e75 --key-hl-color a01b83 --line-color 00000000 --inside-color 00000088 --separator-color 00000000"
lockt="exec ~/utils/bin/sway-locker -t"
revert() {
killall swayidle
swayidle -w timeout 3600 "$lock" \
timeout 3610 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep "$lockt"
}
trap revert HUP INT TERM
swayidle -w timeout 5 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' &
swaylock --screenshots --clock --indicator --indicator-radius 100 --indicator-thickness 7 --effect-blur 7x5 --effect-vignette 0.5:0.5 --ring-color 451e75 --key-hl-color a01b83 --line-color 00000000 --inside-color 00000088 --separator-color 00000000
revert

68
bin/swws.py Executable file

@ -0,0 +1,68 @@
#!/usr/bin/python
# thanks to dalahast < https://git.dotya.ml/dalahast >
import json,sys,subprocess
args = sys.argv
if len(args) > 2:
a = args[2]
else:
a = ""
ws = args[1]
ws10 = str(10+int(ws))
msg = json.loads(subprocess.run(["swaymsg", "-t", "get_workspaces"], stdout=subprocess.PIPE).stdout.decode('utf-8'))
def expl_pick(mon_type):
if mon_type == "LVDS-1":
subprocess.run(["swaymsg", "focus", "output", "HDMI-A-1"])
subprocess.run(["swaymsg", "workspace", ws10])
else:
subprocess.run(["swaymsg", "focus", "output", "LVDS-1"])
subprocess.run(["swaymsg", "workspace", ws])
def mov_to(mon_type):
if mon_type == "LVDS-1":
subprocess.run(["swaymsg", "move", "container", "to", "workspace", ws])
else:
subprocess.run(["swaymsg", "move", "container", "to", "workspace", ws10])
def mov_to_next_mon(mon_type):
if mon_type == "LVDS-1":
subprocess.run(["swaymsg", "move", "container", "to", "workspace", ws10])
else:
subprocess.run(["swaymsg", "move", "container", "to", "workspace", ws])
def wssw(mon_type):
if a == '-c':
expl_pick(mon_type)
elif a == '-s':
mov_to(mon_type)
elif a == '-t':
mov_to_next_mon(mon_type)
for i in range(len(msg)):
if msg[i]["focused"] == True:
if msg[i]["output"] == "LVDS-1":
if not a:
subprocess.run(["swaymsg", "workspace", ws])
else:
mon_type = "LVDS-1"
wssw(mon_type)
if msg[i]["output"] == "HDMI-A-1":
if not a:
subprocess.run(["swaymsg", "workspace", ws10])
else:
mon_type = "HDMI-A-1"
wssw(mon_type)
if msg[i]["output"] == "DP-2":
if not a:
subprocess.run(["swaymsg", "workspace", ws10])
else:
mon_type = "DP-2"
wssw(mon_type)
if msg[i]["output"] == "DP-3":
if not a:
subprocess.run(["swaymsg", "workspace", ws10])
else:
mon_type = "DP-3"
wssw(mon_type)