diff --git a/nvim/init.lua b/nvim/init.lua index b8062e4..a062827 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -24,6 +24,7 @@ require('packer').startup(function() use { 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', + 'RubixDev/mason-update-all', 'neovim/nvim-lspconfig' } use 'joshdick/onedark.vim' diff --git a/nvim/lua/user/lsp/handlers.lua b/nvim/lua/user/lsp/handlers.lua index af834b2..3edef49 100644 --- a/nvim/lua/user/lsp/handlers.lua +++ b/nvim/lua/user/lsp/handlers.lua @@ -60,15 +60,15 @@ local function lsp_keymaps(bufnr) keymap(bufnr, "n", "gI", "lua vim.lsp.buf.implementation()", opts) keymap(bufnr, "n", "gr", "lua vim.lsp.buf.references()", opts) keymap(bufnr, "n", "gl", "lua vim.diagnostic.open_float()", opts) - keymap(bufnr, "n", "\\lf", "lua vim.lsp.buf.format", opts) - keymap(bufnr, "n", "\\li", "LspInfo", opts) - keymap(bufnr, "n", "\\lI", "LspInstallInfo", opts) - keymap(bufnr, "n", "\\la", "lua vim.lsp.buf.code_action()", opts) - keymap(bufnr, "n", "\\lj", "lua vim.diagnostic.goto_next({buffer=0})", opts) - keymap(bufnr, "n", "\\lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) - keymap(bufnr, "n", "\\lr", "lua vim.lsp.buf.rename()", opts) - keymap(bufnr, "n", "\\ls", "lua vim.lsp.buf.signature_help()", opts) - keymap(bufnr, "n", "\\lq", "lua vim.diagnostic.setloclist()", opts) + keymap(bufnr, "n", "lf", "lua vim.lsp.buf.format", opts) + keymap(bufnr, "n", "li", "LspInfo", opts) + keymap(bufnr, "n", "lI", "LspInstallInfo", opts) + keymap(bufnr, "n", "la", "lua vim.lsp.buf.code_action()", opts) + keymap(bufnr, "n", "lj", "lua vim.diagnostic.goto_next({buffer=0})", opts) + keymap(bufnr, "n", "lk", "lua vim.diagnostic.goto_prev({buffer=0})", opts) + keymap(bufnr, "n", "lr", "lua vim.lsp.buf.rename()", opts) + keymap(bufnr, "n", "ls", "lua vim.lsp.buf.signature_help()", opts) + keymap(bufnr, "n", "lq", "lua vim.diagnostic.setloclist()", opts) end M.on_attach = function(client, bufnr) diff --git a/nvim/lua/user/lsp/mason.lua b/nvim/lua/user/lsp/mason.lua index 9a199cf..9c9af59 100644 --- a/nvim/lua/user/lsp/mason.lua +++ b/nvim/lua/user/lsp/mason.lua @@ -9,6 +9,14 @@ require('mason-lspconfig').setup({ ensure_installed = servers, automatic_installation = true, }) +require('mason-update-all').setup() + +vim.api.nvim_create_autocmd('User', { + pattern = 'MasonUpdateAllComplete', + callback = function() + print('mason-update-all has finished') + end, +}) local lsp_status_ok, lspconfig = pcall(require, 'lspconfig') if not lsp_status_ok then diff --git a/nvim/lua/user/lsp/settings/phpactor.lsp b/nvim/lua/user/lsp/settings/phpactor.lsp new file mode 100644 index 0000000..2251c6c --- /dev/null +++ b/nvim/lua/user/lsp/settings/phpactor.lsp @@ -0,0 +1,8 @@ +return { + settings = { + init_options = { + ["language_server_phpstan.enabled"] = false, + ["language_server_psalm.enabled"] = false, + } + }, +} diff --git a/sway/config b/sway/config index 6f0ca1e..e39d491 100644 --- a/sway/config +++ b/sway/config @@ -1,7 +1,7 @@ # set edp output eDP-1 { - mode 1920x1080@60.004Hz - # mode 1920x1080@144.003Hz + #mode 1920x1080@60.004Hz + mode 1920x1080@144.003Hz scale 1.25 adaptive_sync on } @@ -29,6 +29,9 @@ exec_always { gsettings set org.gnome.desktop.interface font-name "Cantarell" } +# polkit +exec /usr/bin/lxpolkit + # set mod to super set $mod Mod4 @@ -207,7 +210,7 @@ gaps inner 20 #smart_gaps on # set desktop bg -exec_always --no-startup-id swaybg -i ~/.config/sway/wall.jpg -m stretch +exec_always swaybg -i ~/.config/sway/wall.jpg -m stretch # start picom, config: .config/picom.conf #exec --no-startup-id dbus-launch picom --experimental-backend @@ -254,12 +257,13 @@ bindsym XF86MonBrightnessDown exec sudo /usr/bin/light -U 10 # Custom Bindings for Applications # Mod + n firefox -bindsym $mod+n exec firefox +bindsym $mod+n exec firefox -p #bindsym $mod+n exec "brave --enable-features=VaapiVideoDecoder --use-gl=desktop --disable-features=UseChromeOSDirectVideoDecoder --disable-gpu-memory-buffer-compositor-resources --disable-gpu-memory-buffer-video-frames --enable-hardware-overlays" #bindsym $mod+n exec "brave --enable-features=VaapiVideoEncoder,VaapiVideoDecoder,CanvasOopRasterization --enable-video-acceleration --enable-zero-copy --use-gl=desktop --ignore-gpu-blocklist --ignore-gpu-blacklist --enable-oop-rasterization --enable-raw-draw --enable-gpu-rasterization --use-vulkan --disable-reading-from-canvas --disable-sync-preferences" -# Mod + b min -bindsym $mod+b exec "min --use-gl=desktop --enable-features=VaapiVideoDecoder,VaapiVideoEncoder,CanvasOopRasterization --ozone-platform-hint=auto --ignore-gpu-blocklist --enable-gpu-rasterization --enable-zero-copy --disable-features=UseSkiaRenderer,UseChromeOSDirectVideoDecoder --canvas-oop-rasterization" +# Mod + b (old: min) notesnook +#bindsym $mod+b exec "min --use-gl=desktop --enable-features=VaapiVideoDecoder,VaapiVideoEncoder,CanvasOopRasterization --ozone-platform-hint=auto --ignore-gpu-blocklist --enable-gpu-rasterization --enable-zero-copy --disable-features=UseSkiaRenderer,UseChromeOSDirectVideoDecoder --canvas-oop-rasterization" +bindsym $mod+b exec "notesnook --ozone-platform=wayland --ozone-platform-hint=wayland" # Mod + m pantheon files bindsym $mod+m exec io.elementary.files @@ -275,6 +279,7 @@ assign [class="discord"] 10 # make notification windows floating for_window [window_role="pop-up"] floating enable for_window [window_role="task_dialog"] floating enable +for_window [title="\ -\ Sharing\ Indicator$"] floating enable, sticky enable # fix notifs for ms teams for_window [title="Microsoft Teams Notification"] floating enable diff --git a/sway/wall.jpg b/sway/wall.jpg index 78fa762..34ce8eb 100644 Binary files a/sway/wall.jpg and b/sway/wall.jpg differ diff --git a/waybar/config b/waybar/config index 8b91aef..6e22173 100644 --- a/waybar/config +++ b/waybar/config @@ -6,7 +6,7 @@ // Choose the order of the modules "modules-left": ["sway/workspaces", "sway/mode"], "modules-center": [], - "modules-right": ["battery", "pulseaudio", "cpu", "temperature", "memory", "backlight", "clock", "tray"], + "modules-right": ["custom/bluetooth-battery", "battery", "pulseaudio", "cpu", "temperature", "memory", "backlight", "clock", "tray"], "fixed-center": true, "sway/mode": { "format": "{}" @@ -47,6 +47,14 @@ "format-alt": "{icon} {time}", "format-icons": ["", "", "", "", ""] }, + "custom/bluetooth-battery": { + "format": "{}", + "return-type": "json", + "interval": 5, + "exec": "~/.config/waybar/scripts/bt-bat-waybar-module.sh", + "exec-if": "~/.config/waybar/scripts/bt-bat-status.sh >/dev/null 2>&1", + "signal": 9 + }, "network": { // "interface": "wlp2*", // (Optional) To force the use of this interface "format-wifi": "{essid} ({signalStrength}%) ", diff --git a/waybar/scripts/bt-bat-status.sh b/waybar/scripts/bt-bat-status.sh new file mode 100755 index 0000000..7982c9a --- /dev/null +++ b/waybar/scripts/bt-bat-status.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +SCRIPTS_DIR=~/.config/waybar/scripts + +get_battery_status() { + device_uuid=$1 + device_uuid_slug=$(echo "$device_uuid" | sed 's/:/_/g') + device_upower_path=$(upower -e | grep "$device_uuid_slug") + if [[ "$?" != 0 ]]; then + return 1 + fi + + upower_out=$(upower -i "$device_upower_path") + percentage=$(echo "$upower_out" | grep 'percentage:' | grep -oe '[0-9]*%') + if [[ "$?" != 0 ]]; then + return 1 + fi + + echo $percentage +} + +# prepare devices to process +connected_devices=$1 +if [[ "$connected_devices" == "" ]]; then + connected_devices=$($SCRIPTS_DIR/bt-connected.sh) +fi +if [[ "$connected_devices" == "" ]]; then + echo "no bluetooth devices connected" >&2 + exit 1 +fi + +n=0 +declare -A device_batteries +for device in ${connected_devices//\\n/ }; do + device_battery_percentage=$(get_battery_status "$device") + if [[ $? != 0 ]]; then + continue + fi + + n=$((n+1)) + device_batteries[$device]=$device_battery_percentage + # echo "$device: $device_battery_percentage" +done + +if [[ $n -eq 0 ]]; then + echo "cannot get battery status for any specified bluetooth device" >&2 + exit 1 +fi + +# TODO: do something else? +for device in ${!device_batteries[*]}; do + echo "$device ${device_batteries[$device]}" +done + diff --git a/waybar/scripts/bt-bat-waybar-module.sh b/waybar/scripts/bt-bat-waybar-module.sh new file mode 100755 index 0000000..013613a --- /dev/null +++ b/waybar/scripts/bt-bat-waybar-module.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +ICON_BLUETOOTH="" +ICON_BATTERY_FULL=" " +ICON_BATTERY_THREE_QUARTERS=" " +ICON_BATTERY_HALF=" " +ICON_BATTERY_QUARTER=" " +ICON_BATTERY_EMPTY=" " +BLUETOOTH_BATTERY_STATUS=~/.config/waybar/scripts/bt-bat-status.sh + +tooltip="" + +statuses="$($BLUETOOTH_BATTERY_STATUS)" +if [[ $? != 0 ]]; then + exit 1 +fi + + +n=0 +sum=0 +IFS=$'\n' +for status in $statuses; do + uuid=$(echo "$status" | cut -d' ' -f1) + name=$(bluetoothctl info "$uuid" | grep -oe 'Name: .*' | awk 'match($0, "Name: (.*)", m){print m[1]}') + percent=$(echo "$status" | cut -d' ' -f2 | grep -oe '[0-9]*') + + tooltip="$tooltip$name: $percent%\n" + + n=$((n+1)) + sum=$((sum+percent)) +done +IFS=' ' + +avg=$((sum / n)) + +ICON_BATTERY="" +if [[ $avg -ge 90 ]]; then + ICON_BATTERY=$ICON_BATTERY_FULL +elif [[ $avg -ge 75 ]]; then + ICON_BATTERY=$ICON_BATTERY_THREE_QUARTERS +elif [[ $avg -ge 50 ]]; then + ICON_BATTERY=$ICON_BATTERY_HALF +elif [[ $avg -ge 25 ]]; then + ICON_BATTERY=$ICON_BATTERY_QUARTER +else + ICON_BATTERY=$ICON_BATTERY_EMPTY +fi + +tooltip=${tooltip%\\n} + +echo "{\"text\": \"$ICON_BLUETOOTH $ICON_BATTERY\", \"tooltip\": \"$tooltip\"}" + diff --git a/waybar/scripts/bt-connected.sh b/waybar/scripts/bt-connected.sh new file mode 100755 index 0000000..9cee092 --- /dev/null +++ b/waybar/scripts/bt-connected.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +bluetoothctl devices | cut -f2 -d' ' | while read uuid; do bluetoothctl info $uuid | grep -B9 -e 'Connected: yes' | grep -e 'Device' | cut -f2 -d' '; done