diff options
| author | Christian Krinitsin <code@krinitsin.xyz> | 2024-06-04 22:00:30 +0200 |
|---|---|---|
| committer | Christian Krinitsin <code@krinitsin.xyz> | 2024-06-04 22:00:30 +0200 |
| commit | f470ff39e653eea2ea17d8dcc8c9c1bf1185a4ff (patch) | |
| tree | f916c30d92c9654efe4b73bdca92770510287097 | |
| parent | 0bf547ad73c360b8e86c7e632735cdd926b38cb4 (diff) | |
| parent | 2dc33f72ec5ffacfc48ba301c3c2d5de8f2c6b89 (diff) | |
| download | dotfiles-f470ff39e653eea2ea17d8dcc8c9c1bf1185a4ff.tar.gz dotfiles-f470ff39e653eea2ea17d8dcc8c9c1bf1185a4ff.zip | |
Merge branch 'main' of github.com:ckrinitsin/dotfiles
| -rwxr-xr-x | bin/bluetooth-devices | 39 | ||||
| -rwxr-xr-x | bin/blur-lock (renamed from waybar/.config/waybar/scripts/blur-lock) | 0 | ||||
| -rwxr-xr-x | bin/gaps | 60 | ||||
| -rwxr-xr-x | bin/powermenu (renamed from waybar/.config/waybar/scripts/powermenu) | 0 | ||||
| -rwxr-xr-x | bin/volume_brightness (renamed from waybar/.config/waybar/scripts/volume_brightness.sh) | 2 | ||||
| -rwxr-xr-x | dunstify/.config/dunst/dunstrc | 2 | ||||
| -rw-r--r-- | nvim/.config/nvim/init.lua | 1 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/core/autocmd.lua | 9 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/core/keymaps.lua | 2 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/appearance.lua | 2 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/lspconfig.lua | 5 | ||||
| -rw-r--r-- | scripts/getty@tty1.service | 60 | ||||
| -rwxr-xr-x | scripts/install-packages.sh | 6 | ||||
| -rwxr-xr-x | scripts/lsp.sh | 2 | ||||
| -rw-r--r-- | sway/.config/sway/config | 16 | ||||
| -rw-r--r-- | waybar/.config/waybar/config | 20 |
16 files changed, 193 insertions, 33 deletions
diff --git a/bin/bluetooth-devices b/bin/bluetooth-devices index 5cc4876..f5fe284 100755 --- a/bin/bluetooth-devices +++ b/bin/bluetooth-devices @@ -2,11 +2,34 @@ # # This program lists all paired devices which you can select from, the selected one -# will be connected +# will be connected / disconnected # -# Opens dmenu prompt, which lets you decide which device you want to connect to -DEVICE=$(bluetoothctl devices | sed 's/[^ ]* //' | sed 's/[^ ]* //' | dmenu) +connect_bluetooth() { + local MAC=$1 + local DEVICE=$2 + if bluetoothctl connect $MAC | grep -q 'successful' + then + notify-send -t 5000 -r 2954 -u normal " Connected successfully from" " $DEVICE" + else + notify-send -t 5000 -r 2954 -u normal " Couldn't connect from" " $DEVICE" + fi +} + + +disconnect_bluetooth() { + local MAC=$1 + local DEVICE=$2 + if bluetoothctl disconnect $MAC | grep -q 'Successful' + then + notify-send -t 5000 -r 2954 -u normal " Disconnected successfully from" " $DEVICE" + else + notify-send -t 5000 -r 2954 -u normal " Couldn't disconnect from" " $DEVICE" + fi +} + +# Opens dmenu prompt, which lets you decide which device you want to connect to / disconnect from +DEVICE=$(bluetoothctl devices | sed 's/[^ ]* //' | sed 's/[^ ]* //' | dmenu -i) # If dmenu was cancelled, exit program if [ $? -ne 0 ]; then @@ -16,10 +39,12 @@ fi # Get MAC adress of the device you selected MAC=$(bluetoothctl devices | grep "$DEVICE" | sed 's/[^ ]* //' | cut -d ' ' -f1) -# Send a notify whether the connection was successful -if bluetoothctl connect $MAC | grep -q 'successful' +# If bluetooth device is already connected, disconnect, else connect +CONNECTED=$(bluetoothctl devices Connected | cut -f3 -d ' ') +if echo $CONNECTED | grep $DEVICE then - notify-send -t 5000 -r 2954 -u normal " Connected successfully to" " $DEVICE" + disconnect_bluetooth $MAC $DEVICE else - notify-send -t 5000 -r 2954 -u normal " Couldn't connect to" " $DEVICE" + connect_bluetooth $MAC $DEVICE fi + diff --git a/waybar/.config/waybar/scripts/blur-lock b/bin/blur-lock index 7b5aa6a..7b5aa6a 100755 --- a/waybar/.config/waybar/scripts/blur-lock +++ b/bin/blur-lock diff --git a/bin/gaps b/bin/gaps new file mode 100755 index 0000000..10ac7a2 --- /dev/null +++ b/bin/gaps @@ -0,0 +1,60 @@ +#!/usr/bin/python3 + +# +# Interactive gaps, depending on number of applications on a workspace +# + +import i3ipc +i3 = i3ipc.Connection() +print("starting") + +#################### -- window management -- #################### +def two_gap(): + i3.command('gaps left current set 200') + i3.command('gaps right current set 200') + +def one_gap(): + i3.command('gaps right current set 400') + i3.command('gaps left current set 400') + +def remove_gaps(): + i3.command('gaps left current set 0') + i3.command('gaps right current set 0') + +def make_window_normal(workspace): + i3.command('fullscreen disable') + +def make_window_fullscreen(workspace): + i3.command('fullscreen enable') + +def manage_new_close_window(self, e): + focused = i3.get_tree().find_focused() + workspace = focused.workspace() + monitor = workspace.ipc_data['output'] + + if monitor != "HDMI-A-1": + return + + y = len(workspace.nodes) + + if y > 2: + remove_gaps() + return + + if y == 2: + two_gap() + return + + one_gap() + return +########################### -- end -- ########################### + + +i3.on('window::new', manage_new_close_window) +i3.on('window::close', manage_new_close_window) +i3.on('window::move', manage_new_close_window) +i3.on('window::focus', manage_new_close_window) +i3.on('workspace::empty', manage_new_close_window) +i3.on('workspace::init', manage_new_close_window) + +i3.main() diff --git a/waybar/.config/waybar/scripts/powermenu b/bin/powermenu index ac1d677..ac1d677 100755 --- a/waybar/.config/waybar/scripts/powermenu +++ b/bin/powermenu diff --git a/waybar/.config/waybar/scripts/volume_brightness.sh b/bin/volume_brightness index d98dc69..f6174ca 100755 --- a/waybar/.config/waybar/scripts/volume_brightness.sh +++ b/bin/volume_brightness @@ -29,7 +29,7 @@ function get_volume_icon { volume=$(get_volume) mute=$(get_mute) if [ "$mute" == "yes" ] ; then - volume_icon=" " + volume_icon=" " elif [ "$volume" -eq 0 ]; then volume_icon=" " elif [ "$volume" -lt 50 ]; then diff --git a/dunstify/.config/dunst/dunstrc b/dunstify/.config/dunst/dunstrc index 0166817..15bec42 100755 --- a/dunstify/.config/dunst/dunstrc +++ b/dunstify/.config/dunst/dunstrc @@ -4,7 +4,7 @@ ### Display ### # Which monitor should the notifications be displayed on. - monitor = 0 + monitor = 1 # Display notification on focused monitor. Possible modes are: # mouse: follow mouse pointer diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 15c11dd..b0f092c 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -2,4 +2,5 @@ vim.loader.enable() require('core/options') require('core/keymaps') +require('core/autocmd') require('core/lazy') diff --git a/nvim/.config/nvim/lua/core/autocmd.lua b/nvim/.config/nvim/lua/core/autocmd.lua new file mode 100644 index 0000000..dfecbf8 --- /dev/null +++ b/nvim/.config/nvim/lua/core/autocmd.lua @@ -0,0 +1,9 @@ +vim.api.nvim_create_autocmd( + "BufWritePost", + { + pattern = "*.tex", + callback = function() + vim.cmd("silent make --silent") + end, + } +) diff --git a/nvim/.config/nvim/lua/core/keymaps.lua b/nvim/.config/nvim/lua/core/keymaps.lua index 3c384d9..f78f23a 100644 --- a/nvim/.config/nvim/lua/core/keymaps.lua +++ b/nvim/.config/nvim/lua/core/keymaps.lua @@ -12,3 +12,5 @@ vim.keymap.set('n', '<C-n>', ':NvimTreeToggle<CR>', {}) vim.keymap.set('n', '<C-x>', ':bd<CR>', {}) vim.keymap.set('n', '<C-j>', ':bp<CR>', {}) vim.keymap.set('n', '<C-k>', ':bn<CR>', {}) + +vim.keymap.set('n', '<leader>ma', ':w<CR>:make<CR>', {}) diff --git a/nvim/.config/nvim/lua/plugins/appearance.lua b/nvim/.config/nvim/lua/plugins/appearance.lua index 425a7de..ae7959d 100644 --- a/nvim/.config/nvim/lua/plugins/appearance.lua +++ b/nvim/.config/nvim/lua/plugins/appearance.lua @@ -5,7 +5,7 @@ return { build = ":TSUpdate", config = function () require("nvim-treesitter.configs").setup({ - ensure_installed = { "c", "lua", "vim", "rust", "toml" }, + ensure_installed = { "c", "lua", "vim", "rust", "toml", "latex" }, sync_install = false, highlight = { enable = true }, indent = { enable = true }, diff --git a/nvim/.config/nvim/lua/plugins/lspconfig.lua b/nvim/.config/nvim/lua/plugins/lspconfig.lua index 3c371da..d36e1fa 100644 --- a/nvim/.config/nvim/lua/plugins/lspconfig.lua +++ b/nvim/.config/nvim/lua/plugins/lspconfig.lua @@ -36,6 +36,11 @@ return { capabilities = require('cmp_nvim_lsp').default_capabilities(), } + require'lspconfig'.texlab.setup{ + capabilities = require('cmp_nvim_lsp').default_capabilities(), + settings = { texlab = { diagnostics = { ignoredPatterns = { 'Unused label'} } } } + } + vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) diff --git a/scripts/getty@tty1.service b/scripts/getty@tty1.service new file mode 100644 index 0000000..9e12fb8 --- /dev/null +++ b/scripts/getty@tty1.service @@ -0,0 +1,60 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Getty on %I +Documentation=man:agetty(8) man:systemd-getty-generator(8) +Documentation=https://0pointer.de/blog/projects/serial-console.html +After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target + +# If additional gettys are spawned during boot then we should make +# sure that this is synchronized before getty.target, even though +# getty.target didn't actually pull it in. +Before=getty.target +IgnoreOnIsolate=yes + +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + +# On systems without virtual consoles, don't start any getty. Note +# that serial gettys are covered by serial-getty@.service, not this +# unit. +ConditionPathExists=/dev/tty0 + +[Service] +# the VT is cleared by TTYVTDisallocate +# The '-o' option value tells agetty to replace 'login' arguments with an +# option to preserve environment (-p), followed by '--' for safety, and then +# the entered username. +ExecStart=-/sbin/agetty -a chris --noclear - $TERM +Type=idle +Restart=always +RestartSec=0 +UtmpIdentifier=%I +StandardInput=tty +StandardOutput=tty +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +IgnoreSIGPIPE=no +SendSIGHUP=yes +ImportCredential=agetty.* +ImportCredential=login.* + +# Unset locale for the console getty since the console has problems +# displaying some internationalized messages. +UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION + +[Install] +WantedBy=getty.target +DefaultInstance=tty1 diff --git a/scripts/install-packages.sh b/scripts/install-packages.sh index 1fd1cb8..0e0c11e 100755 --- a/scripts/install-packages.sh +++ b/scripts/install-packages.sh @@ -1,10 +1,14 @@ #!/usr/bin/bash # install packages -sudo pacman -S pacman-contrib python-tldextract pass gnupg base-devel libnotify wl-clipboard qt6-wayland xorg-server-xwayland nerd-fonts zoxide waybar bison startup-notification flex wayland-protocols pkg-config cmake gcc alacritty dunst neovim qutebrowser starship xdg-user-dirs zathura zathura-pdf-mupdf meson ninja +sudo pacman -S fzf grim pacman-contrib python-tldextract pass gnupg base-devel libnotify wl-clipboard qt6-wayland xorg-server-xwayland nerd-fonts zoxide waybar bison startup-notification flex wayland-protocols pkg-config cmake gcc alacritty dunst neovim qutebrowser starship xdg-user-dirs zathura zathura-pdf-mupdf meson ninja sudo pacman -S pipewire pipewire-audio pipewire-alsa pipewire-pulse pavucontrol +sudo pacman -S texlive-basic texlive-bibtexextra texlive-latex texlive-mathscience texlive-latexrecommended texlive-latexextra texlive-binextra + +yay -S grimshot + # install rofi and dmenu for wayland git clone https://github.com/lbonn/rofi.git /tmp/rofi cd /tmp/rofi diff --git a/scripts/lsp.sh b/scripts/lsp.sh index d516a87..ad9fc98 100755 --- a/scripts/lsp.sh +++ b/scripts/lsp.sh @@ -1,4 +1,4 @@ #!/usr/bin/bash -sudo pacman -S lua-language-server clang rust-analyzer +sudo pacman -S lua-language-server clang rust-analyzer texlab diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 91b2f10..205dda0 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -109,18 +109,18 @@ bindsym $mod+t exec rofi -show window -config ~/.config/rofi/rofidmenu.rasi bindsym $mod+Shift+t exec thunderbird bindsym $mod+Shift+w exec qutebrowser bindsym $mod+Return exec alacritty -bindsym $mod+Shift+e exec ~/.config/waybar/scripts/powermenu -bindsym $mod+p exec ~/.config/waybar/scripts/blur-lock +bindsym $mod+Shift+e exec powermenu +bindsym $mod+p exec blur-lock bindsym $mod+Shift+c reload bindsym $mod+Shift+r restart # multimedia -bindsym XF86MonBrightnessUp exec --no-startup-id ~/.config/waybar/scripts/volume_brightness.sh brightness_up -bindsym XF86MonBrightnessDown exec --no-startup-id ~/.config/waybar/scripts/volume_brightness.sh brightness_down -bindsym XF86AudioRaiseVolume exec --no-startup-id ~/.config/waybar/scripts/volume_brightness.sh volume_up -bindsym XF86AudioLowerVolume exec --no-startup-id ~/.config/waybar/scripts/volume_brightness.sh volume_down -bindsym XF86AudioMute exec --no-startup-id ~/.config/waybar/scripts/volume_brightness.sh volume_mute +bindsym XF86MonBrightnessUp exec --no-startup-id volume_brightness brightness_up +bindsym XF86MonBrightnessDown exec --no-startup-id volume_brightness brightness_down +bindsym XF86AudioRaiseVolume exec --no-startup-id volume_brightness volume_up +bindsym XF86AudioLowerVolume exec --no-startup-id volume_brightness volume_down +bindsym XF86AudioMute exec --no-startup-id volume_brightness volume_mute bindsym XF86AudioMicMute exec amixer sset Capture toggle bindsym XF86AudioPlay exec playerctl play-pause bindsym XF86AudioPause exec playerctl play-pause @@ -129,7 +129,7 @@ bindsym XF86AudioPrev exec playerctl previous bindsym $mod+Ctrl+s exec screenshot # custom scripts -bindsym $mod+Shift+o exec zathura-fzf /home/chris/uni/ +bindsym $mod+Shift+o exec zathura-fzf /home/chris/uni/ /home/chris/downloads bindsym $mod+Shift+b exec bluetooth-devices bindsym $mod+w exec qtb-load-session bindsym $mod+Shift+s exec run-spotify-player diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config index d12e8d0..2300c46 100644 --- a/waybar/.config/waybar/config +++ b/waybar/.config/waybar/config @@ -84,7 +84,7 @@ // "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", "critical-threshold": 80, "format": "{icon} {temperatureC}°C", - "format-icons": ["", "", ""], + "format-icons": ["", "", ""], "tooltip": false }, "backlight": { @@ -115,22 +115,16 @@ "format-ethernet": " {ipaddr}/{cidr}", "format-linked": " {ifname} (No IP)", "format-disconnected": " ⚠", - "on-click": "nm-connection-editor", + "on-click": "alacritty -e nmtui", "tooltip": false }, "pulseaudio": { // "scroll-step": 1, // %, can be a float "format": "{icon} {volume}%", - "format-bluetooth": "{volume}% {icon} ", - "format-bluetooth-muted": " ", - "format-muted": " ", + "format-bluetooth": "{volume}% ", + "format-bluetooth-muted": " ", + "format-muted": " ", "format-icons": { - "headphone": "", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", "default": ["", " ", " "] }, "on-click": "pavucontrol" @@ -149,8 +143,8 @@ }, "custom/pacman": { "format": " {}", - "interval": 3600, // every hour - "exec": "checkupdates | wc -l", // # of updates + "interval": 30, // every hour + "exec": "pacman -Qu | wc -l", // # of updates "exec-if": "exit 0", // always run; consider advanced run conditions "on-click": "alacritty -e yay; pkill -SIGRTMIN+8 waybar", // update system "signal": 8, |