From e97bfa42261476ea1e920b222ae2eab7f8522697 Mon Sep 17 00:00:00 2001 From: krizej Date: Wed, 16 Oct 2024 16:08:40 +0200 Subject: [PATCH] refactor * --- files/darcula.vim | 669 --------------------------- files/i3_communicators_layout.json | 44 -- files/i3status-format-fix.patch | 13 +- files/sddm-i3-theme/metadata.desktop | 2 +- modules/stuff/flameshot.nix | 8 +- modules/stuff/git.nix | 2 + modules/stuff/i3.nix | 386 ++++++++-------- modules/stuff/mpd.nix | 44 +- modules/stuff/xdg.nix | 6 +- modules/stuff/xserver.nix | 3 +- pkgs/schildi/schildichat-desktop.nix | 1 + readme.txt | 2 +- 12 files changed, 223 insertions(+), 957 deletions(-) delete mode 100644 files/darcula.vim delete mode 100644 files/i3_communicators_layout.json diff --git a/files/darcula.vim b/files/darcula.vim deleted file mode 100644 index feed86f..0000000 --- a/files/darcula.vim +++ /dev/null @@ -1,669 +0,0 @@ -" stolen and modified from https://github.com/doums/darcula - -" This Source Code Form is subject to the terms of the Mozilla Public -" License, v. 2.0. If a copy of the MPL was not distributed with this -" file, You can obtain one at https://mozilla.org/MPL/2.0/. - -if exists("g:darcula") - finish -endif -let g:darcula = 1 -highlight clear -if exists("syntax_on") - syntax reset -endif - -let g:colors_name='darcula' - -let s:p={ - \ 'null': ['NONE', 'NONE'], - \ 'bg': ['#2B2B2B', 235], - \ 'fg': ['#A9B7C6', 145], - \ 'cursor': ['#BBBBBB', 250], - \ 'identifierUnderCaret': ['#344134', 237], - \ 'identifierUnderCaretWrite': ['#40332B', 58], - \ 'gutter': ['#313335', 236], - \ 'selection': ['#214283', 24], - \ 'cursorLine': ['#323232', 236], - \ 'cursorLineNr': ['#A4A3A3', 248], - \ 'errorMsg': ['#CC666E', 174], - \ 'error': ['#BC3F3C', 131], - \ 'warning': ['#A9B7C6', 145], - \ 'muted': ['#606060', 241], - \ 'link': ['#287BDE', 32], - \ 'stdOutput': ['#BBBBBB', 250], - \ 'lineNumber': ['#606366', 241], - \ 'matchBraceFg': ['#FFEF28', 220], - \ 'matchBraceBg': ['#3B514D', 59], - \ 'todo': ['#A8C023', 142], - \ 'search': ['#32593D', 23], - \ 'incSearch': ['#155221', 22], - \ 'foldedFg': ['#8C8C8C', 245], - \ 'foldedBg': ['#3A3A3A', 237], - \ 'constant': ['#9876AA', 103], - \ 'keyword': ['#CC7832', 172], - \ 'comment': ['#808080', 244], - \ 'docComment': ['#629755', 65], - \ 'string': ['#6A8759', 101], - \ 'number': ['#6897BB', 103], - \ 'delimiter': ['#CC7832', 172], - \ 'specialComment': ['#8A653B', 95], - \ 'function': ['#FFC66D', 216], - \ 'diffAdd': ['#294436', 23], - \ 'diffText': ['#385570', 60], - \ 'diffDelete': ['#484A4A', 239], - \ 'diffChange': ['#303C47', 23], - \ 'addStripe': ['#384C38', 66], - \ 'stripeWhiteSpace': ['#4C4638', 59], - \ 'changeStripe': ['#374752', 60], - \ 'deleteStripe': ['#656E76', 242], - \ 'typo': ['#659C6B', 72], - \ 'metaData': ['#BBB529', 142], - \ 'macroName': ['#908B25', 100], - \ 'cDataStructure': ['#B5B6E3', 146], - \ 'cStructField': ['#9373A5', 103], - \ 'debug': ['#666D75', 102], - \ 'codeError': ['#532B2E', 52], - \ 'codeWarning': ['#52503A', 59], - \ 'errorStripe': ['#9E2927', 124], - \ 'warnStripe': ['#BE9117', 136], - \ 'infoStripe': ['#756D56', 101], - \ 'hintStripe': ['#6c7176', 242], - \ 'typeDef': ['#B9BCD1', 146], - \ 'menu': ['#46484A', 238], - \ 'menuFg': ['#BBBBBB', 250], - \ 'menuSel': ['#113A5C', 23], - \ 'menuSBar': ['#616263', 241], - \ 'tag': ['#E8BF6A', 180], - \ 'entity': ['#6D9CBE', 109], - \ 'htmlAttribute': ['#BABABA', 250], - \ 'htmlString': ['#A5C261', 143], - \ 'tsObject': ['#507874', 66], - \ 'statusLine': ['#3C3F41', 237], - \ 'statusLineFg': ['#BBBBBB', 250], - \ 'statusLineNC': ['#787878', 243], - \ 'tabLineSel': ['#4E5254', 239], - \ 'shCommand': ['#C57633', 137], - \ 'templateLanguage': ['#232525', 235], - \ 'rustMacro': ['#4EADE5', 74], - \ 'rustLifetime': ['#20999D', 37], - \ 'duplicateFromServer': ['#5E5339', 59], - \ 'hintBg': ['#3B3B3B', 237], - \ 'hintFg': ['#787878', 243], - \ 'wrapGuide': ['#2F2F2F', 236], - \ 'UIBorder': ['#616161', 241], - \ 'UISelection': ['#0D293E', 17], - \ 'ANSIBlack': ['#FFFFFF', 231], - \ 'ANSIRed': ['#FF6B68', 210], - \ 'ANSIGreen': ['#A8C023', 142], - \ 'ANSIYellow': ['#D6BF55', 179], - \ 'ANSIBlue': ['#5394EC', 68], - \ 'ANSIMagenta': ['#AE8ABE', 139], - \ 'ANSICyan': ['#299999', 37], - \ 'ANSIGray': ['#999999', 247], - \ 'ANSIDarkGray': ['#555555', 240], - \ 'ANSIBrightRed': ['#FF8785', 210], - \ 'ANSIBrightGreen': ['#A8C023', 142], - \ 'ANSIBrightYellow': ['#FFFF00', 226], - \ 'ANSIBrightBlue': ['#7EAEF1', 110], - \ 'ANSIBrightMagenta': ['#FF99FF', 219], - \ 'ANSIBrightCyan': ['#6CDADA', 116], - \ 'ANSIWhite': ['#1F1F1F', 234], - \ 'UIBlue': ['#3592C4', 67], - \ 'UIGreen': ['#499C54', 71], - \ 'UIRed': ['#C75450', 131], - \ 'UIBrown': ['#93896C', 102], - \ 'otherBuiltin': ['#8888C6', 147] - \ } - -" expose the palette -let darcula#palette=s:p - -" helper function -function s:Hi(group, fg, ...) - " arguments: group, fg, bg, style - if a:0 >= 1 - let bg=a:1 - else - let bg=s:p.null - endif - if a:0 >= 2 && strlen(a:2) - let style=a:2 - else - let style='NONE' - endif - let hiList = [ - \ 'hi', a:group, - \ 'ctermfg=' . a:fg[1], - \ 'guifg=' . a:fg[0], - \ 'ctermbg=' . bg[1], - \ 'guibg=' . bg[0], - \ 'cterm=' . style, - \ 'gui=' . style - \ ] - execute join(hiList) -endfunction - -" expose that function -function darcula#Hi(group, fg, ...) - if a:0 >= 2 - call s:Hi(a:group, a:fg, a:1, a:2) - elseif a:0 == 1 - call s:Hi(a:group, a:fg, a:1) - else - call s:Hi(a:group, a:fg) - endif -endfunction - -call s:Hi('Normal', s:p.fg, s:p.bg) -call s:Hi('ColorColumn', s:p.null, s:p.wrapGuide) -call s:Hi('Conceal', s:p.muted, s:p.bg) -call s:Hi('Cursor', s:p.cursor) -hi! link lCursor Cursor -hi! link CursorIM Cursor -hi! link CursorColumn CursorLine -call s:Hi('CursorLine', s:p.null, s:p.cursorLine, 'NONE') -call s:Hi('DiffAdd', s:p.null, s:p.diffAdd) -call s:Hi('DiffChange', s:p.null, s:p.diffChange) -call s:Hi('DiffDelete', s:p.null, s:p.diffDelete) -call s:Hi('DiffText', s:p.null, s:p.diffText) -hi! link Directory NormalFg -hi! link EndOfBuffer NonText -call s:Hi('ErrorMsg', s:p.errorMsg) -call s:Hi('Error', s:p.error) -call s:Hi('VertSplit', s:p.muted) -call s:Hi('Folded', s:p.foldedFg, s:p.foldedBg) -hi! link FoldColumn Folded -call s:Hi('SignColumn', s:p.null, s:p.gutter) -call s:Hi('LineNr', s:p.lineNumber, s:p.gutter) -hi! link LineNrAbove LineNr -hi! link LineNrBelow LineNr -call s:Hi('CursorLineNr', s:p.cursorLineNr, s:p.cursorLine) -call s:Hi('MatchParen', s:p.matchBraceFg, s:p.matchBraceBg, 'bold') -call s:Hi('ModeMsg', s:p.stdOutput) -hi! link MoreMsg NormalFg -call s:Hi('NonText', s:p.muted) -call s:Hi('Pmenu', s:p.menuFg, s:p.menu) -call s:Hi('PmenuSel', s:p.menuFg, s:p.menuSel) -call s:Hi('PmenuSbar', s:p.menu, s:p.menu) -call s:Hi('PmenuThumb', s:p.menuSBar, s:p.menuSBar) -hi! link Question NormalFg -hi! link QuickFixLine NormalFg -call s:Hi('Search', s:p.null, s:p.search) -call s:Hi('IncSearch', s:p.null, s:p.incSearch) -hi! link SpecialKey NonText -call s:Hi('SpellBad', s:p.typo, s:p.null, 'underline') -hi! link SpellCap SpellBad -hi! link SpellLocal SpellBad -hi! link SpellRare SpellBad -call s:Hi('StatusLine', s:p.statusLineFg, s:p.statusLine) -call s:Hi('StatusLineNC', s:p.statusLineNC, s:p.statusLine) -hi! link StatusLineTerm StatusLine -hi! link StatusLineTermNC StatusLineNC -call s:Hi('TabLine', s:p.statusLineFg, s:p.statusLine) -call s:Hi('TabLineFill', s:p.statusLine, s:p.statusLine) -call s:Hi('TabLineSel', s:p.fg, s:p.tabLineSel) -call s:Hi('Terminal', s:p.stdOutput, s:p.bg) -hi! link Title Special -call s:Hi('Visual', s:p.null, s:p.selection) -hi! link VisualNOS Visual -call s:Hi('WarningMsg', s:p.warning) -hi! link WildMenu PmenuSel -call s:Hi('Comment', s:p.comment) -hi! link Identifier NormalFg -hi! link Type Keyword -call s:Hi('Typedef', s:p.typeDef) -call s:Hi('Todo', s:p.todo, s:p.null, 'italic') -hi! link Special PreProc -call s:Hi('Constant', s:p.constant, s:p.null, 'italic') -call s:Hi('String', s:p.string) -hi! link Character String -call s:Hi('Number', s:p.number) -call s:Hi('Delimiter', s:p.delimiter) -call s:Hi('SpecialComment', s:p.specialComment, s:p.null, 'italic') -hi! link Statement Keyword -call s:Hi('Keyword', s:p.keyword) -call s:Hi('Underlined', s:p.fg, s:p.null, 'underline') -call s:Hi('PreProc', s:p.metaData) -hi! link Tag Keyword -call s:Hi('Debug', s:p.debug, s:p.null, 'italic') -call s:Hi('Function', s:p.function) -call s:Hi('OtherBuiltin', s:p.otherBuiltin) - -" fixes -hi! link Integer Number -hi! link Macro cMacroName -hi! link Include PreProc -hi! link Operator Keyword -hi! link SpecialChar PreProc -hi! link GitGutterAdd GitAddStripe -hi! link GitGutterChange GitChangeStripe -hi! link GitGutterDelete GitDeleteStripe -hi! link StorageClass Keyword -hi! link Structure Keyword -hi! link Conditional Keyword -hi! link Repeat Keyword -hi! link cDefine PreProc - -" nix -hi! link nixBoolean Keyword -hi! link nixInterpolationParam InstanceField -hi! link nixInterpolationDelimiter InstanceField -hi! link nixStringDelimiter String -hi! link nixPath Constant -hi! link nixSearchPath nixPath -hi! link nixURI nixPath -hi! link nixPathDelimiter nixPath -hi! link nixSearchPathRef nixPath -hi! link nixHomePath nixPath -hi! link nixAttributeDot Identifier -hi! link nixSimpleFunctionArgument Function -hi! link nixArgumentDefinition Function -hi! link nixNamespacedBuiltin OtherBuiltin -hi! link nixSimpleBuiltin OtherBuiltin -hi! link nixBuiltin OtherBuiltin -hi! link nixStringSpecial Keyword -hi! link nixArgumentSeparator Operator - -" helper groups -call s:Hi('docComment', s:p.docComment, s:p.null, 'italic') -call s:Hi('NormalFg', s:p.fg) -call s:Hi('GitAddStripe', s:p.addStripe, s:p.addStripe) -call s:Hi('GitChangeStripe', s:p.changeStripe, s:p.changeStripe) -call s:Hi('GitDeleteStripe', s:p.deleteStripe, s:p.gutter) -call s:Hi('CodeError', s:p.null, s:p.codeError) -call s:Hi('CodeWarning', s:p.null, s:p.codeWarning) -call s:Hi('CodeInfo', s:p.null, s:p.infoStripe) -call s:Hi('CodeHint', s:p.hintFg, s:p.hintBg) -call s:Hi('ErrorSign', s:p.errorStripe, s:p.gutter) -call s:Hi('WarningSign', s:p.warnStripe, s:p.gutter) -call s:Hi('InfoSign', s:p.infoStripe, s:p.gutter) -call s:Hi('HintSign', s:p.hintStripe, s:p.gutter) -call s:Hi('IdentifierUnderCaret', s:p.null, s:p.identifierUnderCaret) -call s:Hi('IdentifierUnderCaretWrite', s:p.null, s:p.identifierUnderCaretWrite) -call s:Hi('InstanceField', s:p.constant) -call s:Hi('UIDialog', s:p.fg, s:p.statusLine) -call s:Hi('UIBorder', s:p.UIBorder, s:p.statusLine) -call s:Hi('UISelection', s:p.null, s:p.UISelection) - -" neovim -if has('nvim') - " the following code snippet fix an issue with CursorLine hi group - " see https://github.com/neovim/neovim/issues/9019 - if has('termguicolors') && &termguicolors - hi CursorLine ctermfg=white - else - hi CursorLine guifg=white - endif - hi! link NormalFloat Pmenu - hi! link NormalNC NormalFg - hi! link MsgArea NormalFg - hi! link MsgSeparator StatusLine - hi! link QuickFixLine NormalFg - hi! link Substitute Search - " TermCursor - " TermCursorNC - hi! link Whitespace NonText - hi! link healthSuccess IncSearch - call s:Hi('NvimInternalError', s:p.error, s:p.error) - call s:Hi('RedrawDebugClear', s:p.fg, s:p.duplicateFromServer) - call s:Hi('RedrawDebugComposed', s:p.fg, s:p.search) - call s:Hi('RedrawDebugRecompose', s:p.fg, s:p.codeError) - " Terminal colors - let g:terminal_color_0 = s:p.ANSIBlack[0] - let g:terminal_color_1 = s:p.ANSIRed[0] - let g:terminal_color_2 = s:p.ANSIGreen[0] - let g:terminal_color_3 = s:p.ANSIYellow[0] - let g:terminal_color_4 = s:p.ANSIBlue[0] - let g:terminal_color_5 = s:p.ANSIMagenta[0] - let g:terminal_color_6 = s:p.ANSICyan[0] - let g:terminal_color_7 = s:p.ANSIGray[0] - let g:terminal_color_8 = s:p.ANSIDarkGray[0] - let g:terminal_color_9 = s:p.ANSIBrightRed[0] - let g:terminal_color_10 = s:p.ANSIBrightGreen[0] - let g:terminal_color_11 = s:p.ANSIBrightYellow[0] - let g:terminal_color_12 = s:p.ANSIBrightBlue[0] - let g:terminal_color_13 = s:p.ANSIBrightMagenta[0] - let g:terminal_color_14 = s:p.ANSIBrightCyan[0] - let g:terminal_color_15 = s:p.ANSIWhite[0] - - " nvim-treesitter - hi! link TSAnnotation PreProc - hi! link TSAttribute PreProc - hi! link TSBoolean Keyword - hi! link TSCharacter Character - hi! link TSComment Comment - hi! link TSConstructor Function - hi! link TSConditional Keyword - hi! link TSConstant Constant - hi! link TSConstBuiltin Keyword - hi! link TSConstMacro cMacroName - hi! link TSError codeError - hi! link TSException Keyword - hi! link TSField InstanceField - hi! link TSFloat Number - hi! link TSFunction Function - hi! link TSFuncBuiltin Normal - hi! link TSFuncMacro cMacroName - hi! link TSInclude Keyword - hi! link TSKeyword Keyword - hi! link TSKeywordFunction Keyword - hi! link TSLabel Normal - hi! link TSMethod Function - hi! link TSNamespace cDataStructure - hi! link TSNone Normal - hi! link TSNumber Number - hi! link TSOperator Normal - hi! link TSParameter Normal - hi! link TSParameterReference Normal - hi! link TSProperty TSField - hi! link TSPunctDelimiter Normal - hi! link TSPunctBracket Normal - hi! link TSPunctSpecial Keyword - hi! link TSRepeat Keyword - hi! link TSString String - hi! link TSStringRegex Number - hi! link TSStringEscape Keyword - hi! link TSTag htmlTag - hi! link TSTagDelimiter htmlTag - hi! link TSText Normal - call s:Hi('TSStrong', s:p.fg, s:p.null, 'bold') - call s:Hi('TSEmphasis', s:p.fg, s:p.null, 'italic') - call s:Hi('TSUnderline', s:p.fg, s:p.null, 'underline') - call s:Hi('TSStrike', s:p.fg, s:p.null, 'strikethrough') - call s:Hi('TSTitle', s:p.fg, s:p.null, 'bold,underline') - hi! link TSLiteral Normal - hi! link TSURI markdownLinkText - hi! link TSNote CodeInfo - hi! link TSWarning CodeWarning - hi! link TSDanger CodeError - hi! link TSType Normal - hi! link TSTypeBuiltin Keyword - hi! link TSVariable Normal - hi! link TSVariableBuiltin Keyword - - " LSP - hi! link LspDiagnosticsDefaultError CodeError - hi! link LspDiagnosticsDefaultWarning CodeWarning - hi! link LspDiagnosticsDefaultInformation CodeInfo - hi! link LspDiagnosticsDefaultHint CodeHint - hi! link LspDiagnosticsSignError ErrorSign - hi! link LspDiagnosticsSignWarning WarningSign - hi! link LspDiagnosticsSignInformation InfoSign - hi! link LspDiagnosticsSignHint HintSign - hi! link LspReferenceText IdentifierUnderCaret - hi! link LspReferenceRead IdentifierUnderCaret - hi! link LspReferenceWrite IdentifierUnderCaretWrite - hi! link LspDiagnosticsUnderlineError CodeError - hi! link LspDiagnosticsUnderlineWarning CodeWarning - hi! link LspDiagnosticsUnderlineInformation CodeInfo - hi! link LspDiagnosticsUnderlineHint CodeHint - hi! link LspDiagnosticsFloatingError NormalFloat - hi! link LspDiagnosticsFloatingWarning NormalFloat - hi! link LspDiagnosticsFloatingInformation NormalFloat - hi! link LspDiagnosticsFloatingHint NormalFloat -endif - -" Vim terminal colors (for :terminal) -if !has('nvim') - let g:terminal_ansi_colors=[ - \ s:p.ANSIBlack[0], - \ s:p.ANSIRed[0], - \ s:p.ANSIGreen[0], - \ s:p.ANSIYellow[0], - \ s:p.ANSIBlue[0], - \ s:p.ANSIMagenta[0], - \ s:p.ANSICyan[0], - \ s:p.ANSIGray[0], - \ s:p.ANSIDarkGray[0], - \ s:p.ANSIBrightRed[0], - \ s:p.ANSIBrightGreen[0], - \ s:p.ANSIBrightYellow[0], - \ s:p.ANSIBrightBlue[0], - \ s:p.ANSIBrightMagenta[0], - \ s:p.ANSIBrightCyan[0], - \ s:p.ANSIWhite[0] - \ ] -endif - -" C/C++ -call s:Hi('cMacroName', s:p.macroName) -hi! link cConstant cMacroName -hi! link cPreInclude String -hi! link cPreProcRegion NormalFg -hi! link cUserLabel NormalFg -hi! link cDataStructureKeyword Keyword -call s:Hi('cDataStructure', s:p.cDataStructure) -hi! link cFunction Function -hi! link cppDestructor cFunction -hi! link cSemicolon Keyword -hi! link cComma Keyword -call s:Hi('cppAfterColon', s:p.cStructField) -hi! link cppBeforeColon cDataStructure -call s:Hi('cStructField', s:p.cStructField) -hi! link cppNullptr Keyword -hi! link cppTemplate Keyword -hi! link cTypedef Keyword -hi! link cppTypeName Keyword -hi! link cSpecial Keyword -hi! link cEnum Keyword -call s:Hi('cSomeMacro', s:p.macroName) - -hi! link cJCFunc Function - -" Rust -call s:Hi('rustDeriveTrait', s:p.metaData) -hi! link rustQuestionMark Keyword -hi! link rustComma Keyword -hi! link rustSemicolon Keyword -hi! link rustOperator NormalFg -call s:Hi('rustCommentLineDoc', s:p.docComment, s:p.null, 'italic') -call s:Hi('rustMacro', s:p.rustMacro) -hi! link rustAssert rustMacro -hi! link rustPanic rustMacro -hi! link rustEscape Keyword -hi! link rustSigil NormalFg -hi! link rustSelf Keyword -call s:Hi('rustLifetime', s:p.rustLifetime, s:p.null, 'italic') -call s:Hi('rustTypeParameter', s:p.rustLifetime) -hi! link rustEnumVariant Constant -hi! link rustModPath NormalFg -hi! link rustModPathSep NormalFg -hi! link rustAs Keyword -hi! link rustConst Constant -hi! link rustVarField InstanceField - -" Vim -hi! link vimOption Constant -hi! link vimFunction Function -hi! link vimContinue NonText -hi! link vimParenSep NormalFg -hi! link vimBracket PreProc -hi! link vimOper NormalFg -hi! link vimSep NormalFg -hi! link vimCommentString Comment - -" JavaScript -hi! link jsNoise Keyword -hi! link JsImport Keyword -hi! link JsFrom Keyword -hi! link JsOperator NormalFg -hi! link jsArrowFunction NormalFg -hi! link jsFuncArgCommas Delimiter -hi! link jsObjectKey InstanceField -hi! link jsTernaryIfOperator NormalFg -hi! link jsObjectSeparator Keyword -hi! link jsSpreadOperator NormalFg -hi! link jsModuleComma Keyword -hi! link jsClassDefinition NormalFg -hi! link jsSuper Keyword -hi! link jsThis Keyword -hi! link jsObjectProp InstanceField -hi! link jsDestructuringNoise Keyword -hi! link jsClassProperty Function -hi! link jsBooleanTrue Keyword -hi! link jsBooleanFalse Keyword -hi! link jsObjectShorthandProp NormalFg -hi! link jsObjectColon NormalFg -hi! link jsExport Keyword -hi! link jsModuleAs Keyword - -" TypeScript -hi! link typescriptBraces NormalFg -hi! link typescriptDocComment docComment -hi! link typescriptDocParam docComment -hi! link typescriptParens NormalFg -hi! link typescriptOpSymbols InstanceField -hi! link typescriptRegexpString Number -hi! link typescriptSpecial Keyword -hi! link typescriptLogicSymbols InstanceField -hi! link typescriptExceptions Keyword -call s:Hi('typescriptDocTags', s:p.docComment, s:p.null, 'bold,italic,underline') -call s:Hi('typescriptGlobalObjects', s:p.tsObject) - -" JSON -hi! link jsonBraces NormalFg -hi! link jsonKeyword InstanceField -hi! link jsonNoise Keyword -hi! link jsonKeywordMatch Keyword -hi! link jsonBoolean Keyword -hi! link jsonNull Keyword -hi! link jsonEscape Keyword -hi! link jsonStringMatch String - -" XML -call s:Hi('xmlTagName', s:p.tag) -hi! link xmlEndTag xmlTagName -hi! link xmlAttrib NormalFg -hi! link xmlProcessingDelim xmlTagName -hi! link xmlDocTypeKeyword xmlTagName -hi! link xmlComment Comment -hi! link xmlCommentStart xmlComment -hi! link xmlCommentPart xmlComment -call s:Hi('xmlEntity', s:p.entity) -hi! link xmlEntityPunct xmlEntity -hi! link xmlCdata NormalFg -hi! link xmlCdataCdata xmlCdata -hi! link xmlCdataStart xmlCdata -hi! link xmlCdataEnd xmlCdata -hi! link xmlNamespace InstanceField -hi! link xmlAttribPunct NormalFg -hi! link xmlEqual xmlString - -" GraphQL -hi! link graphqlTaggedTemplate NormalFg - -" YAML -hi! link yamlDocumentStart NormalFg -hi! link yamlDocumentEnd NormalFg -hi! link yamlComment docComment -hi! link yamlBlockMappingKey Keyword -hi! link yamlKeyValueDelimiter NormalFg -hi! link yamlInteger NormalFg -hi! link yamlFloat NormalFg -hi! link yamlBlockCollectionItemStart NormalFg -call s:Hi('yamlAnchor', s:p.tag) -hi! link yamlAlias yamlAnchor -hi! link yamlBool NormalFg -hi! link yamlNodeTag NormalFg -hi! link yamlNull NormalFg - -" Markdown -hi! link markdownH1 Constant -hi! link markdownH2 markdownH1 -hi! link markdownH3 markdownH1 -hi! link markdownH4 markdownH1 -hi! link markdownH5 markdownH1 -hi! link markdownH6 markdownH1 -hi! link markdownHeadingRule markdownH1 -hi! link markdownHeadingDelimiter markdownH1 -call s:Hi('markdownAutomaticLink', s:p.link, s:p.null, 'underline') -hi! link markdownBlockquote String -hi! link markdownBoldDelimiter Keyword -hi! link markdownBold NormalFg -hi! link markdownItalicDelimiter Keyword -hi! link markdownItalic NormalFg -hi! link markdownCode Comment -hi! link markdownCodeDelimiter markdownCode -hi! link markdownCodeBlock markdownCode -call s:Hi('markdownLinkText', s:p.link, s:p.null, 'underline') -hi! link markdownLinkTextDelimiter markdownLinkText -hi! link markdownUrlDelimiter markdownLinkText -call s:Hi('markdownUrl', s:p.function, s:p.null, 'italic') -hi! link markdownIdDelimiter Keyword -hi! link markdownLinkDelimiter Keyword -hi! link markdownIdDeclaration Keyword -hi! link markdownLinkDelimiter NormalFg -hi! link markdownUrlTitleDelimiter Comment -hi! link markdownRule Comment - -" HTML -let html_no_rendering=1 -call s:Hi('htmlTag', s:p.tag) -hi! link htmlTagName htmlTag -hi! link htmlEndTag htmlTag -call s:Hi('htmlArg', s:p.htmlAttribute) -call s:Hi('htmlString', s:p.htmlString) -hi! link htmlValue htmlString -hi! link htmlComment Comment -hi! link htmlCommentError Comment -hi! link htmlCommentPart Comment -call s:Hi('htmlSpecialChar', s:p.entity) -hi! link htmlSpecialTagName htmlTag - -" CSS -hi! link cssAtKeyword Keyword -hi! link cssBraces NormalFg -hi! link cssAttributeSelector htmlTag -hi! link cssSelectorOp NormalFg -hi! link cssClassName htmlTag -hi! link cssNoise Keyword -hi! link cssAttrComma Keyword -hi! link cssFunctionComma Keyword -hi! link cssMediaComma Keyword -hi! link cssComment Comment -hi! link cssClassNameDot NormalFg -call s:Hi('cssFunctionName', s:p.tag) -call s:Hi('cssColor', s:p.number) -call s:Hi('cssIdentifier', s:p.tag) -call s:Hi('cssPseudoClassId', s:p.tag) -call s:Hi('cssImportant', s:p.keyword, s:p.null, 'bold') -call s:Hi('cssProp', s:p.htmlAttribute) -call s:Hi('cssAttr', s:p.htmlString) -call s:Hi('cssAttrRegion', s:p.htmlString) -call s:Hi('cssURL', s:p.link) - -" Shell Script -call s:Hi('sheBang', s:p.fg, s:p.null, 'bold') -hi! link shRange NormalFg -hi! link shFunctionKey Keyword -call s:Hi('shStatement', s:p.shCommand) -hi! link bashStatement shStatement -hi! link shDerefVar NormalFg -hi! link shQuote String -call s:Hi('shHereDoc', s:p.null, s:p.templateLanguage) -call s:Hi('shRedir', s:p.fg, s:p.null, 'bold') -hi! link shDerefSimple NormalFg -hi! link shCommandSubBQ InstanceField -hi! link shOption NormalFg -hi! link shCmdSubRegion shStatement -hi! link shCommandSub NormalFg -hi! link shLoop Keyword -hi! link shCommandSub Keyword -hi! link shSet shStatement -hi! link shFunctionTwo shStatement -hi! link shCtrlSeq String -hi! link shSpecial String -hi! link shCommandSub NormalFg -hi! link shDerefSpecial NormalFg -hi! link shOperator NormalFg - -" help -hi! link helpHyperTextJump Number - - - - - - - diff --git a/files/i3_communicators_layout.json b/files/i3_communicators_layout.json deleted file mode 100644 index 0455863..0000000 --- a/files/i3_communicators_layout.json +++ /dev/null @@ -1,44 +0,0 @@ -// vim:ts=4:sw=4:et -{ - "border": "pixel", - "current_border_width": 1, - "floating": "auto_off", - "geometry": { - "height": 1054, - "width": 940, - "x": 1921, - "y": 1 - }, - "marks": [], - "name": "Friends - Discord", - "percent": 0.6, - "swallows": [ - { - "class": "^discord$", - "title": "^(?!.*Updater)" - } - ], - "type": "con" -} - -{ - "border": "pixel", - "current_border_width": 1, - "floating": "auto_off", - "geometry": { - "height": 1054, - "width": 1918, - "x": 1921, - "y": 1 - }, - "marks": [], - "name": "Element * | the idiot room", - "percent": 0.4, - "swallows": [ - { - "class": "^Element$" - } - ], - "type": "con" -} - diff --git a/files/i3status-format-fix.patch b/files/i3status-format-fix.patch index e9ec2a9..4589ae1 100644 --- a/files/i3status-format-fix.patch +++ b/files/i3status-format-fix.patch @@ -1,19 +1,10 @@ -From 9758bc03df33fc0d6e61b2be86e3efe714b90dee Mon Sep 17 00:00:00 2001 -From: krizej <60076189+krizej@users.noreply.github.com> -Date: Fri, 5 Jul 2024 01:17:31 +0200 -Subject: [PATCH] japierdole - ---- - src/print_cpu_usage.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c index a7ee2e4..1821a99 100644 --- a/src/print_cpu_usage.c +++ b/src/print_cpu_usage.c @@ -201,7 +201,7 @@ void print_cpu_usage(cpu_usage_ctx_t *ctx) { *(outwalk++) = *walk; - + } else if (BEGINS_WITH(walk + 1, "usage")) { - outwalk += sprintf(outwalk, "%02d%s", diff_usage, pct_mark); + outwalk += sprintf(outwalk, "%d%s", diff_usage, pct_mark); @@ -29,6 +20,4 @@ index a7ee2e4..1821a99 100644 } walk += length; } --- -2.45.1 diff --git a/files/sddm-i3-theme/metadata.desktop b/files/sddm-i3-theme/metadata.desktop index 1814ba2..aaf03e4 100644 --- a/files/sddm-i3-theme/metadata.desktop +++ b/files/sddm-i3-theme/metadata.desktop @@ -6,7 +6,7 @@ Copyright=(c) 2024, krizej License=MIT Type=sddm-theme Version=1 -Website=https://github.com/krizej +Website=https://git.jacekpoz.pl/krizej/nix/src/branch/master/files/sddm-i3-theme MainScript=Main.qml ConfigFile=theme.conf Theme-Id=sddm-i3 diff --git a/modules/stuff/flameshot.nix b/modules/stuff/flameshot.nix index 700828e..930d8ef 100644 --- a/modules/stuff/flameshot.nix +++ b/modules/stuff/flameshot.nix @@ -1,5 +1,5 @@ -{ lib, pkgs, config, ...}: let - inherit (lib) mkIf mkEnableOption mkOption; +{ lib, config, ...}: let + inherit (lib) mkIf mkEnableOption; cfg = config.chuj.stuff.flameshot; user = config.chuj.system.user; in { @@ -11,11 +11,13 @@ in { services.flameshot = { enable = true; settings = { - # todo: add some shit (userColors, ui colors, check the other stuff) # https://github.com/flameshot-org/flameshot/blob/master/flameshot.example.ini General = { disabledTrayIcon = true; showStartupLaunchMessage = false; + showDesktopNotification = false; + userColors = "picker, #000000, #ffffff, #800000, #ff0000, #ffff00, #00ff00, #008000, #00ffff, #0000ff, #ff00ff, #800080"; + drawColor = "#ff0000"; }; }; }; diff --git a/modules/stuff/git.nix b/modules/stuff/git.nix index 04a2cfd..6317828 100644 --- a/modules/stuff/git.nix +++ b/modules/stuff/git.nix @@ -10,10 +10,12 @@ in { environment.systemPackages = [ pkgs.git pkgs.codeberg-cli ]; home-manager.users.${user}.programs.git = { enable = true; + # should this be here?????? userName = "krizej"; userEmail = "krizej@protonmail.com"; extraConfig.init.defaultBranch = "master"; ignores = [ + ".direnv/" ".idea/" "build/" ".venv/" diff --git a/modules/stuff/i3.nix b/modules/stuff/i3.nix index 1047976..f22bec5 100644 --- a/modules/stuff/i3.nix +++ b/modules/stuff/i3.nix @@ -1,5 +1,5 @@ { lib, pkgs, config, ...}: let - inherit (lib) mkIf mkEnableOption mkOption types optionals mergeAttrs mergeAttrsList optionalAttrs; + inherit (lib) mkIf mkEnableOption mkOption types optionals optionalAttrs; cfg = config.chuj.stuff.i3; user = config.chuj.system.user; in { @@ -44,7 +44,65 @@ in { }; config = let - HOME = config.home-manager.users.${user}.home.homeDirectory; + hmCfg = config.home-manager.users.${user}; + + exec = what: "exec --no-startup-id ${what}"; + + i3-msg = lib.getExe' hmCfg.xsession.windowManager.i3.package "i3-msg"; + terminal = if (config.chuj.stuff.alacritty.enable) + then (lib.getExe hmCfg.programs.alacritty.package) + else (lib.getExe' hmCfg.xsession.windowManager.i3.package "i3-sensible-terminal"); + firefox = lib.getExe hmCfg.programs.firefox.package; + schildichat = lib.getExe pkgs.schildichat-desktop; + flameshot = lib.getExe hmCfg.services.flameshot.package; + dunst = lib.getExe' hmCfg.services.dunst.package "dunst"; + dunstify = lib.getExe' hmCfg.services.dunst.package "dunstify"; + dmenu_run = lib.getExe' pkgs.dmenu "dmenu_run"; + dmenu = lib.getExe pkgs.dmenu; + yad = lib.getExe pkgs.yad; + mpc = lib.getExe pkgs.mpc-cli; + mpdstatus = lib.getExe config.chuj.stuff.mpd.mpdstatusPackage; + pamixer = lib.getExe pkgs.pamixer; + xdotool = lib.getExe pkgs.xdotool; + xkill = lib.getExe pkgs.xorg.xkill; + killall = lib.getExe pkgs.killall; + sync = lib.getExe' pkgs.coreutils "sync"; + tail = lib.getExe' pkgs.coreutils "tail"; + find = lib.getExe' pkgs.findutils "find"; + sed = lib.getExe pkgs.gnused; + + i3custom-window-actions = lib.getExe (pkgs.writeShellScriptBin "i3custom-window-actions" '' + ${yad} --splash --mouse \ + --title="i3 window actions" \ + --gtkrc="${../../files/i3gtk.css}" \ + --text="i3 window actions" \ + --button float:0 --button kill:1 + + case $? in + 0) ${i3-msg} "floating toggle";; + 1) ${i3-msg} "kill";; + -1) ;; + esac + ''); + + musicsel = lib.getExe (pkgs.writeShellScriptBin "musicsel" '' + cd ~/Music + path=$(${find} . -maxdepth 1 -type d | ${tail} -n +2 | ${sed} 's|^./||g' | ${dmenu}) + ${dunstify} "playing from \"$path\"" + ${mpc} update + ${mpc} rescan + ${mpc} add "$path" + ${mpc} random on + ${mpc} repeat on + ${mpc} play + ''); + + i3custom-center-mouse-on-focus = lib.getExe (pkgs.writeShellScriptBin "i3custom-center-mouse-on-focus" '' + eval $(${xdotool} getwindowfocus getwindowgeometry --shell) + MX=$(($X + $WIDTH / 2)) + MY=$(($Y + $HEIGHT / 2)) + ${xdotool} mousemove $MX $MY + ''); in mkIf cfg.enable { services.xserver.windowManager.i3.enable = true; home-manager.users.${user} = { @@ -86,6 +144,10 @@ in { defaultWorkspace = "workspace number 1"; + # transforms + # { "" = ""; } + # into + # [{ workspace = ""; output = ""; }] workspaceOutputAssign = lib.mapAttrsToList (workspace: output: { inherit workspace output; }) cfg.workspaceOutput; @@ -97,38 +159,17 @@ in { }; startup = [] - ++ optionals config.chuj.stuff.dunst.enable [{ command = "dunst &"; notification = false; }] - ++ optionals config.chuj.stuff.flameshot.enable [{ command = "flameshot &"; notification = false; }] - ++ optionals cfg.communicators.autostart [ -# { command = "i3-msg \"workspace ${cfg.communicators.workspace}; append_layout ${../../files/i3_communicators_layout.json}\""; notification = false; } -# { command = "discord &"; notification = false; } - { command = "schildichat-desktop &"; notification = false; } - ] - ++ optionals config.chuj.stuff.mpd.enable [ - { command = "${pkgs.writeShellScriptBin "mpdstatus" '' - trap "echo SIG" USR1 EXIT + ++ optionals config.chuj.stuff.dunst.enable [{ command = "${dunst} &"; notification = false; }] + ++ optionals config.chuj.stuff.flameshot.enable [{ command = "${flameshot} &"; notification = false; }] + ++ optionals cfg.communicators.autostart [{ command = "${schildichat} &"; notification = false; }] + ++ optionals config.chuj.stuff.mpd.enable [{ command = "${mpdstatus} &"; notification = false; }]; - while true; do - sleep 1 & - wait - - status=$(mpc status | sed -n 2p | cut -d' ' -f1) - title=$(basename "$(mpc current -f '%file%')" .mp3) - echo "$status $title" > /tmp/i3-mpd-status-stuff - echo update!! - - done - ''}/bin/mpdstatus &"; notification = false; } - ]; - - modes = let - cmd_and_center = cmd: "exec --no-startup-id i3-msg '${cmd}' && i3-center-mouse-on-focus"; - in { + modes = { resize = { - "Left" = cmd_and_center "resize shrink width 10 px or 10 ppt"; - "Right" = cmd_and_center "resize grow width 10 px or 10 ppt"; - "Up" = cmd_and_center "resize shrink height 10 px or 10 ppt"; - "Down" = cmd_and_center "resize grow height 10 px or 10 ppt"; + "Left" = "resize shrink width 10 px or 10 ppt; ${exec i3custom-center-mouse-on-focus}"; + "Right" = "resize grow width 10 px or 10 ppt; ${exec i3custom-center-mouse-on-focus}"; + "Up" = "resize shrink height 10 px or 10 ppt; ${exec i3custom-center-mouse-on-focus}"; + "Down" = "resize grow height 10 px or 10 ppt; ${exec i3custom-center-mouse-on-focus}"; "Escape" = "mode default"; }; }; @@ -137,102 +178,85 @@ in { floating.modifier = "Mod4"; keybindings = with config.chuj.stuff.i3.mediaKeys; let - killall = "${pkgs.killall}/bin/killall"; mod = modifier; - execns = "exec --no-startup-id"; - i3-msg = ""; - terminal = ""; - flameshot = ""; - firefox = ""; - dmenu_run = ""; - xkill = ""; - pamixer = ""; - i3custom-window-actions = ""; - dunstify = ""; - mpc = ""; - in let - cmd_and_center = cmd: "${execns} i3-msg '${cmd}' && i3custom-center-mouse-on-focus"; - update_mpdstatus = "${killall} -USR1 mpdstatus && sleep 0.05"; # hack as fack xd - update_i3status = "${killall} -USR1 i3status"; - in mergeAttrs { + update_mpdstatus = "${killall} -USR1 mpdstatus && ${sync} ${config.chuj.stuff.mpd.statusFile}"; + update_i3status = "${killall} -USR1 i3status"; + center_mouse = exec i3custom-center-mouse-on-focus; + in { # Program keybinds - "${mod}+Return" = ''${execns} ${if config.chuj.stuff.alacritty.enable then "alacritty" else "i3-sensible-terminal"}''; - "${mod}+Shift+s" = mkIf config.chuj.stuff.flameshot.enable "${execns} flameshot gui"; - "${mod}+b" = mkIf config.chuj.stuff.firefox.enable "${execns} firefox"; - "${mod}+d" = "${execns} dmenu_run"; - "--release ${mod}+k" = "${execns} xkill"; + "${mod}+Return" = exec terminal; + "${mod}+d" = exec dmenu_run; + "${mod}+Shift+s" = mkIf config.chuj.stuff.flameshot.enable (exec "${flameshot} gui"); + "${mod}+b" = mkIf config.chuj.stuff.firefox.enable (exec firefox); + "--release ${mod}+k" = exec xkill; # Volume control - "Ctrl+${audioMute}" = "${execns} pamixer --toggle-mute && ${update_i3status}"; - "Ctrl+${audioDown}" = "${execns} pamixer --decrease 5 && ${update_i3status}"; - "Ctrl+${audioUp}" = "${execns} pamixer --increase 5 && ${update_i3status}"; + "Ctrl+${audioMute}" = exec "${pamixer} --toggle-mute && ${update_i3status}"; + "Ctrl+${audioDown}" = exec "${pamixer} --decrease 5 && ${update_i3status}"; + "Ctrl+${audioUp}" = exec "${pamixer} --increase 5 && ${update_i3status}"; # General i3 keybindings - "${mod}+f" = cmd_and_center "fullscreen toggle"; + "${mod}+Shift+q" = "kill; ${center_mouse}"; + "${mod}+f" = "fullscreen toggle; ${center_mouse}"; "${mod}+r" = "mode resize"; - "${mod}+Shift+q" = cmd_and_center "kill"; "${mod}+Shift+r" = "restart"; - # Mouse bindings - "--border button3" = "${execns} i3custom-window-actions"; + "--border button3" = exec i3custom-window-actions; - "${mod}+Left" = cmd_and_center "focus left"; - "${mod}+Right" = cmd_and_center "focus right"; - "${mod}+Up" = cmd_and_center "focus up"; - "${mod}+Down" = cmd_and_center "focus down"; - "${mod}+Shift+Left" = cmd_and_center "move left"; - "${mod}+Shift+Right" = cmd_and_center "move right"; - "${mod}+Shift+Up" = cmd_and_center "move up"; - "${mod}+Shift+Down" = cmd_and_center "move down"; + "${mod}+Left" = "focus left; ${center_mouse}"; + "${mod}+Right" = "focus right; ${center_mouse}"; + "${mod}+Up" = "focus up; ${center_mouse}"; + "${mod}+Down" = "focus down; ${center_mouse}"; + "${mod}+Shift+Left" = "move left; ${center_mouse}"; + "${mod}+Shift+Right" = "move right; ${center_mouse}"; + "${mod}+Shift+Up" = "move up; ${center_mouse}"; + "${mod}+Shift+Down" = "move down; ${center_mouse}"; - "${mod}+q" = cmd_and_center "layout stacking"; - "${mod}+w" = cmd_and_center "layout tabbed"; - "${mod}+e" = cmd_and_center "layout toggle split"; + "${mod}+q" = "layout stacking; ${center_mouse}"; + "${mod}+w" = "layout tabbed; ${center_mouse}"; + "${mod}+e" = "layout toggle split; ${center_mouse}"; - "${mod}+Shift+space" = "floating toggle; ${execns} i3custom-center-mouse-on-focus"; - "${mod}+space" = cmd_and_center "focus mode_toggle"; + "${mod}+Shift+space" = "floating toggle; ${center_mouse}"; + "${mod}+space" = "focus mode_toggle; ${center_mouse}"; - "${mod}+1" = cmd_and_center "workspace number 1"; - "${mod}+2" = cmd_and_center "workspace number 2"; - "${mod}+3" = cmd_and_center "workspace number 3"; - "${mod}+4" = cmd_and_center "workspace number 4"; - "${mod}+5" = cmd_and_center "workspace number 5"; - "${mod}+6" = cmd_and_center "workspace number 6"; - "${mod}+7" = cmd_and_center "workspace number 7"; - "${mod}+8" = cmd_and_center "workspace number 8"; - "${mod}+9" = cmd_and_center "workspace number 9"; - "${mod}+0" = cmd_and_center "workspace number 10"; + "${mod}+1" = "workspace number 1; ${center_mouse}"; + "${mod}+2" = "workspace number 2; ${center_mouse}"; + "${mod}+3" = "workspace number 3; ${center_mouse}"; + "${mod}+4" = "workspace number 4; ${center_mouse}"; + "${mod}+5" = "workspace number 5; ${center_mouse}"; + "${mod}+6" = "workspace number 6; ${center_mouse}"; + "${mod}+7" = "workspace number 7; ${center_mouse}"; + "${mod}+8" = "workspace number 8; ${center_mouse}"; + "${mod}+9" = "workspace number 9; ${center_mouse}"; + "${mod}+0" = "workspace number 10; ${center_mouse}"; - "${mod}+Shift+1" = cmd_and_center "move container to workspace number 1"; - "${mod}+Shift+2" = cmd_and_center "move container to workspace number 2"; - "${mod}+Shift+3" = cmd_and_center "move container to workspace number 3"; - "${mod}+Shift+4" = cmd_and_center "move container to workspace number 4"; - "${mod}+Shift+5" = cmd_and_center "move container to workspace number 5"; - "${mod}+Shift+6" = cmd_and_center "move container to workspace number 6"; - "${mod}+Shift+7" = cmd_and_center "move container to workspace number 7"; - "${mod}+Shift+8" = cmd_and_center "move container to workspace number 8"; - "${mod}+Shift+9" = cmd_and_center "move container to workspace number 9"; - "${mod}+Shift+0" = cmd_and_center "move container to workspace number 10"; - } (optionalAttrs config.chuj.stuff.mpd.enable { + "${mod}+Shift+1" = "move container to workspace number 1; ${center_mouse}"; + "${mod}+Shift+2" = "move container to workspace number 2; ${center_mouse}"; + "${mod}+Shift+3" = "move container to workspace number 3; ${center_mouse}"; + "${mod}+Shift+4" = "move container to workspace number 4; ${center_mouse}"; + "${mod}+Shift+5" = "move container to workspace number 5; ${center_mouse}"; + "${mod}+Shift+6" = "move container to workspace number 6; ${center_mouse}"; + "${mod}+Shift+7" = "move container to workspace number 7; ${center_mouse}"; + "${mod}+Shift+8" = "move container to workspace number 8; ${center_mouse}"; + "${mod}+Shift+9" = "move container to workspace number 9; ${center_mouse}"; + "${mod}+Shift+0" = "move container to workspace number 10; ${center_mouse}"; + } // (optionalAttrs config.chuj.stuff.mpd.enable { # MPD controls - "Ctrl+${musicMenu}" = "${execns} mpdfdial.sh && ${update_mpdstatus} && ${update_i3status}"; - "Ctrl+${musicPrev}" = "${execns} mpc prev && ${update_mpdstatus} && ${update_i3status}"; - "Ctrl+${musicPlay}" = "${execns} mpc toggle && ${update_mpdstatus} && ${update_i3status}"; - "Ctrl+${musicNext}" = "${execns} mpc next && ${update_mpdstatus} && ${update_i3status}"; - "Ctrl+Shift+${musicPrev}" = "${execns} mpc seek -3"; - "Ctrl+Shift+${musicPlay}" = "${execns} mpc clear && ${update_mpdstatus} && ${update_i3status}"; - "Ctrl+Shift+${musicNext}" = "${execns} mpc seek +3"; - "Ctrl+Shift+${audioDown}" = ''${execns} mpc volume -5 && dunstify "mpc $(mpc volume)" -r 420''; - "Ctrl+Shift+${audioUp}" = ''${execns} mpc volume +5 && dunstify "mpc $(mpc volume)" -r 420''; + "Ctrl+${musicMenu}" = exec "${musicsel} && ${update_mpdstatus} && ${update_i3status}"; + "Ctrl+${musicPrev}" = exec "${mpc} prev && ${update_mpdstatus} && ${update_i3status}"; + "Ctrl+${musicNext}" = exec "${mpc} next && ${update_mpdstatus} && ${update_i3status}"; + "Ctrl+${musicPlay}" = exec "${mpc} toggle && ${update_mpdstatus} && ${update_i3status}"; + "Ctrl+Shift+${musicPlay}" = exec "${mpc} clear && ${update_mpdstatus} && ${update_i3status}"; + "Ctrl+Shift+${musicPrev}" = exec "${mpc} seek -3"; + "Ctrl+Shift+${musicNext}" = exec "${mpc} seek +3"; + "Ctrl+Shift+${audioDown}" = exec ''${mpc} volume -5 && ${dunstify} "mpc $(${mpc} volume)" -r 420''; + "Ctrl+Shift+${audioUp}" = exec ''${mpc} volume +5 && ${dunstify} "mpc $(${mpc} volume)" -r 420''; }); - bars = [ - { - inherit fonts; - trayOutput = "primary"; - # todo: getexe - statusCommand = "${pkgs.i3status}/bin/i3status"; - } - ]; + bars = [{ + inherit fonts; + trayOutput = "primary"; + statusCommand = "${lib.getExe hmCfg.programs.i3status.package}"; + }]; }; }; @@ -249,103 +273,59 @@ in { output_format = "i3bar"; }; - modules = mergeAttrsList [ - { - "cpu_usage" = { - position = 0; - settings = { - format = "cpu: %usage"; - }; + modules = { + "cpu_usage" = { + position = 0; + settings = { + format = "cpu: %usage"; }; - - "memory" = { - position = 1; - settings = { - format = "mem: %used"; - threshold_degraded = "1G"; - format_degraded = "MEMORY < %available"; - }; + }; + "memory" = { + position = 1; + settings = { + format = "mem: %used"; + threshold_degraded = "1G"; + format_degraded = "MEMORY < %available"; }; - - "volume master" = { - position = 2; - settings = { - color_degraded = "#333333"; - format = "vol: %volume"; - format_muted = "vol: ---"; - }; + }; + "volume master" = { + position = 2; + settings = { + color_degraded = "#333333"; + format = "vol: %volume"; + format_muted = "vol: ---"; }; - - "tztime local" = { - position = 4; - settings = { - format = "%Y-%m-%d %H:%M:%S (%A)"; - }; + }; + "tztime local" = { + position = 4; + settings = { + format = "%Y-%m-%d %H:%M:%S (%A)"; }; - } - (optionalAttrs cfg.battery { - "battery 0" = { - position = 3; - settings = { - format = "bat%status: %percentage"; - status_chr = "(+)"; - status_bat = ""; - status_unk = "(?)"; - status_full = "(+)"; - status_idle = ""; - low_threshold = 30; - }; + }; + } // (optionalAttrs cfg.battery { + "battery 0" = { + position = 3; + settings = { + format = "bat%status: %percentage"; + status_chr = "(+)"; + status_bat = ""; + status_unk = "(?)"; + status_full = "(+)"; + status_idle = ""; + low_threshold = 30; }; - }) - (optionalAttrs config.chuj.stuff.mpd.enable { - "read_file mpd" = { - position = -1; - settings = { - format = "%content"; - format_bad = "mpdstatus file not found, restart i3"; - path = "/tmp/i3-mpd-status-stuff"; - color_good = "#ffffff"; - }; + }; + }) // (optionalAttrs config.chuj.stuff.mpd.enable { + "read_file mpd" = { + position = -1; + settings = { + format = "%content"; + format_bad = "mpdstatus file not found"; + path = config.chuj.stuff.mpd.statusFile; + color_good = "#ffffff"; }; - }) - ]; - }; - - home.packages = with pkgs; let - xdotool = ""; - yad = ""; - i3gtk = ""; - i3-msg = ""; - in [ - (writeShellScriptBin "i3custom-center-mouse-on-focus" '' - eval $(xdotool getwindowfocus getwindowgeometry --shell) - MX=$(($X + $WIDTH / 2)) - MY=$(($Y + $HEIGHT / 2)) - xdotool mousemove $MX $MY - '') - - (writeShellScriptBin "i3custom-window-actions" '' - ${yad}/bin/yad --splash --mouse \ - --title="i3 window actions" \ - --gtkrc="${HOME}/.config/i3/i3gtk.css" \ - --text="i3 window actions" \ - --button float:0 --button kill:1 - - case $? in - 0) i3-msg "floating toggle";; - 1) i3-msg "kill";; - -1) ;; - esac - '') - - (writeShellScriptBin "i3custom-floating-toggle" '' - i3-msg "mark --add _; [con_mark=f] floating disable, border pixel 1, mark --add --toggle _; [con_mark=_] floating enable, border normal; mark --add --toggle f;" - '') - ]; - - # todo: remove - home.file = { - ".config/i3/i3gtk.css".source = ../../files/i3gtk.css; + }; + }); }; }; }; diff --git a/modules/stuff/mpd.nix b/modules/stuff/mpd.nix index 4576d50..929cda3 100644 --- a/modules/stuff/mpd.nix +++ b/modules/stuff/mpd.nix @@ -5,6 +5,30 @@ in { options.chuj.stuff.mpd = { enable = mkEnableOption "mpd"; + statusFile = mkOption { + type = lib.types.str; + default = "/tmp/mpdstatus"; + }; + mpdstatusPackage = mkOption { + type = lib.types.package; + default = let + sleep = lib.getExe' pkgs.coreutils "sleep"; + cut = lib.getExe' pkgs.coreutils "cut"; + basename = lib.getExe' pkgs.coreutils "basename"; + echo = lib.getExe' pkgs.coreutils "echo"; + mpc = lib.getExe pkgs.mpc-cli; + sed = lib.getExe pkgs.gnused; + in (pkgs.writeShellScriptBin "mpdstatus" '' + trap "echo SIG" USR1 EXIT + while true; do + ${sleep} 1 & + wait + status=$(${mpc} status | ${sed} -n 2p | ${cut} -d' ' -f1) + title=$(${basename} "$(${mpc} current -f '%file%')" .mp3) + ${echo} "$status $title" > ${config.chuj.stuff.mpd.statusFile} + done + ''); + }; }; config = mkIf cfg.enable { @@ -18,25 +42,9 @@ in { } ''; }; - home.packages = let - yad = "${pkgs.yad}/bin/yad"; - dunstify = "${pkgs.dunst}/bin/dunstify"; - mpc = "${pkgs.mpc-cli}/bin/mpc"; - cut = "${pkgs.coreutils}/bin/cut"; - in [ + home.packages = [ pkgs.mpc-cli - # todo: dmenu for this if i3 - (pkgs.writeShellScriptBin "mpdfdial.sh" '' - path=$(${yad} --file --directory | ${cut} -d "/" -f5-) - - ${dunstify} "playing from \"$path\"" - ${mpc} update - ${mpc} rescan - ${mpc} add "$path" - ${mpc} random on - ${mpc} repeat on - ${mpc} play - '') + config.chuj.stuff.mpd.mpdstatusPackage ]; }; }; diff --git a/modules/stuff/xdg.nix b/modules/stuff/xdg.nix index 4149c16..cd6cf29 100644 --- a/modules/stuff/xdg.nix +++ b/modules/stuff/xdg.nix @@ -38,17 +38,16 @@ in { }; }; - home.sessionVariables = let + home.sessionVariables = rec { XDG_DATA_HOME = hmCfg.xdg.dataHome; XDG_CONFIG_HOME = hmCfg.xdg.configHome; XDG_STATE_HOME = hmCfg.xdg.stateHome; XDG_CACHE_HOME = hmCfg.xdg.cacheHome; - in { ANDROID_USER_HOME = "${XDG_DATA_HOME}/android"; ANDROID_HOME = "${XDG_DATA_HOME}/android/sdk"; GRADLE_USER_HOME = "${XDG_DATA_HOME}/gradle"; PYTHONSTARTUP = "${XDG_CONFIG_HOME}/python/pythonrc"; - HISTFILE = "${XDG_CACHE_HOME}/bash/history"; + HISTFILE = "${XDG_CACHE_HOME}/bash_history"; CARGO_HOME = "${XDG_DATA_HOME}/cargo"; _JAVA_OPTIONS = "-Djava.utils.prefs.userRoot=${XDG_CONFIG_HOME}/java"; GNUPGHOME = "${XDG_DATA_HOME}/gnupg"; @@ -66,7 +65,6 @@ in { ]; xdg.configFile = { - # todo: XDG_CACHE_HOME Not found "python/pythonrc".text = '' import os import atexit diff --git a/modules/stuff/xserver.nix b/modules/stuff/xserver.nix index 9a251f4..1e38080 100644 --- a/modules/stuff/xserver.nix +++ b/modules/stuff/xserver.nix @@ -16,9 +16,8 @@ in { # autoRepeatInterval = 50; # fixme: ^ this doesn't work - # todo: getexe (or fix the above displayManager.sessionCommands = '' - ${pkgs.xorg.xset}/bin/xset r rate 180 50 + ${lib.getExe pkgs.xorg.xset} r rate 180 50 ''; enableTearFree = true; }; diff --git a/pkgs/schildi/schildichat-desktop.nix b/pkgs/schildi/schildichat-desktop.nix index 7eb8530..2078307 100644 --- a/pkgs/schildi/schildichat-desktop.nix +++ b/pkgs/schildi/schildichat-desktop.nix @@ -111,6 +111,7 @@ stdenv.mkDerivation rec { passthru.updateScript = ./update.sh; meta = with lib; { + mainProgram = executableName; description = "Matrix client / Element Desktop fork"; homepage = "https://schildi.chat/"; changelog = "https://github.com/SchildiChat/schildichat-desktop/releases"; diff --git a/readme.txt b/readme.txt index 075c6c9..10110c8 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ i have a slight idea of what i'm doing todo: -- remove hardcoded binary names +- clean up modules/system.nix - investigate firefox config - all the remaining individual todos