some more x scripts

This commit is contained in:
Bryson Steck 2023-05-31 22:46:32 -06:00
parent 3991ac66a5
commit 698a8a7f30
7 changed files with 69 additions and 15 deletions

View file

@ -12,6 +12,7 @@ fi
export EDITOR=/usr/bin/vim export EDITOR=/usr/bin/vim
export TERMINAL=/usr/bin/alacritty export TERMINAL=/usr/bin/alacritty
export BROWSER=/usr/bin/librewolf-bin export BROWSER=/usr/bin/librewolf-bin
export XZ_OPT='-9 -T0'
export PATH export PATH
complete -cf doas complete -cf doas

View file

@ -1,15 +1,17 @@
# Beware! This file is rewritten by htop when settings are changed in the interface. # Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly. # The parser is also very primitive, and not human-friendly.
htop_version=3.2.1 htop_version=3.2.2
config_reader_min_version=3 config_reader_min_version=3
fields=0 48 17 18 38 39 40 2 46 47 49 1 fields=0 48 17 18 38 39 40 2 46 47 49 1
hide_kernel_threads=1 hide_kernel_threads=1
hide_userland_threads=0 hide_userland_threads=0
hide_running_in_container=0
shadow_other_users=0 shadow_other_users=0
show_thread_names=0 show_thread_names=0
show_program_path=1 show_program_path=1
highlight_base_name=1 highlight_base_name=0
highlight_deleted_exe=1 highlight_deleted_exe=1
shadow_distribution_path_prefix=0
highlight_megabytes=1 highlight_megabytes=1
highlight_threads=1 highlight_threads=1
highlight_changes=0 highlight_changes=0
@ -19,7 +21,7 @@ strip_exe_from_cmdline=1
show_merged_command=0 show_merged_command=0
header_margin=1 header_margin=1
screen_tabs=1 screen_tabs=1
detailed_cpu_time=1 detailed_cpu_time=0
cpu_count_from_one=0 cpu_count_from_one=0
show_cpu_usage=1 show_cpu_usage=1
show_cpu_frequency=1 show_cpu_frequency=1
@ -29,7 +31,7 @@ update_process_names=0
account_guest_in_cpu_meter=0 account_guest_in_cpu_meter=0
color_scheme=0 color_scheme=0
enable_mouse=1 enable_mouse=1
delay=7 delay=15
hide_function_bar=0 hide_function_bar=0
header_layout=two_50_50 header_layout=two_50_50
column_meters_0=LeftCPUs Memory Swap column_meters_0=LeftCPUs Memory Swap
@ -37,21 +39,21 @@ column_meter_modes_0=1 1 1
column_meters_1=RightCPUs Tasks LoadAverage Uptime column_meters_1=RightCPUs Tasks LoadAverage Uptime
column_meter_modes_1=1 2 2 2 column_meter_modes_1=1 2 2 2
tree_view=0 tree_view=0
sort_key=46 sort_key=47
tree_sort_key=0 tree_sort_key=46
sort_direction=-1 sort_direction=-1
tree_sort_direction=1 tree_sort_direction=-1
tree_view_always_by_pid=0 tree_view_always_by_pid=0
all_branches_collapsed=0 all_branches_collapsed=0
screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command screen:Main=PID USER PRIORITY NICE M_VIRT M_RESIDENT M_SHARE STATE PERCENT_CPU PERCENT_MEM TIME Command
.sort_key=PERCENT_CPU .sort_key=PERCENT_MEM
.tree_sort_key=PID .tree_sort_key=PERCENT_CPU
.tree_view=0 .tree_view=0
.tree_view_always_by_pid=0 .tree_view_always_by_pid=0
.sort_direction=-1 .sort_direction=-1
.tree_sort_direction=1 .tree_sort_direction=-1
.all_branches_collapsed=0 .all_branches_collapsed=0
screen:I/O=PID USER COMM IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE screen:I/O=PID USER IO_PRIORITY IO_RATE IO_READ_RATE IO_WRITE_RATE
.sort_key=IO_RATE .sort_key=IO_RATE
.tree_sort_key=PID .tree_sort_key=PID
.tree_view=0 .tree_view=0

View file

@ -13,6 +13,8 @@ cp -r ~/.vim/after ./vim
cp ~/.xinitrc* ./x cp ~/.xinitrc* ./x
cp ~/.Xresources ./x cp ~/.Xresources ./x
cp ~/.Xmodmap ./x cp ~/.Xmodmap ./x
cp ~/bin/spawn-alacritty.sh ./x
cp ~/bin/quitconf ./x
cp ~/bin/battery.pl ./x cp ~/bin/battery.pl ./x
cp ~/bin/startdwm.sh ./x cp ~/bin/startdwm.sh ./x
cp ~/.config/VSCodium/User/settings.json ./vscode cp ~/.config/VSCodium/User/settings.json ./vscode

View file

@ -40,6 +40,7 @@
"vim.hlsearch": true, "vim.hlsearch": true,
"workbench.startupEditor": "none", "workbench.startupEditor": "none",
"workbench.sideBar.location": "right", "workbench.sideBar.location": "right",
"window.restoreWindows": "none",
"vim.normalModeKeyBindingsNonRecursive": [ "vim.normalModeKeyBindingsNonRecursive": [
{ {
"before": ["<leader>", "h"], "before": ["<leader>", "h"],
@ -65,5 +66,8 @@
"workbench.action.navigateRight" "workbench.action.navigateRight"
] ]
} }
] ],
"debug.onTaskErrors": "showErrors",
"explorer.confirmDelete": false,
"errorLens.messageMaxChars": 200
} }

View file

@ -22,13 +22,13 @@ while (1) {
if (int($battery_level) <= int($CRITICAL_LEVEL)) { if (int($battery_level) <= int($CRITICAL_LEVEL)) {
$CRITICAL = 'def'; $CRITICAL = 'def';
$sent = 'def'; $sent = 'def';
system "notify-send -i \"battery-empty\" -t 0 -u critical \"BATTERY CRITICAL\" \"Battery level is ${battery_level}%\n\nCharge the system NOW.\"" system "notify-send -i \"battery-empty-symbolic\" -t 0 -u critical \"BATTERY CRITICAL\" \"Battery level is ${battery_level}%\n\nCharge the system NOW.\""
} }
} if (!$LOW && !$sent) { } if (!$LOW && !$sent) {
if (int($battery_level) <= int($LOW_LEVEL)) { if (int($battery_level) <= int($LOW_LEVEL)) {
$LOW = 'def'; $LOW = 'def';
$sent = 'def'; $sent = 'def';
system "notify-send -i \"battery-caution\" -t 0 -u normal \"BATTERY LOW\" \"Battery level is ${battery_level}%\n\nCharge the system soon.\"" system "notify-send -i \"battery-caution-symbolic\" -t 0 -u normal \"BATTERY LOW\" \"Battery level is ${battery_level}%\n\nCharge the system soon.\""
} }
} if (int($battery_level) <= int($DEAD_LEVEL)) { } if (int($battery_level) <= int($DEAD_LEVEL)) {
system "notify-send -t 0 -u critical \"SHUTTING DOWN\" \"Battery level is too low. The system will shutdown in 2 minutes to prevent corruption.\n\nCharge the system NOW to cancel the shutdown.\""; system "notify-send -t 0 -u critical \"SHUTTING DOWN\" \"Battery level is too low. The system will shutdown in 2 minutes to prevent corruption.\n\nCharge the system NOW to cancel the shutdown.\"";
@ -40,7 +40,7 @@ while (1) {
$CRITICAL = undef; $CRITICAL = undef;
$LOW = undef; $LOW = undef;
system "doas shutdown -c"; system "doas shutdown -c";
system "notify-send -t 3000 -i \"battery-good-charging\" \"System is now charging\""; system "notify-send -t 3000 -i \"battery-good-charging-symbolic\" \"System is now charging\"";
} }
} }

8
x/quitconf Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
input=$(printf "no\nyes" | dmenu -m $1 -fn "JetBrains Mono NF:style=medium:size=11" -nb $2 -nf $3 -sb "#cc241d" -sf $4 -p "Quit dwm?")
if [ "$input" = "yes" ]; then
killall dwm
fi

37
x/spawn-alacritty.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
# Stole from https://github.com/alacritty/alacritty/issues/808#issuecomment-334200570
#
# Spawn a new instance of Alacritty using the CWD of the currently focused
# Alacritty process.
#
# This is useful in environment like i3 where terminals are opened using a
# key-combination while another terminal is already focused.
#
# If the script is run with a non-Alacritty window in focus or a non-compliant
# version of Alacritty, an instance will be spawned in the user's $HOME.
ACTIVE_WINDOW=$(xdotool getactivewindow)
ACTIVE_WM_CLASS=$(xprop -id $ACTIVE_WINDOW | grep WM_CLASS)
if [[ $ACTIVE_WM_CLASS == *"Alacritty"* ]]
then
# Get PID. If _NET_WM_PID isn't set, bail.
PID=$(xprop -id $ACTIVE_WINDOW | grep _NET_WM_PID | grep -oP "\d+")
if [[ "$PID" == "" ]]
then
WINIT_X11_SCALE_FACTOR=1 alacritty
fi
# Get first child of terminal
CHILD_PID=$(pgrep -P $PID)
if [[ "$PID" == "" ]]
then
WINIT_X11_SCALE_FACTOR=1 alacritty
fi
# Get current directory of child. The first child should be the shell.
pushd "/proc/${CHILD_PID}/cwd"
SHELL_CWD=$(pwd -P)
popd
# Start alacritty with the working directory
WINIT_X11_SCALE_FACTOR=1 alacritty --working-directory "$SHELL_CWD"
else
WINIT_X11_SCALE_FACTOR=1 alacritty
fi