diff --git a/config/cp/.clang-format b/config/cp/.clang-format new file mode 100644 index 0000000..59cd6f1 --- /dev/null +++ b/config/cp/.clang-format @@ -0,0 +1,17 @@ +BasedOnStyle: LLVM +IndentWidth: 2 +UseTab: Never + +AllowShortIfStatementsOnASingleLine: Never +AllowShortLoopsOnASingleLine: false +AllowShortFunctionsOnASingleLine: None +AllowShortLambdasOnASingleLine: None +AllowShortBlocksOnASingleLine: Never +AllowShortEnumsOnASingleLine: false +AllowShortCaseExpressionOnASingleLine: false + +BreakBeforeBraces: Attach +ColumnLimit: 100 +AlignAfterOpenBracket: Align +BinPackArguments: false +BinPackParameters: false diff --git a/config/nvim/lua/plugins/dev.lua b/config/nvim/lua/plugins/dev.lua index 4223208..c4fc3cf 100644 --- a/config/nvim/lua/plugins/dev.lua +++ b/config/nvim/lua/plugins/dev.lua @@ -58,24 +58,6 @@ end local git_status = new_git_status() -local clang_format = [[BasedOnStyle: LLVM -IndentWidth: 2 -UseTab: Never - -AllowShortIfStatementsOnASingleLine: Never -AllowShortLoopsOnASingleLine: false -AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: None -AllowShortBlocksOnASingleLine: Never -AllowShortEnumsOnASingleLine: false -AllowShortCaseExpressionOnASingleLine: false - -BreakBeforeBraces: Attach -ColumnLimit: 100 -AlignAfterOpenBracket: Align -BinPackArguments: false -BinPackParameters: false]] - return { { 'barrettruth/midnight.nvim', @@ -258,34 +240,27 @@ return { panel = { diff_modes = { 'side-by-side', 'git' } }, }, hooks = { - setup_io_input = function(buf) - require('cp.helpers').clearcol(buf) - end, - setup_io_output = function(buf) - require('cp.helpers').clearcol(buf) - end, - before_run = function(_) - require('config.lsp').format() - end, - before_debug = function(_) - require('config.lsp').format() - end, - setup_code = function(_) - vim.opt_local.winbar = '' - vim.opt_local.foldlevel = 0 - vim.opt_local.foldmethod = 'marker' - vim.opt_local.foldmarker = '{{{,}}}' - vim.opt_local.foldtext = '' - vim.diagnostic.enable(false) - - local clang_format_path = vim.fn.getcwd() .. '/.clang-format' - if vim.fn.filereadable(clang_format_path) == 0 then - vim.fn.writefile( - vim.split(clang_format, '\n'), - clang_format_path - ) - end - end, + setup = { + contest = function(state) + local dir = vim.fn.fnamemodify(state.get_source_file(state.get_language()), ':h') + local path = dir .. '/.clang-format' + if vim.fn.filereadable(path) == 0 then + vim.fn.system({ 'cp', vim.fn.expand('~/.config/nix/config/cp/.clang-format'), path }) + end + end, + code = function(_) + vim.opt_local.foldlevel = 0 + vim.opt_local.foldmethod = 'marker' + vim.opt_local.foldmarker = '{{{,}}}' + vim.opt_local.foldtext = '' + vim.diagnostic.enable(false) + end, + }, + on = { + enter = function(_) vim.opt_local.winbar = '' end, + run = function(_) require('config.lsp').format() end, + debug = function(_) require('config.lsp').format() end, + }, }, filename = function(_, _, problem_id) return problem_id diff --git a/home/modules/ui.nix b/home/modules/ui.nix index 410af7b..bab1975 100644 --- a/home/modules/ui.nix +++ b/home/modules/ui.nix @@ -112,7 +112,7 @@ in "custom/keyboard" "privacy" "custom/mic" - "pulseaudio" + "custom/pulseaudio" "network" "battery" "clock" @@ -165,24 +165,16 @@ in on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%-"; }; - pulseaudio = { - format = "{icon}"; - format-muted = "󰖁"; - format-icons = { - default = [ - "󰕿" - "󰖀" - "󰕾" - ]; - }; + "custom/pulseaudio" = { + exec = ''sh -c 'out=$(wpctl get-volume @DEFAULT_AUDIO_SINK@); vol=$(echo "$out" | awk "{printf \"%d\", \$2 * 100}"); if echo "$out" | grep -q MUTED; then icon="󰖁"; elif [ "$vol" -le 33 ]; then icon="󰕿"; elif [ "$vol" -le 66 ]; then icon="󰖀"; else icon="󰕾"; fi; echo "{\"text\":\"$icon\",\"tooltip\":\"Volume: ''${vol}%\"}"' ''; + return-type = "json"; + interval = 1; signal = 1; - tooltip = true; - tooltip-format = "Volume: {volume}%\nOutput: {desc}"; on-click = "ctl audio sink"; on-click-right = "pgrep -f 'waybar.*slider' && pkill -f 'waybar.*slider' || (waybar -c ${config.xdg.configHome}/waybar/slider.json &)"; - on-click-middle = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; - on-scroll-up = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ --limit 1.0"; - on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"; + on-click-middle = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; pkill -RTMIN+1 waybar"; + on-scroll-up = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ --limit 1.0; pkill -RTMIN+1 waybar"; + on-scroll-down = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; pkill -RTMIN+1 waybar"; }; network = { @@ -234,7 +226,6 @@ in format = " {:%a %d/%m/%Y %H:%M:%S}"; interval = 1; tooltip = false; - on-click-right = "notify-send test 'right click'"; }; "custom/power" = { @@ -273,7 +264,7 @@ in #privacy, #tray, #custom-mic, - #pulseaudio, + #custom-pulseaudio, #network, #battery, #clock,