Merge branch 'arch' into gentoo

This commit is contained in:
ItsDrike 2022-02-02 00:28:10 +01:00
commit d2ca79a5bc
No known key found for this signature in database
GPG key ID: FB8CA11A2CF3A843
54 changed files with 1687 additions and 687 deletions

View file

@ -111,11 +111,10 @@ font:
# - (macOS) Menlo
# - (Linux/BSD) monospace
# - (Windows) Consolas
family: monospace
#family: Source Code Pro
family: JetBrains Mono
# The `style` can be specified to pick a specific face.
style: Regular
style: Medium
# Bold font face
#bold:
@ -135,7 +134,7 @@ font:
#
# If the italic family is not specified, it will fall back to the
# value specified for the normal font.
family: monospace
#family: monospace
#family: Source Code Pro
# The `style` can be specified to pick a specific face.

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=Discord
StartupWMClass=discord
Comment=All-in-one voice and text chat for gamers that's free, secure, and works on both your desktop and phone.
GenericName=Internet Messenger
Exec=/opt/discord/Discord --start-minimized
Icon=discord
Type=Application
Categories=Network;InstantMessaging;
Path=/usr/bin

View file

@ -0,0 +1,10 @@
[Desktop Entry]
Name=Element
StartupWMClass=element
Comment=Chat client for matrix protocl
GenericName=Internet Messenger
Exec=/usr/bin/element-desktop --hidden
Icon=element
Type=Application
Categories=Network;InstantMessaging;
Path=/usr/bin

View file

@ -0,0 +1,16 @@
[Desktop Entry]
Type=Application
Name=OpenSnitch
Exec=/bin/sh -c 'pkill -15 opensnitch-ui; opensnitch-ui'
Icon=opensnitch-ui
GenericName=OpenSnitch Firewall
GenericName[hu]=OpenSnitch-tűzfal
Comment=Application firewall
Comment[es]=Firewall de aplicaciones
Comment[hu]=Alkalmazási tűzfal
Terminal=false
NoDisplay=false
Categories=System;Filesystem;Network;
Keywords=system;firewall;policies;security;polkit;policykit;
X-GNOME-Autostart-Delay=3
X-GNOME-Autostart-enabled=true

View file

@ -25,7 +25,7 @@
# positive x is measured from the left, negative from right
# Y is measured from the top and bottom respectively.
# width can be negative, making it the screen width - width
geometry = "300x5-30+30"
geometry = "300x0-30+30"
# Show how many messages are currently hidden (because of geometry)
indicate_hidden = yes
@ -153,7 +153,7 @@
max_icon_size = 32
# Paths to default icons
icon_path = /usr/share/icons/hicolor/16x16/status/:/usr/share/icons/hicolor/16x16/devices/:/usr/share/icons/hicolor/16x16/apps/:/usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/:/usr/share/icons/Adwaita/16x16/apps/
icon_path = /usr/share/icons/hicolor/16x16/status/:/usr/share/icons/hicolor/16x16/devices/:/usr/share/icons/hicolor/16x16/apps/
### History ###
@ -218,7 +218,7 @@
# Close all notifications.
close_all = ctrl+shift+space
# Redisplay last message(s)
history = ctrl+grave
history = ctrl+shift+grave
# Context menu
context = ctrl+shift+period
@ -226,7 +226,7 @@
background = "#35383b"
foreground = "#fcf7e2"
frame_color = "#27292c"
timeout = 3
timeout = 5
# Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon

View file

@ -0,0 +1,44 @@
[General]
contrastOpacity=188
disabledTrayIcon=true
drawColor=#ad00ff
drawThickness=1
filenamePattern=Screenshot_%Y-%m-%d_%H-%M-%S
savePath=/home/itsdrike/Pictures/Screenshots
savePathFixed=false
setSaveAsFileExtension=Portable Network Graphic file (PNG) (*.png)
showStartupLaunchMessage=true
startupLaunch=true
[Shortcuts]
TYPE_ARROW=A
TYPE_CIRCLE=C
TYPE_CIRCLECOUNT=
TYPE_COMMIT_CURRENT_TOOL=Ctrl+Return
TYPE_COPY=Ctrl+C
TYPE_DELETE_CURRENT_TOOL=Del
TYPE_DRAWER=D
TYPE_EXIT=Ctrl+Q
TYPE_MARKER=M
TYPE_MOVESELECTION=Ctrl+M
TYPE_MOVE_DOWN=Down
TYPE_MOVE_LEFT=Left
TYPE_MOVE_RIGHT=Right
TYPE_MOVE_UP=Up
TYPE_OPEN_APP=Ctrl+O
TYPE_PENCIL=P
TYPE_PIN=
TYPE_PIXELATE=B
TYPE_RECTANGLE=R
TYPE_REDO=Ctrl+Shift+Z
TYPE_RESIZE_DOWN=Shift+Down
TYPE_RESIZE_LEFT=Shift+Left
TYPE_RESIZE_RIGHT=Shift+Right
TYPE_RESIZE_UP=Shift+Up
TYPE_SAVE=Ctrl+S
TYPE_SELECTION=S
TYPE_SELECTIONINDICATOR=
TYPE_SELECT_ALL=Ctrl+A
TYPE_TEXT=T
TYPE_TOGGLE_PANEL=Space
TYPE_UNDO=Ctrl+Z

View file

@ -1,22 +1,77 @@
# This is Git's per-user configuration file.
[user]
name = ItsDrike
email = itsdrikeofficial@gmail.com
signingkey = B5F6B41F708C3ADD
[credential]
helper = store --file ~/.config/git/git-credentials
name = ItsDrike
email = itsdrike@protonmail.com
signingkey = FB8CA11A2CF3A843
[alias]
l = log --oneline --decorate --all --graph
lol = log --pretty=oneline --abbrev-commit --graph
lg = log --all --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
quickclone = "clone --single-branch --depth=1"
bareclone = "!sh -c 'git clone --bare \"$0\" \"$1\"/.bare; echo \"gitdir: ./.bare\" > \"$1/.git\"'"
m = "merge"
p = "push"
pl = "pull"
f = "fetch"
s = "status --short --branch"
ss = "status"
ch = "checkout"
chb = "checkout -b"
undo = "reset --soft HEAD~"
redo = "reset HEAD@{1}"
unstage = "restore --staged"
c = "commit"
ca = "commit --ammend"
ci = "commit --interactive"
cm = "commit --message"
cv = "commit --verbose"
a = "add"
aa = "add --all"
ap = "add --patch"
au = "add --update"
d = "diff"
dc = "diff --cached"
ds = "diff --staged"
dw = "diff --word-diff"
b = "branch"
ba = "branch --all"
bd = "branch --delete"
bD = "branch --delete --force"
bm = "branch --move"
bM = "branch --move --force"
l = "log --oneline --decorate --all --graph"
lp = "log --patch"
lo = "log --pretty=oneline --abbrev-commit --graph"
lg = "log --all --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
set-upstream = "!git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`"
stash-staged = "!sh -c 'git stash --keep-index; git stash push -m \"staged\" --keep-index; git stash pop stash@{1}'"
find-merge = "!sh -c 'commit=$0 && branch=${1:-HEAD} && (git rev-list $commit..$branch --ancestry-path | cat -n; git rev-list $commit..$branch --first-parent | cat -n) | sort -k2 -s | uniq -f1 -d | sort -n | tail -1 | cut -f2'"
show-merge = "!sh -c 'merge=$(git find-merge $0 $1) && [ -n \"$merge\" ] && git show $merge'"
[credential]
helper = store --file ~/.config/git/git-credentials
[core]
excludefile = ~/.config/git/global_gitignore
editor = nvim
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
line-numbers = true
[merge]
tool = meld
[mergetool]
keepbackup = false
keeptemporaries = false
conflictstyle = diff3
[diff]
tool = meld
tool = vimdiff
[fetch]
prune = true
[commit]
gpgsign = true
[gpg]
program = /usr/bin/gpg
gpgsign = true
[init]
defaultBranch = main

View file

@ -0,0 +1,25 @@
# vim: filetype=conf
# Byte-compiled / optimized / DLL Files
__pycache__/
*.py[cod]
*$py.class
# Virtual Environments
.venv/
# Editor project settings
## VSCode
.vscode/
## PyCharm intellij
.idea/
## repl.it
.replit
## spyder
.spyproject/
.spyderproject/
# Custom attributes for folders on Mac OS
.DS_Store
# Personal TODO files
TODO

View file

@ -12,7 +12,7 @@ set scrolloff 5
cmd open ${{
case $(file --mime-type "$f" -bL) in
text/*|application/json) $EDITOR "$f";;
*) xdg-open "$f" ;;
*) devour xdg-open "$f" ;;
esac
}}

View file

@ -1,5 +1,22 @@
# Vim keys seeking
l seek 5
h seek -5
j seek -60
k seek 60
S cycle sub
# Set A-B Loop key to g, since l was rebound
g ab-loop
# Swap i and I, use lowercase for toggle
i script-binding stats/display-stats-toggle
I script-binding stats/display-stats
# Zooming
- add video-zoom -.25
+ add video-zoom .25
# Moving/panning video
kp8 add video-pan-y .05
kp6 add video-pan-x -.05
kp2 add video-pan-y -.05
kp4 add video-pan-x .05
kp5 set video-pan-x 0; set video-pan-y 0; set video-zoom 0

View file

@ -0,0 +1,180 @@
# mpv keybindings
#
# Location of user-defined bindings: ~/.config/mpv/input.conf
#
# Lines starting with # are comments. Use SHARP to assign the # key.
# Copy this file and uncomment and edit the bindings you want to change.
#
# List of commands and further details: DOCS/man/input.rst
# List of special keys: --input-keylist
# Keybindings testing mode: mpv --input-test --force-window --idle
#
# Use 'ignore' to unbind a key fully (e.g. 'ctrl+a ignore').
#
# Strings need to be quoted and escaped:
# KEY show-text "This is a single backslash: \\ and a quote: \" !"
#
# You can use modifier-key combinations like Shift+Left or Ctrl+Alt+x with
# the modifiers Shift, Ctrl, Alt and Meta (may not work on the terminal).
#
# The default keybindings are hardcoded into the mpv binary.
# You can disable them completely with: --no-input-default-bindings
# Developer note:
# On compilation, this file is baked into the mpv binary, and all lines are
# uncommented (unless '#' is followed by a space) - thus this file defines the
# default key bindings.
# If this is enabled, treat all the following bindings as default.
#default-bindings start
#MBTN_LEFT ignore # don't do anything
#MBTN_LEFT_DBL cycle fullscreen # toggle fullscreen
#MBTN_RIGHT cycle pause # toggle pause/playback mode
#MBTN_BACK playlist-prev # skip to the previous file
#MBTN_FORWARD playlist-next # skip to the next file
# Mouse wheels, touchpad or other input devices that have axes
# if the input devices supports precise scrolling it will also scale the
# numeric value accordingly
#WHEEL_UP seek 10 # seek 10 seconds forward
#WHEEL_DOWN seek -10 # seek 10 seconds backward
#WHEEL_LEFT add volume -2 # lower the volume
#WHEEL_RIGHT add volume 2 # raise the volume
## Seek units are in seconds, but note that these are limited by keyframes
#RIGHT seek 5 # seek 5 seconds forward
#LEFT seek -5 # seek 5 seconds backward
#UP seek 60 # seek 1 minute forward
#DOWN seek -60 # seek 1 minute backward
# Do smaller, always exact (non-keyframe-limited), seeks with shift.
# Don't show them on the OSD (no-osd).
#Shift+RIGHT no-osd seek 1 exact # seek exactly 1 second forward
#Shift+LEFT no-osd seek -1 exact # seek exactly 1 second backward
#Shift+UP no-osd seek 5 exact # seek exactly 5 seconds forward
#Shift+DOWN no-osd seek -5 exact # seek exactly 5 seconds backward
#Ctrl+LEFT no-osd sub-seek -1 # seek to the previous subtitle
#Ctrl+RIGHT no-osd sub-seek 1 # seek to the next subtitle
#Ctrl+Shift+LEFT sub-step -1 # change subtitle timing such that the previous subtitle is displayed
#Ctrl+Shift+RIGHT sub-step 1 # change subtitle timing such that the next subtitle is displayed
#Alt+left add video-pan-x 0.1 # move the video right
#Alt+right add video-pan-x -0.1 # move the video left
#Alt+up add video-pan-y 0.1 # move the video down
#Alt+down add video-pan-y -0.1 # move the video up
#Alt++ add video-zoom 0.1 # zoom in
#Alt+- add video-zoom -0.1 # zoom out
#Alt+BS set video-zoom 0 ; set video-pan-x 0 ; set video-pan-y 0 # reset zoom and pan settings
#PGUP add chapter 1 # seek to the next chapter
#PGDWN add chapter -1 # seek to the previous chapter
#Shift+PGUP seek 600 # seek 10 minutes forward
#Shift+PGDWN seek -600 # seek 10 minutes backward
#[ multiply speed 1/1.1 # decrease the playback speed
#] multiply speed 1.1 # increase the playback speed
#{ multiply speed 0.5 # halve the playback speed
#} multiply speed 2.0 # double the playback speed
#BS set speed 1.0 # reset the speed to normal
#Shift+BS revert-seek # undo the previous (or marked) seek
#Shift+Ctrl+BS revert-seek mark # mark the position for revert-seek
#q quit # exit
#Q quit-watch-later # exit and remember the playback position
#q {encode} quit 4 # exit
#ESC set fullscreen no # leave fullscreen
#ESC {encode} quit 4 # exit
#p cycle pause # toggle pause/playback mode
#. frame-step # advance one frame and pause
#, frame-back-step # go back by one frame and pause
#SPACE cycle pause # toggle pause/playback mode
#> playlist-next # skip to the next file
#ENTER playlist-next # skip to the next file
#< playlist-prev # skip to the previous file
#O no-osd cycle-values osd-level 3 1 # toggle displaying the OSD on user interaction or always
#o show-progress # show playback progress
#P show-progress # show playback progress
#i script-binding stats/display-stats # display information and statistics
#I script-binding stats/display-stats-toggle # toggle displaying information and statistics
#` script-binding console/enable # open the console
#z add sub-delay -0.1 # shift subtitles 100 ms earlier
#Z add sub-delay +0.1 # delay subtitles by 100 ms
#x add sub-delay +0.1 # delay subtitles by 100 ms
#ctrl++ add audio-delay 0.100 # change audio/video sync by delaying the audio
#ctrl+- add audio-delay -0.100 # change audio/video sync by shifting the audio earlier
#Shift+g add sub-scale +0.1 # increase the subtitle font size
#Shift+f add sub-scale -0.1 # decrease the subtitle font size
#9 add volume -2 # lower the volume
#/ add volume -2 # lower the volume
#0 add volume 2 # raise the volume
#* add volume 2 # raise the volume
#m cycle mute # toggle mute
#1 add contrast -1 # decrease the contrast
#2 add contrast 1 # increase the contrast
#3 add brightness -1 # decrease the brightness
#4 add brightness 1 # increase the brightness
#5 add gamma -1 # decrease the gamma
#6 add gamma 1 # increase the gamma
#7 add saturation -1 # decrease the saturation
#8 add saturation 1 # increase the saturation
#Alt+0 set current-window-scale 0.5 # halve the window size
#Alt+1 set current-window-scale 1.0 # reset the window size
#Alt+2 set current-window-scale 2.0 # double the window size
#d cycle deinterlace # toggle the deinterlacing filter
#r add sub-pos -1 # move subtitles up
#R add sub-pos +1 # move subtitles down
#t add sub-pos +1 # move subtitles down
#v cycle sub-visibility # hide or show the subtitles
#Alt+v cycle secondary-sub-visibility # hide or show the secondary subtitles
#V cycle sub-ass-vsfilter-aspect-compat # toggle stretching SSA/ASS subtitles with anamorphic videos to match the historical renderer
#u cycle-values sub-ass-override "force" "no" # toggle overriding SSA/ASS subtitle styles with the normal styles
#j cycle sub # switch subtitle track
#J cycle sub down # switch subtitle track backwards
#SHARP cycle audio # switch audio track
#_ cycle video # switch video track
#T cycle ontop # toggle placing the video on top of other windows
#f cycle fullscreen # toggle fullscreen
#s screenshot # take a screenshot of the video in its original resolution with subtitles
#S screenshot video # take a screenshot of the video in its original resolution without subtitles
#Ctrl+s screenshot window # take a screenshot of the window with OSD and subtitles
#Alt+s screenshot each-frame # automatically screenshot every frame; issue this command again to stop taking screenshots
#w add panscan -0.1 # decrease panscan
#W add panscan +0.1 # shrink black bars by cropping the video
#e add panscan +0.1 # shrink black bars by cropping the video
#A cycle-values video-aspect-override "16:9" "4:3" "2.35:1" "-1" # cycle the video aspect ratio ("-1" is the container aspect)
#POWER quit # exit
#PLAY cycle pause # toggle pause/playback mode
#PAUSE cycle pause # toggle pause/playback mode
#PLAYPAUSE cycle pause # toggle pause/playback mode
#PLAYONLY set pause no # unpause
#PAUSEONLY set pause yes # pause
#STOP quit # exit
#FORWARD seek 60 # seek 1 minute forward
#REWIND seek -60 # seek 1 minute backward
#NEXT playlist-next # skip to the next file
#PREV playlist-prev # skip to the previous file
#VOLUME_UP add volume 2 # raise the volume
#VOLUME_DOWN add volume -2 # lower the volume
#MUTE cycle mute # toggle mute
#CLOSE_WIN quit # exit
#CLOSE_WIN {encode} quit 4 # exit
#ctrl+w quit # exit
#E cycle edition # switch edition
#l ab-loop # set/clear A-B loop points
#L cycle-values loop-file "inf" "no" # toggle infinite looping
#ctrl+c quit 4 # exit
#DEL script-binding osc/visibility # cycle OSC visibility between never, auto (mouse-move) and always
#ctrl+h cycle-values hwdec "auto" "no" # toggle hardware decoding
#F8 show-text ${playlist} # show the playlist
#F9 show-text ${track-list} # show the list of video, audio and sub tracks
#
# Legacy bindings (may or may not be removed in the future)
#
#! add chapter -1 # seek to the previous chapter
#@ add chapter 1 # seek to the next chapter
#
# Not assigned by default
# (not an exhaustive list of unbound commands)
#
# ? cycle sub-forced-only # toggle DVD forced subs
# ? stop # stop playback (quit or enter idle mode)

View file

@ -0,0 +1,47 @@
unbind-key j
unbind-key k
unbind-key h
unbind-key H
unbind-key L
unbind-key c
unbind-key ,
browser "xdg-open %u"
# Feed settings
prepopulate-query-feeds yes
refresh-on-startup yes
# Macros
macro w set browser "mpv %u" ; open-in-browser ; set browser "xdg-open %u"
macro r set browser "w3m %u" ; open-in-browser ; set browser "xdg-open %u"
# bind keys
bind-key ; macro-prefix
bind-key BACKSPACE quit
bind-key h quit
bind-key j down
bind-key k up
bind-key l open
bind-key H prev-feed
bind-key L next-feed
bind-key c toggle-show-read-feeds
color background default default
color listnormal default default
color listnormal_unread default default
color listfocus color16 cyan
color listfocus_unread color16 cyan
color info default black
color article default default
highlight article "(^Feed:.*|^Title:.*|^Author:.*)" cyan default bold
highlight article "(^Link:.*|^Date:.*)" default default
highlight article "https?://[^ ]+" green default
highlight article "^(Title):.*$" blue default
highlight article "\\[[0-9][0-9]*\\]" magenta default bold
highlight article "\\[image\\ [0-9]+\\]" green default bold
highlight article "\\[embedded flash: [0-9][0-9]*\\]" green default bold
highlight article ":.*\\(link\\)$" cyan default
highlight article ":.*\\(image\\)$" blue default
highlight article ":.*\\(embedded flash\\)$" magenta default

View file

@ -0,0 +1,2 @@
https://itsdrike.com/posts/index.xml
https://archlinux.org/feeds/news

1
home/.config/nvim Submodule

@ -0,0 +1 @@
Subproject commit 5e10bd30328a890bc2f62d8687b3c346a8032b14

View file

@ -1,14 +0,0 @@
" Let init.vim handle sourcing other more specific
" vim configuration files, rather than keeping everything
" in a single huge config file
let config_dir = system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim"')
let rc_dir = config_dir.'/rc'
execute 'source '.rc_dir.'/base.vim'
execute 'source '.rc_dir.'/mappings.vim'
execute 'source '.rc_dir.'/abbreviations.vim'
execute 'source '.rc_dir.'/autocmd.vim'
execute 'source '.rc_dir.'/plugins.vim'
" Needs to be below plugins for colorscheme
execute 'source '.rc_dir.'/theme.vim'

View file

@ -1,11 +0,0 @@
cnoreabbrev Wq wq
cnoreabbrev wQ wq
cnoreabbrev WQ wq
cnoreabbrev Wa wa
cnoreabbrev W w
cnoreabbrev Q q
cnoreabbrev Qall qall
cnoreabbrev W! w!
cnoreabbrev Q! q!
cnoreabbrev Qall! qall!

View file

@ -1,15 +0,0 @@
" Move ~/.viminfo to XDG_CACHE_HOME
"set viminfofile=$XDG_CACHE_HOME/vim/viminfo
" Disable automatic commenting on newline
autocmd FileType * setlocal formatoptions-=cro
" Have Vim jump to the last position when reopening a file
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" Automatically deletes all trailing whitespace on save
autocmd BufWritePre * %s/\s\+$//e
" Enable spellcheck for certain file types
autocmd FileType tex,latex,markdown,gitcommit setlocal spell spelllang=en_us

View file

@ -1,28 +0,0 @@
filetype plugin on " Enable filetype detection
" Tab settings
set expandtab " Expand tabs to spaces
set tabstop=4 " Tab size
set shiftwidth=4 " Indentation size
set softtabstop=4 " Tabs/Spaces interrop
set tabpagemax=50 " More tabs
" In-file Search (/)
set ignorecase " Do case insensitive matching
set incsearch " Show partial matches for a search phrase
set hlsearch " Highlight Search
" Command-mode search
set path+=** " Search down into subfolders with tab completion
set wildmode=longest,list,full " Enable autocompletion
set wildmenu " Display all matching files when we tab complete
" Misc
set autoindent " Enable autoindent
set autoread " Reload files on change
set undolevels=999 " Lots of these
set history=1000 " More history
set encoding=utf-8 " Use UTF-8 encoding
set mouse=a " Enable mouse mode
set splitbelow splitright " Split in more natural way

View file

@ -1,60 +0,0 @@
" Unmap arrow keys in normal mode to remove bad habits
nnoremap <Down> <nop>
nnoremap <Left> <nop>
nnoremap <Right> <nop>
nnoremap <Up> <nop>
" Stop search highlight on Ctrl+l (until next search)
map <silent> <C-l> :noh<CR>
" System clipboard interactions
map <C-c> "+y
vnoremap <C-v> "+p
" Start spell-check
map <leader>s :setlocal spell! spelllang=en_us<CR>
" Use shift to move 10 lines up/down quickly
noremap <silent> K 10k
noremap <silent> J 10j
" Enable/Disable auto comment
map <leader>c :setlocal formatoptions-=cro<CR>
map <leader>C :setlocal formatoptions=cro<CR>
" Tab navigation
nnoremap <Tab> gt
nnoremap <S-Tab> gT
nnoremap <silent> <A-t> :tabnew<CR>
nnoremap <silent> <A-2> :tabmove +<CR>
nnoremap <silent> <A-1> :tabmove -<CR>
nnoremap <A-p> :tabp<CR>
nnoremap <A-n> :tabn<CR>
" Remap splits navigation to just CTRL + hjkl
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Make adjusting split sizes a bit more friendly
noremap <silent> <C-Left> :vertical resize +3<CR>
noremap <silent> <C-Right> :vertical resize -3<CR>
noremap <silent> <C-Up> :resize +3<CR>
noremap <silent> <C-Down> :resize -3<CR>
" Alias replace all
nnoremap <A-s> :%s//gI<Left><Left><Left>
" Save file as sudo when no write permissions
cmap w!! w !sudo tee > /dev/null %
" Don't leave visual mode after indenting
vmap < <gv
vmap > >gv
" Compile opened file (using custom comp script)
nnoremap <A-c> :w \| !comp <c-r>%<CR>
" Shell check
nnoremap <leader>p :!shellcheck %<CR>

View file

@ -1,13 +0,0 @@
" Airline specific theming settings
let g:airline_theme='codedark' " Use codedark theme from vim-ariline-themes
let g:airline_right_sep = "" " Don't use special separators (<)
let g:airline_left_sep = "" " Don't use special separators (>)
let g:airline#extensions#tabline#enabled = 1 " Enable tabline (top line)
let g:airline#tabline#formatter = 'unique_tail' " Tabline filename formatter
let g:webdevicons_enable_airline_statusline = 0 " Use special icons from vim-devicons (requires nerdfonts)
let g:airline_powerline_fonts = 1 " Use special symbols from powerline fonts (line no, col no)
if empty($DISPLAY) " Use ASCII-only if we're in TTY
let g:airline_symbols_ascii = 1
endif

View file

@ -1,12 +0,0 @@
" NERDTree config
map <C-n> :NERDTreeToggle<CR>
let g:NERDTreeDirArrowExpandable = '►'
let g:NERDTreeDirArrowCollapsible = '▼'
let NERDTreeShowLineNumbers=1
let NERDTreeShowHidden=1
let NERDTreeMinimalUI = 1
let g:NERDTreeWinSize=38
if empty($DISPLAY) " Disable devicons for nerdtree in TTY
let g:webdevicons_enable_nerdtree = 0
endif

View file

@ -1,12 +0,0 @@
" Define python-specific neomake config
" Neomake is python syntax checker, in this case, we use flake8
" Requires: pip install flake8
let g:neomake_python_enabled_makers = ['flake8']
let g:neomake_python_flake8_maker = {'args': ['--ignore=E501', '--format=default']}
call neomake#configure#automake('nrwi', 500)
" Enable deoplete on startup
" Deoplete provides autosuggestions from python standard library
" Requires: pip install pynvim
let g:deoplete#enable_at_startup = 1

View file

@ -1,8 +0,0 @@
let wiki_conf = {}
let wiki_conf.path = '~/Personal/vimwiki'
let wiki_conf.path_html = '~/Personal/vimwiki-html'
let wiki_conf.html_template = '~/Personal/vimwiki-html/template.tpl'
let wiki_conf.syntax = 'markdown'
let wiki_conf.ext = '.md'
let g:vimwiki_list = [wiki_conf]

View file

@ -1,43 +0,0 @@
" This file handles plugin management with plug.vim
" It contains an automatic first-time installer for plug.vim and plugins
" It also sources plugin specific config files
" Install plugins automatically
if ! filereadable(config_dir."/autoload/plug.vim")
echo "Downloading junegunn/vim-plug to manage plugins..."
let x = system('mkdir -p '.config_dir.'/autoload')
let x = system('curl https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim > '.config_dir.'/autoload/plug.vim')
autocmd VimEnter * PlugInstall
endif
" Plug.vim plugin list
call plug#begin(config_dir."/plugged")
" Code completion
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" Themes
Plug 'tomasiser/vim-code-dark'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
" Python
Plug 'neomake/neomake'
Plug 'zchee/deoplete-jedi'
" Misc
Plug 'dhruvasagar/vim-table-mode'
Plug 'vimwiki/vimwiki'
Plug 'wakatime/vim-wakatime'
Plug 'preservim/nerdcommenter'
Plug 'preservim/nerdtree'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
call plug#end()
" Source more plugin-specific configuration files from here
let plugins_rc_dir = rc_dir."/plugins.d"
execute "source ".plugins_rc_dir."/airline.vim"
execute "source ".plugins_rc_dir."/nerdtree.vim"
execute "source ".plugins_rc_dir."/vimwiki.vim"
execute "source ".plugins_rc_dir."/python.vim"

View file

@ -1,26 +0,0 @@
" General colorscheme settings
syntax on " Turn syntax highlighting on
colorscheme codedark " Requires vim-code-dark plugin
set cursorline " Highlight cursor line
set laststatus=2 " Always show status line
set number relativenumber " Show relative line numbers
set showmatch " Show matching brackets
set scrolloff=5 " Keep 5 lines horizonal scrolloff
set sidescrolloff=5 " Keep 5 characters vertical scrolloff
set guioptions-=m " Remove menubar
set guioptions-=T " Remove toolbar
set guioptions-=r " Remove right-hand scrollbar
set guioptions-=L " Remove left-hand scrollbar
" Use more noticable cursor line color
highlight CursorLine guibg=#2b2b2b
" Don't use true colors in TTY
if empty($DISPLAY)
set notermguicolors
else
set termguicolors
endif

View file

@ -1,16 +1,175 @@
# Apply blur to terminals
# NOTE 1: This configuration when used as-is, requires --experimental-backends
# command line option to be used, in order to enable the usage of the
# dual-kawase blur method.
# NOTE 2: With the picom from standard repositories, currently using experimental
# backends will disable the support for rounded corners. If you want to use both
# the dual-kawase blur method and rounded corners, you will need to use a fork.
# However it is not mandantory. If you will use the standard version, you will just
# see a warning in picom's logs each time it's started, you can disable rounded
# corners completely to prevent this. If you do want to use a fork, I recommend this:
# <https://github.com/jonaburg/picom> (picom-jonaburg-git on AUR).
# NOTE 3: The shadows are currently disabled, the reason for this are the issues
# that occur with combining rounded corners and shadows, for more info, check:
# <https://github.com/jonaburg/picom/issues/62>
# General settings
###################
# Daemonize process. Fork to background after initialization.
# Causes issues with certain (badly-written) drivers.
daemon = false
# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
# `xrender` is the default one.
# We use GLX since it's generally a lot faster than xrender.
# There usually aren't anny issues with this, but if you do experience some
# try falling back to xrender.
backend = "glx";
# To properly use the GLX backend, we need to enable experimental backends
experimental-backends = true;
# Enable/Disable VSync.
vsync = true;
# Enable remote control via D-Bus.
dbus = false;
# Try to detect WM windows (a non-override-redirect window with no
# child that has 'WM_STATE') and mark them as active.
mark-wmwin-focused = true;
# Mark override-redirect windows that doesn't have a child window
# with 'WM_STATE' focused.
mark-ovredir-focused = true;
# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
detect-rounded-corners = true;
# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_OPACITY' of client windows to frame windows.
detect-client-opacity = true;
# Specify refresh rate of the screen. If not specified or 0, picom will
# try detecting this with X RandR extension.
refresh-rate = 0;
# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
# Might cause incorrect opacity when rendering transparent content (but never
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
glx-no-stencil = true;
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
# Recommended if it works.
glx-no-rebind-pixmap = true;
# Disable/Enable the use of damage information.
# Disabling cause the whole screen to be redrawn everytime, instead of the part
# of the screen has actually changed. Potentially degrades the performance,
# but might fix some artifacts. It is recommended to keep this enabled.
# The opposing option is no-use-damage
use-damage = true
# Window type settings
#
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
# "tooltip", "notification", "combo", and "dnd".
#
# Following per window-type options are available: ::
#
# fade, shadow:::
# Controls window-type-specific shadow and fade settings.
#
# opacity:::
# Controls default opacity of the window type.
#
# focus:::
# Controls whether the window of this type is to be always considered focused.
# (By default, all window types except "normal" and "dialog" has this on.)
#
# full-shadow:::
# Controls whether shadow is drawn under the parts of the window that you
# normally won't be able to see. Useful when the window has parts of it
# transparent, and you want shadows in those areas.
#
# redir-ignore:::
# Controls whether this type of windows should cause screen to become
# redirected again after been unredirected. If you have unredir-if-possible
# set, and doesn't want certain window to cause unnecessary screen redirection,
# you can set this to `true`.
#
wintypes:
{
normal = { full-shadow = true; blur-background = true; };
splash = { blur-background = false; };
menu = { full-shadow = true; };
tooltip = { fade = true; shadow = false; focus = true;};
dock = { shadow = false; };
dnd = { shadow = false; };
popup_menu = { full-shadow = true; };
utility = { full-shadow = true; };
toolbar = { full-shadow = true; };
notification = { opacity = 1; }
};
# Transparency / Opacity
#########################
# Specify a list of opacity rules.
# format: "[Opacity level]:[xprop info name] = '[xprop value]'"
# class_g reffers to class in position #0,
# class_i reffers to class in position #1
# - class_g reffers to class in position #0,
# - class_i reffers to class in position #1
# Note we don't make any guarantee about possible conflicts with other
# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
# Apply blur to terminals
opacity-rule = [
"90:class_g = 'Alacritty'",
"90:class_g = 'st-256color'",
"90:class_g = 'URxvt'",
"90:class_g = 'kitty'",
"90:class_g = 'tabbed'"
"100:name = 'Dunst'",
# Opacities with enabled shadows (shadows allow for higher alpha - lower number)
#"70:class_g = 'Alacritty'",
#"70:class_g = 'st-256color'",
#"70:class_g = 'URxvt'",
#"70:class_g = 'kitty'",
#"82:class_g = 'Spotify'"
# Opacities without shadows
"80:class_g = 'Alacritty'",
"80:class_g = 'st-256color'",
"80:class_g = 'URxvt'",
"80:class_g = 'kitty'",
"92:class_g = 'Spotify'"
];
# Blur
# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
active-opacity = 1;
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
inactive-opacity = 1;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
frame-opacity = 1.0;
# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0)
opacity = 1.0
# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
inactive-opacity-override = false
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
inactive-dim = 0.0
# Use fixed inactive dim value, instead of adjusting according to window opacity.
inactive-dim-fixed = 1.0
# Specify a list of conditions of windows that should always be considered focused.
focus-exclude = []
# Background blurring
########################
blur:
{
# dual_kawase blur method requires GLX as backend
@ -18,28 +177,113 @@ blur:
# dual_kawase allows for multi-threaded bluring that's
# very fast.
method = "dual_kawase";
strength = 1;
#method = "kernel";
#kernel = "11x11gaussian";
strength = 4;
deviation = 1.0;
# When true, blur background of semi-transparent / ARGB window.
background = false;
# When true, the background of windows when the window frame
# is not opaque is blurred, implies background=true
background-frame = false;
# Whe true, use fixeed blur strength rather than adjusing
# according to window opacity
background-fixed = false;
# Specify the blur convolution kernel
kern = "3x3box"
}
wintypes:
{
normal = { blur-background = true };
splash = { blur-background = false };
};
# Exclude conditions for background blur
blur-background-exclude = [
# Prevents picom from blurring the background
# when taking selection screenshot with `maim`
"class_g = 'slop'",
"_GTK_FRAME_EXTENTS@:c"
];
# Fading
# Shadows
################
# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
shadow = false;
# The blur radius for shadows, in pixels. (defaults to 12)
shadow-radius = 12;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
shadow-opacity = 0.75;
# The left offset for shadows, in pixels. (defaults to -15)
shadow-offset-x = -15;
# The top offset for shadows, in pixels. (defaults to -15)
shadow-offset-y = -15;
# Red color value of shadow (0.0 - 1.0, defaults to 0).
shadow-red = 0
# Green color value of shadow (0.0 - 1.0, defaults to 0).
shadow-green = 0
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
shadow-blue = 0
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
xinerama-shadow-crop = false
# Specify a list of conditions of windows that should have no shadow.
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"class_g = 'slop'",
"class_g = 'Polybar'",
"_GTK_FRAME_EXTENTS@:c"
];
# Window Fading
################
# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used.
fading = false;
fade-in-step = 0.07;
fade-out-step = 0.07;
fade-exclude = [ ];
# GLX backend
# Use GLX as a backend instead of default xrender.
# GLX will generally be a lot faster than xrender.
# There shouldn't be any issues with this, but if you
# do experience any, you should try falling back to xrender.
backend = "glx";
glx-no-stencil = true;
glx-copy-from-front = false;
use-damage = true
glx-no-rebind-pixmap = true;
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
fade-in-step = 0.07;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
fade-out-step = 0.1;
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
fade-delta = 10
# Do not fade on window open/close.
no-fading-openclose = false
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox,
# Fluxbox, etc.
no-fading-destroyed-argb = false
# Specify a list of conditions of windows that should not be faded.
# don't need this, we disable fading for all normal windows with wintypes: {}
fade-exclude = [
"class_g = 'slop'" # maim
]
# Corners
################
# Sets the radius of rounded window corners. When > 0, the compositor will
# round the corners of windows.
corner-radius = 12;
rounded-corners-exclude = [
"class_g = 'Rofi'",
"class_g = 'dmenu'",
"name = 'Notification area'",
"name = 'Dunst'"
]
# Rounded corners alone only changes the window, but the borders
# around it still remain rectangular, round-borders option allows
# the borders to also be round.
round-borders = 1;
# Specify a list of border width rules.
# format: "[pixels]:[xprop info name] = '[xprop value]'"
# Note this doesn't have any guarantee about not conflicting with the
# border width set by the window manager.
round-borders-rule = [];

View file

@ -1,4 +1,4 @@
#!/usr/bin/env zsh
#!/bin/sh
# I'm not the greatest typist
alias sl='ls'
@ -8,6 +8,14 @@ alias souce='source'
alias suod='sudo '
alias sduo='sudo '
# Replacements (adding flags)
alias cp='cp -iv' # Ask before overwriting, verbose
alias mv='mv -iv' # Ask before overwriting, verbose
alias rm='trash-put' # Use trash-cli instead of true removal
alias rmr='\rm -v' # True rm, verbose (asking here is too annoying)
alias wget='wget -c' # Resume wget by default
alias df='df -H' # Show sizes as powers of 1000
# Directory changing
alias ..='cd ..'
alias ...='cd ../../'
@ -17,47 +25,34 @@ alias .2='cd ../../'
alias .3='cd ../../../'
alias .4='cd ../../../../'
alias .5='cd ../../../../../'
# z.lua script
alias j='z' # for the sake of autojump old habits
alias zz='z -c' # restrict matches to subdirs of $PWD
alias zb='z -b' # restrict matches to parent directories
alias zi='z -I' # cd with interactive fzf selection
alias zbi='z -b -I' # pick parent directory to cd into with fzf
# Files/Directories utilities
alias mkdir='mkdir -p'
alias md='mkdir'
alias fhere='find . -name'
alias rr='rm -r'
alias rf='rm -f'
alias rrf='rm -rf'
alias rr='rmr -r'
alias rf='rmr -f'
alias rrf='rmr -rf'
alias vimdiff='nvim -d'
# Replacements (adding flags)
alias cp='cp -iv' # Ask before overwriting, verbose
alias mv='mv -iv' # Ask before overwriting, verbose
alias rm='rm -v' # Verbose (asking here is too annoying)
alias wget='wget -c' # Resume wget by default
alias df='df -H' # Show sizes as powers of 1000
# Directory listing aliases, defaults to exa, if aviable
if command -v exa > /dev/null; then
alias ls='exa'
alias l='exa -glah --classify'
alias ll='exa -glah --classify -s=size --group-directories-first -r'
alias ldir='exa -glahD'
alias tree='exa -Tlagh'
alias dotall='exa -hulad .[a-z]*' # Show both dotdirs and dotfiles
alias dotfiles='dotall | grep -v ^d' # Show all dotfiles
alias dotdirs='dotall | grep --color=never ^d' # Show all dotdirs
alias ls='exa'
alias l='exa -glah --classify'
alias ll='exa -glah --classify -s=size --group-directories-first -r'
alias ldir='exa -glahD'
alias tree='exa -Tlagh'
alias dotall='exa -hulad .[a-z]*' # Show both dotdirs and dotfiles
alias dotfiles='dotall | grep -v ^d' # Show all dotfiles
alias dotdirs='dotall | grep --color=never ^d' # Show all dotdirs
else
alias ls='ls --color=auto'
alias l='ls -lahX --classify'
alias ll='ls -lahX --classify --group-directories-first'
alias ldir='ls -lahX --classify | grep --color=never ^d'
alias dotall='ls -lahXd .[a-z]*'
alias dotfiles='dotall | grep -v ^d'
alias dotdirs='dotall | grep --color=never ^d'
alias ls='ls --color=auto'
alias l='ls -lahX --classify'
alias ll='ls -lahX --classify --group-directories-first'
alias ldir='ls -lahX --classify | grep --color=never ^d'
alias dotall='ls -lahXd .[a-z]*'
alias dotfiles='dotall | grep -v ^d'
alias dotdirs='dotall | grep --color=never ^d'
fi
# Config access shortcuts
@ -70,16 +65,40 @@ alias cfenv='cfenvironment'
alias cfhandlers='vim ~/.config/shell/handlers'
alias cfprompt='vim ~/.config/shell/prompt'
alias cfkeybinds='vim ~/.config/shell/keybinds'
alias cfxprofile='vim ~/.config/x11/xprofile'
alias cfxmonad='vim ~/.config/xmonad/xmonad.hs && xmonad --recompile && xmonad --restart'
alias cfxmobar='vim ~/.config/xmobar/xmobarrc.hs && ~/.config/xmobar/multi_mon.sh 2'
alias cftodo='vim ~/Personal/todo'
alias cftodo='vim ~/Personal/vimwiki/todo.md'
alias cfnvim='vim ~/.config/nvim'
alias cfvim='cfnvim'
# Python
alias py3='python3'
alias py2='python2'
alias ipy='ipython'
alias bpy='bpython'
command -v ipython > /dev/null && alias py='ipython' || alias py='python'
# z.lua shortcuts
alias j='z' # for the sake of autojump old habits
alias zz='z -c' # restrict matches to subdirs of $PWD
alias zb='z -b' # restrict matches to parent directories
alias zi='z -I' # cd with interactive fzf selection
alias zbi='z -b -I' # pick parent directory to cd into with fzf
## Make aliases for individual cpython/pypy versions
py_versions="\n2\n3\n3.6\n3.7\n3.8\n3.9\n3.10"
# shellcheck disable=SC2139
echo "$py_versions" | while read -r version; do
for python in python pypy; do
[ "$python" = "python" ] && prefix="py" || prefix="pypy"
if command -v "$python$version" >/dev/null; then
if [ "$python" = "python" ]; then
alias "pip$version=$python$version -m pip"
else
alias "ppip$version=$python$version -m pip"
fi
alias "$prefix${version}pip=$python$version -m pip"
alias "$prefix$version=$python$version"
alias "i$prefix$version=$python$version -c 'import IPython;IPython.start_ipython()'"
alias "b$prefix$version=$python$version -c 'from bpython.curtsies import main;import sys;sys.exit(main())'"
fi
done
done
# Fallbacks
command -v hd > /dev/null || alias hd='hexdump -C' # Cannonical hex dump; some systems have this symlinked
@ -87,6 +106,7 @@ command -v md5sum > /dev/null || alias md5sum='md5' # Fallback from `md5sum` to
command -v sha1sum > /dev/null || alias sha1sum='shasum' # Fallback from `sha1sum` to `shasum`
command -v vim > /dev/null && alias vi='vim' # Let vim take precedence over vi
command -v nvim > /dev/null && alias vi='nvim' && alias vim='nvim' # Let nvim take precedence over vi/vim
command -v vimtutor > /dev/null || alias vimtutor='nvim -c Tutor' # Let vimtutor fallback to nvim's tutor
# X11 clipboard (either using xclip or xsel, xsel takes precedence if both)
command -v xclip > /dev/null && alias pbcopy='xclip -selection clipboard'
@ -102,6 +122,13 @@ alias mergepdf='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=_merged.p
alias encrypt='gpg -c --no-symkey-cache --cipher-algo AES256' # Encrypt file with AES256 symetric encryption
alias decrypt='gpg' # For the sake of completeness, include decrypt command to the above, though it's only just gpg alias
# Terminal window swallowing for blocking programs (devour)
alias xdg-open='devour xdg-open'
alias mpv='devour mpv'
alias nomacs='devour nomacs'
alias pcmanfm='devour pcmanfm'
alias spotify='devour spotify'
# Regular expressions
alias reg_email='echo "[a-Z0-9._%-]+@[a-Z0-9.-]+\.[a-Z]{2,10}"'
alias reg_mac='echo "([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'
@ -116,7 +143,7 @@ alias grep_mac='grep -E `reg_mac`'
alias massgrep='grep -RHIni'
# Network
alias ip-show='curl https://api.ipify.org' # Get global IP address
alias ip-show='curl https://ifconfig.co' # Get global IP address
alias ips="ifconfig -a | grep -oE \"inet6? (addr:)?s?\`reg_ip\`\" | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
alias lan-device-scan='nmap -T5 -sP 192.168.0.0-255'
alias lan-vuln-scan='nmap -sT -O --script vuln 192.168.0.0-255'
@ -143,13 +170,16 @@ alias kernel-configure='cd /usr/src/linux && make menuconfig'
# System actions
alias sv='systemctl'
alias pacnew="find / -name '*.pacnew' 2>/dev/null" # Search for all new configurations after pacman update
alias backup="rsync -avHAXS --delete --filter='dir-merge /.rsync-filter'" # Make full rsync backup, respecting .rsync-filter files for exclusions
alias upload='curl -F "f:1=<-" ix.io'
alias upload-journal='sudo journalctl -b -1 | upload' # Upload journalctl from last boot to ix.io
alias auth-log='journalctl SYSLOG_FACILITY=10 -r'
alias cpu-stress='for i in $(seq $(getconf _NPROCESSORS_ONLN)); do yes > /dev/null & done' # Run `yes > /dev/null` on all cores as stress test
alias nvidia='__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia' # Run app with nvidia (on hybrid mode with optimus)
alias swapout='sudo swapoff -a; sudo swapon -a' # Reset swap (move everything to RAM)
alias mount-ram='mount -t tmpfs tmpfs' # Mount RAM disk for fast filesystem
alias screenlock='xset s activate' # Use DPMS to trigger xss-lock and handle screen locking
# System info
alias meminfo='free -m -l -t'
@ -184,26 +214,22 @@ alias cleanup='clean-trash && clean-down && clean-journal && clean-pacman'
# Git aliases
alias g='git'
alias gs='git status'
alias gp='git push'
alias gpl='git pull'
alias gf='git fetch'
alias gs='git status --short --branch'
alias gss='git status'
alias ga='git add'
alias gap='git add --patch'
alias gc='git commit'
alias gcm='git commit --message'
alias gb='git branch'
alias gch='git checkout'
alias gchb='git checkout -b'
alias gd='git diff'
alias gdc='git diff --cached'
alias gm='git merge'
alias ga='git add'
alias gaa='git add all'
alias gc='git commit'
alias gcm='git commit -m' && alias commit='git commit -m'
alias gp='git push' && alias push='git push'
alias gpl='git pull' && alias pull='git pull'
alias gf='git fetch' && alias fetch='git fetch'
alias gb='git branch' && alias branch='git branch'
alias gch='git checkout' && alias checkout='git checkout'
alias gau='git add -u' && alias addup='git add -u'
alias gchb='git checkout -b'
alias gcda='git diff --cached' # Diff any files staged for commit
alias glog='git log --oneline --decorate --graph'
alias gundo='git reset HEAD~'
alias gundo='git reset --soft HEAD~'
alias gredo="git reset 'HEAD@{1}'"
alias gundopush="git push -f origin HEAD^:master"
# Youtube-dl aliases
alias ytv-best='youtube-dl -f bestvideo+bestaudio'
@ -211,6 +237,12 @@ alias yta-best='youtube-dl --extract-audio --audio-format best'
alias yta-mp3='youtube-dl --extract-audio --audio-format mp3'
alias yta-wav='youtube-dl --extract-audio --audio-format wav'
# Terminal vim-like exits, in case I think the terminal is vim
alias :q='exit'
alias :q!='exit'
alias :wq='exit'
alias :wq!='exit'
# Shell aliases
alias reload="exec \$SHELL" # Reload the shell (i.e. invoke as a login shell)
alias path='echo -e ${PATH//:/\\n}' # Print each PATH entry on a separate line
@ -221,22 +253,22 @@ alias tty-clock='tty-clock -Ssc' # Terminal clock screensaver
alias rick='curl -s -L https://raw.githubusercontent.com/ItsDrike/rickrollrc/master/roll.sh| bash' # Terminal rickroll
# If user is not root, pass all commands via sudo/doas
if [ $UID -ne 0 ]; then
# Enable aliases to be sudoed/doased
if [ "$(id -u)" -ne 0 ]; then
# Enable aliases to be sudoed/doased
# with doas having precedence over sudo if found
## Uncomment if you are using autocompletion (is ZSH)
## Uncomment if you are using autocompletion (is ZSH)
#command -v /usr/bin/sudo > /dev/null && alias doas='nocorrect sudo ' && alias sudo='nocorrect sudo '
#command -v /usr/bin/doas > /dev/null && alias doas='nocorrect doas ' && alias sudo='nocorrect doas '
## if the above is uncommented, comment this
## if the above is uncommented, comment this
command -v /usr/bin/sudo > /dev/null && alias doas='sudo ' && alias sudo='sudo '
command -v /usr/bin/doas > /dev/null && alias doas='doas ' && alias sudo='doas '
command -v /usr/bin/doas > /dev/null && alias doas='doas ' && alias sudo='doas '
fi
# enable color support
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
(test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)") || eval "$(dircolors -b)"
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
@ -254,21 +286,23 @@ fi
# Normalize `open` across Linux, macOS, and Windows.
# This is needed to make `open` function (see below) cross-platform
if [ ! $(uname -s) = 'Darwin' ]; then
if grep -q Microsoft /proc/version; then
# Ubuntu on Windows using the Linux subsystem
alias open='explorer.exe'
else
alias open='xdg-open'
fi
if [ ! "$(uname -s)" = 'Darwin' ]; then
if grep -q Microsoft /proc/version; then
# Ubuntu on Windows using the Linux subsystem
alias open='explorer.exe'
else
alias open='xdg-open'
fi
fi
# Functions
if [ -f ~/.config/shell/functions ]; then
source ~/.config/shell/functions
# shellcheck source=/home/itsdrike/.config/shell/functions
. "$HOME/.config/shell/functions"
fi
# Extra
if [ -f ~/.config/shell/extra ]; then
source ~/.config/shell/extra
# shellcheck source=/home/itsdrike/.config/shell/extra
. "$HOME/.config/shell/extra"
fi

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Environmental variable definitions.
# This file is only sourced once after login, unlike .zshrc/.bashrc
@ -8,6 +8,8 @@
# which means the XDG definitions will be ignored anyway, and
# defining them may break programs when root is actually logged in.
# Define some variables for POSIX compatibility
uid="$(id -u)"
# Default programs
export EDITOR="nvim"
@ -18,7 +20,7 @@ export TERMINAL="alacritty"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_RUNTIME_DIR="/run/user/$UID"
export XDG_RUNTIME_DIR="/run/user/$uid"
# Per-Application XDG settings
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
@ -42,6 +44,7 @@ export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
# Colorful man pages
# If bat is installed, use it as manpager
# shellcheck disable=SC2155
if command -v bat > /dev/null; then
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
else
@ -56,7 +59,12 @@ fi
# Other program settings
export SUDO_ASKPASS="$HOME/.local/bin/scripts/dmenu/dmenupass"
export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv
export XSECURELOCK_SHOW_HOSTNAME=0 # Don't show hostname in xsecurelock
#export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within projects ./.venv
export XSECURELOCK_SHOW_HOSTNAME=0 # Don't show hostname in xsecurelock
export XSECURELOCK_SHOW_DATETIME=1 # Show current date and time in xsecurelock
export QT_QPA_PLATFORMTHEME="qt5ct" # Have QT use theme from qt5ct.
#export QT_STYLE_OVERRIDE="gtk2" # Have QT use the gtk2 theme (needs aur/qt5-styleplugins)
# Remove irrelevant variables added for posix compatibility
unset posix

View file

@ -1,55 +1,58 @@
#!/usr/bin/env zsh
#!/bin/sh
# TODO: Currently, this file isn't entirely POSIX compatible,
# it will run fine with bash or zsh, however some functions may cause
# issues with pure POSIX. The fill will however run fine, the errors
# would only occur if the incompatible functions would be started.
# Show application listening on given port
function port() {
sudo netstat -pln | grep $1 | awk '{print $NF}'
port() {
sudo netstat -pln | grep "$1" | awk '{print $NF}'
}
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
mkd() {
# shellcheck disable=SC2164
mkdir -p "$1" && cd "$1";
}
# `o` with no arguments opens the current directory, otherwise opens the given
# location
function o() {
if [ $# -eq 0 ]; then
open .;
else
open "$@";
fi;
o() {
if [ $# -eq 0 ]; then
open .;
else
open "$@";
fi;
}
# Use bat for nicer git diffs
function batdiff() {
batdiff() {
git diff --name-only --diff-filter=d | xargs bat --diff
}
# Determine size of a file or total size of a directory
function dir-size() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
\du $arg -- "$@";
else
\du $arg .[^.]* ./*;
fi;
dirsize() {
if du -b /dev/null > /dev/null 2>&1; then
arg=-sbh;
else
arg=-sh;
fi
if [[ -n "$*" ]]; then
\du $arg -- "$@";
else
\du $arg .[^.]* ./*;
fi;
}
function randmac() {
sudo ip link set dev $1 down
sudo macchanger -A $1
sudo ip link set dev $1 up
randmac() {
sudo ip link set dev "$1" down
sudo macchanger -A "$1"
sudo ip link set dev "$1" up
}
# Go to the root of a git tree
cdgit () {
git rev-parse --is-inside-work-tree > /dev/null 2>&1
if [ $? -eq 0 ]; then
TEMP_PWD=`pwd`
if [ "$(git rev-parse --is-inside-work-tree > /dev/null 2>&1)" -eq 0 ]; then
while ! [ -d .git ]; do
cd ..
done
@ -61,76 +64,76 @@ cdgit () {
}
# Create a data URL from a file
function dataurl() {
local mimeType=$(file -b --mime-type "$1");
if [[ $mimeType == text/* ]]; then
mimeType="${mimeType};charset=utf-8";
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
dataurl() {
mimeType="$(file -b --mime-type "$1")"
if echo "$mimeType" | grep -e "^text/.*$" >/dev/null; then
mimeType="${mimeType};charset=utf-8"
fi
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')";
}
# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring
# the `.git` directory, listing directories first. The output gets piped into
# `less` with options to preserve color and line numbers, unless the output is
# small enough for one screen.
function tre() {
tree -I '.git|node_modules|bower_components' --group-directories-first "$@" | less -FRNX;
tre() {
tree -I '.git|node_modules|bower_components' --group-directories-first "$@" | less -FRNX;
}
# Show all the names (CNs and SANs) listed in the SSL certificate
# for a given domain
function getcertnames() {
if [ -z "${1}" ]; then
echo "ERROR: No domain specified.";
return 1;
fi;
getcertnames() {
if [ -z "${1}" ]; then
echo "ERROR: No domain specified.";
return 1;
fi;
local domain="${1}";
echo "Testing ${domain}…";
echo ""; # newline
domain="${1}";
echo "Testing ${domain}…";
echo ""; # newline
local tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1);
tmp=$(echo -e "GET / HTTP/1.0\nEOT" \
| openssl s_client -connect "${domain}:443" -servername "${domain}" 2>&1);
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
local certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
no_serial, no_sigdump, no_signame, no_validity, no_version");
echo "Common Name:";
echo ""; # newline
echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
echo ""; # newline
echo "Subject Alternative Name(s):";
echo ""; # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
| sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
return 0;
else
echo "ERROR: Certificate not found.";
return 1;
fi;
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
certText=$(echo "${tmp}" \
| openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
no_serial, no_sigdump, no_signame, no_validity, no_version");
echo "Common Name:";
echo ""; # newline
echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
echo ""; # newline
echo "Subject Alternative Name(s):";
echo ""; # newline
echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
| sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
return 0;
else
echo "ERROR: Certificate not found.";
return 1;
fi;
}
# Compare original and gzipped file size
function gz-compare() {
local origsize=$(wc -c < "$1");
local gzipsize=$(gzip -c "$1" | wc -c);
local ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l);
printf "orig: %d bytes\n" "$origsize";
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio";
gz_compare() {
origsize=$(wc -c < "$1");
gzipsize=$(gzip -c "$1" | wc -c);
ratio=$(echo "$gzipsize * 100 / $origsize" | bc -l);
printf "orig: %d bytes\n" "$origsize";
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio";
}
# Extract almost any archive
function extract {
extract() {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
return 1
else
for n in $@
for n in "$@"
do
if [ -f "$n" ] ; then
case "${n%,}" in
@ -160,44 +163,47 @@ fi
}
# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
function targz() {
local tmpFile="${@%/}.tar";
tar -cvf "${tmpFile}" "${@}" || return 1;
targz() {
# Combine given names spearated with spaces as the filename
tmpFile="${*%/}.tar"
size=$(
stat -f"%z" "${tmpFile}" 2> /dev/null; # macOS `stat`
stat -c"%s" "${tmpFile}" 2> /dev/null; # GNU `stat`
);
tar -cvf "${tmpFile}" "${@}" || return 1
local cmd="";
if (( size < 52428800 )) && hash zopfli 2> /dev/null; then
# the .tar file is smaller than 50 MB and Zopfli is available; use it
cmd="zopfli";
else
if hash pigz 2> /dev/null; then
cmd="pigz";
else
cmd="gzip";
fi;
fi;
size=$(
stat -f"%z" "${tmpFile}" 2> /dev/null; # macOS `stat`
stat -c"%s" "${tmpFile}" 2> /dev/null; # GNU `stat`
);
echo "Compressing .tar ($((size / 1000)) kB) using \`${cmd}\`…";
"${cmd}" -v "${tmpFile}" || return 1;
[ -f "${tmpFile}" ] && rm "${tmpFile}";
cmd="";
if (( size < 52428800 )) && hash zopfli 2> /dev/null; then
# the .tar file is smaller than 50 MB and Zopfli is available; use it
cmd="zopfli";
else
if hash pigz 2> /dev/null; then
cmd="pigz";
else
cmd="gzip";
fi;
fi;
zippedSize=$(
stat -f"%z" "${tmpFile}.gz" 2> /dev/null; # macOS `stat`
stat -c"%s" "${tmpFile}.gz" 2> /dev/null; # GNU `stat`
);
echo "Compressing .tar ($((size / 1000)) kB) using \`${cmd}\`…";
"${cmd}" -v "${tmpFile}" || return 1;
[ -f "${tmpFile}" ] && rm "${tmpFile}";
echo "${tmpFile}.gz ($((zippedSize / 1000)) kB) created successfully.";
zippedSize=$(
stat -f"%z" "${tmpFile}.gz" 2> /dev/null; # macOS `stat`
stat -c"%s" "${tmpFile}.gz" 2> /dev/null; # GNU `stat`
);
echo "${tmpFile}.gz ($((zippedSize / 1000)) kB) created successfully.";
}
function anonymize {
anonymize() {
# Reset the prompt on initial run to allow this script
# to be ran multiple times without user having to reload
# PS1 manually
source ${XDG_CONFIG_DIR:-$HOME/.config}/shell/prompt
# shellcheck source=/home/itsdrike/.config/shell/prompt
. "${XDG_CONFIG_DIR:-$HOME/.config}/shell/prompt"
# Regular expression to match 0-255 numbers (color)
color_int_re='^(0+)?([0-9]{1,2}|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
@ -212,7 +218,7 @@ function anonymize {
AT_COLOR="%F{004}"
MACHINE_COLOR="%F{070}"
while [[ $# -gt 0 ]]; do
while [ $# -gt 0 ]; do
key=$1
case $key in

View file

@ -1,43 +1,40 @@
#!/usr/bin/env bash
#!/bin/sh
if command -v pkgfile > /dev/null; then
# Command not found hook that uses `pkgfile` package
# to search through the package index in order to find
# a package which includes given command, which was resolved
# and not found, if there are no such packages, only print
# command not found message
command_not_found_handler() {
local pkgs cmd="$1" files=()
printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages
files=(${(f)"$(pkgfile ${cmd})"})
if (( ${#files[@]} )); then
printf '\r%s may be found in the following packages:\n' "$cmd"
local res=() repo package version file
for file in "$files[@]"; do
res=("${(0)file}")
repo="$res[1]"
printf ' %s\n' "$repo"
done
else
printf '\n'
fi
return 127
}
elif [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then
# Ubuntu handle for bash default command-not-found
# it works similarely to the above arch alternative,
# this is based on the original bash implementation
command_not_found_handler() {
# check because cmd not found could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
# Command not found hook that uses `pkgfile` package
# to search through the package index in order to find
# a package which includes given command, which was resolved
# and not found, if there are no such packages, only print
# command not found message
command_not_found_handler() {
cmd="$1"
printf 'zsh: command not found: %s' "$cmd" # print command not found asap, then search for packages
repos="$(pkgfile "$cmd")"
if [ -n "$repos" ]; then
printf '\r%s may be found in the following packages:\n' "$cmd"
echo "$repos" | while read -r pkg; do
printf ' %s\n' "$pkg"
done
else
printf '\n'
fi
return 127
}
elif [ -x /usr/lib/command-not-found ] || [ -x /usr/share/command-not-found/command-not-found ]; then
# Ubuntu handle for bash default command-not-found
# it works similarely to the above arch alternative,
# this is based on the original bash implementation
command_not_found_handler() {
# check because cmd not found could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
fi

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh
# shellcheck disable=SC2030,SC2031,SC2015
# Set default keybindings (mostly from oh-my-zsh)
# Make sure that the terminal is in application mode when zle is active, since
@ -18,30 +19,30 @@ fi
bindkey -e
# Start typing + [Up-Arrow] - fuzzy find history forward
if [[ -n "${terminfo[kcuu1]}" ]]; then
if [ -n "${terminfo[kcuu1]}" ]; then
autoload -U up-line-or-beginning-search
zle -N up-line-or-beginning-search
bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
fi
# Start typing + [Down-Arrow] - fuzzy find history backward
if [[ -n "${terminfo[kcud1]}" ]]; then
if [ -n "${terminfo[kcud1]}" ]; then
autoload -U down-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
fi
# [Home] - Go to beginning of line
[[ -n "${terminfo[khome]}" ]] && bindkey "${terminfo[khome]}" beginning-of-line || bindkey "^[[H" beginning-of-line
[ -n "${terminfo[khome]}" ] && bindkey "${terminfo[khome]}" beginning-of-line || bindkey "^[[H" beginning-of-line
# [End] - Go to end of line
[[ -n "${terminfo[kend]}" ]] && bindkey "${terminfo[kend]}" end-of-line || bindkey "^[[F" end-of-line
[ -n "${terminfo[kend]}" ] && bindkey "${terminfo[kend]}" end-of-line || bindkey "^[[F" end-of-line
# [Shift-Tab] - move through the completion menu backwards
[[ -n "${terminfo[kcbt]}" ]] && bindkey "${terminfo[kcbt]}" reverse-menu-complete
[ -n "${terminfo[kcbt]}" ] && bindkey "${terminfo[kcbt]}" reverse-menu-complete
# [Backspace] - delete backward
bindkey '^?' backward-delete-char
# [Delete] - delete forward
[[ -n "${terminfo[kdch1]}" ]] && bindkey "${terminfo[kdch1]}" delete-char || bindkey "^[[3~" delete-char
[ -n "${terminfo[kdch1]}" ] && bindkey "${terminfo[kdch1]}" delete-char || bindkey "^[[3~" delete-char
# [Ctrl-Delete] - delete whole forward-word
bindkey '^[[3;5~' kill-word
@ -53,9 +54,9 @@ bindkey '^[[1;5D' backward-word
# [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line.
bindkey '^r' history-incremental-search-backward
# [PageUp] - Up a line of history
[[ -n "${terminfo[kpp]}" ]] && bindkey "${terminfo[kpp]}" up-line-or-history
[ -n "${terminfo[kpp]}" ] && bindkey "${terminfo[kpp]}" up-line-or-history
# [PageDown] - Down a line of history
[[ -n "${terminfo[knp]}" ]] && bindkey "${terminfo[knp]}" down-line-or-history
[ -n "${terminfo[knp]}" ] && bindkey "${terminfo[knp]}" down-line-or-history
# [Space] - do history expansion on space
bindkey ' ' magic-space

View file

@ -1,4 +1,5 @@
#!/usr/bin/env zsh
# shellcheck disable=SC2155
# Configuration variables:
@ -30,20 +31,20 @@ export PROMPT_EOL_MARK=""
# (unless you change it in kernel), respect this and downgrade
# the color scheme accordingly (it won't look best, but it's
# still better than no colors)
if [ $TERM = "linux" ]; then
GREEN="%F{002}"
RED="%F{001}"
ORANGE="%F{003}"
BLUE="%F{004}"
LBLUE="%F{006}"
PURPLE="%F{005}"
if [ "$TERM" = "linux" ]; then
GREEN="%F{002}"
RED="%F{001}"
ORANGE="%F{003}"
BLUE="%F{004}"
LBLUE="%F{006}"
PURPLE="%F{005}"
else
GREEN="%F{047}"
RED="%F{196}"
ORANGE="%F{214}"
BLUE="%F{027}"
LBLUE="%F{075}"
PURPLE="%F{105}"
GREEN="%F{047}"
RED="%F{196}"
ORANGE="%F{214}"
BLUE="%F{027}"
LBLUE="%F{075}"
PURPLE="%F{105}"
fi
RESET="%f"
@ -52,34 +53,34 @@ git_prompt() {
ref=$(command git symbolic-ref HEAD 2> /dev/null) || ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
echo -n " $ORANGE${ref#refs/heads/}"
if [ ! -z "$(git status --short)" ]; then
if [ -n "$(git status --short 2>/dev/null)" ]; then
echo "$RED+"
fi
}
# Adds @chroot or @ssh
foreign_prompt() {
if [ "$(awk '$5=="/" {print $1}' </proc/1/mountinfo)" != "$(awk '$5=="/" {print $1}' </proc/$$/mountinfo)" ]; then
echo -n "@${ORANGE}chroot"
elif [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
echo -n "@${ORANGE}ssh"
fi
if [ "$(awk '$5=="/" {print $1}' </proc/1/mountinfo)" != "$(awk '$5=="/" {print $1}' </proc/$$/mountinfo)" ]; then
echo -n "@${ORANGE}chroot"
elif [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
echo -n "@${ORANGE}ssh"
fi
}
# Prints appropriate working directory
#nd Prints appropriate working directory
working_directory() {
# By default up to 5 directories will be tolerated before shortening
# After we surpass that, first directory (or ~) will be printed together with last 3
# This feature uses special symbol '…', but this isn't aviable when in TTY. Because
# of this, when we are in TTY, we fall back to longer '...'
# By default up to 5 directories will be tolerated before shortening
# After we surpass that, first directory (or ~) will be printed together with last 3
# This feature uses special symbol '…', but this isn't aviable when in TTY. Because
# of this, when we are in TTY, we fall back to longer '...'
if [ $USE_SHORTENED_WORKDIR != 1 ]; then
echo -n " $BLUE$~"
elif [ $TERM = "linux" ]; then
echo -n " $BLUE%(5~|%-1~/.../%3~|%4~)"
else
echo -n " $BLUE%(5~|%-1~/…/%3~|%4~)"
fi
if [ $USE_SHORTENED_WORKDIR != 1 ]; then
echo -n " $BLUE$~"
elif [ "$TERM" = "linux" ]; then
echo -n " $BLUE%(5~|%-1~/.../%3~|%4~)"
else
echo -n " $BLUE%(5~|%-1~/…/%3~|%4~)"
fi
}
# Execution time tracking hooks, this is unique to zsh, as it can add
@ -96,7 +97,7 @@ exec_time_preexec_hook() {
exec_time_precmd_hook() {
[[ $SHOW_CMD_TIME == 0 ]] && return
[[ -z $PROMPT_EXEC_TIME_START ]] && return
local PROMPT_EXEC_TIME_STOP=$(date +%s.%N)
local PROMPT_EXEC_TIME_STOP="$(date +%s.%N)"
PROMPT_EXEC_TIME_DURATION=$(echo "($PROMPT_EXEC_TIME_STOP - $PROMPT_EXEC_TIME_START) * 1000" | bc -l)
unset PROMPT_EXEC_TIME_START
}
@ -104,24 +105,24 @@ format_time() {
# Do some formatting to get nice time (e.g. 2m 12s) from miliseconds
# $1 is the milisecond amount (int or float)
# $2 is the precision (ms/s/m/h/d)
local T=$1
local D=$(echo "scale=0;$T/1000/60/60/24" | bc -l)
local H=$(echo "scale=0;$T/1000/60/60%24" | bc -l)
local M=$(echo "scale=0;$T/1000/60%60" | bc -l)
local S=$(echo "scale=0;$T/1000%60" | bc -l)
local MS=$(echo "scale=0;$T%1000" | bc -l)
local T="$1"
local D="$(echo "scale=0;$T/1000/60/60/24" | bc -l)"
local H="$(echo "scale=0;$T/1000/60/60%24" | bc -l)"
local M="$(echo "scale=0;$T/1000/60%60" | bc -l)"
local S="$(echo "scale=0;$T/1000%60" | bc -l)"
local MS="$(echo "scale=0;$T%1000" | bc -l)"
local precision=$2
local out=""
case "$precision" in
"ms") [[ $MS > 0 ]] && out="$(printf "%dms" $MS) ${out}"; precision="s" ;&
"s") [[ $S > 0 ]] && out="$(printf "%ds" $S) ${out}"; precision="m" ;&
"m") [[ $M > 0 ]] && out="$(printf "%dm" $M) ${out}"; precision="h" ;&
"h") [[ $H > 0 ]] && out="$(printf "%dh" $H) ${out}"; precision="d" ;&
"d") [[ $D > 0 ]] && out="$(printf "%dd" $D) ${out}" ;;
"ms") [[ "$MS" -gt 0 ]] && out="$(printf "%dms" "$MS") ${out}"; precision="s" ;&
"s") [[ "$S" -gt 0 ]] && out="$(printf "%ds" "$S") ${out}"; precision="m" ;&
"m") [[ "$M" -gt 0 ]] && out="$(printf "%dm" "$M") ${out}"; precision="h" ;&
"h") [[ "$H" -gt 0 ]] && out="$(printf "%dh" "$H") ${out}"; precision="d" ;&
"d") [[ "$D" -gt 0 ]] && out="$(printf "%dd" "$D") ${out}" ;;
*) out="$T" ;; # Return $1 ($T) if precision wasn't specified/valid
esac
printf "$out"
printf "%s" "$out"
}
display_cmd_time() {
[[ $CMD_TIME_SHOW == 0 ]] && return
@ -134,7 +135,7 @@ display_cmd_time() {
# this happens when all fields (seconds/minutes/...) are 0,
# if we use milisecond precision, this will likely never happen
# but with other precisions, it could
[[ "$(expr length "$time_took")" == 0 ]] && return
[ ${#time_took} -eq 0 ] && return
echo -n " ${LBLUE}took ${time_took}"
}
@ -151,14 +152,14 @@ PS1+="$(foreign_prompt)"
PS1+="$(working_directory)"
PS1+="\$(git_prompt)"
PS1+="\$(display_cmd_time)"
PS1+=" $PURPLE%(!.#.$)$RESET " # Final symbol (# or $)
PS1+=" $PURPLE%(!.#.$)$RESET " # Final symbol (# or $)
# Next line prompt
PS2="$RED\ $RESET"
# Right side prompt
RPS1=""
if [ $TERM = "linux" ]; then
if [ "$TERM" = "linux" ]; then
# Displaying cmd time here works, but often causes issues when we
# resize the terminal, since right prompts can be annoying to deal
# with when resizing. This would run relatively often so it makes
@ -172,7 +173,15 @@ if [ $TERM = "linux" ]; then
RPS1+="%(?..${RED}%? X$RESET)"
else
# Read comments for the section above.
#RPS+="\$(display_cmd_time)"
#RPS1+="\$(display_cmd_time)"
# NOTE: "↵" symbol could cause issues with on some terminals/machines that
# don't handle unicode well, this issue could be very confusing to debug,
# and it would not be apparent what's wrong since the symbol itself will
# be drawn, however when it is drawn, it will also move the cursor line
# 2 places back since this symbol is made up of 3 bytes (in unicode) and
# regular ASCII characters only take up 1 byte, this means that whenever
# the right-side prompt appears (on error), the prompt would have this issue.
RPS1="%(?..${RED}%? ↵$RESET)"
fi

View file

@ -0,0 +1,98 @@
# Don't ask for confirmations
#assume_yes = true
# Disable specific steps - same options as the command line flag
#disable = ["system", "emacs"]
# Ignore failures for these steps
#ignore_failures = ["powershell"]
# Run specific steps - same options as the command line flag
only = ["system", "pip3", "flatpak", "node", "pipx", "rustup", "dotnet", "tldr", "vim"]
# Do not ask to retry failed steps (default: false)
#no_retry = true
# Run inside tmux
#run_in_tmux = true
# List of remote machines with Topgrade installed on them
#remote_topgrades = ["toothless", "pi", "parnas"]
# Arguments to pass SSH when upgrading remote systems
#ssh_arguments = "-o ConnectTimeout=2"
# Path to Topgrade executable on remote machines
#remote_topgrade_path = ".cargo/bin/topgrade"
# Arguments to pass tmux when pulling Repositories
#tmux_arguments = "-S /var/tmux.sock"
# Do not set the terminal title
#set_title = false
# Cleanup temporary or old files
#cleanup = true
[git]
#max_concurrency = 5
# Additional git repositories to pull
#repos = [
# "~/src/*/",
# "~/.config/something"
#]
# Don't pull the predefined git repos
#predefined_repos = false
# Arguments to pass Git when pulling Repositories
#arguments = "--rebase --autostash"
[composer]
#self_update = true
# Commands to run before anything
[pre_commands]
#"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
# Custom commands
[commands]
#"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
[brew]
#greedy_cask = true
[linux]
# Arch Package Manager to use. Allowed values: autodetect, trizen, paru, yay, pacman.
#arch_package_manager = "pacman"
# Arguments to pass yay (or paru) when updating packages
#yay_arguments = "--nodevel"
#show_arch_news = true
#trizen_arguments = "--devel"
#enable_tlmgr = true
#emerge_sync_flags = "-q"
#emerge_update_flags = "-uDNa --with-bdeps=y world"
#redhat_distro_sync = false
#rpm_ostree = false
[windows]
# Manually select Windows updates
#accept_all_updates = false
#open_remotes_in_new_terminal = true
# Causes Topgrade to rename itself during the run to allow package managers
# to upgrade it. Use this only if you installed Topgrade by using a package
# manager such as Scoop to Cargo
#self_rename = true
[npm]
# Use sudo if the NPM directory isn't owned by the current user
#use_sudo = true
[firmware]
# Offer to update firmware; if false just check for and display available updates
#upgrade = true
[flatpak]
# Use sudo for updating the system-wide installation
#use_sudo = true

View file

@ -6,18 +6,14 @@
# Set monitor order
xrandr --output HDMI-1 --auto --output eDP-1 --right-of HDMI-1 --auto &
# Set X11 lockscreen delays (DPMS)
xset s on &
xset s 600 5 & # 10 minutes, 5s for dimmer
# XSS lock with xsecurelock
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
# Start xsecurelock lockscreen with xss-lock
~/.local/bin/scripts/lockscreen start &
# Set the background with a custom `setbg` script
setbg &
# Use xresources file in ~/.config/x11
xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources
xrdb ${XDG_CONFIG_HOME:-$HOME/.config}/x11/xresources &
# Start compositor manager to allow transparency
picom -b --experimental-backends &
@ -41,12 +37,11 @@ aa-notify -p &
# Enable numlock with numlockx
numlockx &
# Run emacs daemon
#emacs --daemon &
# Run urxvt daemon
#urxvtd -q -o -f &
# Udiskie for simple mounting and notifications, no automount for security reasons
udiskie -A -s &
# Enable running applications from chroot
xhost +local:
# Change x shaped default cursor (fonts are located in /usr/include/X11/cursorfont.h)
xsetroot -cursor_name left_ptr

View file

@ -33,41 +33,50 @@ commands = [
-- Gather and format CPU usage information
-- if it's above 50%, we consider it high and make it red
Run Cpu [
"-t", "<fn=1>\xf108</fn> cpu: <total>%",
"-t", "<fn=1>\xf2db</fn> <total>%",
"-H","50",
"--high","red"
] 20,
-- Ram used number and percent
Run Memory ["-t", "<fn=1>\xf233</fn> mem: <used>M (<usedratio>%)"] 20,
Run Memory ["-t", "<fn=1>\xf538</fn> <used>M (<usedratio>%)"] 20,
-- Battery information. This is likely to require some customization
-- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely.
Run Battery [
"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
"--",
"-i", "<fc=#75c44c>AC</fc>",
"-O", "<fc=#75c44c>AC</fc>",
"-o", "<fc=#ff0000>AUX</fc>",
"-L", "12",
"-h", "green",
"-l", "red"
] 10,
--Run Battery [
--"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
--"--",
--"-i", "<fc=#75c44c>AC</fc>",
--"-O", "<fc=#75c44c>AC</fc>",
--"-o", "<fc=#ff0000>AUX</fc>",
--"-L", "12",
--"-h", "green",
--"-l", "red"
--] 10,
-- Time and date
Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50,
-- Network up and down
Run Network "wlp2s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "wlp4s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
-- Uptime
Run Uptime ["-t", "<fn=1>\xf011</fn> <days>d <hours>h"] 360,
-- Show free disk space on /
Run DiskU [("/", "<fn=1>\xf0c7</fn> hdd: <free>")] [] 60,
Run DiskU [("/", "<fn=1>\xf0c7</fn> <free>")] [] 60,
-- Get kernel version from uname -r
Run Com "uname" ["-r"] "" 3600,
-- Volume info
Run Volume "default" "Master" ["-t", "<fn=1>\xf028</fn> <volume>%"] 5,
-- Get bitcoin price from a custom script
Run Com "/home/itsdrike/.local/bin/scripts/bitcoin" [] "bitcoin" 300,
-- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others
@ -93,14 +102,21 @@ template = "\
\<icon=haskell_20.xpm/> \
\<fc=#666666>|</fc> %UnsafeStdinReader% }{ \
\<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \
\<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \
\<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %wlp2s0% </fc> \
\<fc=#666666>|</fc> <fc=#78db32> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %default:Master% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %uptime% </fc> \
\<fc=#666666>|</fc> <fc=#efcb10><fn=2></fn> %bitcoin% </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\<fc=#666666>|</fc> %trayerpad%\
\ "
}
-- Abandoned template strings
-- Network Wifi:
-- \<fc=#666666>|</fc> <fc=#98be65> %wlp4s0% </fc> \
-- Network Ethernet:
-- \<fc=#666666>|</fc> <fc=#98be65> %enp3s0% </fc> \
-- Battery:
-- \<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \

View file

@ -33,41 +33,50 @@ commands = [
-- Gather and format CPU usage information
-- if it's above 50%, we consider it high and make it red
Run Cpu [
"-t", "<fn=1>\xf108</fn> cpu: <total>%",
"-t", "<fn=1>\xf2db</fn> <total>%",
"-H","50",
"--high","red"
] 20,
-- Ram used number and percent
Run Memory ["-t", "<fn=1>\xf233</fn> mem: <used>M (<usedratio>%)"] 20,
Run Memory ["-t", "<fn=1>\xf538</fn> <used>M (<usedratio>%)"] 20,
-- Battery information. This is likely to require some customization
-- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely.
Run Battery [
"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
"--",
"-i", "<fc=#75c44c>AC</fc>",
"-O", "<fc=#75c44c>AC</fc>",
"-o", "<fc=#ff0000>AUX</fc>",
"-L", "12",
"-h", "green",
"-l", "red"
] 10,
--Run Battery [
--"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
--"--",
--"-i", "<fc=#75c44c>AC</fc>",
--"-O", "<fc=#75c44c>AC</fc>",
--"-o", "<fc=#ff0000>AUX</fc>",
--"-L", "12",
--"-h", "green",
--"-l", "red"
--] 10,
-- Time and date
Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50,
-- Network up and down
Run Network "wlp2s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "wlp4s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
-- Uptime
Run Uptime ["-t", "<fn=1>\xf011</fn> <days>d <hours>h"] 360,
-- Show free disk space on /
Run DiskU [("/", "<fn=1>\xf0c7</fn> hdd: <free>")] [] 60,
Run DiskU [("/", "<fn=1>\xf0c7</fn> <free>")] [] 60,
-- Get kernel version from uname -r
Run Com "uname" ["-r"] "" 3600,
-- Volume info
Run Volume "default" "Master" ["-t", "<fn=1>\xf028</fn> <volume>%"] 5,
-- Get bitcoin price from a custom script
Run Com "/home/itsdrike/.local/bin/scripts/bitcoin" [] "bitcoin" 300,
-- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others
@ -93,12 +102,21 @@ template = "\
\<icon=haskell_20.xpm/> \
\<fc=#666666>|</fc> %UnsafeStdinReader% }{ \
\<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \
\<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \
\<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %wlp2s0% </fc> \
\<fc=#666666>|</fc> <fc=#78db32> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %default:Master% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %uptime% </fc> \
\<fc=#666666>|</fc> <fc=#efcb10><fn=2></fn> %bitcoin% </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\<fc=#666666>|</fc> %trayerpad%\
\ "
}
-- Abandoned template strings
-- Network Wifi:
-- \<fc=#666666>|</fc> <fc=#98be65> %wlp4s0% </fc> \
-- Network Ethernet:
-- \<fc=#666666>|</fc> <fc=#98be65> %enp3s0% </fc> \
-- Battery:
-- \<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \

View file

@ -33,41 +33,50 @@ commands = [
-- Gather and format CPU usage information
-- if it's above 50%, we consider it high and make it red
Run Cpu [
"-t", "<fn=1>\xf108</fn> cpu: <total>%",
"-t", "<fn=1>\xf2db</fn> <total>%",
"-H","50",
"--high","red"
] 20,
-- Ram used number and percent
Run Memory ["-t", "<fn=1>\xf233</fn> mem: <used>M (<usedratio>%)"] 20,
Run Memory ["-t", "<fn=1>\xf538</fn> <used>M (<usedratio>%)"] 20,
-- Battery information. This is likely to require some customization
-- based upon your specific hardware. Or, for a desktop you may want
-- to just remove this section entirely.
Run Battery [
"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
"--",
"-i", "<fc=#75c44c>AC</fc>",
"-O", "<fc=#75c44c>AC</fc>",
"-o", "<fc=#ff0000>AUX</fc>",
"-L", "12",
"-h", "green",
"-l", "red"
] 10,
--Run Battery [
--"-t", "<fn=1>\xf240</fn> <acstatus> <left>% - <timeleft>",
--"--",
--"-i", "<fc=#75c44c>AC</fc>",
--"-O", "<fc=#75c44c>AC</fc>",
--"-o", "<fc=#ff0000>AUX</fc>",
--"-L", "12",
--"-h", "green",
--"-l", "red"
--] 10,
-- Time and date
Run Date "<fn=1>\xf017</fn> %H:%M %b %d %Y" "date" 50,
-- Network up and down
Run Network "wlp2s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "wlp4s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
--Run Network "enp3s0" ["-t", "<fn=1>\xf0ab</fn> <rx>kb <fn=1>\xf0aa</fn> <tx>kb"] 20,
-- Uptime
Run Uptime ["-t", "<fn=1>\xf011</fn> <days>d <hours>h"] 360,
-- Show free disk space on /
Run DiskU [("/", "<fn=1>\xf0c7</fn> hdd: <free>")] [] 60,
Run DiskU [("/", "<fn=1>\xf0c7</fn> <free>")] [] 60,
-- Get kernel version from uname -r
Run Com "uname" ["-r"] "" 3600,
-- Volume info
Run Volume "default" "Master" ["-t", "<fn=1>\xf028</fn> <volume>%"] 5,
-- Get bitcoin price from a custom script
Run Com "/home/itsdrike/.local/bin/scripts/bitcoin" [] "bitcoin" 300,
-- Add dynamic invisible XPM icon that resizes to accomodate trayer
-- this needs to be an absolute string path, env vars or relpaths aren't accepted
-- this should only be on 1 monitor (single file), so ignore this comment on others
@ -92,11 +101,20 @@ template = "\
\<icon=haskell_20.xpm/> \
\<fc=#666666>|</fc> %UnsafeStdinReader% }{ \
\<fc=#666666>|</fc> <fc=#b3afc2><fn=2></fn> %uname% </fc> \
\<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ff6c6b> %memory% </fc> \
\<fc=#666666>|</fc> <fc=#51afef> %disku% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %wlp2s0% </fc> \
\<fc=#666666>|</fc> <fc=#78db32> %cpu% </fc> \
\<fc=#666666>|</fc> <fc=#ecbe7b> %default:Master% </fc> \
\<fc=#666666>|</fc> <fc=#98be65> %uptime% </fc> \
\<fc=#666666>|</fc> <fc=#efcb10><fn=2></fn> %bitcoin% </fc> \
\<fc=#666666>|</fc> <fc=#46d9ff> %date% </fc> \
\ "
}
-- Abandoned template strings
-- Network Wifi:
-- \<fc=#666666>|</fc> <fc=#98be65> %wlp4s0% </fc> \
-- Network Ethernet:
-- \<fc=#666666>|</fc> <fc=#98be65> %enp3s0% </fc> \
-- Battery:
-- \<fc=#666666>|</fc> <fc=#9ce996> %battery% </fc> \

View file

@ -4,4 +4,4 @@
AUTOSTART_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/autostart"
find $AUTOSTART_DIR -name '*.desktop' -exec ~/.local/bin/scripts/deskopen {} +
find $AUTOSTART_DIR -name "*.desktop" | xargs -I {} sh -c "~/.local/bin/scripts/deskopen {} &"

View file

@ -64,6 +64,8 @@ myModMask = mod4Mask
-- Preferred programs
myTerminal = "alacritty"
myBrowser = "firefox"
myFileManager = "pcmanfm"
myCliFileManager = "lf"
-- Preferred font
myFont :: String
@ -82,7 +84,7 @@ myFocusedBorderColor :: String
myFocusedBorderColor = "#bc96da"
-- Default workspaces. Number of workspaces is determined by the list length.
myWorkspaces = ["dev", "www", "sys", "chat", "mus", "vid", "doc", "virt", "etc"]
myWorkspaces = [" dev ", " www ", " sys ", " chat ", " mus ", " vid ", " doc ", " virt ", " etc "]
myWorkspaceIndices = M.fromList $ zipWith (,) myWorkspaces [1..] -- (,) == \x y -> (x,y)
-- Make the workspaces clickable
@ -104,12 +106,11 @@ myKeys =
[ ("M-S-r", spawn "xmonad --recompile; xmonad --restart") -- Recompiles xmonad
, ("M-S-q", io exitSuccess) -- Quits xmonad
-- Lock screen
, ("C-M-l", spawn "xset s activate") -- Send DPMS trigger for lockscreen
-- Programs
, ("M-b", spawn (myBrowser))
, ("M-<Return>", spawn (myTerminal))
, ("M-b", spawn (myBrowser))
, ("M-v", spawn (myFileManager))
, ("M-M1-v", spawn (myTerminal ++ " -e " ++ myCliFileManager))
, ("M-M1-h", spawn (myTerminal ++ " -e htop"))
, ("M-M1-b", spawn (myTerminal ++ " -e bpytop"))
, ("M-M1-p", spawn (myTerminal ++ " -e ipython"))
@ -127,7 +128,9 @@ myKeys =
-- Script shortcuts
, ("M-S-p", spawn "setbg ~/Pictures/Wallpapers/Active") -- Set random background
, ("M-S-d", spawn "displayselect")
, ("M-S-d", spawn "displayselect") -- Set display configurations
, ("M-C-l", spawn "lockscreen lock") -- Lock the screen
, ("M-C-S-l", spawn "lockscreen toggle") -- Toggle automatic locking
-- Kill windows
, ("M-w", kill1) -- Kill the currently focused client
@ -141,12 +144,13 @@ myKeys =
, ("M-.", nextScreen) -- Switch focus to next monitor
, ("M-,", prevScreen) -- Switch focus to prev monitor
, ("M-S-<KP_Add>", shiftTo Next nonNSP >> moveTo Next nonNSP) -- Shifts focused window to next ws
, ("M-S-<KP-Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
, ("M-S-<KP_Subtract>", shiftTo Prev nonNSP >> moveTo Prev nonNSP) -- Shifts focused window to prev ws
-- Floating windows
, ("M-f", sendMessage (T.Toggle "floats")) -- Toggles 'floats' layout
, ("M-f", withFocused $ float) -- Make window float
, ("M-t", withFocused $ windows . W.sink) -- Push floating window back to tile
, ("M-S-t", sinkAll) -- Push all floating windows to tile
, ("M-S-f", sendMessage (T.Toggle "floats")) -- Toggles 'floats' layout
-- Increase/decrease spacing (gaps)
, ("C-M1-j", decWindowSpacing 4) -- Decrease window spacing
@ -315,9 +319,11 @@ myManageHook = composeAll
, className =? "splash" --> doFloat
, className =? "toolbar" --> doFloat
, className =? "Qalculate-gtk" --> doFloat
, className =? "udiskie" --> doFloat
, isFullscreen --> doFullFloat
-- auto-shift applications to their respecitve workspaces
, className =? "discord" --> doShift ( myWorkspaces !! 3 )
, className =? "Element" --> doShift ( myWorkspaces !! 3 )
, className =? "Code" --> doShift ( myWorkspaces !! 0 )
, className =? "Stremio" --> doShift ( myWorkspaces !! 5 )
, title =? "Mozilla Firefox" --> doShift ( myWorkspaces !! 1 )
@ -347,15 +353,18 @@ myLogHook :: Handle -> Handle -> X ()
myLogHook xmproc0 xmproc1 = dynamicLogWithPP $ xmobarPP
{ ppOutput = \x -> hPutStrLn xmproc0 x -- xmobar on monitor 1
>> hPutStrLn xmproc1 x -- xmobar on monitor 2
, ppCurrent = xmobarColor "#98be65" "" . wrap " [" "] " -- Current workspace
, ppVisible = xmobarColor "#98be65" "" . wrap " " " " . clickable -- Visible but not current workspace
, ppHidden = xmobarColor "#82AAFF" "" . wrap " *" " " . clickable -- Hidden workspaces
, ppHiddenNoWindows = xmobarColor "#c792ea" "" . wrap " " " " . clickable -- Hidden workspaces (no windows)
, ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window
, ppSep = "<fc=#666666> | </fc>" -- Separator character
, ppUrgent = xmobarColor "#C45500" "" . wrap " !" "! " -- Urgent workspace
, ppExtras = [windowCount] -- # of windows current workspace
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t] -- order of things in xmobar
, ppCurrent = xmobarColor "#98be65" "" -- Current workspace
. wrap "<box type=Bottom width=2 mb=2 color=#98be65>" "</box>" . clickable
, ppVisible = xmobarColor "#98be65" "" .clickable -- Visible but not current workspace
, ppHidden = xmobarColor "#82aaff" "" . clickable -- Hidden workspaces
, ppHiddenNoWindows = xmobarColor "#c792ea" "" . clickable -- Hidden workspaces (no windows)
, ppTitle = xmobarColor "#b3afc2" "" . shorten 60 -- Title of active window
, ppSep = "<fc=#666666> | </fc>" -- Separator character
, ppUrgent = xmobarColor "#c45500" "" . wrap "!" "!" -- Urgent workspace
, ppExtras = [windowCount] -- # of windows current workspace
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t] -- order of things in xmobar
}

12
home/.local/bin/scripts/bitcoin Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
BTC_DATA=$(curl https://api.coindesk.com/v1/bpi/currentprice.json 2>/dev/null || echo 'ERR')
if [ "$BTC_DATA" != "ERR" ]; then
BTC_PRICE=$(echo $BTC_DATA | jq -r ".bpi.USD.rate_float")
BTC_PRICE=$(printf "%.2f" "$BTC_PRICE")
echo \$"$BTC_PRICE"
else
echo "N/A"
fi

111
home/.local/bin/scripts/cheat.sh Executable file
View file

@ -0,0 +1,111 @@
#!/bin/sh
# rm_trailing_slashes(string)
#
# Prints a string without any trailing slashes.
# This is used because cheat.sh doesn't play nicely with multiple slashes in
# URLs.
rm_trailing_slashes() {
string="$1"
last_char="$(printf "$string" | tail -c 1)"
if [ "$last_char" = "/" ]; then
echo "$(rm_trailing_slashes "${string%?}")"
else
echo "$string"
fi
}
# pick_category(must_match, query, argument, recurse)
#
# Pick cheat.sh category.
# if must_match is 1, only allow listed options to be picked.
# if query is specified, pick sub-category of it, else pick global categories.
# if argument is specified, optionally perform must_match check and print it.
# if recurse is 1, if the selected option ends with /, run the function again.
#
# Prints the chosen category
pick_category() {
must_match="$1"
query="$(rm_trailing_slashes "$2")"
argument="$3"
recurse="$4"
# Query all possible options
if [ -n "$query" ]; then
url="cheat.sh/$query/:list"
else
url="cheat.sh/:list"
fi
selectable="$(curl -s "$url")"
# If argument is specified, print it, optionally perform must_match check.
if [ -n "$argument" ]; then
if [ "$must_match" -ne 1 ] || echo "$selectable" | grep -qe "\b$1\b"; then
selected="$argument"
else
echo "Invalid selection: '$argument'"
echo "For all selections, query $url"
exit 1
fi
# Select the option with fzf, optionally allow other matches if must_match isn't set.
else
if [ "$must_match" -ne 1 ]; then
if [ -z "$selectable" ]; then
header="No selections found, you can use empty query to show category help, or type a custom query."
else
header="Use alt-enter to enter non-listed query. You can use empty queries to show category help."
fi
selected="$(printf "\n$selectable" | \
fzf --bind=alt-enter:print-query \
--print-query \
--prompt="cheat.sh/$query query>" \
--header="$header"\
)"
else
selected=$(printf "$selectable" | fzf --prompt="cheat.sh/$query category>")
if [ $? -ne 0 ]; then
echo "Invalid selection: '$selected'"
echo "For all selections, query $url"
exit 1
fi
fi
selected=$(printf "$selected" | tail -1)
fi
# Replace spaces with '+' (cheat.sh resolves those as spaces)
selected="$(echo "$selected" | tr ' ' '+')"
# Prepend the original query, if we have one
# Print the selected category, or subcategory with the category
if [ -n "$query" ]; then
result="$query/$selected"
else
result="$selected"
fi
# Recurse, if specified and the result ended with /
if [ "$recurse" -eq 1 ]; then
if [ "$(printf "$selected" | tail -c 1)" = "/" ]; then
result="$(pick_category "$must_match" "$result" "$argument" 1)"
fi
fi
# Print the result
printf "$result"
}
# Select the cheatsheat category (language/core-util/...)
query=$(pick_category 1 "" "$1" 0)
# If the query isn't already complete, select a sub-category
if ! echo "$query" | grep -qe ":"; then
query="$(pick_category 0 "$query" "$2" 1)"
fi
# Construct the URL from given query and print it
url="cheat.sh/$query"
echo "$url"
# Show the output of cheat.sh request
curl -s "$url"

View file

@ -7,5 +7,5 @@ exec_line=$(grep '^Exec' "$1" | tail -1)
cmd=$(echo $exec_line | sed 's/^Exec=//' | sed 's/%.//')
# Remove "" around command (if present)
cmd=$(echo $cmd | sed 's/^"//g' | sed 's/" *$//g')
# Run the exec line of the application in the background
$($cmd) &
# Run the exec line of the application using /bin/sh
/bin/sh -c "$cmd"

View file

@ -0,0 +1,23 @@
#!/usr/bin/env python
import feedparser
import subprocess
URL = "https://itsdrike.com/posts/index.xml"
def main():
feed = feedparser.parse(URL)
titles = {entry['title']: entry['link'] for entry in feed['entries']}
selected_page = subprocess.check_output(
["dmenu", "-i", "-p", "Post"],
input="\n".join(titles.keys()), universal_newlines=True
)
link = titles[selected_page.strip()]
subprocess.check_output(["xsel", "-bi"], input=link, universal_newlines=True)
if __name__ == '__main__':
main()

View file

@ -0,0 +1,44 @@
#!/bin/sh
if [ "$1" = "start" ]; then
MODE="start"
elif [ "$1" = "stop" ]; then
MODE="stop"
elif [ "$1" = "toggle" ]; then
if pidof -s xss-lock > /dev/null 2>&1; then
MODE="stop"
else
MODE="start"
fi
elif [ "$1" = "lock" ]; then
MODE="lock"
else
echo "Invalid command usage, use: lockscreen [start/stop/toggle/lock]"
exit 1
fi
if [ "$MODE" = "start" ]; then
echo "Starting xss-lock"
# Set X11 lockscreen delays (DPMS)
xset s on
xset s 600 10 # Dim screen after 10 minutes, lock 10s later
# XSS lock with xsecurelock
xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock &
elif [ "$MODE" = "stop" ]; then
echo "Stopping xss-lock"
# Remove X11 lockscreen delays (DPMS)
xset s off
# Stop XSS lock
killall xss-lock
elif [ "$MODE" = "lock" ]; then
# Send a DPMS trigger if xss-lock is running to inform it
# about the lockstate, if it's not running, run xsecurelock directly
if pidof -s xss-lock > /dev/null 2>&1; then
echo "Locking screen - using DPMS (xss-lock active)"
xset s activate
else
echo "Locking screen - running xsecurelock directly (xss-lock isn't running)"
xsecurelock
fi
fi