From 47eb75b4250badd24b3137f77bf237e6f0570b15 Mon Sep 17 00:00:00 2001 From: ivan-boikov Date: Thu, 14 Jul 2022 23:51:06 +0200 Subject: 1 --- compton/.config/compton/compton.conf | 53 ---- git/.config/git/config | 2 + i3/.config/i3/config | 319 --------------------- i3/.config/i3/i3blocks.conf | 176 ------------ nvim/.config/nvim/lua/custom/chadrc.lua | 42 +-- nvim/.config/nvim/lua/custom/init.lua | 23 +- nvim/.config/nvim/lua/custom/plugins/init.lua | 12 +- nvim/.config/nvim/lua/custom/plugins/lspconfig.lua | 2 +- nvim/.config/nvim/lua/custom/plugins/override.lua | 5 + picom/.config/picom/picom.conf | 70 ----- pix/.local/share/wallpapers/bg | 2 +- scripts/.local/bin/checkpipewire | 2 + scripts/.local/bin/checkvideodriver | 2 + scripts/.local/bin/checkzswap | 2 +- scripts/.local/bin/dmnt | 20 +- scripts/.local/bin/gendunstrc | 3 + scripts/.local/bin/genxresrouces | 54 ++++ scripts/.local/bin/rmgenrc | 5 + scripts/.local/bin/sb-battery | 23 ++ scripts/.local/bin/sb-clock | 3 + scripts/.local/bin/sb-cpu | 3 + scripts/.local/bin/sb-cpubars | 37 +++ scripts/.local/bin/sb-disk | 16 ++ scripts/.local/bin/sb-forecast | 21 ++ scripts/.local/bin/sb-internet | 13 + scripts/.local/bin/sb-kbselect | 16 ++ scripts/.local/bin/sb-mailbox | 10 + scripts/.local/bin/sb-memory | 16 ++ scripts/.local/bin/sb-mpdup | 8 + scripts/.local/bin/sb-music | 5 + scripts/.local/bin/sb-nettraf | 22 ++ scripts/.local/bin/sb-volume | 15 + scripts/.local/bin/statusbar/sb-battery | 23 -- scripts/.local/bin/statusbar/sb-clock | 3 - scripts/.local/bin/statusbar/sb-cpu | 3 - scripts/.local/bin/statusbar/sb-cpubars | 44 --- scripts/.local/bin/statusbar/sb-disk | 23 -- scripts/.local/bin/statusbar/sb-doppler | 206 ------------- scripts/.local/bin/statusbar/sb-forecast | 35 --- scripts/.local/bin/statusbar/sb-help-icon | 17 -- scripts/.local/bin/statusbar/sb-internet | 13 - scripts/.local/bin/statusbar/sb-iplocate | 17 -- scripts/.local/bin/statusbar/sb-kbselect | 16 -- scripts/.local/bin/statusbar/sb-mailbox | 22 -- scripts/.local/bin/statusbar/sb-memory | 16 -- scripts/.local/bin/statusbar/sb-moonphase | 37 --- scripts/.local/bin/statusbar/sb-mpdup | 8 - scripts/.local/bin/statusbar/sb-music | 5 - scripts/.local/bin/statusbar/sb-nettraf | 29 -- scripts/.local/bin/statusbar/sb-news | 17 -- scripts/.local/bin/statusbar/sb-pacpackages | 29 -- scripts/.local/bin/statusbar/sb-popupgrade | 9 - scripts/.local/bin/statusbar/sb-price | 50 ---- scripts/.local/bin/statusbar/sb-tasks | 12 - scripts/.local/bin/statusbar/sb-torrent | 27 -- scripts/.local/bin/statusbar/sb-volume | 26 -- scripts/.local/bin/tab-buttons | 10 + scripts/.local/bin/tab-osu | 4 + scripts/.local/bin/tab-scale | 38 +++ scripts/.local/bin/tablet/osu | 4 - scripts/.local/bin/tablet/pad | 10 - scripts/.local/bin/tablet/reset | 2 - scripts/.local/bin/tablet/scale | 41 --- x11/.Xresources | 36 --- x11/.config/x11/xprofile | 48 ++-- x11/.xinitrc | 6 +- 66 files changed, 431 insertions(+), 1457 deletions(-) delete mode 100644 compton/.config/compton/compton.conf delete mode 100644 i3/.config/i3/config delete mode 100644 i3/.config/i3/i3blocks.conf delete mode 100644 picom/.config/picom/picom.conf create mode 100755 scripts/.local/bin/genxresrouces create mode 100755 scripts/.local/bin/rmgenrc create mode 100755 scripts/.local/bin/sb-battery create mode 100755 scripts/.local/bin/sb-clock create mode 100755 scripts/.local/bin/sb-cpu create mode 100755 scripts/.local/bin/sb-cpubars create mode 100755 scripts/.local/bin/sb-disk create mode 100755 scripts/.local/bin/sb-forecast create mode 100755 scripts/.local/bin/sb-internet create mode 100755 scripts/.local/bin/sb-kbselect create mode 100755 scripts/.local/bin/sb-mailbox create mode 100755 scripts/.local/bin/sb-memory create mode 100755 scripts/.local/bin/sb-mpdup create mode 100755 scripts/.local/bin/sb-music create mode 100755 scripts/.local/bin/sb-nettraf create mode 100755 scripts/.local/bin/sb-volume delete mode 100755 scripts/.local/bin/statusbar/sb-battery delete mode 100755 scripts/.local/bin/statusbar/sb-clock delete mode 100755 scripts/.local/bin/statusbar/sb-cpu delete mode 100755 scripts/.local/bin/statusbar/sb-cpubars delete mode 100755 scripts/.local/bin/statusbar/sb-disk delete mode 100755 scripts/.local/bin/statusbar/sb-doppler delete mode 100755 scripts/.local/bin/statusbar/sb-forecast delete mode 100755 scripts/.local/bin/statusbar/sb-help-icon delete mode 100755 scripts/.local/bin/statusbar/sb-internet delete mode 100755 scripts/.local/bin/statusbar/sb-iplocate delete mode 100755 scripts/.local/bin/statusbar/sb-kbselect delete mode 100755 scripts/.local/bin/statusbar/sb-mailbox delete mode 100755 scripts/.local/bin/statusbar/sb-memory delete mode 100755 scripts/.local/bin/statusbar/sb-moonphase delete mode 100755 scripts/.local/bin/statusbar/sb-mpdup delete mode 100755 scripts/.local/bin/statusbar/sb-music delete mode 100755 scripts/.local/bin/statusbar/sb-nettraf delete mode 100755 scripts/.local/bin/statusbar/sb-news delete mode 100755 scripts/.local/bin/statusbar/sb-pacpackages delete mode 100755 scripts/.local/bin/statusbar/sb-popupgrade delete mode 100755 scripts/.local/bin/statusbar/sb-price delete mode 100755 scripts/.local/bin/statusbar/sb-tasks delete mode 100755 scripts/.local/bin/statusbar/sb-torrent delete mode 100755 scripts/.local/bin/statusbar/sb-volume create mode 100755 scripts/.local/bin/tab-buttons create mode 100755 scripts/.local/bin/tab-osu create mode 100755 scripts/.local/bin/tab-scale delete mode 100755 scripts/.local/bin/tablet/osu delete mode 100755 scripts/.local/bin/tablet/pad delete mode 100755 scripts/.local/bin/tablet/reset delete mode 100755 scripts/.local/bin/tablet/scale delete mode 100644 x11/.Xresources diff --git a/compton/.config/compton/compton.conf b/compton/.config/compton/compton.conf deleted file mode 100644 index 91c2270..0000000 --- a/compton/.config/compton/compton.conf +++ /dev/null @@ -1,53 +0,0 @@ -shadow = true; -no-dnd-shadow = true; -no-dock-shadow = true; -clear-shadow = true; -shadow-radius = 7; -shadow-offset-x = -7; -shadow-offset-y = -7; -shadow-opacity = 0.7; -shadow-red = 0.0; -shadow-green = 0.0; -shadow-blue = 0.0; -shadow-exclude = [ "name = 'Notification'", "class_g = 'Conky'", "class_g ?= 'Notify-osd'", "class_g = 'Cairo-clock'" ]; -shadow-ignore-shaped = false; -xinerama-shadow-crop = false; -menu-opacity = 0.8; -inactive-opacity = 0.8; -active-opacity = 1.0; -frame-opacity = 0.7; -inactive-opacity-override = false; -alpha-step = 0.06; -inactive-dim = 0.0; -blur-kern = "3x3box"; -blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ]; -fading = true; -fade-in-step = 0.06; -fade-out-step = 0.06; -fade-exclude = [ ]; -backend = "glx"; -#backend = "xrender"; -mark-wmwin-focused = true; -mark-ovredir-focused = true; -detect-rounded-corners = true; -detect-client-opacity = true; -refresh-rate = 0; -vsync = "none"; -dbe = false; -paint-on-overlay = true; -focus-exclude = [ "class_g = 'Cairo-clock'" ]; -detect-transient = true; -detect-client-leader = true; -invert-color-include = [ ]; -glx-copy-from-front = false; -glx-swap-method = "undefined"; -wintypes : -{ - tooltip : - { - fade = true; - shadow = false; - opacity = 0.75; - focus = true; - }; -}; diff --git a/git/.config/git/config b/git/.config/git/config index aeaff39..33c17e0 100644 --- a/git/.config/git/config +++ b/git/.config/git/config @@ -3,3 +3,5 @@ email = ik.boikov.public@protonmail.com [credential] helper = /usr/bin/pass-git-helper +[http] + sslCAInfo = /home/ivan/sync/cert/gitea.pem diff --git a/i3/.config/i3/config b/i3/.config/i3/config deleted file mode 100644 index 661dd5c..0000000 --- a/i3/.config/i3/config +++ /dev/null @@ -1,319 +0,0 @@ -# Please see http://i3wm.org/docs/userguide.html for a complete reference! - -set $mod Mod4 - -# Font for window titles. Will also be used by the bar unless a different font -# is used in the bar {} block below. -#font pango:monospace 8 -font pango: Font Awesome 8 - -# use Mouse+$mod to drag floating windows to their wanted position -floating_modifier $mod - -# start a terminal -bindsym $mod+Return exec --no-startup-id st - -# kill focused window -bindsym $mod+Shift+q kill - -# start dmenu (a program launcher) -bindsym $mod+d exec dmenu_run -nb '#020e1d' -nf '#00b1ff' -sb '#00b1ff' -sf '#020e1d' - -# change focus -bindsym $mod+h focus left -bindsym $mod+j focus down -bindsym $mod+k focus up -bindsym $mod+l focus right - -# alternatively, you can use the cursor keys: -bindsym $mod+Left focus left -bindsym $mod+Down focus down -bindsym $mod+Up focus up -bindsym $mod+Right focus right - -# move focused window -bindsym $mod+Shift+h move left -bindsym $mod+Shift+j move down -bindsym $mod+Shift+k move up -bindsym $mod+Shift+l move right - -# alternatively, you can use the cursor keys: -bindsym $mod+Shift+Left move left -bindsym $mod+Shift+Down move down -bindsym $mod+Shift+Up move up -bindsym $mod+Shift+Right move right - -# split in horizontal/vertical orientation -bindsym $mod+v split toggle - -bindsym $mod+z sticky toggle - -# enter fullscreen mode for the focused container -bindsym $modf fullscreen toggle - -# change container layout (stacked, tabbed, toggle split) -bindsym $mod+s layout stacking -bindsym $mod+w layout tabbed -bindsym $mod+e layout toggle split - -bindsym $mod+x move workspace to output right - -# toggle tiling / floating -bindsym $mod+Shift+space floating toggle - -# change focus between tiling / floating windows -bindsym $mod+space focus mode_toggle - -# focus the parent container -bindsym $mod+a focus parent - -# focus the child container -bindsym $mod+c focus child - -# switch to workspace -bindsym $mod+1 workspace $workspace1 -bindsym $mod+2 workspace $workspace2 -bindsym $mod+3 workspace $workspace3 -bindsym $mod+4 workspace $workspace4 -bindsym $mod+5 workspace $workspace5 -bindsym $mod+6 workspace $workspace6 -bindsym $mod+7 workspace $workspace7 -bindsym $mod+8 workspace $workspace8 -bindsym $mod+9 workspace $workspace9 -bindsym $mod+0 workspace $workspace10 - -bindsym $mod+Prior workspace prev -bindsym $mod+Next workspace next - -# move focused container to workspace -bindsym $mod+Shift+1 move container to workspace $workspace1 -bindsym $mod+Shift+2 move container to workspace $workspace2 -bindsym $mod+Shift+3 move container to workspace $workspace3 -bindsym $mod+Shift+4 move container to workspace $workspace4 -bindsym $mod+Shift+5 move container to workspace $workspace5 -bindsym $mod+Shift+6 move container to workspace $workspace6 -bindsym $mod+Shift+7 move container to workspace $workspace7 -bindsym $mod+Shift+8 move container to workspace $workspace8 -bindsym $mod+Shift+9 move container to workspace $workspace9 -bindsym $mod+Shift+0 move container to workspace $workspace10 - -#bindsym $mod+Shift+x [floating] move scratchpad -#bindsym $mod+x scratchpad show - -# reload the configuration file -bindsym $mod+Shift+c reload - -# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) -bindsym $mod+Shift+r restart - -# exit i3 (logs you out of your X session) -bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'Confirm i3 exit (this will end X session!)' -b 'Yes, exit i3' 'i3-msg exit'" - -# resize Rindow (you can also use the mouse for that) -mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym j resize shrink width 10 px or 10 ppt - bindsym k resize grow height 10 px or 10 ppt - bindsym l resize shrink height 10 px or 10 ppt - bindsym semicolon resize grow width 10 px or 10 ppt - - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" -} - -bindsym $mod+r mode "resize" - - -# pulseaudio controls -#bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% #increase sound volume -#bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% #decrease sound volume -#bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle # mute sound - - -#################################################################################### Volume control -# from https://github.com/hastinbe/i3-volume - -# Path to volume control, without trailing slash -set $volumepath ~/.local/bin/ - -# Command for the status line -# ie: i3blocks, i3status -set $statuscmd i3status - -# Signal used to update the status line -# i3blocks uses SIGRTMIN+10 by default -# i3status uses SIGUSR1 by default -set $statussig SIGUSR1 - -# Amount to increase/decrease volume as a percentage -set $volumestep 5 - -# pulseaudio-utils settings -# -# Symbolic name for sink (numeric index not supported) -# Recommended: comment out this setting and omit the -s option to use default sink -# List sink names: pacmd list-sinks | awk -F "[<>]" '/^\s+name: <.*>/{print $2}' -#set $sinkname alsa_output.pci-0000_00_1b.0.analog-stereo - -# Using pulseaudio-utils (append "-s $sinkname" without quotes to override default sink) -bindsym XF86AudioRaiseVolume exec --no-startup-id $volumepath/volume -n -t $statuscmd -u $statussig up $volumestep -bindsym XF86AudioLowerVolume exec --no-startup-id $volumepath/volume -n -t $statuscmd -u $statussig down $volumestep -bindsym XF86AudioMute exec --no-startup-id $volumepath/volume -n -t $statuscmd -u $statussig mute -#################################################################################### - -# screen brightness controls -bindsym XF86MonBrightnessUp exec xbacklight -inc 5 -bindsym Shift+XF86MonBrightnessUp exec xbacklight -inc 20 -bindsym XF86MonBrightnessDown exec xbacklight -dec 5 -bindsym Shift+XF86MonBrightnessDown exec xbacklight -dec 20 - -# mediaplayer controls -bindsym XF86AudioPlay exec "playerctl play-pause ; mpc toggle" -bindsym XF86AudioStop exec "playerctl stop ; mpc stop" -bindsym XF86AudioNext exec "playerctl next ; mpc next" -bindsym XF86AudioPrev exec "playerctl previous ; mpc prev" - -# screenshot -bindsym --release Print exec ~/.local/bin/maimpick - -# other shortcuts -bindsym ctrl+F1 exec tabletreset -bindsym ctrl+F2 exec tabletosu - - -############## RICING ############################################################################# -default_orientation horizontal - -hide_edge_borders smart - -default_border pixel 3 - -set $bg-color #00b1ff -set $inactive-bg-color #020e1d -set $text-color #000000 -set $inactive-text-color #ffffff -set $urgent-bg-color #ff0000 - -# window colors -# border background text indicator -client.focused $bg-color $bg-color $text-color #00ff00 -client.unfocused $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00 -client.focused_inactive $inactive-bg-color $inactive-bg-color $inactive-text-color #00ff00 -client.urgent $urgent-bg-color $urgent-bg-color $text-color #00ff00 - -# Start i3bar to display a workspace bar (plus the system information i3status -# finds out, if available) -bar { - status_command i3blocks -c ~/.config/i3/i3blocks.conf - mode hide # only show statusbar on Mod key press - colors { - background $inactive-bg-color - statusline $inactive-text-color - } -} - -# workspace icons -set $workspace1 "" -set $workspace2 "" -set $workspace3 "1" -set $workspace4 "2" -set $workspace5 "3" -set $workspace6 "" -set $workspace7 "" -set $workspace8 "" -set $workspace9 "" -set $workspace10 "" - -assign [class="QtCreator"] $workspace3 -assign [class="matplotlib"] $workspace4 -assign [class="Matplotlib"] $workspace4 -assign [class="gksqt"] $workspace4 -assign [class="Matlab"] $workspace4 -assign [class="Steam"] $workspace5 -assign [class="qBittorrent"] $workspace6 -assign [class="TeamViewer"] $workspace7 -assign [class="Virt-manager"] $workspace7 -assign [class="Firefox"] $workspace8 -assign [class="keepassxc"] $workspace8 -assign [class="protonmail-bridge"] $workspace9 -assign [class="Tor Browser"] $workspace9 -assign [class="thunderbird"] $workspace9 -assign [class="Signal"] $workspace10 -assign [class="discord"] $workspace10 -assign [class="Telegram"] $workspace10 - -############## SPECIAL ATTRIBUTES ################################################################# -for_window [class="VirtualBox"] floating enable -for_window [class="Steam"] floating enable -for_window [class="Gimp"] floating enable -for_window [class="MATLAB*"] floating enable -for_window [window_role="GtkFileChooserDialog"] floating disable, focus - -# https://github.com/ValveSoftware/steam-for-linux/issues/1040 -for_window [class="^Steam$" title="^Friends$"] floating enable -for_window [class="^Steam$" title="Steam - News"] floating enable -for_window [class="^Steam$" title=".* - Chat"] floating enable -for_window [class="^Steam$" title="^Settings$"] floating enable -for_window [class="^Steam$" title=".* - event started"] floating enable -for_window [class="^Steam$" title=".* CD key"] floating enable -for_window [class="^Steam$" title="^Steam - Self Updater$"] floating enable -for_window [class="^Steam$" title="^Screenshot Uploader$"] floating enable -for_window [class="^Steam$" title="^Steam Guard - Computer Authorization Required$"] floating enable -for_window [title="^Steam Keyboard$"] floating enable - -############## AUTOSTART ########################################################################## -#workspace 2 -#exec --no-startup-id st -e nnn -# workspace 7 -#exec --no-startup-id teamviewer -#exec --no-startup-id virt-manager -# workspace 8 -exec --no-startup-id firefox -#exec --no-startup-id keepassxc -#workspace 9 -exec --no-startup-id thunderbird -# workspace 10 -exec --no-startup-id signal-desktop -exec --no-startup-id telegram-desktop - -# keyboard layout toggle -exec_always --no-startup-id "/usr/bin/setxkbmap -model pc105 -layout fr,ru -variant us, -option grp:ctrl_shift_toggle lv3:alt_switch" - -# keyboard repeat rate and remappings -# external keyboard Alt_R may be mapped to Multi_Key instead of ISO_Level3_Shift, which breaks French QWERTY layout -#exec_always --no-startup-id "(sleep 5 ; ~/.local/bin/remaps) & " -exec_always --no-startup-id "~/.local/bin/remaps" - -# set wallpaper and terminal color theme -exec --no-startup-id "wal -R" # unnesessary? -exec_always "~/.local/bin/setbg ~/.local/share/wallpapers/bg" - -# restart compton -exec_always --no-startup-id "/usr/bin/pkill compton ; /usr/bin/compton --config ~/.config/compton/compton.conf" - -# restart notification daemon -exec_always --no-startup-id "/usr/bin/pkill dunst ; /usr/bin/dunst" - -# screen blue color filter -exec --no-startup-id redshift -l40:2 - -# other daemons/tray/etc -exec --no-startup-id nm-applet -exec --no-startup-id syncthing -exec --no-startup-id xfce4-power-manager -exec --no-startup-id protonmail-bridge --no-window - -# for some reason only on my PC i3 keybinding stop working after login -# this is solved by manual i3 restart -#exec --no-startup-id "notify-send asd ; sleep 10 ; notify-osd dfsfef ; i3-msg restart" diff --git a/i3/.config/i3/i3blocks.conf b/i3/.config/i3/i3blocks.conf deleted file mode 100644 index 38ae0e4..0000000 --- a/i3/.config/i3/i3blocks.conf +++ /dev/null @@ -1,176 +0,0 @@ -# i3blocks config file -# -# Please see man i3blocks for a complete reference! -# The man page is also hosted at http://vivien.github.io/i3blocks -# -# List of valid properties: -# -# align -# color -# command -# full_text -# instance -# interval -# label -# min_width -# name -# separator -# separator_block_width -# short_text -# signal -# urgent - - -# Global properties -# -# The top properties below are applied to every block, but can be overridden. -# Each block command defaults to the script name to avoid boilerplate. -command=/usr/share/i3blocks/$BLOCK_NAME -separator_block_width=15 -markup=none -color=#657383 -#color=#ffffff - -[mediaplayer] -#instance=cmus -interval=5 -signal=10 -separator=false - -# Volume indicator -# -# The first parameter sets the step (and units to display) -# The second parameter overrides the mixer selection -# See the script for details. -[volume] -label= -#label=♪ -instance=Master -#instance=PCM -interval=1 -signal=10 - - -# CPU usage -# -# The script may be called with -w and -c switches to specify thresholds, -# see the script for details. -[cpu_usage] -#label=CPU -interval=1 -min_width=100.00% -separator=false - -[load_average] -interval=1 -separator=false - -[cpu_temp] -#full_text= -command=sensors | grep Tctl | awk '{print $2}' -interval=1 - -# Memory usage -# -# The type defaults to "mem" if the instance is not specified. -[memory] -label= -separator=false -interval=1 - -[memory] -label= -instance=swap -separator=false -interval=30 - -# Disk usage -# -# The directory defaults to $HOME if the instance is not specified. -# The script may be called with a optional argument to set the alert -# (defaults to 10 for 10%). -[disk] -label= -#instance=/mnt/data -interval=30 - - - -# Network interface monitoring -# -# If the instance is not specified, use the interface used for default route. -# The address can be forced to IPv4 or IPv6 with -4 or -6 switches. -[iface] -#instance=wlan0 -color=#00FF00 -interval=10 -separator=false - -[wifi] -#instance=wlp3s0 -interval=10 -separator=false - -[bandwidth] -#label= -#instance=eth0 -interval=1 -# min_width="IN 999K OUT 999K" - -# Battery indicator -# -# The battery instance defaults to 0. -[battery] -label=BAT -label=⚡ -#instance=1 -interval=10 - -# Date Time -# -[time] -#command=date '+%Y-%m-%d %H:%M:%S' -command=date '+%d-%m-%Y %H:%M:%S' -interval=1 - -# Guess the weather hourly -#[weather] -#command=curl -Ss 'https://wttr.in/St.Petersburg' | cut -c 16- | head -3 | xargs echo -#interval=3600 -#color=#A4C2F4 - -# Generic media player support -# -# This displays "ARTIST - SONG" if a music is playing. -# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others. -# OpenVPN support -# -# Support multiple VPN, with colors. -#[openvpn] -#interval=20 - -# Temperature -# -# Support multiple chips, though lm-sensors. -# The script may be called with -w and -c switches to specify thresholds, -# see the script for details. -#[temperature] -#label=TEMP -#interval=10 - -# Key indicators -# -# Add the following bindings to i3 config file: -# -# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks -# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks -[keyindicator] -instance=CAPS -interval=1 -#interval=once -#signal=11 - -#[keyindicator] -#instance=NUM -#interval=once -#signal=11 diff --git a/nvim/.config/nvim/lua/custom/chadrc.lua b/nvim/.config/nvim/lua/custom/chadrc.lua index 1d3acd3..a5f551d 100644 --- a/nvim/.config/nvim/lua/custom/chadrc.lua +++ b/nvim/.config/nvim/lua/custom/chadrc.lua @@ -7,23 +7,28 @@ local userPlugins = require "custom.plugins" M.plugins = { - options = { - lspconfig = { - setup_lspconf = "custom.plugins.lspconfig", - }, - - statusline = { - separator_style = "round", - }, - }, - - override = { - ["kyazdani42/nvim-tree.lua"] = override.nvimtree, - ["nvim-treesitter/nvim-treesitter"] = override.treesitter, - ["nvim-telescope/telescope.nvim"] = override.telescope, - }, - - user = userPlugins, + options = { + lspconfig = { + setup_lspconf = "custom.plugins.lspconfig", + }, + + statusline = { + separator_style = "round", + }, + }, + + override = { + ["kyazdani42/nvim-tree.lua"] = override.nvimtree, + ["nvim-treesitter/nvim-treesitter"] = override.treesitter, + ["nvim-telescope/telescope.nvim"] = override.telescope, + }, + + -- I forked this repo for my own snippets + remove = { + "rafamadriz/friendly-snippets", + }, + + user = userPlugins, } @@ -31,10 +36,9 @@ M.plugins = { -- example of changing theme: M.ui = { - theme = "onedark", + theme = "onedark", } - M.mappings = require "custom.mappings" return M diff --git a/nvim/.config/nvim/lua/custom/init.lua b/nvim/.config/nvim/lua/custom/init.lua index 457afb0..3af297a 100644 --- a/nvim/.config/nvim/lua/custom/init.lua +++ b/nvim/.config/nvim/lua/custom/init.lua @@ -1,19 +1,32 @@ local opt = vim.opt + + -- Indenting opt.expandtab = false opt.shiftwidth = 4 opt.tabstop = 4 opt.smartindent = true + +vim.g.latex_to_unicode_tab=0 + -- runs a script that cleans out tex build files whenever I close out of a .tex file. vim.cmd("autocmd VimLeave *.tex !texclear %") -- Ensure files are read as what I want: vim.cmd("autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown") vim.cmd("autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff") -vim.cmd("autocmd BufRead,BufNewFile *.tex set filetype=tex") + +-- NvChad uses neovim's filedetector by default (but I force it just in case and posterity) +-- this breaks julia-vim's Unicode support +-- so - revert it back when editing julia file +-- however, I cannot just load julia-vim lazily because devs are even more lazy +vim.g.did_load_filetypes=0 +vim.g.do_filetype_lua=1 vim.cmd("autocmd BufRead,BufNewFile *.jl set filetype=julia") +vim.cmd("autocmd BufRead,BufNewFile *.jl let g:did_load_filetypes=1") +vim.cmd("autocmd BufRead,BufNewFile *.jl let g:do_filetype_lua=0") -- save file as sudo on files that require root permission vim.cmd("cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit!") @@ -42,5 +55,13 @@ if &diff endif ]]) +--disable autocommenting on newline +vim.cmd("autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o") + -- autocompile dwmblocks -- vim.cmd("autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid dwmblocks & "}) + +-- needed to load python3, which is needed for latex-live-preview +-- why the hell is this required now??? +vim.g.loaded_python3_provider=1 +vim.g.python3_host_prog="/usr/bin/python3.10" diff --git a/nvim/.config/nvim/lua/custom/plugins/init.lua b/nvim/.config/nvim/lua/custom/plugins/init.lua index c787e64..5d4555b 100644 --- a/nvim/.config/nvim/lua/custom/plugins/init.lua +++ b/nvim/.config/nvim/lua/custom/plugins/init.lua @@ -14,7 +14,12 @@ return { ["JuliaEditorSupport/julia-vim"] = { -- lazy load does not work -- https://github.com/JuliaEditorSupport/julia-vim/issues/269 - -- ft = {"jl"}, + --ft = {"jl"}, + config = function() + vim.g.latex_to_unicode_auto = 1 + -- just in case to avoid interference with tab-completion + vim.g.latex_to_unicode_tab = "off" + end, }, ["christoomey/vim-tmux-navigator"] = { @@ -53,4 +58,9 @@ return { vim.g.vimwiki_list = {{ path = HOME .. '/sync/vimwiki', syntax = 'markdown', ext = '.md' }} end, }, + + ["ivan-boikov/friendly-snippets"] = { + module = "cmp_nvim_lsp", + event = "InsertEnter", + } } diff --git a/nvim/.config/nvim/lua/custom/plugins/lspconfig.lua b/nvim/.config/nvim/lua/custom/plugins/lspconfig.lua index 1b8fa97..77a4b4f 100644 --- a/nvim/.config/nvim/lua/custom/plugins/lspconfig.lua +++ b/nvim/.config/nvim/lua/custom/plugins/lspconfig.lua @@ -4,7 +4,7 @@ M.setup_lsp = function(attach, capabilities) local lspconfig = require "lspconfig" --local servers = { "html", "cssls", "bashls", "emmet_ls", "tsserver", "clangd" } - local servers = { "html", "cssls", "bashls", "clangd", "julials" } + local servers = { "html", "cssls", "bashls", "clangd"} for _, lsp in ipairs(servers) do lspconfig[lsp].setup { diff --git a/nvim/.config/nvim/lua/custom/plugins/override.lua b/nvim/.config/nvim/lua/custom/plugins/override.lua index a42b0d3..3c55585 100644 --- a/nvim/.config/nvim/lua/custom/plugins/override.lua +++ b/nvim/.config/nvim/lua/custom/plugins/override.lua @@ -17,6 +17,9 @@ M.treesitter = { "julia", "latex", }, + highlight = { + enable = true + } } M.nvimtree = { @@ -34,4 +37,6 @@ M.telescope = { }, } + + return M diff --git a/picom/.config/picom/picom.conf b/picom/.config/picom/picom.conf deleted file mode 100644 index a03aefa..0000000 --- a/picom/.config/picom/picom.conf +++ /dev/null @@ -1,70 +0,0 @@ -shadow = true; -#clear-shadow = true; -shadow-radius = 7; -shadow-offset-x = -7; -shadow-offset-y = -7; -shadow-opacity = 0.7; -shadow-red = 0.0; -shadow-green = 0.0; -shadow-blue = 0.0; -shadow-exclude = [ "name = 'Notification'", "class_g = 'Conky'", "class_g ?= 'Notify-osd'", "class_g = 'Cairo-clock'" ]; -shadow-ignore-shaped = false; -xinerama-shadow-crop = false; -inactive-opacity = 0.8; -active-opacity = 1.0; -frame-opacity = 0.7; -inactive-opacity-override = false; -#alpha-step = 0.06; -inactive-dim = 0.0; -blur-kern = "3x3box"; -blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ]; -fading = true; -fade-in-step = 0.06; -fade-out-step = 0.06; -fade-exclude = [ ]; -backend = "glx"; -#backend = "xrender"; -mark-wmwin-focused = true; -mark-ovredir-focused = true; -detect-rounded-corners = true; -detect-client-opacity = true; -refresh-rate = 0; -vsync = true; -dbe = false; -#paint-on-overlay = true; -focus-exclude = [ "class_g = 'Cairo-clock'" ]; -detect-transient = true; -detect-client-leader = true; -invert-color-include = [ ]; -glx-copy-from-front = false; -#glx-swap-method = "undefined"; -use-damage=true; -wintypes : -{ -tooltip : - { - fade = true; - shadow = false; - opacity = 0.75; - focus = true; - }; -#no-dnd-shadow = true; -dnd : - { - shadow=false; - }; -#no-dock-shadow = true; -dock : - { - shadow=false; - }; -#menu-opacity = 0.8; -popup_menu : - { - opacity=0.8; - }; -dropdown_menu : - { - opacity=0.8; - }; -}; diff --git a/pix/.local/share/wallpapers/bg b/pix/.local/share/wallpapers/bg index 9dffc66..a6be94a 120000 --- a/pix/.local/share/wallpapers/bg +++ b/pix/.local/share/wallpapers/bg @@ -1 +1 @@ -/home/ivan/.local/share/wallpapers/sunset.jpg \ No newline at end of file +sunset.jpg \ No newline at end of file diff --git a/scripts/.local/bin/checkpipewire b/scripts/.local/bin/checkpipewire index 33af0d4..d5b3389 100755 --- a/scripts/.local/bin/checkpipewire +++ b/scripts/.local/bin/checkpipewire @@ -1 +1,3 @@ +#!/bin/sh + LANG=C pactl info | grep "Server Name" diff --git a/scripts/.local/bin/checkvideodriver b/scripts/.local/bin/checkvideodriver index 935cf00..d398345 100755 --- a/scripts/.local/bin/checkvideodriver +++ b/scripts/.local/bin/checkvideodriver @@ -1 +1,3 @@ +#!/bin/sh + lshw -c video diff --git a/scripts/.local/bin/checkzswap b/scripts/.local/bin/checkzswap index 905e106..d6a4a00 100755 --- a/scripts/.local/bin/checkzswap +++ b/scripts/.local/bin/checkzswap @@ -1,4 +1,4 @@ -#! /bin/sh - +#!/bin/sh # https://gist.github.com/phizev/31185a30e7d4984724f1fbbf9c2afe19 diff --git a/scripts/.local/bin/dmnt b/scripts/.local/bin/dmnt index 4d4b70c..9371ce8 100755 --- a/scripts/.local/bin/dmnt +++ b/scripts/.local/bin/dmnt @@ -11,7 +11,7 @@ getmount() { \ [ "$mp" = "" ] && exit 1 if [ ! -d "$mp" ]; then mkdiryn=$(printf "No\nYes" | "$dmenu" -i -p "$mp does not exist. Create it?") || exit 1 - [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || doas mkdir -p "$mp") + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo mkdir -p "$mp") fi } @@ -21,24 +21,24 @@ mountusb() { \ # *crypto_LUKS*) #;; #esac - #doas mount "$1" 2>/dev/null && notify-send "USB mounting" "$1 mounted." && exit 0 - doas mount "$1" 2>/dev/null && notify-send "$1 mounted" "" && exit 0 + #sudo mount "$1" 2>/dev/null && notify-send "USB mounting" "$1 mounted." && exit 0 + sudo mount "$1" 2>/dev/null && notify-send "$1 mounted" "" && exit 0 alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') getmount "/mnt /media -maxdepth 1 -type d $alreadymounted" partitiontype="$(lsblk -no "fstype" "$1")" case "$partitiontype" in - "vfat") doas mount -t vfat "$1" "$mp" -o rw,umask=0000;; - "exfat") doas mount "$1" "$mp" -o uid="$(id -u)",gid="$(id -g)";; + "vfat") sudo mount -t vfat "$1" "$mp" -o rw,umask=0000;; + "exfat") sudo mount "$1" "$mp" -o uid="$(id -u)",gid="$(id -g)";; *crypto_LUKS*) name="$(LC_ALL=C tr -dc A-Za-z0-9 fifo & - doas cryptsetup open --type luks "$1" "$name" --key-file fifo + sudo cryptsetup open --type luks "$1" "$name" --key-file fifo rm fifo device="/dev/mapper/$name" - doas mount "$device" "$mp" + sudo mount "$device" "$mp" ;; - *) doas mount "$1" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; doas chown "$user":"$ug" "$mp";; + *) sudo mount "$1" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo chown "$user":"$ug" "$mp";; esac notify-send "$1 mounted to $mp." "" } @@ -55,7 +55,7 @@ mountsamba() { \ getmount "/mnt -maxdepth 1 -type d" user=$(echo $(whoami) | $dmenu -i -p "Input user name for $1:") pass=$(pass-askpass "Input password for user \"$user\" for share $1") - doas mount -t cifs -o user="$user",password="$pass",iocharset=utf8,uid=$(id -u),gid=$(id -g),file_mode=0644,dir_mode=0755 "$1" "$mp" + sudo mount -t cifs -o user="$user",password="$pass",iocharset=utf8,uid=$(id -u),gid=$(id -g),file_mode=0644,dir_mode=0755 "$1" "$mp" if [ $? -ne 0 ]; then notify-send -u critical "Samba mounting" "Failed to mount $1 to $mp as $user" exit 1 @@ -64,7 +64,7 @@ mountsamba() { \ } unmountdev() { \ - result=$(doas umount "$1" 2>&1) + result=$(sudo umount "$1" 2>&1) if [ -z "$result" ]; then notify-send "Unmount device" "$1 unmounted" return diff --git a/scripts/.local/bin/gendunstrc b/scripts/.local/bin/gendunstrc index 10fca2c..d1d2dc9 100755 --- a/scripts/.local/bin/gendunstrc +++ b/scripts/.local/bin/gendunstrc @@ -14,6 +14,9 @@ cat <&1)" in + "Full") status="F" ;; + "Discharging") status="-" ;; + "Charging") status="+" ;; + "Not charging") status="" ;; + "Unknown") status="?" ;; + *) exit 1 ;; + esac + capacity="$(cat "$battery/capacity" 2>&1)" + # Will make a warn variable if discharging and low + [ "$status" = "D" ] && [ "$capacity" -le 25 ] && warn="!!!" + # Prints the info + printf "%d%%%s%s" "$capacity" "$status" "$warn" ; unset warn +done && printf "\\n" diff --git a/scripts/.local/bin/sb-clock b/scripts/.local/bin/sb-clock new file mode 100755 index 0000000..e6fbb6b --- /dev/null +++ b/scripts/.local/bin/sb-clock @@ -0,0 +1,3 @@ +#!/bin/sh + +date "+%d/%m/%y %a %H:%M:%S" diff --git a/scripts/.local/bin/sb-cpu b/scripts/.local/bin/sb-cpu new file mode 100755 index 0000000..4594826 --- /dev/null +++ b/scripts/.local/bin/sb-cpu @@ -0,0 +1,3 @@ +#!/bin/sh + +sensors | awk '/CPU:/ {print $2}' | sed 's/....$//' diff --git a/scripts/.local/bin/sb-cpubars b/scripts/.local/bin/sb-cpubars new file mode 100755 index 0000000..946f9ef --- /dev/null +++ b/scripts/.local/bin/sb-cpubars @@ -0,0 +1,37 @@ +#!/bin/sh + +# Module showing CPU load as a changing bars. +# Just like in polybar. +# Each bar represents amount of load on one core since +# last run. + +# Cache in tmpfs to improve speed and reduce SSD load +cache=/tmp/cpubarscache + +# id total idle +stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) +[ ! -f $cache ] && echo "$stats" > "$cache" +old=$(cat "$cache") +printf "" +echo "$stats" | while read -r row; do + id=${row%% *} + rest=${row#* } + total=${rest%% *} + idle=${rest##* } + + case "$(echo "$old" | awk '{if ($1 == id) + printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ + id="$id" total="$total" idle="$idle")" in + + "0") printf "▁";; + "1") printf "▂";; + "2") printf "▃";; + "3") printf "▄";; + "4") printf "▅";; + "5") printf "▆";; + "6") printf "▇";; + "7") printf "█";; + "8") printf "█";; + esac +done; printf "\\n" +echo "$stats" > "$cache" diff --git a/scripts/.local/bin/sb-disk b/scripts/.local/bin/sb-disk new file mode 100755 index 0000000..c5629cd --- /dev/null +++ b/scripts/.local/bin/sb-disk @@ -0,0 +1,16 @@ +#!/bin/sh + +# Status bar module for disk space +# $1 should be drive mountpoint, otherwise assumed /. + +location=${1:-/} + +[ -d "$location" ] || exit + +case "$location" in + "/home"* ) icon="H" ;; + "/mnt"* ) icon="M" ;; + *) icon="O";; +esac + +printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/scripts/.local/bin/sb-forecast b/scripts/.local/bin/sb-forecast new file mode 100755 index 0000000..40a50c3 --- /dev/null +++ b/scripts/.local/bin/sb-forecast @@ -0,0 +1,21 @@ +#!/bin/sh + +# If we have internet, get a weather report from wttr.in and store it locally. +# You could set up a shell alias to view the full file in a pager in the +# terminal if desired. This function will only be run once a day when needed. +weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" +getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} + +# Some very particular and terse stream manipulation. We get the maximum +# precipitation chance and the daily high and low from the downloaded file and +# display them with coresponding emojis. +showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | + grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" +sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " " $1 ".." $2 "°"}' ;} + +# The test if our forcecast is updated to the day. If it isn't download a new +# weather report from wttr.in with the above function. +[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || + getforecast + +showweather diff --git a/scripts/.local/bin/sb-internet b/scripts/.local/bin/sb-internet new file mode 100755 index 0000000..6d80852 --- /dev/null +++ b/scripts/.local/bin/sb-internet @@ -0,0 +1,13 @@ +#!/bin/sh + +# Show wifi W and percent strength or w if none. +# Show E if connected to ethernet or e if none. +# Show V if a vpn connection is active + +if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then + wifiicon="$(awk '/^\s*w/ { print "W" int($3 * 100 / 70) }' /proc/net/wireless)" +elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then + grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="w" || wifiicon="w" +fi + +printf "%s%s%s\n" "$(sed "s/.*/V/" /sys/class/net/tun*/operstate 2>/dev/null)" "$(sed "s/down/e/;s/up/E/" /sys/class/net/e*/operstate 2>/dev/null)" "$wifiicon" diff --git a/scripts/.local/bin/sb-kbselect b/scripts/.local/bin/sb-kbselect new file mode 100755 index 0000000..f0c923f --- /dev/null +++ b/scripts/.local/bin/sb-kbselect @@ -0,0 +1,16 @@ +#!/bin/sh +# works on any init system +# requirements: dmenu, xorg-setxkbmap +kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1 + +case $BLOCK_BUTTON in + 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)" + kb="$(echo "$kb_choice" | awk '{print $3}')" + setxkbmap "$kb" + pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; + 3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')") +- Left click to change keyboard.";; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +echo "$kb" diff --git a/scripts/.local/bin/sb-mailbox b/scripts/.local/bin/sb-mailbox new file mode 100755 index 0000000..451c129 --- /dev/null +++ b/scripts/.local/bin/sb-mailbox @@ -0,0 +1,10 @@ +#!/bin/sh + +# Displays number of unread mail and an loading icon if updating. +# When clicked, brings up `neomutt`. + +unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" + +pidof mbsync >/dev/null 2>&1 && icon="U" + +[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "$unread$icon" diff --git a/scripts/.local/bin/sb-memory b/scripts/.local/bin/sb-memory new file mode 100755 index 0000000..bfb31c3 --- /dev/null +++ b/scripts/.local/bin/sb-memory @@ -0,0 +1,16 @@ +#!/bin/sh + +case $BLOCK_BUTTON in + 1) notify-send "Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; + 2) setsid -f "$TERMINAL" -e htop ;; + 3) notify-send "Memory module" "\- Shows Memory Used/Total. +- Click to show memory hogs. +- Middle click to open htop." ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +RAM=$(free --mebi | sed -n '2{p;q}' | awk '{printf ("%2.1f/%2.1f\n", ( $3 / 1024), ($2 / 1024))}') + +swap=$(free --mebi | sed -n '3{p;q}' | awk '{printf ("%2.1f/%2.1f\n", ( $3 / 1024), ($2 / 1024))}') + +echo "$RAM $swap" diff --git a/scripts/.local/bin/sb-mpdup b/scripts/.local/bin/sb-mpdup new file mode 100755 index 0000000..af81a7d --- /dev/null +++ b/scripts/.local/bin/sb-mpdup @@ -0,0 +1,8 @@ +#!/bin/sh + +# This loop will update the mpd statusbar module whenever a command changes the +# music player's status. mpd must be running on X's start for this to work. + +while : ; do + mpc idle >/dev/null && kill -45 "$(pidof "${STATUSBAR:-dwmblocks}")" || break +done diff --git a/scripts/.local/bin/sb-music b/scripts/.local/bin/sb-music new file mode 100755 index 0000000..06e7e4d --- /dev/null +++ b/scripts/.local/bin/sb-music @@ -0,0 +1,5 @@ +#!/bin/sh + +pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 & + +mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -; diff --git a/scripts/.local/bin/sb-nettraf b/scripts/.local/bin/sb-nettraf new file mode 100755 index 0000000..07cbd5c --- /dev/null +++ b/scripts/.local/bin/sb-nettraf @@ -0,0 +1,22 @@ +#!/bin/sh + +# Module showing network traffic. Shows how much data has been received (RX) or +# transmitted (TX) since the previous time this script ran. So if run every +# second, gives network traffic per second. + +update() { + sum=0 + for arg; do + read -r i < "$arg" + sum=$(( sum + i )) + done + cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/} + [ -f "$cache" ] && read -r old < "$cache" || old=0 + printf %d\\n "$sum" > "$cache" + printf %d\\n $(( sum - old )) +} + +rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) +tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) + +printf "%4sB %4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx) diff --git a/scripts/.local/bin/sb-volume b/scripts/.local/bin/sb-volume new file mode 100755 index 0000000..be07c93 --- /dev/null +++ b/scripts/.local/bin/sb-volume @@ -0,0 +1,15 @@ +#!/bin/sh + +# Prints the current volume or MUT if muted. + +[ $(pamixer --get-mute) = true ] && echo "MUT" && exit + +vol="$(pamixer --get-volume)" + +if [ "$vol" -gt "0" ]; then + icon="" +else + echo "MUT" && exit +fi + +printf "%3d" $vol diff --git a/scripts/.local/bin/statusbar/sb-battery b/scripts/.local/bin/statusbar/sb-battery deleted file mode 100755 index 04a3cf7..0000000 --- a/scripts/.local/bin/statusbar/sb-battery +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# Prints all batteries, their percentage remaining - -# Loop through all attached batteries and format the info -for battery in /sys/class/power_supply/BAT?*; do - # If non-first battery, print a space separator. - [ -n "${capacity+x}" ] && printf " " - # Sets up the status and capacity - case "$(cat "$battery/status" 2>&1)" in - "Full") status="F" ;; - "Discharging") status="-" ;; - "Charging") status="+" ;; - "Not charging") status="" ;; - "Unknown") status="?" ;; - *) exit 1 ;; - esac - capacity="$(cat "$battery/capacity" 2>&1)" - # Will make a warn variable if discharging and low - [ "$status" = "D" ] && [ "$capacity" -le 25 ] && warn="!!!" - # Prints the info - printf "%d%%%s%s" "$capacity" "$status" "$warn" ; unset warn -done && printf "\\n" diff --git a/scripts/.local/bin/statusbar/sb-clock b/scripts/.local/bin/statusbar/sb-clock deleted file mode 100755 index e6fbb6b..0000000 --- a/scripts/.local/bin/statusbar/sb-clock +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -date "+%d/%m/%y %a %H:%M:%S" diff --git a/scripts/.local/bin/statusbar/sb-cpu b/scripts/.local/bin/statusbar/sb-cpu deleted file mode 100755 index 4594826..0000000 --- a/scripts/.local/bin/statusbar/sb-cpu +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -sensors | awk '/CPU:/ {print $2}' | sed 's/....$//' diff --git a/scripts/.local/bin/statusbar/sb-cpubars b/scripts/.local/bin/statusbar/sb-cpubars deleted file mode 100755 index cfa54e4..0000000 --- a/scripts/.local/bin/statusbar/sb-cpubars +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh - -# Module showing CPU load as a changing bars. -# Just like in polybar. -# Each bar represents amount of load on one core since -# last run. - -# Cache in tmpfs to improve speed and reduce SSD load -cache=/tmp/cpubarscache - -case $BLOCK_BUTTON in - 2) setsid -f "$TERMINAL" -e htop ;; - 3) notify-send "CPU load module" "Each bar represents -one CPU core";; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -# id total idle -stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat) -[ ! -f $cache ] && echo "$stats" > "$cache" -old=$(cat "$cache") -printf "" -echo "$stats" | while read -r row; do - id=${row%% *} - rest=${row#* } - total=${rest%% *} - idle=${rest##* } - - case "$(echo "$old" | awk '{if ($1 == id) - printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \ - id="$id" total="$total" idle="$idle")" in - - "0") printf "▁";; - "1") printf "▂";; - "2") printf "▃";; - "3") printf "▄";; - "4") printf "▅";; - "5") printf "▆";; - "6") printf "▇";; - "7") printf "█";; - "8") printf "█";; - esac -done; printf "\\n" -echo "$stats" > "$cache" diff --git a/scripts/.local/bin/statusbar/sb-disk b/scripts/.local/bin/statusbar/sb-disk deleted file mode 100755 index e947509..0000000 --- a/scripts/.local/bin/statusbar/sb-disk +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# Status bar module for disk space -# $1 should be drive mountpoint, otherwise assumed /. - -location=${1:-/} - -[ -d "$location" ] || exit - -case $BLOCK_BUTTON in - 1) notify-send "💽 Disk space" "$(df -h --output=target,used,size)" ;; - 3) notify-send "💽 Disk module" "\- Shows used hard drive space. -- Click to show all disk info." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -case "$location" in - "/home"* ) icon="🏠" ;; - "/mnt"* ) icon="💾" ;; - *) icon="🖥";; -esac - -printf "%s: %s\n" "$icon" "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2}')" diff --git a/scripts/.local/bin/statusbar/sb-doppler b/scripts/.local/bin/statusbar/sb-doppler deleted file mode 100755 index dc93db0..0000000 --- a/scripts/.local/bin/statusbar/sb-doppler +++ /dev/null @@ -1,206 +0,0 @@ -#!/bin/sh - -# Show a Doppler RADAR of an American user's preferred location. - -secs=600 # Download a new doppler radar if one hasn't been downloaded in $secs seconds. -radarloc="${XDG_CACHE_HOME:-$HOME/.cache}/radar" -doppler="${XDG_CACHE_HOME:-$HOME/.cache}/doppler.gif" - -pickloc() { chosen="$(echo "Northeast -Southeast -PacNorthWest -PacSouthWest -UpperMissVly -SouthMissVly -SouthPlains -NorthRockies -SouthRockies -Alaska -Carib -Hawaii -CentGrLakes -Conus-Large -KABR: Aberdeen, SD -KBIS: Bismarck, ND -KFTG: Denver/Boulder, CO -KDMX: Des Moines, IA -KDTX: Detroit, MI -KDDC: Dodge City, KS -KDLH: Duluth, MN -KCYS: Cheyenne, WY -KLOT: Chicago, IL -KGLD: Goodland, KS -KUEX: Hastings, NE -KGJX: Grand Junction, CO -KGRR: Grand Rapids, MI -KMVX: Fargo/Grand Forks, ND -KGRB: Green Bay, WI -KIND: Indianapolis, IN -KJKL: Jackson, KY -KARX: La Crosse, WI -KILX: Lincoln/Central Illinois, IL -KLVX: Louisville, KY -KMQT: Marquette -KMKX: Milwaukee, WI -KMPX: Minneapolis, MN -KAPX: Gaylord/Alpena, MI -KLNX: North Platte, NE -KIWX: N. Webster/Northern, IN -KOAX: Omaha, NE -KPAH: Paducah, KY -KEAX: Pleasant Hill, MO -KPUX: Pueblo, CO -KDVN: Quad Cities, IA -KUDX: Rapid City, SD -KRIW: Riverton, WY -KSGF: Springfield, MO -KLSX: St. LOUIS, MO -KFSD: Sioux Falls, IA -KTWX: Topeka, KS -KICT: Wichita, KS -KVWX: Paducah, KY -ICAO: Responsible Wfo -KLTX: WILMINGTON, NC -KCCX: State College/Central, PA -KLWX: Sterling, VA -KFCX: Blacksburg/Roanoke, VA -KRAX: Raleigh/Durham, NC -KGYX: Portland, ME -KDIX: Mt Holly/Philadelphia, PA -KPBZ: Pittsburgh, PA -KAKQ: Wakefield, VA -KMHX: Morehead City, NC -KGSP: Greer/Greenville/Sprtbg, SC -KILN: Wilmington/Cincinnati, OH -KCLE: Cleveland, OH -KCAE: Columbia, SC -KBGM: Binghamton, NY -KENX: Albany, NY -KBUF: Buffalo, NY -KCXX: Burlington, VT -KCBW: Caribou, ME -KBOX: Boston /Taunton, MA -KOKX: New York City, NY -KCLX: Charleston, SC -KRLX: Charleston, WV -ICAO: Responsible WFO -KBRO: Brownsville, TX -KABX: Albuquerque, NM -KAMA: Amarillo, TX -KFFC: Peachtree City/Atlanta, GA -KEWX: Austin/Sanantonio, TX -KBMX: Birmingham, AL -KCRP: Corpus Christi, TX -KFWS: Dallas / Ft. Worth, TX -KEPZ: El Paso, TX -KHGX: Houston/ Galveston, TX -KJAX: Jacksonville, FL -KBYX: Key West, FL -KMRX: Morristown/knoxville, TN -KLBB: Lubbock, TX -KLZK: Little Rock, AR -KLCH: Lake Charles, LA -KOHX: Nashville, TN -KMLB: Melbourne, FL -KNQA: Memphis, TN -KAMX: Miami, FL -KMAF: Midland/odessa, TX -KTLX: Norman, OK -KHTX: Huntsville, AL -KMOB: Mobile, AL -KTLH: Tallahassee, FL -KTBW: Tampa Bay Area, FL -KSJT: San Angelo, TX -KINX: Tulsa, OK -KSRX: Tulsa, OK -KLIX: New Orleans/slidell, LA -KDGX: Jackson, MS -KSHV: Shreveport, LA -ICAO: Responsible WFO -KLGX: Seattle / Tacoma, WA -KOTX: Spokane, WA -KEMX: Tucson, AZ -KYUX: Phoenix, AZ -KNKX: San Diego, CA -KMUX: Monterey/san Francisco, CA -KHNX: San Joaquin/hanford, CA -KSOX: San Diego, CA -KATX: Seattle / Tacoma, WA -KIWA: Phoenix, AZ -KRTX: Portland, OR -KSFX: Pocatello, ID -KRGX: Reno, NV -KDAX: Sacramento, CA -KMTX: Salt Lake City, UT -KPDT: Pendleton, OR -KMSX: Missoula, MT -KESX: Las Vegas, NV -KVTX: Los Angeles, CA -KMAX: Medford, OR -KFSX: Flagstaff, AZ -KGGW: Glasgow, MT -KLRX: Elko, NV -KBHX: Eureka, CA -KTFX: Great Falls, MT -KCBX: Boise, ID -KBLX: Billings, MT -KICX: Salt Lake City, UT -ICAO: Responsible Wfo W/ MSCF -PABC: Anchorage, AK -PAPD: Fairbanks, AK -PHKM: Honolulu, HI -PAHG: Anchorage, AK -PAKC: Anchorage, AK -PAIH: Anchorage, AK -PHMO: Honolulu, HI -PAEC: Fairbanks, AK -TJUA: San Juan, PR -PACG: Juneau, AK -PHKI: Honolulu, HI -PHWA: Honolulu, HI -ICAO: Responsible Wfo W/ MSCF -KFDR: Norman, OK -PGUA: Guam -KBBX: Sacramento, CA -KFDX: Albuquerque, NM -KGWX: Jackson, MS -KDOX: Wakefield, VA -KDYX: San Angelo, TX -KEYX: Las Vegas, NV -KEVX: Mobile, AL -KHPX: Paducah, KY -KTYX: Burlington, VT -KGRK: Dallas / Ft. Worth, TX -KPOE: Lake Charles, LA -KEOX: Tallahassee, FL -KHDX: El Paso, TX -KDFX: San Antonio, TX -KMXX: Birmingham, AL -KMBX: Bismarck, ND -KVAX: Jacksonville, FL -KJGX: Peachtree City/atlanta, GA -KVNX: Norman, OK -KVBX: Vandenberg Afb: Orcutt, CA" | dmenu -r -i -l 50 -p "Select a National Weather Service radar to use as default:" | sed "s/:.*//" | tr "[:lower:]" "[:upper:]")" - -# Sanity check of selection and ensure user did not escape. -echo "$chosen" | grep -q "^[A-Z]\+$" && echo "$chosen" > "$radarloc" ;} - -getdoppler() { - loc="$(cat "$radarloc")" - notify-send "🌦️ Doppler RADAR" "Pulling most recent Doppler RADAR for $loc." - curl -sL "https://radar.weather.gov/ridge/lite/${loc}_loop.gif" > "$doppler" ;} - -showdoppler() { setsid -f mpv --no-osc --loop=inf --no-terminal "$doppler" ;} - -case $BLOCK_BUTTON in - 1) [ ! -f "$radarloc" ] && pickloc && getdoppler - [ $(($(date '+%s') - $(stat -c %Y "$doppler"))) -gt "$secs" ] && getdoppler - showdoppler ;; - 2) pickloc && getdoppler && showdoppler ;; - 3) notify-send "🗺️ Doppler RADAR module" "\- Left click for local Doppler RADAR. -- Middle click to update change RADAR location. -After $secs seconds, new clicks will also automatically update the doppler RADAR." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -echo 🗺️ diff --git a/scripts/.local/bin/statusbar/sb-forecast b/scripts/.local/bin/statusbar/sb-forecast deleted file mode 100755 index 1a625bd..0000000 --- a/scripts/.local/bin/statusbar/sb-forecast +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -# Displays todays precipication chance (☔) and daily low (🥶) and high (🌞). -# Usually intended for the statusbar. - -# If we have internet, get a weather report from wttr.in and store it locally. -# You could set up a shell alias to view the full file in a pager in the -# terminal if desired. This function will only be run once a day when needed. -weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" -getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} - -# Some very particular and terse stream manipulation. We get the maximum -# precipitation chance and the daily high and low from the downloaded file and -# display them with coresponding emojis. -showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | - grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" -sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " " $1 ".." $2 "°"}' ;} - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; - 2) getforecast && showweather ;; - 3) notify-send "🌈 Weather module" "\- Left click for full forecast. -- Middle click to update forecast. -☔: Chance of rain/snow -🥶: Daily low -🌞: Daily high" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -# The test if our forcecast is updated to the day. If it isn't download a new -# weather report from wttr.in with the above function. -[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || - getforecast - -showweather diff --git a/scripts/.local/bin/statusbar/sb-help-icon b/scripts/.local/bin/statusbar/sb-help-icon deleted file mode 100755 index 8fa4a52..0000000 --- a/scripts/.local/bin/statusbar/sb-help-icon +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# The clickable help menu. Middle click to restart wm. - -# If dwm is running, use dwm's readme and restart. -pidof dwm >/dev/null && - READMEFILE=/usr/local/share/dwm/larbs.mom - restartwm() { pkill -HUP dwm ;} || - restartwm() { i3 restart ;} - -case $BLOCK_BUTTON in - 1) groff -mom "${READMEFILE:-${XDG_DATA_HOME:-$HOME/.local/share}/larbs/readme.mom}" -Tpdf | zathura - ;; - 2) restartwm ;; - 3) notify-send "❓ Help module" "\- Left click to open LARBS guide. -- Middle click to refresh window manager." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac; echo "❓" diff --git a/scripts/.local/bin/statusbar/sb-internet b/scripts/.local/bin/statusbar/sb-internet deleted file mode 100755 index 6d80852..0000000 --- a/scripts/.local/bin/statusbar/sb-internet +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -# Show wifi W and percent strength or w if none. -# Show E if connected to ethernet or e if none. -# Show V if a vpn connection is active - -if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then - wifiicon="$(awk '/^\s*w/ { print "W" int($3 * 100 / 70) }' /proc/net/wireless)" -elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then - grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="w" || wifiicon="w" -fi - -printf "%s%s%s\n" "$(sed "s/.*/V/" /sys/class/net/tun*/operstate 2>/dev/null)" "$(sed "s/down/e/;s/up/E/" /sys/class/net/e*/operstate 2>/dev/null)" "$wifiicon" diff --git a/scripts/.local/bin/statusbar/sb-iplocate b/scripts/.local/bin/statusbar/sb-iplocate deleted file mode 100755 index ab89ffd..0000000 --- a/scripts/.local/bin/statusbar/sb-iplocate +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Gets your public ip address checks which country you are in and -# displays that information in the statusbar -# -# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ - -#ifinstalled "geoip" || exit -#addr="$(curl ifconfig.me 2>/dev/null)" || exit -#grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" - -locaddr=$(hostname -i | awk '{print $1}') -echo $locaddr - -case $BLOCK_BUTTON in - 1) notify-send "$(curl ifconfig.me 2>/dev/null)" -esac diff --git a/scripts/.local/bin/statusbar/sb-kbselect b/scripts/.local/bin/statusbar/sb-kbselect deleted file mode 100755 index f0c923f..0000000 --- a/scripts/.local/bin/statusbar/sb-kbselect +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# works on any init system -# requirements: dmenu, xorg-setxkbmap -kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1 - -case $BLOCK_BUTTON in - 1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)" - kb="$(echo "$kb_choice" | awk '{print $3}')" - setxkbmap "$kb" - pkill -RTMIN+30 "${STATUSBAR:-dwmblocks}";; - 3) notify-send "⌨ Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')") -- Left click to change keyboard.";; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -echo "$kb" diff --git a/scripts/.local/bin/statusbar/sb-mailbox b/scripts/.local/bin/statusbar/sb-mailbox deleted file mode 100755 index 13e152f..0000000 --- a/scripts/.local/bin/statusbar/sb-mailbox +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# Displays number of unread mail and an loading icon if updating. -# When clicked, brings up `neomutt`. - -# ivan: removed gay emoji - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e neomutt ;; - 2) setsid -f mw -Y >/dev/null ;; - 3) notify-send "📬 Mail module" "\- Shows unread mail -- Shows 🔃 if syncing mail -- Left click opens neomutt -- Middle click syncs mail" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)" - -pidof mbsync >/dev/null 2>&1 && icon="U" - -[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "$unread$icon" diff --git a/scripts/.local/bin/statusbar/sb-memory b/scripts/.local/bin/statusbar/sb-memory deleted file mode 100755 index bfb31c3..0000000 --- a/scripts/.local/bin/statusbar/sb-memory +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -case $BLOCK_BUTTON in - 1) notify-send "Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; - 2) setsid -f "$TERMINAL" -e htop ;; - 3) notify-send "Memory module" "\- Shows Memory Used/Total. -- Click to show memory hogs. -- Middle click to open htop." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -RAM=$(free --mebi | sed -n '2{p;q}' | awk '{printf ("%2.1f/%2.1f\n", ( $3 / 1024), ($2 / 1024))}') - -swap=$(free --mebi | sed -n '3{p;q}' | awk '{printf ("%2.1f/%2.1f\n", ( $3 / 1024), ($2 / 1024))}') - -echo "$RAM $swap" diff --git a/scripts/.local/bin/statusbar/sb-moonphase b/scripts/.local/bin/statusbar/sb-moonphase deleted file mode 100755 index fab8b4d..0000000 --- a/scripts/.local/bin/statusbar/sb-moonphase +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# Shows the current moon phase. - -moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase" - -[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || - { curl -sf "wttr.in/?format=%m" > "$moonfile" || exit 1 ;} - -icon="$(cat "$moonfile")" - -case "$icon" in - 🌑) name="New" ;; - 🌒) name="Waxing Crescent" ;; - 🌓) name="First Quarter" ;; - 🌔) name="Waxing Gibbous" ;; - 🌕) name="Full" ;; - 🌖) name="Waning Gibbous" ;; - 🌗) name="Last Quarter" ;; - 🌘) name="Waning Crescent" ;; - *) exit 1 ;; -esac - -echo "${icon-?}" - -case $BLOCK_BUTTON in - 3) notify-send "🌜 Moon phase module" "Displays current moon phase. -- 🌑: New -- 🌒: Waxing Crescent -- 🌓: First Quarter -- 🌔: Waxing Gibbous -- 🌕: Full -- 🌖: Waning Gibbous -- 🌗: Last Quarter -- 🌘: Waning Crescent" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac diff --git a/scripts/.local/bin/statusbar/sb-mpdup b/scripts/.local/bin/statusbar/sb-mpdup deleted file mode 100755 index af81a7d..0000000 --- a/scripts/.local/bin/statusbar/sb-mpdup +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# This loop will update the mpd statusbar module whenever a command changes the -# music player's status. mpd must be running on X's start for this to work. - -while : ; do - mpc idle >/dev/null && kill -45 "$(pidof "${STATUSBAR:-dwmblocks}")" || break -done diff --git a/scripts/.local/bin/statusbar/sb-music b/scripts/.local/bin/statusbar/sb-music deleted file mode 100755 index 06e7e4d..0000000 --- a/scripts/.local/bin/statusbar/sb-music +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -pidof -x sb-mpdup >/dev/null 2>&1 || sb-mpdup >/dev/null 2>&1 & - -mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[paused\\].*/⏸/g;/\\[playing\\].*/d;/^ERROR/Q" | paste -sd ' ' -; diff --git a/scripts/.local/bin/statusbar/sb-nettraf b/scripts/.local/bin/statusbar/sb-nettraf deleted file mode 100755 index 824e156..0000000 --- a/scripts/.local/bin/statusbar/sb-nettraf +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# Module showing network traffic. Shows how much data has been received (RX) or -# transmitted (TX) since the previous time this script ran. So if run every -# second, gives network traffic per second. - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e bmon ;; - 3) notify-send "🌐 Network traffic module" "🔻: Traffic received -🔺: Traffic transmitted" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -update() { - sum=0 - for arg; do - read -r i < "$arg" - sum=$(( sum + i )) - done - cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/} - [ -f "$cache" ] && read -r old < "$cache" || old=0 - printf %d\\n "$sum" > "$cache" - printf %d\\n $(( sum - old )) -} - -rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) -tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes) - -printf "%4sB/%4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx) diff --git a/scripts/.local/bin/statusbar/sb-news b/scripts/.local/bin/statusbar/sb-news deleted file mode 100755 index fe701db..0000000 --- a/scripts/.local/bin/statusbar/sb-news +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# Displays number of unread news items and an loading icon if updating. -# When clicked, brings up `newsboat`. - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e newsboat ;; - 2) setsid -f newsup >/dev/null exit ;; - 3) notify-send "📰 News module" "\- Shows unread news items -- Shows 🔃 if updating with \`newsup\` -- Left click opens newsboat -- Middle click syncs RSS feeds -Note: Only one instance of newsboat (including updates) may be running at a time." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - - cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print "📰" $1}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)" diff --git a/scripts/.local/bin/statusbar/sb-pacpackages b/scripts/.local/bin/statusbar/sb-pacpackages deleted file mode 100755 index 37ebed3..0000000 --- a/scripts/.local/bin/statusbar/sb-pacpackages +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# Displays number of upgradeable packages. -# For this to work, have a `pacman -Sy` command run in the background as a -# cronjob every so often as root. This script will then read those packages. -# When clicked, it will run an upgrade via pacman. -# -# Add the following text as a file in /usr/share/libalpm/hooks/statusbar.hook: -# -# [Trigger] -# Operation = Upgrade -# Type = Package -# Target = * -# -# [Action] -# Description = Updating statusbar... -# When = PostTransaction -# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3. - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e sb-popupgrade ;; - 2) notify-send "$(/usr/bin/pacman -Qu)" ;; - 3) notify-send "🎁 Upgrade module" "📦: number of upgradable packages -- Left click to upgrade packages -- Middle click to show upgradable packages" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -pacman -Qu | grep -Fcv "[ignored]" | sed "s/^/📦/;s/^📦0$//g" diff --git a/scripts/.local/bin/statusbar/sb-popupgrade b/scripts/.local/bin/statusbar/sb-popupgrade deleted file mode 100755 index 29d6230..0000000 --- a/scripts/.local/bin/statusbar/sb-popupgrade +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -printf "Beginning upgrade.\\n" - -yay -Syu -pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}" - -printf "\\nUpgrade complete.\\nPress to exit window.\\n\\n" -read -r _ diff --git a/scripts/.local/bin/statusbar/sb-price b/scripts/.local/bin/statusbar/sb-price deleted file mode 100755 index 42c84c1..0000000 --- a/scripts/.local/bin/statusbar/sb-price +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -# Usage: -# price -# price bat "Basic Attention Token" 🦁 -# When the name of the currency is multi-word, put it in quotes. - -[ -z "$3" ] && exit 1 - -# use $4 as currency, if not passed in use "usd" as default -currency="${4:-usd}" -interval="@14d" # History contained in chart preceded by '@' (7d = 7 days) -dir="${XDG_DATA_HOME:-$HOME/.local/share}/crypto-prices" -pricefile="$dir/$1-$currency" -chartfile="$dir/$1-$currency-chart" - -updateprice() { temp="$(mktemp)" - curl -s "$currency.rate.sx/1$1" > "$temp" && - mv -f "$temp" "$pricefile" && - curl -s "$currency.rate.sx/$1$interval" > "$temp" && - mv -f "$temp" "$chartfile" ;} - -[ -d "$dir" ] || mkdir -p "$dir" - -[ "$(stat -c %x "$pricefile" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && - updateprice "$1" - -case $BLOCK_BUTTON in - 1) setsid "$TERMINAL" -e less -Srf "$chartfile" ;; - 2) notify-send -u low "$3 Updating..." "Updating $2 price..." - updateprice "$1" && notify-send "$3 Update complete." "$2 price is now -\$$(cat "$pricefile")" ;; - 3) uptime="$(date -d "$(stat -c %x "$pricefile")" '+%D at %T' | sed "s|$(date '+%D')|Today|")" - notify-send "$3 $2 module" "\- Exact price: \$$(cat "$pricefile") -- Left click for chart of changes. -- Middle click to update. -- Shows 🔃 if updating prices. -- Last updated: - $uptime" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -case "$currency" in - usd) symb="$" ;; - gbp) symb="£" ;; - eur) symb="€" ;; - btc) symb="₿" ;; -esac - -printf "$3$symb%0.2f$after" "$(cat "$pricefile")" diff --git a/scripts/.local/bin/statusbar/sb-tasks b/scripts/.local/bin/statusbar/sb-tasks deleted file mode 100755 index 349e8cb..0000000 --- a/scripts/.local/bin/statusbar/sb-tasks +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -# Originally by Andr3as07 -# Some changes by Luke -# Rebuild by Tenyun - -# This block displays the number running background tasks. Requires tsp. - -num=$(tsp -l | awk -v numr=0 -v numq=0 '{if (/running/)numr++; if (/queued/)numq++} END{print numr+numq"("numq")"}') - -[ "$num" != "0(0)" ] && - echo "$num" diff --git a/scripts/.local/bin/statusbar/sb-torrent b/scripts/.local/bin/statusbar/sb-torrent deleted file mode 100755 index 6527005..0000000 --- a/scripts/.local/bin/statusbar/sb-torrent +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -transmission-remote -l | grep % | - sed " # The letters are for sorting and will not appear. - s/.*Stopped.*/A 🛑/; - s/.*Seeding.*/Z 🌱/; - s/.*100%.*/N ✅/; - s/.*Idle.*/B 🕰️/; - s/.*Uploading.*/L ⬆️/; - s/.*%.*/M ⬇️/" | - sort -h | uniq -c | awk '{print $3 $1}' | paste -sd ' ' - - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e tremc ;; - 2) td-toggle ;; - 3) notify-send "🌱 Torrent module" "\- Left click to open tremc. -- Middle click to toggle transmission. -- Shift click to edit script. -Module shows number of torrents: -🛑: paused -🕰: idle (seeds needed) -🔼: uploading (unfinished) -🔽: downloading -✅: done -🌱: done and seeding" ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac diff --git a/scripts/.local/bin/statusbar/sb-volume b/scripts/.local/bin/statusbar/sb-volume deleted file mode 100755 index 2b7ce67..0000000 --- a/scripts/.local/bin/statusbar/sb-volume +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# Prints the current volume or 🔇 if muted. - -case $BLOCK_BUTTON in - 1) setsid -f "$TERMINAL" -e pulsemixer ;; - 2) pamixer -t ;; - 4) pamixer --allow-boost -i 1 ;; - 5) pamixer --allow-boost -d 1 ;; - 3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted. -- Middle click to mute. -- Scroll to change." ;; - 6) "$TERMINAL" -e "$EDITOR" "$0" ;; -esac - -[ $(pamixer --get-mute) = true ] && echo 🔇 && exit - -vol="$(pamixer --get-volume)" - -if [ "$vol" -gt "0" ]; then - icon="" -else - echo  && exit -fi - -echo "$icon$vol%" diff --git a/scripts/.local/bin/tab-buttons b/scripts/.local/bin/tab-buttons new file mode 100755 index 0000000..a056d19 --- /dev/null +++ b/scripts/.local/bin/tab-buttons @@ -0,0 +1,10 @@ +pad=$(xsetwacom list | grep pad | cut -f 1 | xargs) + +xsetwacom --set "$pad" Button 1 "key +shift +alt p -alt -shift" +xsetwacom --set "$pad" Button 2 "key +shift +alt a -alt -shift" +xsetwacom --set "$pad" Button 3 12 +xsetwacom --set "$pad" Button 8 13 +xsetwacom --set "$pad" Button 9 14 +xsetwacom --set "$pad" Button 10 "key +shift +alt l -alt -shift" +xsetwacom --set "$pad" Button 11 "key +shift +alt s -alt -shift" +xsetwacom --set "$pad" Button 12 "key +ctrl z -ctrl" diff --git a/scripts/.local/bin/tab-osu b/scripts/.local/bin/tab-osu new file mode 100755 index 0000000..6de540d --- /dev/null +++ b/scripts/.local/bin/tab-osu @@ -0,0 +1,4 @@ +#!/bin/bash +notify-send 'Tablet: osu!' +#$HOME/.local/bin/tablet/scale 1366 768 4 100 50 0 0 +$HOME/.local/bin/tab-scale 1920 1080 4 100 50 0 0 diff --git a/scripts/.local/bin/tab-scale b/scripts/.local/bin/tab-scale new file mode 100755 index 0000000..25fd7bf --- /dev/null +++ b/scripts/.local/bin/tab-scale @@ -0,0 +1,38 @@ +#!/bin/bash + +args=("$@") + +tablet=$(xsetwacom list | grep stylus | cut -f 1 | xargs) + +Wx=${args[0]} +Wy=${args[1]} +alpha=${args[2]} +Sx=${args[3]} +Sy=${args[4]} +skewX=${args[5]} +skewY=${args[6]} + +xsetwacom --set "$tablet" ResetArea +Nx=$(xsetwacom get "$tablet" Area | cut -f 3 -d ' ') +Ny=$(xsetwacom get "$tablet" Area | cut -f 4 -d ' ') + +resX=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -f 1 -d 'x') +resY=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -f 2 -d 'x') + +#dual display hack +#resX=$(($resX/2)) + +Nxx=$(($Nx/$alpha)) +Nyy=$(($Sx*$Ny*$Wy/$alpha/$Sy/$Wx)) + +dx=$((($resX-$Wx)/2 + $skewX)) +dy=$((($resY-$Wy)/2 + $skewY)) + +#echo $tablet +#echo Area 0 0 $Nxx $Nyy +#echo MapToOutput ${Wx} ${Wy} ${dx} ${dy} + +#xsetwacom --set "${tablet}" Area 0 0 $Nxx $Nyy +xsetwacom --set "${tablet}" Area $((($Nx-$Nxx)/2)) 0 $((($Nx+$Nxx)/2)) $Nyy +#xsetwacom --set "${tablet}" Area 0 $(($Ny-$Nyy)) $Nxx $Ny +xsetwacom --set "${tablet}" MapToOutput ${Wx}x${Wy}+$dx+$dy diff --git a/scripts/.local/bin/tablet/osu b/scripts/.local/bin/tablet/osu deleted file mode 100755 index c46480a..0000000 --- a/scripts/.local/bin/tablet/osu +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -notify-send 'Tablet: osu!' -#$HOME/.local/bin/tablet/scale 1366 768 4 100 50 0 0 -$HOME/.local/bin/tablet/scale 1920 1080 4 100 50 0 0 diff --git a/scripts/.local/bin/tablet/pad b/scripts/.local/bin/tablet/pad deleted file mode 100755 index a056d19..0000000 --- a/scripts/.local/bin/tablet/pad +++ /dev/null @@ -1,10 +0,0 @@ -pad=$(xsetwacom list | grep pad | cut -f 1 | xargs) - -xsetwacom --set "$pad" Button 1 "key +shift +alt p -alt -shift" -xsetwacom --set "$pad" Button 2 "key +shift +alt a -alt -shift" -xsetwacom --set "$pad" Button 3 12 -xsetwacom --set "$pad" Button 8 13 -xsetwacom --set "$pad" Button 9 14 -xsetwacom --set "$pad" Button 10 "key +shift +alt l -alt -shift" -xsetwacom --set "$pad" Button 11 "key +shift +alt s -alt -shift" -xsetwacom --set "$pad" Button 12 "key +ctrl z -ctrl" diff --git a/scripts/.local/bin/tablet/reset b/scripts/.local/bin/tablet/reset deleted file mode 100755 index 3f68711..0000000 --- a/scripts/.local/bin/tablet/reset +++ /dev/null @@ -1,2 +0,0 @@ -notify-send 'Tablet: reset' -tabletscale 1920 1080 1 87 54 0 0 diff --git a/scripts/.local/bin/tablet/scale b/scripts/.local/bin/tablet/scale deleted file mode 100755 index c405048..0000000 --- a/scripts/.local/bin/tablet/scale +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -args=("$@") - -#echo Number of arguments: $# - -tablet=$(xsetwacom list | grep stylus | cut -f 1 | xargs) - -Wx=${args[0]} -Wy=${args[1]} -alpha=${args[2]} -Sx=${args[3]} -Sy=${args[4]} -skewX=${args[5]} -skewY=${args[6]} - -xsetwacom --set "$tablet" ResetArea -Nx=$(xsetwacom get "$tablet" Area | cut -f 3 -d ' ') -Ny=$(xsetwacom get "$tablet" Area | cut -f 4 -d ' ') - -resX=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -f 1 -d 'x') -resY=$(xdpyinfo | awk '/dimensions/{print $2}' | cut -f 2 -d 'x') - -#dual display hack -#resX=$(($resX/2)) - -Nxx=$(($Nx/$alpha)) -Nyy=$(($Sx*$Ny*$Wy/$alpha/$Sy/$Wx)) - -dx=$((($resX-$Wx)/2 + $skewX)) -dy=$((($resY-$Wy)/2 + $skewY)) - -#echo $tablet -#echo Area 0 0 $Nxx $Nyy -#echo MapToOutput ${Wx} ${Wy} ${dx} ${dy} - -#xsetwacom --set "${tablet}" Area 0 0 $Nxx $Nyy -xsetwacom --set "${tablet}" Area $((($Nx-$Nxx)/2)) 0 $((($Nx+$Nxx)/2)) $Nyy -#xsetwacom --set "${tablet}" Area 0 $(($Ny-$Nyy)) $Nxx $Ny -xsetwacom --set "${tablet}" MapToOutput ${Wx}x${Wy}+$dx+$dy - diff --git a/x11/.Xresources b/x11/.Xresources deleted file mode 100644 index c449eb6..0000000 --- a/x11/.Xresources +++ /dev/null @@ -1,36 +0,0 @@ -! special -*.foreground: #e1a15b -*.background: #0e0a05 -*.cursorColor: #e1a15b - -! black -*.color0: #222222 -*.color8: #000000 - -! red -*.color1: #e75c58 -*.color9: #b22b31 - -! green -*.color2: #00b800 -*.color10: #008100 - -! yellow -*.color3: #ebeb00 -*.color11: #d3d300 - -! blue -*.color4: #0082ff -*.color12: #0061c3 - -! magenta -*.color5: #d160c4 -*.color13: #a03196 - -! cyan -*.color6: #009393 -*.color14: #007e7e - -! white -*.color7: #d2d2d2 -*.color15: #787878 diff --git a/x11/.config/x11/xprofile b/x11/.config/x11/xprofile index a746216..da3bf16 100644 --- a/x11/.config/x11/xprofile +++ b/x11/.config/x11/xprofile @@ -1,33 +1,37 @@ -#!/bin/sh +#!/bin/bash # This file runs when a DM logs you into a graphical session. # If you use startx/xinit like a Chad, this file will also be sourced. - "xrdb ${XDG_CACHE_HOME:-$HOME/.cache}/wal/colors.Xresources" autostart=( - "xrandr --dpi 96" - "xrdb $HOME/.Xresources" - "$HOME/.local/bin/setbg" - "$HOME/.local/bin/remaps" - "picom" - "mpd" - "dunst" - "unclutter" - "dwmblocks" - "gentoo-pipewire-launcher" - "syncthing --no-browser" - "redshift -l40:2") - -for program in "${autostart[@]}" ; do - pidof -s "${program%% *}" || setsid -f $program -done >$XDG_CACHE_HOME/xprofile.errors 2>&1 - -if [ -x /usr/bin/gpg-agent ]; then - eval "$(/usr/bin/gpg-agent --daemon)" -fi + "xrdb $HOME/.Xresources" + "$HOME/.local/bin/setbg" + "$HOME/.local/bin/remaps" + "xcompmgr" + "mpd" + "dunst" + "unclutter" + "gentoo-pipewire-launcher" + "syncthing --no-browser" + "dwmblocks" + "redshift -l40:2") + + for program in "${autostart[@]}" ; do + pidof -s "${program%% *}" || setsid -f $program + done >$XDG_CACHE_HOME/xprofile.errors 2>&1 + + if [ -x /usr/bin/gpg-agent ]; then + eval "$(/usr/bin/gpg-agent --daemon)" + fi + +# generate .Xresources +$HOME/.local/bin/genxresources > $HOME/.Xresources # generate zathura config with colors from .Xresources mkdir -pv $HOME/.config/zathura && $HOME/.local/bin/genzathurarc > $HOME/.config/zathura/zathurarc +# and dunst too +mkdir -pv $HOME/.config/dunst && $HOME/.local/bin/gendunstrc > $HOME/.config/dunst/dunstrc + # Ensure that xrdb has finished running before moving on to start the WM/DE. [ -n "$xrdbpid" ] && wait "$xrdbpid" diff --git a/x11/.xinitrc b/x11/.xinitrc index 6134ca3..57be318 100755 --- a/x11/.xinitrc +++ b/x11/.xinitrc @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # xinitrc runs automatically when you run startx. @@ -9,9 +9,9 @@ # I source them here with the line below. if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" ]; then - . "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" + . "${XDG_CONFIG_HOME:-$HOME/.config}/x11/xprofile" else - . "$HOME/.xprofile" + . "$HOME/.xprofile" fi ssh-agent "$(which dwm)" -- cgit v1.2.3