mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 20:39:18 -08:00
Music + GPG agent forwarding + all sorts.
This commit is contained in:
parent
2c6230dd63
commit
c548add318
24 changed files with 525 additions and 56 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
../../services/zfs.nix
|
../../services/zfs.nix
|
||||||
../../services/nginx.nix
|
../../services/nginx.nix
|
||||||
./thermal
|
./thermal
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ config, pkgs, lib, sources, witch, ... }:
|
{ config, pkgs, lib, sources, witch, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
# libvirtd is used for our virtual machine
|
# libvirtd is used for our virtual machine
|
||||||
virtualisation.libvirtd = {
|
virtualisation.libvirtd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
qemuOvmf = true;
|
qemuOvmf = true;
|
||||||
|
|
@ -11,8 +11,9 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# required for guest reboots with the 580
|
# required for guest reboots with the 580
|
||||||
boot.extraModulePackages =
|
boot.extraModulePackages = [
|
||||||
[ (pkgs.linuxPackagesFor config.boot.kernelPackages.kernel).vendor-reset ];# required groups for various intentions
|
(pkgs.linuxPackagesFor config.boot.kernelPackages.kernel).vendor-reset
|
||||||
|
]; # required groups for various intentions
|
||||||
users.users.kat.extraGroups = [ "libvirtd" "input" "qemu-libvirtd" ];
|
users.users.kat.extraGroups = [ "libvirtd" "input" "qemu-libvirtd" ];
|
||||||
|
|
||||||
# video=efifb:off allows the 580 to be passed through regardless of being the boot display and allows the 560 to act as a console device
|
# video=efifb:off allows the 580 to be passed through regardless of being the boot display and allows the 560 to act as a console device
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
binaryCaches = [ "https://arc.cachix.org" ];
|
binaryCaches = [ "https://arc.cachix.org" ];
|
||||||
binaryCachePublicKeys =
|
binaryCachePublicKeys =
|
||||||
[ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" ];
|
[ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" ];
|
||||||
};
|
|
||||||
gc.automatic = lib.mkDefault true;
|
gc.automatic = lib.mkDefault true;
|
||||||
gc.options = lib.mkDefault "--delete-older-than 1w";
|
gc.options = lib.mkDefault "--delete-older-than 1w";
|
||||||
trustedUsers = [ "root" "@wheel" ];
|
trustedUsers = [ "root" "@wheel" ];
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,6 @@
|
||||||
./nextcloud.nix
|
./nextcloud.nix
|
||||||
./gpg.nix
|
./gpg.nix
|
||||||
./gtk.nix
|
./gtk.nix
|
||||||
|
./music.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ let
|
||||||
"app.update.auto" = false;
|
"app.update.auto" = false;
|
||||||
"identity.fxaccounts.account.device.name" = superConfig.networking.hostName;
|
"identity.fxaccounts.account.device.name" = superConfig.networking.hostName;
|
||||||
"signon.rememberSignons" = false;
|
"signon.rememberSignons" = false;
|
||||||
|
"browser.download.lastDir" = "/home/kat/downloads";
|
||||||
"browser.urlbar.placeholderName" = "DuckDuckGo";
|
"browser.urlbar.placeholderName" = "DuckDuckGo";
|
||||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||||
"identity.sync.tokenserver.uri" =
|
"identity.sync.tokenserver.uri" =
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,22 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.deploy.profile.gui {
|
config = lib.mkIf config.deploy.profile.gui {
|
||||||
home.file.".gnupg/gpg-agent.conf".text = ''
|
home.sessionVariables = {
|
||||||
enable-ssh-support
|
SSH_AUTH_SOCK =
|
||||||
pinentry-program ${pkgs.pinentry.gtk2}/bin/pinentry
|
"\${SSH_AUTH_SOCK:-$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)}";
|
||||||
'';
|
};
|
||||||
|
services.gpg-agent = {
|
||||||
|
enable = true;
|
||||||
|
enableExtraSocket = true;
|
||||||
|
enableSshSupport = false;
|
||||||
|
pinentryFlavor = "gtk2";
|
||||||
|
extraConfig = lib.mkMerge [
|
||||||
|
"auto-expand-secmem 0x30000" # otherwise "gpg: public key decryption failed: Cannot allocate memory"
|
||||||
|
"pinentry-timeout 30"
|
||||||
|
"allow-loopback-pinentry"
|
||||||
|
"enable-ssh-support"
|
||||||
|
"no-allow-external-cache"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
settings = {
|
settings = {
|
||||||
font_size = witch.style.font.size;
|
font_size = witch.style.font.size;
|
||||||
background = witch.style.base16.color0;
|
background = witch.style.base16.color0;
|
||||||
background_opacity = "0.7";
|
background_opacity = "0.9";
|
||||||
foreground = witch.style.base16.color7;
|
foreground = witch.style.base16.color7;
|
||||||
selection_background = witch.style.base16.color7;
|
selection_background = witch.style.base16.color7;
|
||||||
selection_foreground = witch.style.base16.color0;
|
selection_foreground = witch.style.base16.color0;
|
||||||
|
|
|
||||||
35
config/profiles/gui/home/music.nix
Normal file
35
config/profiles/gui/home/music.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
{ config, lib, pkgs, witch, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.deploy.profile.gui {
|
||||||
|
programs.ncmpcpp = {
|
||||||
|
enable = true;
|
||||||
|
mpdMusicDir = "/home/kat/music";
|
||||||
|
};
|
||||||
|
programs.beets = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.unstable.beets;
|
||||||
|
settings = {
|
||||||
|
directory = "~/music";
|
||||||
|
library = "~/.local/share/beets.db";
|
||||||
|
plugins = lib.concatStringsSep " " [
|
||||||
|
"mpdstats"
|
||||||
|
"mpdupdate"
|
||||||
|
"duplicates"
|
||||||
|
"chroma"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.mpd = {
|
||||||
|
enable = true;
|
||||||
|
network.startWhenNeeded = true;
|
||||||
|
musicDirectory = "/home/kat/music";
|
||||||
|
extraConfig = ''
|
||||||
|
audio_output {
|
||||||
|
type "pulse"
|
||||||
|
name "speaker"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,12 @@
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./shell.nix ./git.nix ./tmux.nix ./ssh.nix ./emacs ./packages.nix ];
|
imports = [
|
||||||
|
./shell.nix
|
||||||
|
./neovim
|
||||||
|
./git.nix
|
||||||
|
./tmux.nix
|
||||||
|
./ssh.nix
|
||||||
|
./packages.nix
|
||||||
|
]; # ./emacs bye emacs lol
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
config/profiles/kat/home/neovim/coc-settings.json
Normal file
7
config/profiles/kat/home/neovim/coc-settings.json
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"python.formatting.provider": "black",
|
||||||
|
"python.jediEnabled": true,
|
||||||
|
"python.linting.flake8Enabled": true,
|
||||||
|
"python.linting.enabled": true,
|
||||||
|
"python.pythonPath": "nvim-python3"
|
||||||
|
}
|
||||||
32
config/profiles/kat/home/neovim/default.nix
Normal file
32
config/profiles/kat/home/neovim/default.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{ config, lib, pkgs, witch, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
config = lib.mkIf config.deploy.profile.kat {
|
||||||
|
home.sessionVariables.EDITOR = "nvim";
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
withPython3 = true;
|
||||||
|
plugins = with pkgs.vimPlugins; [
|
||||||
|
nerdtree
|
||||||
|
vim-nix
|
||||||
|
coc-nvim
|
||||||
|
coc-yank
|
||||||
|
coc-python
|
||||||
|
coc-json
|
||||||
|
coc-yaml
|
||||||
|
coc-git
|
||||||
|
vim-fugitive
|
||||||
|
{
|
||||||
|
plugin = vim-startify;
|
||||||
|
config = "let g:startify_change_to_vcs_root = 0";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
extraPackages = with pkgs;
|
||||||
|
[ (python3.withPackages (ps: with ps; [ black flake8])) ];
|
||||||
|
extraPython3Packages = (ps: with ps; [ jedi pylint ]);
|
||||||
|
extraConfig = import ./vimrc.nix { inherit pkgs; };
|
||||||
|
};
|
||||||
|
xdg.configFile."nvim/coc-settings.json".text =
|
||||||
|
builtins.readFile ./coc-settings.json;
|
||||||
|
};
|
||||||
|
}
|
||||||
177
config/profiles/kat/home/neovim/vimrc.nix
Normal file
177
config/profiles/kat/home/neovim/vimrc.nix
Normal file
|
|
@ -0,0 +1,177 @@
|
||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
''
|
||||||
|
" Set internal encoding of vim, not needed on neovim, since coc.nvim using some
|
||||||
|
" unicode characters in the file autoload/float.vim
|
||||||
|
set encoding=utf-8
|
||||||
|
|
||||||
|
" Enable mouse
|
||||||
|
set mouse=a
|
||||||
|
|
||||||
|
" Open NERDTree at start
|
||||||
|
autocmd VimEnter * NERDTree | wincmd p
|
||||||
|
|
||||||
|
let g:coc_node_path='${pkgs.nodejs}/bin/node'
|
||||||
|
|
||||||
|
" TextEdit might fail if hidden is not set.
|
||||||
|
set hidden
|
||||||
|
|
||||||
|
" Some servers have issues with backup files, see #649.
|
||||||
|
set nobackup
|
||||||
|
set nowritebackup
|
||||||
|
|
||||||
|
" Give more space for displaying messages.
|
||||||
|
" set cmdheight=2
|
||||||
|
|
||||||
|
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||||
|
" delays and poor user experience.
|
||||||
|
set updatetime=300
|
||||||
|
|
||||||
|
" Don't pass messages to |ins-completion-menu|.
|
||||||
|
set shortmess+=c
|
||||||
|
|
||||||
|
" Always show the signcolumn, otherwise it would shift the text each time
|
||||||
|
" diagnostics appear/become resolved.
|
||||||
|
if has("patch-8.1.1564")
|
||||||
|
" Recently vim can merge signcolumn and number column into one
|
||||||
|
set signcolumn=number
|
||||||
|
else
|
||||||
|
set signcolumn=yes
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Use tab for trigger completion with characters ahead and navigate.
|
||||||
|
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||||
|
" other plugin before putting this into your config.
|
||||||
|
inoremap <silent><expr> <TAB>
|
||||||
|
\ pumvisible() ? "\<C-n>" :
|
||||||
|
\ <SID>check_back_space() ? "\<TAB>" :
|
||||||
|
\ coc#refresh()
|
||||||
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||||
|
|
||||||
|
function! s:check_back_space() abort
|
||||||
|
let col = col('.') - 1
|
||||||
|
return !col || getline('.')[col - 1] =~# '\s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Use <c-space> to trigger completion.
|
||||||
|
if has('nvim')
|
||||||
|
inoremap <silent><expr> <c-space> coc#refresh()
|
||||||
|
else
|
||||||
|
inoremap <silent><expr> <c-@> coc#refresh()
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Make <CR> auto-select the first completion item and notify coc.nvim to
|
||||||
|
" format on enter, <cr> could be remapped by other vim plugin
|
||||||
|
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
||||||
|
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||||
|
|
||||||
|
" Use `[g` and `]g` to navigate diagnostics
|
||||||
|
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
||||||
|
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||||
|
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||||
|
|
||||||
|
" GoTo code navigation.
|
||||||
|
nmap <silent> gd <Plug>(coc-definition)
|
||||||
|
nmap <silent> gy <Plug>(coc-type-definition)
|
||||||
|
nmap <silent> gi <Plug>(coc-implementation)
|
||||||
|
nmap <silent> gr <Plug>(coc-references)
|
||||||
|
|
||||||
|
" Use K to show documentation in preview window.
|
||||||
|
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||||
|
|
||||||
|
function! s:show_documentation()
|
||||||
|
if (index(['vim','help'], &filetype) >= 0)
|
||||||
|
execute 'h '.expand('<cword>')
|
||||||
|
elseif (coc#rpc#ready())
|
||||||
|
call CocActionAsync('doHover')
|
||||||
|
else
|
||||||
|
execute '!' . &keywordprg . " " . expand('<cword>')
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Highlight the symbol and its references when holding the cursor.
|
||||||
|
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||||
|
|
||||||
|
" Symbol renaming.
|
||||||
|
nmap <leader>rn <Plug>(coc-rename)
|
||||||
|
|
||||||
|
" Formatting selected code.
|
||||||
|
xmap <leader>f <Plug>(coc-format-selected)
|
||||||
|
nmap <leader>f <Plug>(coc-format-selected)
|
||||||
|
|
||||||
|
augroup mygroup
|
||||||
|
autocmd!
|
||||||
|
" Setup formatexpr specified filetype(s).
|
||||||
|
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||||
|
" Update signature help on jump placeholder.
|
||||||
|
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||||
|
augroup end
|
||||||
|
|
||||||
|
" Applying codeAction to the selected region.
|
||||||
|
" Example: `<leader>aap` for current paragraph
|
||||||
|
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||||
|
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||||
|
|
||||||
|
" Remap keys for applying codeAction to the current buffer.
|
||||||
|
nmap <leader>ac <Plug>(coc-codeaction)
|
||||||
|
" Apply AutoFix to problem on the current line.
|
||||||
|
nmap <leader>qf <Plug>(coc-fix-current)
|
||||||
|
|
||||||
|
" Map function and class text objects
|
||||||
|
" NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
||||||
|
xmap if <Plug>(coc-funcobj-i)
|
||||||
|
omap if <Plug>(coc-funcobj-i)
|
||||||
|
xmap af <Plug>(coc-funcobj-a)
|
||||||
|
omap af <Plug>(coc-funcobj-a)
|
||||||
|
xmap ic <Plug>(coc-classobj-i)
|
||||||
|
omap ic <Plug>(coc-classobj-i)
|
||||||
|
xmap ac <Plug>(coc-classobj-a)
|
||||||
|
omap ac <Plug>(coc-classobj-a)
|
||||||
|
|
||||||
|
" Remap <C-f> and <C-b> for scroll float windows/popups.
|
||||||
|
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||||
|
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||||
|
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||||
|
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||||
|
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||||
|
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||||
|
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Use CTRL-S for selections ranges.
|
||||||
|
" Requires 'textDocument/selectionRange' support of language server.
|
||||||
|
nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||||
|
xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||||
|
|
||||||
|
" Add `:Format` command to format current buffer.
|
||||||
|
command! -nargs=0 Format :call CocAction('format')
|
||||||
|
|
||||||
|
" Add `:Fold` command to fold current buffer.
|
||||||
|
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||||
|
|
||||||
|
" Add `:OR` command for organize imports of the current buffer.
|
||||||
|
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||||
|
|
||||||
|
" Add (Neo)Vim's native statusline support.
|
||||||
|
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||||
|
" provide custom statusline: lightline.vim, vim-airline.
|
||||||
|
set statusline^=%{coc#status()}%{get(b:,'coc_current_function',''')}
|
||||||
|
|
||||||
|
" Mappings for CoCList
|
||||||
|
" Show all diagnostics.
|
||||||
|
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr>
|
||||||
|
" Manage extensions.
|
||||||
|
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr>
|
||||||
|
" Show commands.
|
||||||
|
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr>
|
||||||
|
" Find symbol of current document.
|
||||||
|
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr>
|
||||||
|
" Search workspace symbols.
|
||||||
|
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr>
|
||||||
|
" Do default action for next item.
|
||||||
|
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR>
|
||||||
|
" Do default action for previous item.
|
||||||
|
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR>
|
||||||
|
" Resume latest coc list.
|
||||||
|
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR>
|
||||||
|
''
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
config = lib.mkIf config.deploy.profile.kat {
|
config = lib.mkIf config.deploy.profile.kat {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [ kitty.terminfo ];
|
||||||
kitty.terminfo
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -5,10 +5,6 @@
|
||||||
programs.fish = {
|
programs.fish = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interactiveShellInit = ''
|
interactiveShellInit = ''
|
||||||
${if (config.deploy.profile.gui) then
|
|
||||||
"export SSH_AUTH_SOCK=(gpgconf --list-dirs agent-ssh-socket)"
|
|
||||||
else
|
|
||||||
""}
|
|
||||||
fish_vi_key_bindings
|
fish_vi_key_bindings
|
||||||
set -g fish_greeting ""
|
set -g fish_greeting ""
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
programs.fish.shellAliases = {
|
programs.fish.shellAliases = {
|
||||||
tne = "tmux new -s";
|
tne = "tmux new -s";
|
||||||
tat = "tmux attach -t";
|
tat = "tmux attach -t";
|
||||||
|
tren = "tmux new -AD -s";
|
||||||
};
|
};
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -37,6 +38,9 @@
|
||||||
|
|
||||||
# messages
|
# messages
|
||||||
set -g message-style 'fg=colour232 bg=colour16 bold'
|
set -g message-style 'fg=colour232 bg=colour16 bold'
|
||||||
|
|
||||||
|
# mouse
|
||||||
|
set -g mouse on
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
151
config/profiles/sway/home/grimshot.sh
Executable file
151
config/profiles/sway/home/grimshot.sh
Executable file
|
|
@ -0,0 +1,151 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
## Grimshot: a helper for screenshots within sway
|
||||||
|
## Requirements:
|
||||||
|
## - `grim`: screenshot utility for wayland
|
||||||
|
## - `slurp`: to select an area
|
||||||
|
## - `swaymsg`: to read properties of current window
|
||||||
|
## - `wl-copy`: clipboard utility
|
||||||
|
## - `jq`: json utility to parse swaymsg output
|
||||||
|
## - `notify-send`: to show notifications
|
||||||
|
## Those are needed to be installed, if unsure, run `grimshot check`
|
||||||
|
##
|
||||||
|
## See `man 1 grimshot` or `grimshot usage` for further details.
|
||||||
|
|
||||||
|
getTargetDirectory() {
|
||||||
|
echo "/home/kat/media/Screenshots"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$1" = "--notify" ]; then
|
||||||
|
NOTIFY=yes
|
||||||
|
shift 1
|
||||||
|
else
|
||||||
|
NOTIFY=no
|
||||||
|
fi
|
||||||
|
|
||||||
|
ACTION=${1:-usage}
|
||||||
|
SUBJECT=${2:-screen}
|
||||||
|
FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
|
||||||
|
|
||||||
|
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
|
||||||
|
echo "Usage:"
|
||||||
|
echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE]"
|
||||||
|
echo " grimshot check"
|
||||||
|
echo " grimshot usage"
|
||||||
|
echo ""
|
||||||
|
echo "Commands:"
|
||||||
|
echo " copy: Copy the screenshot data into the clipboard."
|
||||||
|
echo " save: Save the screenshot to a regular file."
|
||||||
|
echo " check: Verify if required tools are installed and exit."
|
||||||
|
echo " usage: Show this message and exit."
|
||||||
|
echo ""
|
||||||
|
echo "Targets:"
|
||||||
|
echo " active: Currently active window."
|
||||||
|
echo " screen: All visible outputs."
|
||||||
|
echo " output: Currently active output."
|
||||||
|
echo " area: Manually select a region."
|
||||||
|
echo " window: Manually select a window."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
notify() {
|
||||||
|
notify-send -t 3000 -a grimshot "$@"
|
||||||
|
}
|
||||||
|
notifyOk() {
|
||||||
|
[ "$NOTIFY" = "no" ] && return
|
||||||
|
|
||||||
|
TITLE=${2:-"Screenshot"}
|
||||||
|
MESSAGE=${1:-"OK"}
|
||||||
|
notify "$TITLE" "$MESSAGE"
|
||||||
|
}
|
||||||
|
notifyError() {
|
||||||
|
if [ $NOTIFY = "yes" ]; then
|
||||||
|
TITLE=${2:-"Screenshot"}
|
||||||
|
MESSAGE=${1:-"Error taking screenshot with grim"}
|
||||||
|
notify -u critical "$TITLE" "$MESSAGE"
|
||||||
|
else
|
||||||
|
echo $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
die() {
|
||||||
|
MSG=${1:-Bye}
|
||||||
|
notifyError "Error: $MSG"
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
COMMAND=$1
|
||||||
|
if command -v "$COMMAND" > /dev/null 2>&1; then
|
||||||
|
RESULT="OK"
|
||||||
|
else
|
||||||
|
RESULT="NOT FOUND"
|
||||||
|
fi
|
||||||
|
echo " $COMMAND: $RESULT"
|
||||||
|
}
|
||||||
|
|
||||||
|
takeScreenshot() {
|
||||||
|
FILE=$1
|
||||||
|
GEOM=$2
|
||||||
|
OUTPUT=$3
|
||||||
|
if [ ! -z "$OUTPUT" ]; then
|
||||||
|
grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
|
||||||
|
elif [ -z "$GEOM" ]; then
|
||||||
|
grim "$FILE" || die "Unable to invoke grim"
|
||||||
|
else
|
||||||
|
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$ACTION" = "check" ] ; then
|
||||||
|
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
|
||||||
|
check grim
|
||||||
|
check slurp
|
||||||
|
check swaymsg
|
||||||
|
check wl-copy
|
||||||
|
check jq
|
||||||
|
check notify-send
|
||||||
|
exit
|
||||||
|
elif [ "$SUBJECT" = "area" ] ; then
|
||||||
|
GEOM=$(slurp -d)
|
||||||
|
# Check if user exited slurp without selecting the area
|
||||||
|
if [ -z "$GEOM" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
WHAT="Area"
|
||||||
|
elif [ "$SUBJECT" = "active" ] ; then
|
||||||
|
FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)')
|
||||||
|
GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"')
|
||||||
|
APP_ID=$(echo "$FOCUSED" | jq -r '.app_id')
|
||||||
|
WHAT="$APP_ID window"
|
||||||
|
elif [ "$SUBJECT" = "screen" ] ; then
|
||||||
|
GEOM=""
|
||||||
|
WHAT="Screen"
|
||||||
|
elif [ "$SUBJECT" = "output" ] ; then
|
||||||
|
GEOM=""
|
||||||
|
OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
|
||||||
|
WHAT="$OUTPUT"
|
||||||
|
elif [ "$SUBJECT" = "window" ] ; then
|
||||||
|
GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)
|
||||||
|
# Check if user exited slurp without selecting the area
|
||||||
|
if [ -z "$GEOM" ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
WHAT="Window"
|
||||||
|
else
|
||||||
|
die "Unknown subject to take a screen shot from" "$SUBJECT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$ACTION" = "copy" ] ; then
|
||||||
|
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
|
||||||
|
notifyOk "$WHAT copied to buffer"
|
||||||
|
else
|
||||||
|
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
|
||||||
|
TITLE="Screenshot of $SUBJECT"
|
||||||
|
MESSAGE=$(basename "$FILE")
|
||||||
|
notifyOk "$MESSAGE" "$TITLE"
|
||||||
|
echo $FILE
|
||||||
|
else
|
||||||
|
notifyError "Error taking screenshot with grim"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
XDG_SESSION_TYPE = "wayland";
|
XDG_SESSION_TYPE = "wayland";
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [ grim slurp ];
|
home.packages = with pkgs; [ grim slurp wl-clipboard jq ];
|
||||||
|
|
||||||
wayland.windowManager.sway = {
|
wayland.windowManager.sway = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -138,6 +138,13 @@
|
||||||
"${cfg.modifier}+d" = "exec ${cfg.menu}";
|
"${cfg.modifier}+d" = "exec ${cfg.menu}";
|
||||||
"${cfg.modifier}+x" = "exec ${lockCommand}";
|
"${cfg.modifier}+x" = "exec ${lockCommand}";
|
||||||
|
|
||||||
|
"${cfg.modifier}+Print" =
|
||||||
|
"exec ${./grimshot.sh} --notify save screen";
|
||||||
|
"${cfg.modifier}+Shift+Print" =
|
||||||
|
"exec ${./grimshot.sh} --notify save area";
|
||||||
|
"${cfg.modifier}+Mod1+Print" =
|
||||||
|
"exec ${./grimshot.sh} --notify save window";
|
||||||
|
|
||||||
"${cfg.modifier}+i" = "move workspace to output left";
|
"${cfg.modifier}+i" = "move workspace to output left";
|
||||||
"${cfg.modifier}+o" = "move workspace to output left";
|
"${cfg.modifier}+o" = "move workspace to output left";
|
||||||
"${cfg.modifier}+b" = "splith";
|
"${cfg.modifier}+b" = "splith";
|
||||||
|
|
@ -172,15 +179,15 @@
|
||||||
colors = {
|
colors = {
|
||||||
focused = {
|
focused = {
|
||||||
border = witch.style.base16.color8;
|
border = witch.style.base16.color8;
|
||||||
background = witch.style.base16.color4;
|
background = witch.style.base16.color13;
|
||||||
text = witch.style.base16.color0;
|
text = witch.style.base16.color0;
|
||||||
indicator = witch.style.base16.color2;
|
indicator = witch.style.base16.color2;
|
||||||
childBorder = witch.style.base16.color8;
|
childBorder = witch.style.base16.color8;
|
||||||
};
|
};
|
||||||
focusedInactive = {
|
focusedInactive = {
|
||||||
border = witch.style.base16.color0;
|
border = witch.style.base16.color0;
|
||||||
background = witch.style.base16.color11;
|
background = witch.style.base16.color10;
|
||||||
text = witch.style.base16.color12;
|
text = witch.style.base16.color13;
|
||||||
indicator = witch.style.base16.color2;
|
indicator = witch.style.base16.color2;
|
||||||
childBorder = witch.style.base16.color8;
|
childBorder = witch.style.base16.color8;
|
||||||
};
|
};
|
||||||
|
|
@ -192,7 +199,7 @@
|
||||||
childBorder = witch.style.base16.color8;
|
childBorder = witch.style.base16.color8;
|
||||||
};
|
};
|
||||||
urgent = {
|
urgent = {
|
||||||
border = witch.style.base16.color8;
|
border = witch.style.base16.color0;
|
||||||
background = witch.style.base16.color9;
|
background = witch.style.base16.color9;
|
||||||
text = witch.style.base16.color0;
|
text = witch.style.base16.color0;
|
||||||
indicator = witch.style.base16.color1;
|
indicator = witch.style.base16.color1;
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,18 @@
|
||||||
};
|
};
|
||||||
settings = [{
|
settings = [{
|
||||||
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
|
modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ];
|
||||||
modules-center = [ "clock" "custom/weather" ];
|
modules-center = [ ]; # "clock" "custom/weather"
|
||||||
modules-right = [
|
modules-right = [
|
||||||
"pulseaudio"
|
"pulseaudio"
|
||||||
"network"
|
|
||||||
"cpu"
|
"cpu"
|
||||||
"memory"
|
"memory"
|
||||||
"temperature"
|
"temperature"
|
||||||
"backlight"
|
"backlight"
|
||||||
"battery"
|
"battery"
|
||||||
|
#"mpd"
|
||||||
|
"network"
|
||||||
|
"custom/weather"
|
||||||
|
"clock"
|
||||||
"tray"
|
"tray"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -33,9 +36,15 @@
|
||||||
format = "{}";
|
format = "{}";
|
||||||
interval = 3600;
|
interval = 3600;
|
||||||
on-click = "xdg-open 'https://google.com/search?q=weather'";
|
on-click = "xdg-open 'https://google.com/search?q=weather'";
|
||||||
exec = "${pkgs.kat-weather}/bin/kat-weather ${witch.secrets.profiles.sway.city} ${witch.secrets.profiles.sway.api_key}";
|
exec =
|
||||||
|
"${pkgs.kat-weather}/bin/kat-weather ${witch.secrets.profiles.sway.city} ${witch.secrets.profiles.sway.api_key}";
|
||||||
};
|
};
|
||||||
cpu = { format = " {usage}%"; };
|
cpu = { format = " {usage}%"; };
|
||||||
|
#mpd = {
|
||||||
|
# format = " {album} - {artist} - {title}";
|
||||||
|
# format-stopped = "ﱙ";
|
||||||
|
# format-paused = " Paused";
|
||||||
|
#};
|
||||||
memory = { format = " {percentage}%"; };
|
memory = { format = " {percentage}%"; };
|
||||||
temperature = { format = "﨎 {temperatureC}°C"; };
|
temperature = { format = "﨎 {temperatureC}°C"; };
|
||||||
backlight = {
|
backlight = {
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@
|
||||||
#workspaces { padding: 0px 4px 0px 4px }
|
#workspaces { padding: 0px 4px 0px 4px }
|
||||||
|
|
||||||
#workspaces button {
|
#workspaces button {
|
||||||
color: ${style.base16.color7};
|
color: ${style.base16.color13};
|
||||||
background: ${hextorgba style.base16.color11};
|
background: ${hextorgba style.base16.color10};
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin: 0px 4px 0px 4px;
|
margin: 0px 4px 0px 4px;
|
||||||
border-bottom: 2px solid transparent;
|
border-bottom: 2px solid transparent;
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,22 @@
|
||||||
rec {
|
rec {
|
||||||
base16 = {
|
base16 = {
|
||||||
color0 = "#2e3440";
|
color0 = "#181818";
|
||||||
color1 = "#bf616a";
|
color1 = "#ab4642";
|
||||||
color2 = "#a3be8c";
|
color2 = "#a1b56c";
|
||||||
color3 = "#ebcb8b";
|
color3 = "#f7ca88";
|
||||||
color4 = "#81a1c1";
|
color4 = "#7cafc2";
|
||||||
color5 = "#b48ead";
|
color5 = "#ba8baf";
|
||||||
color6 = "#88c0d0";
|
color6 = "#86c1b9";
|
||||||
color7 = "#e5e9f0";
|
color7 = "#d8d8d8";
|
||||||
|
|
||||||
color8 = "#4c566a";
|
color8 = "#585858";
|
||||||
color9 = "#d08770";
|
color9 = "#dc9656";
|
||||||
color10 = "#3b4252";
|
color10 = "#282828";
|
||||||
color11 = "#434c5e";
|
color11 = "#383838";
|
||||||
color12 = "#d8dee9";
|
color12 = "#b8b8b8";
|
||||||
color13 = "#eceff4";
|
color13 = "#e8e8e8";
|
||||||
color14 = "#5e81ac";
|
color14 = "#a16946";
|
||||||
color15 = "#8fbcbb";
|
color15 = "#f8f8f8";
|
||||||
|
|
||||||
color16 = "#fd971f";
|
color16 = "#fd971f";
|
||||||
color17 = "#cc6633";
|
color17 = "#cc6633";
|
||||||
|
|
@ -24,6 +24,33 @@ rec {
|
||||||
color19 = "#49483e";
|
color19 = "#49483e";
|
||||||
color20 = "#a59f85";
|
color20 = "#a59f85";
|
||||||
color21 = "#f5f4f1";
|
color21 = "#f5f4f1";
|
||||||
|
|
||||||
|
## Nord
|
||||||
|
|
||||||
|
# color0 = "#2e3440";
|
||||||
|
# color1 = "#bf616a";
|
||||||
|
# color2 = "#a3be8c";
|
||||||
|
# color3 = "#ebcb8b";
|
||||||
|
# color4 = "#81a1c1";
|
||||||
|
# color5 = "#b48ead";
|
||||||
|
# color6 = "#88c0d0";
|
||||||
|
# color7 = "#e5e9f0";
|
||||||
|
|
||||||
|
# color8 = "#4c566a";
|
||||||
|
# color9 = "#d08770";
|
||||||
|
# color10 = "#3b4252";
|
||||||
|
# color11 = "#434c5e";
|
||||||
|
# color12 = "#d8dee9";
|
||||||
|
# color13 = "#eceff4";
|
||||||
|
# color14 = "#5e81ac";
|
||||||
|
# color15 = "#8fbcbb";
|
||||||
|
|
||||||
|
# color16 = "#fd971f";
|
||||||
|
# color17 = "#cc6633";
|
||||||
|
# color18 = "#383830";
|
||||||
|
# color19 = "#49483e";
|
||||||
|
# color20 = "#a59f85";
|
||||||
|
# color21 = "#f5f4f1";
|
||||||
};
|
};
|
||||||
|
|
||||||
font = {
|
font = {
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "kat-weather";
|
name = "kat-weather";
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
(python36.withPackages (pythonPackages: with pythonPackages; [
|
(python36.withPackages (pythonPackages: with pythonPackages; [ requests ]))
|
||||||
requests
|
|
||||||
]))
|
|
||||||
];
|
];
|
||||||
unpackPhase = "true";
|
unpackPhase = "true";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
|
||||||
10
todo.org
10
todo.org
|
|
@ -40,10 +40,16 @@ Too many excess unneccessary parameters.
|
||||||
** TODO Syncplay server
|
** TODO Syncplay server
|
||||||
Need to do SSL properly. Also set up salt + room passwords.
|
Need to do SSL properly. Also set up salt + room passwords.
|
||||||
|
|
||||||
** TODO Unfuckulate the weechat config
|
|
||||||
Move to arc's weechat module.
|
* Refactor
|
||||||
|
|
||||||
|
** TODO Move to arc's weechat module.
|
||||||
https://github.com/arcnmx/nixexprs/blob/f3f24ef4226a8ff3531d9a3e005c4993ed0d7ba2/modules/home/weechat.nix
|
https://github.com/arcnmx/nixexprs/blob/f3f24ef4226a8ff3531d9a3e005c4993ed0d7ba2/modules/home/weechat.nix
|
||||||
|
|
||||||
|
** TODO Refactor secrets usage into private host configs.
|
||||||
|
|
||||||
|
** TODO Move ZNC config into etc, out of store.
|
||||||
|
|
||||||
* Research
|
* Research
|
||||||
|
|
||||||
** TODO Investigate nix-darwin
|
** TODO Investigate nix-darwin
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue