next gen init

This commit is contained in:
Strix 2023-10-14 22:38:11 +02:00
parent 84872dc103
commit a16479ee7a
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774
40 changed files with 239 additions and 894 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
.idea/
.dotfiles/

View file

@ -1,9 +1,10 @@
# Faulty's Dotfiles
Version: 3
# Dotfiles
---
## file sync
files in `./files` are synced across the system.
files in `./files/home` are synced to the home of the user running the script.
files in `./files/root` are synced with sudo to the root of the script.
## `distros/`
This directory is meant to setup the distro to the liking of the user.
### `distros/*/root`
Contains files to overlay over the executing system.
### `distro/*/sys-scripts`
scripts that are ran as `root`
### `distro/*/user-scripts`
scripts that are ran as the user

View file

@ -1,12 +0,0 @@
#!/bin/sh
export SUDO=sudo
export PM=dnf
export PM_INSTALL=install
export PM_NOCONFIRM=-y
$SUDO dnf update
[ "${NO_GRAPHICS:-no}" = "yes" ] || $SUDO $PM $PM_INSTALL $PM_NOCONFIRM libX11-devel libXft-devel libXinerama-devel libXrandr-devel xorg-x11-xinit-session
[ -f ./sync.sh ] && ./sync.sh $@ || (cd .. && ./sync.sh $@)

19
distros/alpine/pm.sh Normal file
View file

@ -0,0 +1,19 @@
cmd="apk"
while getopts "icru" opt; do
case $opt in
i)
cmd="$cmd add"
;;
u)
cmd="$cmd add"
r)
cmd="$cmd remove"
;;
c)
cmd="$cmd info -q"
;;
esac
done
shift $((OPTIND-1))
$cmd $@

4
distros/any/package.list Normal file
View file

@ -0,0 +1,4 @@
neofetch
git
vim
sudo

View file

@ -0,0 +1,4 @@
root ALL=(ALL:ALL) ALL
%wheel ALL=(ALL:ALL) ALL
%root ALL=(ALL:ALL) NOPASSWD: ALL
@includedir /etc/sudoers.d

View file

@ -0,0 +1,2 @@
reflector # for scripts/00-reflector.sh
alacritty # favourite terminal emulator

22
distros/arch/pm.sh Normal file
View file

@ -0,0 +1,22 @@
#!/bin/sh
cmd="pacman --noconfirm"
while getopts "icru" opt; do
case $opt in
i)
cmd="$cmd -S"
;;
u)
cmd="$cmd -Syyu"
;;
r)
cmd="$cmd -R"
;;
c)
cmd="$cmd -Q"
;;
esac
done
shift $((OPTIND-1))
$cmd $@

View file

@ -0,0 +1,31 @@
[options]
HoldPkg = pacman glibc yay
Architecture = auto
Color
CheckSpace
ParallelDownloads = 5
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist

View file

@ -0,0 +1,12 @@
#!/bin/sh
# Sets up fast mirrors on arch
if ! pacman -Q reflector; then
echo "reflector was not installed"
exit 1
fi
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
reflector -c NL -f 10 --threads 4 --save /etc/pacman.d/mirrorlist
echo "Server = arch.neo.faulty.nl/$repo/os/$arch" >> /etc/pacman.d/mirrorlist

View file

@ -0,0 +1,13 @@
#!/bin/sh
# Installs yay.
[ "$UID" = "0" ] || exit 0
yaytmpdir=$(mktemp -d)
git clone https://aur.archlinux.org/yay $yaytmpdir
oldpwd=$(pwd)
cd $yaytmpdir
makepkg -si
cd $oldpwd

View file

@ -1,158 +0,0 @@
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
static const unsigned int systrayonleft = 0; /* 0: systray in the right corner, >0: systray on left of status text */
static const unsigned int systrayspacing = 2; /* systray spacing */
static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
static const int showsystray = 1; /* 0 means no systray */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
static const char col_bg_inactive[] = "#444444";
static const char col_fg_inactive[] = "#bbbbbb";
static const char col_bg_highlight[] = "#ffaaaa";
static const char col_fg_highlight[] = "#000000";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_fg_inactive, col_bg_inactive, col_bg_inactive },
[SchemeSel] = { col_fg_highlight, col_bg_highlight, col_bg_highlight }
};
/* tagging */
static const char *tags[] = { "main", "term", "www", "chat", "5", "6", "7", "8", "9", };
static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, True, -1 },
{ "firefox", NULL, NULL, 1 << 2, False, -1 },
{ "discord", NULL, NULL, 1 << 3, False, -1 },
{ "Thunderbird", NULL, NULL, 2, False, -1 },
{ "stalonetray", NULL, NULL, 1, False, -1 },
{ "chrome", NULL, NULL, 4, False, -1 },
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
static const int nmaster = 1; /* number of clients in master area */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
// dmenu
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = {
"dmenu_run",
"-m", dmenumon,
"-fn", dmenufont,
"-nb", col_bg_inactive,
"-nf", col_fg_inactive,
"-sb", col_bg_highlight,
"-sf", col_fg_highlight, NULL };
// terminal
static const char *termcmd[] = { "alacritty", NULL };
// general & sys
static const char *locksaver[] = { "/usr/local/bin/dwm-lock", NULL };
static const char *vol_up[] = { "amixer", "set", "Master", "5%+", NULL };
static const char *vol_down[] = { "amixer", "set", "Master", "5%-", NULL };
static const char *vol_mute[] = { "amixer", "set", "Master", "toggle", NULL };
static const char *light_up[] = {"light", "-A", "5", NULL};
static const char *light_down[] = {"light", "-U", "5", NULL};
// screenshots
static const char *screenshot[] = {"flameshot", "full", "-c", NULL};
static const char *screenshot_partial[] = {"flameshot", "gui", "-c", NULL};
// kill dwm
static const char *dwmdie[] = {"/bin/sh", "-c", "pkill dwm-start && pkill dwm", "null"};
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ShiftMask, XK_d, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_e, spawn, {.v = dwmdie } },
{ MODKEY, XK_l, spawn, {.v = locksaver } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_h, incnmaster, {.i = +1} },
{ MODKEY|Mod1Mask, XK_u, incnmaster, {.i = -1} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ 0, XK_Print, spawn, {.v = screenshot } },
{ Mod1Mask, XK_Print, spawn, {.v = screenshot_partial } },
{ 0, XF86XK_AudioRaiseVolume, spawn, {.v = vol_up } },
{ 0, XF86XK_AudioLowerVolume, spawn, {.v = vol_down } },
{ 0, XF86XK_AudioMute, spawn, {.v = vol_mute } },
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = light_up} },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = light_down} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask|Mod1Mask, XK_q, quit, {0} },
};
/* button definitions */
/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};

View file

@ -1,5 +0,0 @@
#!/bin/sh
touch /tmp/$USER-screen.lock
i3lock ${@:--nefc "#000000"}
rm -f /tmp/$USER-screen.lock

View file

@ -1,18 +0,0 @@
#!/bin/sh
LITE=${LITE:-no}
xsetroot -solid black
start_apps() {
nm-applet &
flameshot &
discord &
firefox &
}
[ "$LITE" = "yes" ] || /usr/local/bin/dwm-status &
[ "$LITE" = "yes" ] || (sleep 1 && start_apps) &
feh -zZ --bg-scale $HOME/Pictures/background.*
[ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null

View file

@ -1,26 +0,0 @@
#!/bin/sh
xsetroot -solid black -name "starting dwm..."
#while loop to update statusbar with some goodies
while true; do
sleep 1
[ -f /tmp/$USER-screen.lock ] && continue
#memfreak to get it in MB
memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }')
memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
memfreak=$(((memtotal - memfree) / 1024))
#time
CLK=$(date +'%a %b %d %R:%S %Z')
#volume
VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]')
#loadavg
AVG=$(cat /proc/loadavg | cut -d ' ' -f -3)
#network stats in Bytes
NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}')
battper=$(cat /sys/class/power_supply/BAT0/capacity)
#this one is not so good, increases a delay of 1-2s of the updating.
#put it in the xsetrootname plz (tip of the day, do not put | as first char after "
xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK |"
done

View file

@ -1,7 +0,0 @@
#!/bin/sh
pushd ~/.local/dotfiles
./sync.sh 30-dwm.sh
popd
loginctl kill-user $USER

View file

@ -1,6 +0,0 @@
[Desktop Entry]
Encoding=UTF-8
Name=dwm
Comment=This session starts dwm
Exec=/usr/local/bin/dwm-start
Type=Application

View file

@ -1,9 +0,0 @@
profile school {
output "Iiyama North America PL2483H 1156290962278" mode 1920x1080 position 0,0
output eDP-1 mode 1920x1080 position 1920,0
}
#profile sharing {
# output HDMI-A-1 mode 1920x1080 position 0,1080
# output eDP-1 mode 1920x1080 position 0,0
#}

View file

@ -1 +0,0 @@
/home/didier/.local/dotfiles/./files/kitty/kitty.conf

View file

@ -1 +0,0 @@
@theme "Arc-Dark"

View file

@ -1,248 +0,0 @@
# Faulty's sway Config
set $mod Mod1
set $sup Mod4
set $terminal alacritty #sway-sensible-terminal
set $browser firefox
set $editor gedit
#font pango:monospace 8
font pango:DejaVu Sans Mono 8
#! Startup Applications
exec --no-startup-id kanshi
exec --no-startup-id xss-lock --transfer-sleep-lock -- swaylock --nofork
exec --no-startup-id gnome-keyring-daemon --start --components=ssh,secrets,pkcs11
exec --no-startup-id nm-applet
exec thunderbird
exec discord
set $lock swaylock -c "#000000"
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (Shift+r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id $lock, mode "default"
bindsym e exec --no-startup-id sway exit, mode "default"
bindsym s exec --no-startup-id $lock && systemctl suspend, mode "default"
bindsym h exec --no-startup-id $lock && systemctl hibernate, mode "default"
bindsym Shift+r exec --no-startup-id systemctl reboot, mode "default"
bindsym Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $sup+Delete mode "$mode_system"
bindsym $sup+l exec --no-startup-id $lock
#! Media
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_swaystatus
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_swaystatus
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_swaystatus
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_swaystatus
#! Light
bindsym XF86MonBrightnessUp exec light -A 10 # increase screen brightness
bindsym XF86MonBrightnessDown exec light -U 10 # decrease screen brightness
#! Customization
# class border backgr. text indicator child_border
client.focused #000000 #222299 #ffffff #000000 #222222
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a
client.unfocused #333333 #222222 #888888 #292d2e #222222
client.urgent #EF2929 #900000 #ffffff #900000 #900000
client.placeholder #000000 #0c0c0c #ffffff #000000 #0c0c0c
client.background #888A85
#exec --no-startup-id xsetroot -solid "#333333"
exec --no-startup-id swaybg -i ~/Pictures/background.png
no_focus [class="Fig" instance="fig" window_role="autocomplete"]
for_window [class="Fig" instance="fig" window_role="autocomplete"] border pixel 0
#! Navigation
set $up l
set $down k
set $left j
set $right semicolon
# use Mouse+Mod1 to drag floating windows to their wanted position
floating_modifier $sup
#! Applications
bindsym $sup+Return exec $terminal
bindsym $sup+q exec $browser
bindsym $sup+d exec rofi -show run
bindsym $sup+Shift+d exec --no-startup-id rofi -show drun
bindsym Ctrl+Print exec --no-startup-id grim ~/Pictures/Screenshots/$(date +"%d-%m-%y_%H:%M:%S").png
bindsym Print exec --no-startup-id grim - | xclip -selection clipboard -t image/png
# kill focused window
bindsym $sup+Shift+q kill
# change focus
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right 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+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right 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 orientation
bindsym $mod+h split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
#! Layouts
# change container layout (stacked, tabbed, toggle split)
bindsym $sup+s layout stacking
bindsym $sup+w layout tabbed
bindsym $sup+e layout toggle split
# 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 Mod1+d focus child
# move the currently focused window to the scratchpad
bindsym $sup+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $sup+minus scratchpad show
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
#! Workspaces
set $ws1 "1: main"
set $ws2 "2: browse"
set $ws3 "3: term"
set $ws4 "4: other"
set $ws5 "5: other"
set $ws6 "6: other"
set $ws7 "7: other"
set $ws8 "8: business"
set $ws9 "9: talk"
set $ws10 "10: misc"
#! Assignments
assign [class="Spotify"] $ws10
assign [class="firefox"] $ws2
assign [class="thunderbird"] $ws8
assign [class="discord"] $ws9
assign [class="jetbrains-idea-ce"] $ws1
bindsym $sup+$left workspace prev
bindsym $sup+$right workspace next
# alter.. youknow what is coming
bindsym $sup+Left workspace prev
bindsym $sup+Right workspace next
# switch to workspace
bindsym $sup+1 workspace number $ws1
bindsym $sup+2 workspace number $ws2
bindsym $sup+3 workspace number $ws3
bindsym $sup+4 workspace number $ws4
bindsym $sup+5 workspace number $ws5
bindsym $sup+6 workspace number $ws6
bindsym $sup+7 workspace number $ws7
bindsym $sup+8 workspace number $ws8
bindsym $sup+9 workspace number $ws9
bindsym $sup+0 workspace number $ws10
# move focused container to workspace
bindsym $sup+Shift+1 move container to workspace number $ws1
bindsym $sup+Shift+2 move container to workspace number $ws2
bindsym $sup+Shift+3 move container to workspace number $ws3
bindsym $sup+Shift+4 move container to workspace number $ws4
bindsym $sup+Shift+5 move container to workspace number $ws5
bindsym $sup+Shift+6 move container to workspace number $ws6
bindsym $sup+Shift+7 move container to workspace number $ws7
bindsym $sup+Shift+8 move container to workspace number $ws8
bindsym $sup+Shift+9 move container to workspace number $ws9
bindsym $sup+Shift+0 move container to workspace number $ws10
#! sway manage
# reload the configuration file
bindsym $sup+Shift+c reload
# restart sway inplace (preserves your layout/session, can be used to upgrade sway)
bindsym $sup+Shift+r restart
# exit sway (logs you out of your wayland session)
#bindsym $sup+Shift+e exec "swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your X session.' -B 'Yes, exit sway' 'sway exit'"
bindsym $sup+Shift+e exec wlogout
# edit config
bindsym $sup+Shift+Alt+c exec "$editor ~/.config/sway/config"
#! Resize
# resize window (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 windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
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
# same bindings, but for the arrow keys
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 or Mod1+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $sup+r mode "default"
}
bindsym $sup+r mode "resize"
input "1102:4629:ALP0016:00_044E:1215" {
tap enabled
natural_scroll enabled
}
bar {
position top
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command while ~/.config/sway/status.sh; do printf ''; done
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}

View file

@ -1,25 +0,0 @@
import socket
from datetime import datetime
from psutil import disk_usage, sensors_battery
from psutil._common import bytes2human
import socket
from subprocess import check_output
from sys import stdout
from time import sleep
def write(data):
stdout.write('%s\n' % data)
stdout.flush()
def refresh():
disk = f"{bytes2human(disk_usage('/').used)} / {bytes2human(disk_usage('/').total)} ({bytes2human(disk_usage('/').free)})"
hostname = socket.gethostname()
ip = socket.gethostbyname(hostname+".")
battery = int(sensors_battery().percent)
status = "Charging" if sensors_battery().power_plugged else "Discharging"
date = datetime.now().strftime('%h %d %A %H:%M:%S')
write(f"d: {disk} | n: {hostname} @ {ip} | b: {battery}% ({status.lower()[:3]}) | {date}")
while True:
refresh()
sleep(1)

View file

@ -1,16 +0,0 @@
#!/bin/sh
uptimef=$(uptime | cut -d ',' -f1 | cut -d ' ' -f4,5)
datef=$(date "+%a %F %H:%M:%S")
linux_version=$(uname -r | cut -d '-' -f1)
battery_status=$(cat /sys/class/power_supply/BAT0/status)
battery_percent=$(cat /sys/class/power_supply/BAT0/capacity)
#audio_volume=$(awk -F"[][]" '/Left:/ { print $2 }' <(amixer sget Master))
audio_volume=$(pamixer --get-volume)%
disk_usage=$(df -kh / | grep dev | awk '{print $5}')
mem_used=$(free | awk '/Mem/{printf("%.2f%"), $3/$2*100}')
local_ip=$(ip addr show wlp58s0 | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
# 💎 💻 💡 🔌 ⚡ 📁 \|
printf "📁 %3s | 💎 %7s | 💻 %s | 📶 %s | 🐧 %7s | 🔋 %7s | 🔉 %4s | %s\n" \
"$disk_usage" "$mem_used" "$uptimef" "$local_ip" "$linux_version" "$battery_percent% ($battery_status)" "$audio_volume" "$datef"
sleep 1

View file

@ -1,2 +0,0 @@
_ZSH_PREF_NO_PFETCH=0
_ZSH_PREF_NO_NONSENSE=0

View file

@ -1,49 +0,0 @@
__is_arch() {
. /etc/os-release
if [ "$ID" = "arch" ]; then return 0; else return 1; fi
}
pkg_once() {
if [ ! __is_arch ]; then
printf "This command is only for Arch Linux.\n"
return
fi
if [ ! -n "$1" ]; then
printf "Usage: pkg_once <PACKAGE_NAME> [command]\n"
printf "command is optional; if there is no command the package name is ran\n"
return
fi
printf "Installing $1...\n"
yay -S --noconfirm $1 > /dev/null
if [ ! -n "$2" ]; then $1; else $2; fi
printf "Remoiving $1..."
yay -R --noconfirm $1 > /dev/null
echo "done.\n"
}
rando () {
case $1 in
*|d|default) tr -dc A-Za-z0-9 </dev/urandom | head -c $2 ; echo '' ;;
s|special) tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c $2 ; echo ;;
esac
}
touchx () {
case $1 in
--shebang) content="#!/bin/sh"; file=$2 ;;
*) file=$1 ;;
esac
if [ -s $file ]; then
printf 'file exists'
return
fi
touch $file
if [ -n "$content" ]; then
printf '%s\n' $content >> $file
fi
chmod +x $file
printf '%s' $file
}
alias docurr="docker run -itd --rm --name current"

View file

@ -1,35 +0,0 @@
export GPG_TTY=$(tty)
source ~/.zsh_preferences
# paths
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
if [ $_ZSH_PREF_NO_NONSENSE != 1 ]; then
# ZSH
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="afowler"
plugins=(git docker docker-compose node zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
source ~/.zsh_scripts
# ALIASES
alias open="xdg-open"
alias nobeep="sudo modprobe -r pcspkr"
alias bl="sudo light -S"
alias kssh="kitty +kitten ssh"
alias get_idf='. $HOME/esp/esp-idf/export.sh'
alias get_rust='. $HOME/.cargo/env'
alias s="title $HOST && cmatrix -rs && clear"
# COSMETICS
if [ $_ZSH_PREF_NO_PFETCH != 1 ]; then fastfetch; fi
else
PS1="$(whoami)@$(cat /etc/hostname) $ "
fi
alias q="exit"
export PATH="${PATH}:/home/${USER}/.local/bin"
export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh"

View file

@ -1,100 +0,0 @@
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives
#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir = /
#DBPath = /var/lib/pacman/
#CacheDir = /var/cache/pacman/pkg/
#LogFile = /var/log/pacman.log
#GPGDir = /etc/pacman.d/gnupg/
#HookDir = /etc/pacman.d/hooks/
HoldPkg = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg =
#IgnoreGroup =
#NoUpgrade =
#NoExtract =
# Misc options
#UseSyslog
#Color
#NoProgressBar
CheckSpace
#VerbosePkgLists
ParallelDownloads = 5
# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.
#
# REPOSITORIES
# - can be defined here or included from another file
# - pacman will search repositories in the order defined here
# - local/custom mirrors can be added here or in separate files
# - repositories listed first will take precedence when packages
# have identical names, regardless of version number
# - URLs will have $repo replaced by the name of the current repo
# - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
# [repo-name]
# Server = ServerName
# Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#
# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

View file

@ -1,11 +0,0 @@
# Mirrorlist for NL setup
# Private mirror
Server = https://arch.neo.faulty.nl/$repo/os/$arch
# Public mirrors
Server = http://mirror.mikrogravitation.org/archlinux/$repo/os/$arch
Server = http://mirror.wtnet.de/archlinux/$repo/os/$arch
Server = http://mirror.pagenotfound.de/archlinux/$repo/os/$arch
Server = http://mirror.informatik.tu-freiberg.de/arch/$repo/os/$arch
Server = http://ftp.snt.utwente.nl/pub/os/linux/archlinux/$repo/os/$arch

View file

@ -1,3 +0,0 @@
alacritty
sway
kanshi

1
files/home/.vimrc → home/.vimrc Executable file → Normal file
View file

@ -1,2 +1,3 @@
set number
set relativenumber

15
hop.sh
View file

@ -1,15 +0,0 @@
#!/bin/sh
# need to hop? this script copies the important stuff.
tar \
--exclude={node_modules,target,dist,cache} \
-cvf \
${TAR_FILE:-backup.tar} \
~/.ssh \
~/.config \
~/.mozilla \
~/Documents \
~/Pictures \
~/code \
~/environments

View file

@ -1,4 +0,0 @@
curl
vim
zsh
docker

View file

@ -1,6 +0,0 @@
#!/bin/sh
# This file only installs what is needed for the sync to perform...
$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \
rsync

View file

@ -1,32 +0,0 @@
#!/bin/sh
$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \
zsh \
cmake # for fastfetch
# install fastfetch
[ -d /tmp/fastfetch ] || \
git clone https://github.com/LinusDierheimer/fastfetch /tmp/fastfetch
if [ ! -f /tmp/fastfetch/build/fastfetch ]; then
pushd /tmp/fastfetch
mkdir -p build
pushd build
cmake ..
cmake --build . --target fastfetch
$SUDO mv fastfetch /usr/local/bin/fastfetch
popd
popd
fi
# install omz
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended || echo "zsh not installed"
# favourite omz plugins
PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-autosuggestions $PL_DIR
PL_DIR=${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
[ -d "$PL_DIR" ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $PL_DIR
# set default shell
$SUDO usermod $USER --shell /bin/zsh

View file

@ -1,8 +0,0 @@
#!/bin/sh
HOME_FILES=${HOME_FILES:-./files/home}
ROOT_FILES=${ROOT_FILES:-./files/root}
# overwrite files but preserve files surrounding
rsync -av $HOME_FILES/ $HOME
$SUDO rsync -av $ROOT_FILES/ /

View file

@ -1,23 +0,0 @@
#!/bin/sh
PACKAGE_LIST=${PACKAGE_LIST:-./package.list}
GRAPHICAL_PACKAGE_LIST=${GRAPHICAL_PACKAGE_LIST:-./gpackage.list}
_APPLICATIONS=""
while read -r pkg; do
[ -z "$pkg" ] && continue
[ "$(echo "$pkg" | cut -c1)" = "#" ] && continue
_APPLICATIONS="$_APPLICATIONS $pkg"
done < "$PACKAGE_LIST"
if [ "${NO_GRAPHICS:-no}" = "no" ]; then
if [ -f "$GRAPHICAL_PACKAGE_LIST" ]; then
while read -r pkg; do
[ -z "$pkg" ] && continue
[ "$(echo "$pkg" | cut -c1)" = "#" ] && continue
_APPLICATIONS="$_APPLICATIONS $pkg"
done < "$GRAPHICAL_PACKAGE_LIST"
fi
fi
$SUDO $PM $PM_INSTALL $PM_NOCONFIRM $_APPLICATIONS

View file

@ -1,49 +0,0 @@
#!/bin/sh
# This file configures builds and installs DWM.
[ "${NO_GRAPHICS:-no}" = "yes" ] && return 0
# install dependencies
$SUDO $PM $PM_INSTALL $PM_NOCONFIRM \
feh \
network-manager-applet \
alsa-utils \
dstat \
curl \
flameshot \
dmenu \
i3lock
# clone
[ -d /tmp/dotfiles-dwm ] || git clone https://git.suckless.org/dwm /tmp/dotfiles-dwm
# config
cp ./files/dwm/config.h /tmp/dotfiles-dwm/config.h
# build, patch and install
pushd /tmp/dotfiles-dwm
# patches
curl https://dwm.suckless.org/patches/systray/dwm-systray-6.4.diff -o /tmp/dwm-systray.diff
git apply -3 /tmp/dwm-systray.diff
$SUDO make install
popd
# dwm boot/manage scripts
chmod +x ./files/dwm/*.sh
$SUDO cp ./files/dwm/dwm-start.sh /usr/local/bin/dwm-start
$SUDO cp ./files/dwm/dwm-status.sh /usr/local/bin/dwm-status
$SUDO cp ./files/dwm/dwm-sync.sh /usr/local/bin/dwm-sync
$SUDO cp ./files/dwm/dwm-lock.sh /usr/local/bin/dwm-lock
$SUDO chmod +x /usr/local/bin/dwm-*
# DM entry
$SUDO cp ./files/dwm/dwm.desktop /usr/share/xsessions/dwm.desktop
# background
rm -rf $HOME/Pictures/background.*
curl https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/9757d496-239b-46c5-baea-6873cbfe9b3d/ddkbeml-015b05e6-6f8f-471e-a3a4-1c4360127ea6.jpg -o $HOME/Pictures/background.jpg

126
sync.sh Executable file → Normal file
View file

@ -1,24 +1,118 @@
#!/bin/sh
SUDO=${SUDO:-sudo}
osreleaseprop() {
cat /etc/os-release | grep -e "^$1=" | sed 's/ID=//'
}
PM=${PM:-pacman}
PM_INSTALL=${PM_INSTALL:--S}
PM_NOCONFIRM=${PM_NOCONFIRM:---noconfirm}
set -e
main() {
if [ ! -z "$@" ]; then
. ./scripts/$@
exit 0
elevated() {
s=${SUDO:-sudo}
if [ ! "$s" = "none" ]; then
if ! which $s &> /dev/null; then
echo "command \"$s\" not found"
exit 1
fi
else
s=""
fi
for script in ./scripts/* ; do
echo "# exec $script"
. $script
$s $@
}
DISTRO=$(osreleaseprop ID)
if [ ! -d "distros/$DISTRO" ]; then
echo "$DISTRO is not supported."
exit 1
fi
pm() {
elevated "sh distros/$DISTRO/pm.sh $@"
}
install_package_list() {
pkgs=""
[ -f "distros/${1:-$DISTRO}/package.list" ] || return 1
for pkg in $(cat distros/${1:-$DISTRO}/package.list | sed 's/#.*$//'); do
pkgs="$pkgs $pkg"
done
pm -i $pkgs
}
run_scripts() {
cmd=$1
shift
case $cmd in
sys)
dir="distros/${1:-$DISTRO}/sys-scripts"
[ -d "$dir" ] || return
for s in $(ls $dir); do
echo "# running $dir/$s..."
elevated sh $dir/$s || exit 1
done
;;
user)
dir="distros/${1:-$DISTRO}/user-scripts"
[ -d "$dir" ] || return
for s in $(ls $dir); do
echo "# running $dir/$s..."
sh $dir/$s || exit 1
done
;;
esac
}
overlay() {
[ -d "distros/${1:-$DISTRO}/root" ] || return 0
elevated cp -r distros/${1:-$DISTRO}/root /
}
__step_update() {
echo "# updating system..."
pm -u
}
__step_install_package_list() {
echo "# installing package lists..."
install_package_list any
install_package_list
}
__step_run_system_scripts() {
echo "# running system scripts..."
run_scripts sys any
run_scripts sys
}
__step_run_user_scripts() {
echo "# running user scripts..."
run_scripts user any
run_scripts user
}
__step_overlay() {
echo "# overlaying root directories..."
overlay any
overlay
}
__step_link_home() {
echo "# linking all home files..."
trackingfile=".dotfiles/$(git rev-parse HEAD)-links"
for item in $(find ./home -type f); do
path=$(echo $item | sed "s/\.\/home//")
[ -z "$path" ] && continue
path="$HOME$path"
mkdir -p $(dirname $path) &> /dev/null
ln $item $path && echo "$path" >> $trackingfile
done
}
main "$@"
mkdir -p .dotfiles &> /dev/null
echo "# OK"
if [ -n "$1" ]; then
$(printf "__step_%s" "$1")
else
__step_update
__step_install_package_list
__step_run_system_scripts
__step_run_user_scripts
__step_overlay
fi

10
unlink.sh Normal file
View file

@ -0,0 +1,10 @@
#!/bin/sh
for linkfile in $@; do
echo "# processing linkfile $linkfile..."
for link in $(cat $linkfile); do
echo "# unlinking $link..."
unlink $link
done
rm -rf $linkfile
done