index — dotfiles @ 597a57c242422ea8e760f82f285e404ce2e43a41

my dotfiles

add many different things
Christian Krinitsin code@krinitsin.xyz
Tue, 28 May 2024 22:21:23 +0200
commit

597a57c242422ea8e760f82f285e404ce2e43a41

parent

a3b983d90668a87ec07d4f7fb53122d9fe579e74

A bin/volume_brightness

@@ -0,0 +1,102 @@

+#!/bin/bash +# original source: https://gitlab.com/Nmoleo/i3-volume-brightness-indicator + +# taken from here: https://gitlab.com/Nmoleo/i3-volume-brightness-indicator + +# See README.md for usage instructions +bar_color="#d3c6aa" +volume_step=2 +brightness_step=2.5 +max_volume=100 + +# Uses regex to get volume from pactl +function get_volume { + pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]{1,3}(?=%)' | head -1 +} + +# Uses regex to get mute status from pactl +function get_mute { + pactl get-sink-mute @DEFAULT_SINK@ | grep -Po '(?<=Mute: )(yes|no)' +} + +# Uses regex to get brightness from xbacklight +function get_brightness { + brightnessctl | grep "Current brightness" | cut -d '(' -f 2 | cut -d '%' -f 1 +} + +# Returns a mute icon, a volume-low icon, or a volume-high icon, depending on the volume +function get_volume_icon { + volume=$(get_volume) + mute=$(get_mute) + if [ "$mute" == "yes" ] ; then + volume_icon=" " + elif [ "$volume" -eq 0 ]; then + volume_icon=" " + elif [ "$volume" -lt 50 ]; then + volume_icon=" " + else + volume_icon=" " + fi +} + +# Always returns the same icon - I couldn't get the brightness-low icon to work with fontawesome +function get_brightness_icon { + brightness_icon=" " +} + +# Displays a volume notification using dunstify +function show_volume_notif { + volume=$(get_mute) + get_volume_icon + if [ "$mute" == "yes" ]; then + dunstify -t 1000 -r 2593 -u normal "$volume_icon" -h int:value:0 -h string:hlcolor:$bar_color + else + dunstify -t 1000 -r 2593 -u normal "$volume_icon $volume%" -h int:value:$volume -h string:hlcolor:$bar_color + fi +} + +# Displays a brightness notification using dunstify +function show_brightness_notif { + brightness=$(get_brightness) + get_brightness_icon + dunstify -t 1000 -r 2593 -u normal "$brightness_icon $brightness%" -h int:value:$brightness -h string:hlcolor:$bar_color +} + +# Main function - Takes user input, "volume_up", "volume_down", "brightness_up", or "brightness_down" +case $1 in + volume_up) + # Unmutes and increases volume, then displays the notification + pactl set-sink-mute @DEFAULT_SINK@ 0 + volume=$(get_volume) + if [ $(( "$volume" + "$volume_step" )) -gt $max_volume ]; then + pactl set-sink-volume @DEFAULT_SINK@ $max_volume% + else + pactl set-sink-volume @DEFAULT_SINK@ +$volume_step% + fi + show_volume_notif + ;; + + volume_down) + # Raises volume and displays the notification + pactl set-sink-volume @DEFAULT_SINK@ -$volume_step% + show_volume_notif + ;; + + volume_mute) + # Toggles mute and displays the notification + pactl set-sink-mute @DEFAULT_SINK@ toggle + show_volume_notif + ;; + + brightness_up) + # Increases brightness and displays the notification + brightnessctl set +$brightness_step% + show_brightness_notif + ;; + + brightness_down) + # Decreases brightness and displays the notification + brightnessctl set $brightness_step%- + show_brightness_notif + ;; +esac
M nvim/.config/nvim/lua/core/keymaps.luanvim/.config/nvim/lua/core/keymaps.lua

@@ -12,3 +12,5 @@

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>', {})
M nvim/.config/nvim/lua/plugins/lspconfig.luanvim/.config/nvim/lua/plugins/lspconfig.lua

@@ -36,6 +36,10 @@ require'lspconfig'.clangd.setup{

capabilities = require('cmp_nvim_lsp').default_capabilities(), } + require'lspconfig'.texlab.setup{ + capabilities = require('cmp_nvim_lsp').default_capabilities(), + } + vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev)
A 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
M scripts/install-packages.shscripts/install-packages.sh

@@ -1,9 +1,13 @@

#!/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
M scripts/lsp.shscripts/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
M sway/.config/sway/configsway/.config/sway/config

@@ -109,18 +109,18 @@

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

@@ -143,6 +143,7 @@ exec_always --no-startup-id random-wallpaper

input * { xkb_layout "eu" + tap enabled } bar {
M waybar/.config/waybar/configwaybar/.config/waybar/config

@@ -84,7 +84,7 @@ // "thermal-zone": 2,

// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input", "critical-threshold": 80, "format": "{icon} {temperatureC}°C", - "format-icons": ["", "", ""], + "format-icons": ["", "", ""], "tooltip": false }, "backlight": {

@@ -115,19 +115,18 @@ "format-wifi": " {signalStrength}%",

"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-muted": " ", + "format-muted": " ", "format-icons": { "headphone": "", - "hands-free": "", - "headset": "", + "headset": " ", "phone": "", "portable": "", "car": "",
D waybar/.config/waybar/scripts/volume_brightness.sh

@@ -1,102 +0,0 @@

-#!/bin/bash -# original source: https://gitlab.com/Nmoleo/i3-volume-brightness-indicator - -# taken from here: https://gitlab.com/Nmoleo/i3-volume-brightness-indicator - -# See README.md for usage instructions -bar_color="#d3c6aa" -volume_step=2 -brightness_step=2.5 -max_volume=100 - -# Uses regex to get volume from pactl -function get_volume { - pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '[0-9]{1,3}(?=%)' | head -1 -} - -# Uses regex to get mute status from pactl -function get_mute { - pactl get-sink-mute @DEFAULT_SINK@ | grep -Po '(?<=Mute: )(yes|no)' -} - -# Uses regex to get brightness from xbacklight -function get_brightness { - brightnessctl | grep "Current brightness" | cut -d '(' -f 2 | cut -d '%' -f 1 -} - -# Returns a mute icon, a volume-low icon, or a volume-high icon, depending on the volume -function get_volume_icon { - volume=$(get_volume) - mute=$(get_mute) - if [ "$mute" == "yes" ] ; then - volume_icon=" " - elif [ "$volume" -eq 0 ]; then - volume_icon=" " - elif [ "$volume" -lt 50 ]; then - volume_icon=" " - else - volume_icon=" " - fi -} - -# Always returns the same icon - I couldn't get the brightness-low icon to work with fontawesome -function get_brightness_icon { - brightness_icon=" " -} - -# Displays a volume notification using dunstify -function show_volume_notif { - volume=$(get_mute) - get_volume_icon - if [ "$mute" == "yes" ]; then - dunstify -t 1000 -r 2593 -u normal "$volume_icon" -h int:value:0 -h string:hlcolor:$bar_color - else - dunstify -t 1000 -r 2593 -u normal "$volume_icon $volume%" -h int:value:$volume -h string:hlcolor:$bar_color - fi -} - -# Displays a brightness notification using dunstify -function show_brightness_notif { - brightness=$(get_brightness) - get_brightness_icon - dunstify -t 1000 -r 2593 -u normal "$brightness_icon $brightness%" -h int:value:$brightness -h string:hlcolor:$bar_color -} - -# Main function - Takes user input, "volume_up", "volume_down", "brightness_up", or "brightness_down" -case $1 in - volume_up) - # Unmutes and increases volume, then displays the notification - pactl set-sink-mute @DEFAULT_SINK@ 0 - volume=$(get_volume) - if [ $(( "$volume" + "$volume_step" )) -gt $max_volume ]; then - pactl set-sink-volume @DEFAULT_SINK@ $max_volume% - else - pactl set-sink-volume @DEFAULT_SINK@ +$volume_step% - fi - show_volume_notif - ;; - - volume_down) - # Raises volume and displays the notification - pactl set-sink-volume @DEFAULT_SINK@ -$volume_step% - show_volume_notif - ;; - - volume_mute) - # Toggles mute and displays the notification - pactl set-sink-mute @DEFAULT_SINK@ toggle - show_volume_notif - ;; - - brightness_up) - # Increases brightness and displays the notification - brightnessctl set +$brightness_step% - show_brightness_notif - ;; - - brightness_down) - # Decreases brightness and displays the notification - brightnessctl set $brightness_step%- - show_brightness_notif - ;; -esac