Compare commits

..

No commits in common. "61aa1b72508a1ba7c1de2f7e72c0f51612582a9b" and "f40f8f673c9707e36ac469f0d6a175a590407ecf" have entirely different histories.

44 changed files with 2678 additions and 5 deletions

View File

@ -0,0 +1,10 @@
[Default]
save_dir=$XDG_PICTURES_DIR/Screenshots
#save_filename_format=swappy-%Y%m%d-%H%M%S.png
#show_panel=false
#line_size=5
#text_size=20
#text_font=sans-serif
#paint_mode=brush
#early_exit=false
#fill_shape=false

View File

View File

@ -0,0 +1,444 @@
# Config for sway
#
# Read `man 5 sway` for a complete reference.
# $Mod = WINDOWS key or Super key or Mod4
# Mod1 = ALT key
# Control = CTRL key
# Shift = SHIFT key
# Escape = ESCAPE key
# Return = ENTER or RETURN key
# KP_Enter = Keypad Enter
# Pause = PAUSE key
# Print = PRINT key
# Tab = TAB key
### Variables
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
##############################
########### Input ############
##############################
### Keyboard, Mouse and others configuration
# Keyboard config https://man.archlinux.org/man/xkeyboard-config.7
# Sway input https://man.archlinux.org/man/sway-input.5
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
# generic/general options
input * {
# Keyboard
xkb_layout "ch"
xkb_variant ""
xkb_model "pc105"
#xkb_options "grp:win_space_toggle"
# Touchpad
tap enabled
tap_button_map lrm
scroll_method two_finger
natural_scroll disabled
}
# slightly decrease mouse speed
input "1133:16500:Logitech_G305" pointer_accel -0.3
##############################
########## Outputs ###########
##############################
# You can get the names of your outputs by running: swaymsg -t get_outputs
set $output-1 "Acer Technologies XV272U V R307036FE4208"
output $output-1 mode 2560x1440@170Hz
output $output-1 position 0 0
output $output-1 scale 1.25
output $output-1 subpixel rgb
output $output-1 adaptive_sync on
set $output-2 "HP Inc. OMEN 27q CNC3131C9P"
output $output-2 mode 2560x1440@165Hz
output $output-1 position 2048 0
output $output-2 scale 1.25
output $output-2 subpixel rgb
output $output-2 adaptive_sync on
# workspace to displays
workspace 1 output $output-1
workspace 2 output $output-1
workspace 3 output $output-1
workspace 4 output $output-1
workspace 5 output $output-1
workspace 6 output $output-1
workspace 7 output $output-2
workspace 8 output $output-2
workspace 9 output $output-2
workspace 10 output $output-2
##############################
############ Idle ############
##############################
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
# -c 000000 sets the color in RGB (no alpha supported)
# use -i to set an image
exec swayidle -w \
timeout 300 'swaylock -f -e -i "$HOME/.cache/backgrounds/lockscreen"' \
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
before-sleep 'swaylock -f -e -i "$HOME/.cache/backgrounds/lockscreen"' \
before-sleep 'playerctl pause'
### Key bindings
#
# Basics:
# Kill focused window
bindsym $mod+q kill
bindsym $mod+Shift+q kill
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+r reload
# Exit sway (logs you out of your Wayland session)
#bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
# Window focus
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move windows
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow 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
##############################
######### Workspaces #########
##############################
# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
bindsym $mod+F1 workspace number 7
bindsym $mod+F2 workspace number 8
bindsym $mod+F3 workspace number 9
bindsym $mod+F4 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1; workspace 1
bindsym $mod+Shift+2 move container to workspace number 2; workspace 2
bindsym $mod+Shift+3 move container to workspace number 3; workspace 3
bindsym $mod+Shift+4 move container to workspace number 4; workspace 4
bindsym $mod+Shift+5 move container to workspace number 5; workspace 5
bindsym $mod+Shift+6 move container to workspace number 6; workspace 6
bindsym $mod+Shift+7 move container to workspace number 7; workspace 7
bindsym $mod+Shift+8 move container to workspace number 8; workspace 8
bindsym $mod+Shift+9 move container to workspace number 9; workspace 9
bindsym $mod+Shift+0 move container to workspace number 10; workspace 10
bindsym $mod+Shift+F1 move container to workspace number 7; workspace 7
bindsym $mod+Shift+F2 move container to workspace number 8; workspace 8
bindsym $mod+Shift+F3 move container to workspace number 9; workspace 9
bindsym $mod+Shift+F4 move container to workspace number 10; workspace 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
# next/previous workspace
bindsym $mod+Tab workspace next
bindsym $mod+Shift+Tab workspace prev
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+o split h
bindsym $mod+v split v
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+z layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+Shift+f fullscreen toggle
# Toggle the current focus between tiling and floating mode
bindsym $mod+f floating toggle
# Swap focus between the tiling area and the floating area
# TODO haven't ever used this afaik
#bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
# focus the child container
bindsym $mod+d focus child
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
#bindsym $mod+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 $mod+minus scratchpad show
# Screenlock, logout, reboot, shutdown...
# press $mod (super) and X to exit - check toolbar for next choices
set $mode_system "<b>[L]</b> lock, <b>[E]</b> logout, <b>[R]</b> reboot, <b>[S]</b> shutdown, <b>[U]</b> suspend"
bindsym $mod+x mode $mode_system
mode --pango_markup $mode_system {
bindsym l exec ~/.config/sway/sway-scripts/exit.sh lock, mode "default"
bindsym e exec ~/.config/sway/sway-scripts/exit.sh logout, mode "default"
bindsym r exec ~/.config/sway/sway-scripts/exit.sh reboot, mode "default"
bindsym s exec ~/.config/sway/sway-scripts/exit.sh shutdown, mode "default"
bindsym u exec ~/.config/sway/sway-scripts/exit.sh suspend, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
# launch programs in the right workspaces
bindsym $mod+w mode "$layout"
set $layout full (f)
mode "$layout" {
bindsym f exec PLACEHOLDER
bindsym Return mode "default"
bindsym Escape mode "default"
}
# detect XWayland windows and hightlight them differently
for_window [shell="xwayland"] title_format "[XWayland] %title"
#for_window [shell="xwayland"] client.focused #592c2c #592c2c #eeeeee #592c2c
#for_window [shell="xwayland"] client.unfocused #310202 #310202 #eeeeee #310202
#for_window [shell="xwayland"] client.focused_inactive #310202 #310202 #eeeeee #310202
#for_window [shell="xwayland"] client.urgent #a50909 #a50909 #eeeeee #a50909
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
# choose your font
font pango:Fira Mono 9
##############################
# Applications at boot #
##############################
# Authentication dialog
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
# nextcloud
exec --no-startup-id nextcloud --background
# network
exec --no-startup-id nm-applet
# Protonmail Bridge
exec --no-startup-id protonmail-bridge -no-window
# Start KopiaUI
exec --no-startup-id /opt/KopiaUI/kopia-ui
# Easy Effects
exec --no-startup-id easyeffects --gapplication-service
# Blueman
exec --no-startup-id blueman-applet
# notifications
exec --no-startup-id dunst
# hp printer
exec --no-startup-id python /usr/bin/hp-systray --force-startup
# disk management
exec --no-startup-id udiskie --no-automount --tray
# kde connect
exec --no-startup-id /usr/lib/kdeconnectd
exec --no-startup-id kdeconnect-indicator
# Start sway-session.target for sway-specific stuff and import environment
exec_always "systemctl --user import-environment; systemctl --user start sway-session.target"
##############################
# Keyboard shortcuts #
##############################
# Your preferred application launcher
set $menu wofi --show drun -i --matching fuzzy
# Start your launcher
bindsym ctrl+mod1+a exec $menu
# preferred terminal emulator
set $term kitty
# terminal
bindsym ctrl+mod1+Return exec $term;focus
# pavucontrol
bindsym control+mod1+u exec --no-startup-id pavucontrol;focus
# joplin
bindsym control+mod1+n exec --no-startup-id joplin-desktop --enable-features=UseOzonePlatform --ozone-platform=wayland;focus
# texteditor
bindsym ctrl+mod1+e exec --no-startup-id emacs;focus
# file manager
bindsym ctrl+mod1+t exec --no-startup-id thunar;focus
# libreoffice
bindsym ctrl+mod1+l exec --no-startup-id libreoffice;focus
# browser
bindsym control+mod1+f exec --no-startup-id firefox;focus
# jellyfin media player
bindsym ctrl+mod1+j exec --no-startup-id jellyfinmediaplayer;focus
# mail
bindsym ctrl+mod1+b exec --no-startup-id thunderbird;focus
# Screenshots
bindsym Print exec --no-startup-id grim -g "$(slurp)" - | swappy -f -
bindsym Control+Print exec --no-startup-id sleep 2s && grim -g "$(slurp)" - | swappy -f -
##############################
# Audio & Media Control #
##############################
bindsym XF86AudioRaiseVolume exec --no-startup-id bash $HOME/scripts/dunst/dunst-volume.sh up
bindsym XF86AudioLowerVolume exec --no-startup-id bash $HOME/scripts/dunst/dunst-volume.sh down
bindsym XF86AudioMute exec --no-startup-id bash $HOME/scripts/dunst/dunst-volume.sh mute
bindsym XF86AudioPlay exec --no-startup-id ~/scripts/polybar/player-mpris-tail.py play-pause &
bindsym XF86AudioNext exec --no-startup-id ~/scripts/polybar/player-mpris-tail.py next &
bindsym XF86AudioPrev exec --no-startup-id ~/scripts/polybar/player-mpris-tail.py previous &
bindsym XF86AudioStop exec --no-startup-id playerctl stop
##############################
# xbacklight #
##############################
# TODO test
bindsym $mod+Shift+u exec --no-startup-id bash $HOME/scripts/dunst/dunst-backlight.sh up # increase screen brightness
bindsym $mod+Shift+d exec --no-startup-id bash $HOME/scripts/dunst/dunst-backlight.sh down # decrease screen brightness
bindsym XF86MonBrightnessUp exec --no-startup-id bash $HOME/scripts/dunst/dunst-backlight.sh up # increase screen brightness
bindsym XF86MonBrightnessDown exec --no-startup-id bash $HOME/scripts/dunst/dunst-backlight.sh down # decrease screen brightness
##############################
# Borders #
##############################
#default_border pixel 2
default_border normal 2
##############################
####### window control #######
##############################
# don't idle for these windows
for_window [class=".*"] inhibit_idle fullscreen # fullscreen xorg
for_window [app_id=".*"] inhibit_idle fullscreen # fullscreen wayland
for_window [app_id="org.jellyfin.jellyfinmediaplayer"] inhibit_idle visible
# enable floating
for_window [app_id="[Tt]hunar" title="Dateivorgangsfortschritt"] floating enable
for_window [app_id="[Tt]hunar" title="Ersetzen von Dateien bestätigen"] floating enable
for_window [app_id="qalculate-gtk"] floating enable
for_window [app_id="org.kde.kdeconnect.daemon" title="^Datei(en)? (wird|werden) empfangen .* KDE Connect-Dienst$"] floating enable
# Datei wird empfangen (28 % von 25.5 MiB ) — KDE Connect-Dienst
# Dateien werden empfangen — KDE Connect-Dienst
for_window [app_id="org.kde.kdeconnect.daemon" title="^Senden an .* KDE Connect-Dienst$"] floating enable
# Senden an moto g play - 2024 — KDE Connect-Dienst
for_window [app_id="engrampa" title="Archiv entpacken"] floating enable
for_window [app_id="engrampa" title="Komprimieren"] floating enable
for_window [app_id="engrampa" title="Entpacken"] floating enable
#########################################
##### statusbar #####
#########################################
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar swaybar_command waybar
#bar {
# position bottom
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
# status_command while date +'%H:%M | %Y-%m-%d %p'; do sleep 1; done
# colors {
# statusline #ffffff
# background #323232
# inactive_workspace #323232 #323232 #5c5c5c
# }
#}
#######################################
##### inluce other configurations #####
#######################################
# include local configurations
include ./config.d/*
# include system configurations
include @sysconfdir@/sway/config.d/*

View File

@ -0,0 +1,2 @@
output * background "$HOME/.cache/backgrounds/desktop" fill
#output * background '#31022d' solid_color

View File

@ -0,0 +1,21 @@
{
"border": "pixel",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1038,
"width": 1916,
"x": 0,
"y": 0
},
"marks": [],
"name": "Kitty",
"percent": 1,
"swallows": [
{
"class": "^kitty$",
"instance": "^kitty$"
}
],
"type": "con"
}

View File

@ -0,0 +1,97 @@
{
"border": "normal",
"floating": "auto_off",
"layout": "tabbed",
"marks": [],
"percent": null,
"type": "con",
"nodes": [
{
"border": "pixel",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1038,
"width": 1916,
"x": 0,
"y": 0
},
"marks": [],
"name": "Mozilla Firefox",
"percent": 0.25,
"swallows": [
{
"class": "^firefox$",
"instance": "^Navigator$",
"window_role": "^browser$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1038,
"width": 1916,
"x": 0,
"y": 0
},
"marks": [],
"name": "Mozilla Thunderbird",
"percent": 0.25,
"swallows": [
{
"class": "^thunderbird$",
"instance": "^Mail$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1056,
"width": 1916,
"x": 2,
"y": 2
},
"marks": [],
"name": "Joplin",
"percent": 0.25,
"swallows": [
{
"class": "^Joplin$",
"instance": "^joplin$",
"title": "^Joplin$"
}
],
"type": "con"
},
{
"border": "pixel",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 1038,
"width": 1916,
"x": 2,
"y": 20
},
"marks": [],
"name": "Discord",
"percent": 0.25,
"swallows": [
{
"class": "^discord$",
"instance": "^discord$",
"title": ".*Discord$"
}
],
"type": "con"
}
]
}

View File

@ -0,0 +1,21 @@
{
"border": "pixel",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 640,
"width": 672,
"x": 0,
"y": 0
},
"marks": [],
"name": "Doom Emacs",
"percent": 1,
"swallows": [
{
"class": "^Emacs$",
"instance": "^emacs$"
}
],
"type": "con"
}

View File

View File

@ -0,0 +1,21 @@
#!/bin/bash
i3-msg 'mode "default"'
# workspace 1
i3-msg "workspace 1; append_layout ~/.config/i3/layouts/layout-default/workspace-1.json"
(kitty &)
# workspace 2
i3-msg "workspace 2; append_layout ~/.config/i3/layouts/layout-default/workspace-2.json"
(firefox &)
(thunderbird &)
(joplin-desktop &)
(discord &)
# workspace 3
i3-msg "workspace 3; append_layout ~/.config/i3/layouts/layout-default/workspace-3.json"
(emacs &)

View File

@ -0,0 +1,27 @@
#!/usr/bin/env sh
case "$1" in
lock)
swaylock -f -e -i "$HOME/.cache/backgrounds/lockscreen"
;;
logout)
swaymsg exit
;;
suspend)
systemctl suspend
;;
hibernate)
exit 1
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0

172
arch-config/.kopiaignore Normal file
View File

@ -0,0 +1,172 @@
.aegisub
.android
.arduino*
.aspnet
.atom
.att_backups
.audacity-data
.bin
.bitmonero
.cache
.cargo
.cddb
.cemu
.chia
.ComicTagger
.conda
.config
.cups
.docker
.doom.d
.dotnet
.droidcam
.dvdcss
.dwarffortress
.easystroke
.eclipse
.electron
.electron-gyp
.elvish
.emacs.d
.fltk
.fontconfig
.gftp
.ghc
.gkrellm2
.gnome
.gnupg
.gphoto
.gradle
.grip
.grsync
.hedgewars
.hplip
.ICAClient
.icons
.idlerc
.i-nex
.iris-installer
.java
.Kanton\ TG
.kde4
.keras
.kodi
.local
.m2
.mbwarband
.mc
.minecraft
.minetest
.mono
.moonchild productions
.mozilla
.mplayer
.mysql
.node-gyp
.npm
.nuget
.nv
.nx
.openjfx
.oracle_jre_usage
.paradoxinteractive
.password-store_bak
.pipewire-media-session
.processing
.purple
.putty
.pylint.d
.qt
.recoll
.repoconfig
.tooling
.tox
.w3m
.webclipse
.x2go
.x2goclient
.omegat
.rustup
.scenebuilder
.shared-ringdb
.skiko
.thumbnails
.terminfo
.paradoxlauncher
.password-store
.pcloud
.Prison\ Architect
.This\ War\ of\ Mine
.ansible
.cups
.pki
.psensor
.qwinff
.screenlayout
.steam
.subversion
.Superposition
.swt
.thunderbird
.Trash
.Valley
.var
.vnc
.vscode-oss
.yarn
winelauncher
.bash_history
.Xresources
.face
.zoom
anaconda3
Android
Arduino
AshTray
Bilder
cacheDir
Calibre-Bibliothek
corectrl
DeemixDL
Desktop
Dokumente
Downloads
eFisc
FreezerMusic
GitProjects
GNS3
go
gPodder
Grub-themes
Information Factory
lineageos-cache
MangoHud
Musik
Nextcloud
Öffentlich
.bashrc
.gitconfig
.seltheme
.kopiaignore
.xinitrc
.gtkrc-2.0
LICENSE
README.md
.lyxauth
old_dat
packettracer
pCloudDrive
__pycache__
PycharmProjects
REW
Schreibtisch
scripts
sketchbook
SpotiFlyer
steamvr
undefined
VMsSSD
vmware
Vorlagen
workspace
onedrive-bbw

View File

@ -33,9 +33,18 @@ EOF
# get script directory # get script directory
scriptloc="$BASH_SOURCE" scriptloc="$BASH_SOURCE"
#scriptpath="$(dirname "$scriptloc")"
# change to home
#cd "$HOME"
# remove old installs
#rm -rf ~/configs
# Use temporary directory for download # Use temporary directory for download
# FIXME probably lots of issues at first
tempdir="$(mktemp -d)" tempdir="$(mktemp -d)"
#cd "$tempdir"
echo "Checking config file" echo "Checking config file"
@ -95,17 +104,37 @@ fi
# make new backup # make new backup
echo Creating backup echo Creating backup
mkdir -p ~/old_dat/ mkdir -p ~/old_dat/.config
mkdir -p ~/old_dat/.doom.d
#mkdir -p ~/old_dat/.easystroke
mkdir -p ~/old_dat/.mozilla mkdir -p ~/old_dat/.mozilla
mkdir -p ~/old_dat/scripts mkdir -p ~/old_dat/scripts
mkdir -p ~/old_dat/.elvish
mkdir -p ~/old_dat/.ssh mkdir -p ~/old_dat/.ssh
# make subdirectories # make subdirectories
mkdir -p ~/old_dat/.local/share mkdir -p ~/old_dat/.local/share
#config folders #config folders
if [[ -d ~/.config/ ]]; then if [[ -d ~/.config/MangoHud ]]; then
rsync -ah ~/.config/ ~/old_dat/ rsync -ah ~/.config/MangoHud ~/old_dat/.config/
fi
if [[ -d ~/.config/fish ]]; then
rsync -ah ~/.config/fish ~/old_dat/.config/
fi
if [[ -d ~/.config/gtk-3.0 ]]; then
rsync -ah ~/.config/gtk-3.0 ~/old_dat/.config/
fi
if [[ -d ~/.config/sway ]]; then
rsync -ah ~/.config/sway ~/old_dat/.config/
fi
if [[ -d ~/.config/polybar ]]; then
rsync -ah ~/.config/polybar ~/old_dat/.config/
fi
# doom.d folder
if [[ -d ~/.doom.d ]]; then
rsync -ah ~/.doom.d ~/old_dat/
fi fi
# .ssh folder # .ssh folder
@ -113,6 +142,11 @@ if [[ -d ~/.ssh ]]; then
rsync -ah ~/.ssh ~/old_dat/ rsync -ah ~/.ssh ~/old_dat/
fi fi
# easystroke
if [[ -d ~/.easystroke ]]; then
rsync -ah ~/.easystroke ~/old_dat/
fi
# local folder # local folder
if [[ -d ~/.local/share/applications ]]; then if [[ -d ~/.local/share/applications ]]; then
rsync -ah ~/.local/share/applications/ ~/old_dat/.local/share/ rsync -ah ~/.local/share/applications/ ~/old_dat/.local/share/
@ -184,8 +218,13 @@ fi
cp -r "$tempdir/arch-config/.face" ~/ cp -r "$tempdir/arch-config/.face" ~/
cp -r "$tempdir/arch-config/.gtkrc-2.0" ~/ cp -r "$tempdir/arch-config/.gtkrc-2.0" ~/
cp -r "$tempdir/arch-config/.gitconfig" ~/ cp -r "$tempdir/arch-config/.gitconfig" ~/
cp -r "$tempdir/arch-config/.xinitrc" ~/
cp -r "$tempdir/arch-config/.kopiaignore" ~/
echo Copied files echo Copied files
# make .xinitrc executable
chmod +x ~/.xinitrc
#copy scripts #copy scripts
cp -r "$tempdir/arch-config/scripts/" ~/ cp -r "$tempdir/arch-config/scripts/" ~/
@ -203,6 +242,40 @@ cp "$tempdir/arch-config/.Xdefaults" ~/
# Set xdg-user-dirs as environment variables # Set xdg-user-dirs as environment variables
ln -sf "$HOME/.config/user-dirs.dirs" "$HOME/.config/environment.d/user-dirs.dirs.conf" ln -sf "$HOME/.config/user-dirs.dirs" "$HOME/.config/environment.d/user-dirs.dirs.conf"
echo
cat <<EOF
##############################
##### Per Device Settings ####
##############################
EOF
# lupusregina
# TODO analyse parts necessary for Wayland with Alita
if [ "$(hostname)" == "lupusregina" ]; then
echo "Applying overrides for $(hostname)"
# polybar dpi
polybardpi="$(cat ~/configs/arch-config/per-device/lupusregina/polybar-dpi-override.ini)"
awk -v polybardpi="$polybardpi" '/;per-device dpi insert/{print;print polybardpi;next}1' ~/.config/polybar/i3config.ini >/tmp/i3config.ini
cp /tmp/i3config.ini ~/.config/polybar/i3config.ini
# xresources dpi
xftdpi="$(cat ~/configs/arch-config/per-device/lupusregina/xresources-dpi-override)"
awk -v xftdpi="$xftdpi" '/!per-device dpi insert/{print;print xftdpi;next}1' ~/.Xdefaults >/tmp/.Xdefaults
cp /tmp/.Xdefaults ~/.Xdefaults
sudo cp ~/configs/arch-config/per-device/lupusregina/10-monitor.conf /etc/X11/xorg.conf.d/
sudo cp ~/configs/arch-config/per-device/lupusregina/20-amdgpu.conf /etc/X11/xorg.conf.d/
fi
# copy chosen image for lockscreen and desktop
backgroundimage="/home/exu/Bilder/Art/artstation/dk-lan/artstation_14224733_55806391_月半与鬼哭.jpg"
mkdir -p "$HOME/.cache/backgrounds"
if [ -f "$backgroundimage" ]; then
cp "$backgroundimage" "$HOME/.cache/backgrounds/desktop"
cp "$backgroundimage" "$HOME/.cache/backgrounds/lockscreen"
else
printf "\033[38;2;200;20;20mCouldn't find background image\n\033[0m"
fi
echo echo
cat <<EOF cat <<EOF
#################### ####################
@ -215,6 +288,22 @@ echo "Installing bash cat"
mkdir "$tempdir/bash-cat-with-cat" mkdir "$tempdir/bash-cat-with-cat"
git clone https://github.com/RealStickman/bash-cat-with-cat.git "$tempdir/bash-cat-with-cat" &>/dev/null git clone https://github.com/RealStickman/bash-cat-with-cat.git "$tempdir/bash-cat-with-cat" &>/dev/null
cp "$tempdir/bash-cat-with-cat/cat.sh" "$HOME/scripts/pieces/cat.sh" cp "$tempdir/bash-cat-with-cat/cat.sh" "$HOME/scripts/pieces/cat.sh"
#rm -rf ./bash-cat-with-cat
echo
cat <<EOF
########################################
############### Autostart ##############
########################################
EOF
# create autostart directory
mkdir -p ~/.config/autostart/
# copy corectrl desktop file
if [[ $(pacman -Q | grep corectrl) ]]; then
cp /usr/share/applications/org.corectrl.CoreCtrl.desktop ~/.config/autostart/org.corectrl.CoreCtrl.desktop
fi
echo echo
cat <<EOF cat <<EOF
@ -223,6 +312,13 @@ cat <<EOF
######################################## ########################################
EOF EOF
# generate betterlockscreen cache image in background
#imagepath="/home/exu/Bilder/Backgrounds/artstation/dk-lan/artstation_14224733_55806391_月半与鬼哭.jpg"
#if [ -f "$imagepath" ]; then
# betterlockscreen -u "$imagepath" &
# pids="$pids $!"
#fi
# reload systemd user scripts # reload systemd user scripts
systemctl --user daemon-reload systemctl --user daemon-reload
@ -232,6 +328,11 @@ if [[ $(pacman -Q | grep vmware-workstation) ]]; then
sudo systemctl enable --now vmware-usbarbitrator.service || echo "Service failed, continuing" sudo systemctl enable --now vmware-usbarbitrator.service || echo "Service failed, continuing"
fi fi
# FIXME temporary
#if [ -f "/etc/pipewire/pipewire.conf" ]; then
# sudo rm "/etc/pipewire/pipewire.conf"
#fi
# FIXME temporary migrate container store # FIXME temporary migrate container store
if [ -f "$HOME/.config/containers/storage.conf" ]; then if [ -f "$HOME/.config/containers/storage.conf" ]; then
rm "$HOME/.config/containers/storage.conf" rm "$HOME/.config/containers/storage.conf"
@ -320,7 +421,13 @@ EOF
sudo chown root:root -R /etc/sudoers.d/ sudo chown root:root -R /etc/sudoers.d/
sudo chmod 600 -R /etc/sudoers.d/ sudo chmod 600 -R /etc/sudoers.d/
# xfce settings
# disable screensaver & locker
/usr/bin/xfconf-query -c xfce4-session -n -t bool -p /startup/screensaver/enabled -s false
#make bash scripts executable #make bash scripts executable
chmod +x -R ~/.config/polybar/
chmod +x -R ~/.config/sway/scripts
chmod +x -R ~/scripts chmod +x -R ~/scripts
# make applications executable # make applications executable
@ -346,10 +453,33 @@ if [[ -f ~/.config/emacs/bin/doom ]]; then
fi fi
# disable freedesktop notification daemon # disable freedesktop notification daemon
#if [[ -f "/usr/share/dbus-1/services/org.freedesktop.Notifications.service" ]]; then if [[ -f "/usr/share/dbus-1/services/org.freedesktop.Notifications.service" ]]; then
# sudo mv /usr/share/dbus-1/services/org.freedesktop.Notifications.service /usr/share/dbus-1/services/org.freedesktop.Notifications.service.disabled sudo mv /usr/share/dbus-1/services/org.freedesktop.Notifications.service /usr/share/dbus-1/services/org.freedesktop.Notifications.service.disabled
fi
# dunst
pkill dunst && nohup dunst &
# reload .Xresources
# TODO fails without display
#if [[ -f "$HOME/.Xresources" ]]; then
# xrdb ~/.Xresources
#fi #fi
# execute feh
#if [[ -f "$HOME/.fehbg" ]]; then
# "$HOME/.fehbg"
#fi
#if ps aux | grep -E "\si3(\s|$)" &>/dev/null; then
# i3-msg restart 1>/dev/null
#fi
if [ $XDG_SESSION_DESKTOP == "sway" ]; then
swaymsg reload
echo "Reloaded sway"
fi
# wait for all background jobs to finish # wait for all background jobs to finish
wait $pids && echo "Finished background jobs" wait $pids && echo "Finished background jobs"

View File

@ -0,0 +1,15 @@
#!/bin/bash
awk 'BEGIN{
s="/\\/\\/\\/\\/\\"; s=s s s s s s s s;
for (colnum = 0; colnum<77; colnum++) {
r = 255-(colnum*255/76);
g = (colnum*510/76);
b = (colnum*255/76);
if (g>255) g = 510-g;
printf "\033[48;2;%d;%d;%dm", r,g,b;
printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b;
printf "%s\033[0m", substr(s,colnum+1,1);
}
printf "\n";
}'

View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
set -euo pipefail
# prompt for password
echo -n "Password: "
read -s -r pass
echo
# prompt a second time
echo -n "Repeat Password: "
read -s -r pass2
echo
# check correctness
if [ ! "$pass" = "$pass2" ]; then
echo "Passwords don't match!"
exit
fi
# go to home dir
cd "$HOME"
# get current date
currdate="$(date +%Y-%m-%d)"
# create backup directory
mkdir -p "$HOME/evolution-mail-backup"
mkdir -p "$HOME/evolution-mail-backup/.config"
mkdir -p "$HOME/evolution-mail-backup/.local"
# copy stuff to backup directory
cp -r "$HOME/.config/evolution/" "$HOME/evolution-mail-backup/.config/"
cp -r "$HOME/.local/share/evolution/" "$HOME/evolution-mail-backup/.local/"
# create archive from backup
tar -c -I"zstd -19 -T0" -f evolution-mail-backup-${currdate}.tar.zst evolution-mail-backup/
# remove backup dir
rm -rf "$HOME/evolution-mail-backup"
# encrypt backup archive
echo '$pass' | gpg -c --batch --yes --passphrase-fd 0 evolution-mail-backup-${currdate}.tar.zst
# remove unencrypted archive
rm evolution-mail-backup-${currdate}.tar.zst
# put encrypted archive into backups folder
mv evolution-mail-backup-${currdate}.tar.zst.gpg "$HOME/Nextcloud/backups/"
# remove more than the last 3 backups
#find "$HOME/Nextcloud/backups/" -name "evolution-mail-backup-*\.tar.zst.gpg" | sort -r | tail -n +4
mapfile -t old_backups < <( find "$HOME/Nextcloud/backups/" -name "evolution-mail-backup-*\.tar.zst.gpg" | sort -r | tail -n +4 )
for backup in "${old_backups[@]}"; do
echo "Removing old backup. $backup"
rm "$backup"
done

View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -euo pipefail
: '
# give password as argument
if [ $# -eq 1 ]; then
pass=$1
elif [ $# -eq 0 ]; then
echo "Please provide a passphrase"
$(exit 1); echo "$?"
else
echo "Please only insert one argument"
$(exit 1); echo "$?"
fi
'
# prompt for password
echo -n "Password: "
read -s -r pass
echo
# go to home dir
cd "$HOME"
# find latest backup version
latestbackup="$(find "$HOME/Nextcloud/backups/" -name "evolution-mail-backup-*\.tar.zst.gpg" | sort | tail -1)"
# decrypt backup
echo '$pass' | gpg --decrypt-file --batch --yes --passphrase-fd 0 "$latestbackup"
# name of decrypted file
latestdecrypted="${latestbackup%.gpg}"
# expand archive
tar -xvf "$latestdecrypted"
# remove unencrypted archive
rm "$latestdecrypted"
# copy configuration
cp -r "$HOME/evolution-mail-backup/.config/" "$HOME/"
cp -r "$HOME/evolution-mail-backup/.local/" "$HOME/"
# remove folder
rm -rf "$HOME/evolution-mail-backup"

View File

@ -0,0 +1,33 @@
#!/bin/bash
# Script by RealStickman
# https://gitlab.com/RealStickman
file="$1"
count=1
while [[ ! $(file "$file" | grep "ASCII text") ]];
do
if [[ $(file "$file" | grep "POSIX tar archive") ]]; then
tar -xvOf "$file" > taroutfile"$count"
file="taroutfile$count"
((count=count+1))
echo "Using tar"
fi
if [[ $(file "$file" | grep "bzip2 compressed data") ]]; then
bzip2 -dc "$file" > bzoutfile"$count"
file="bzoutfile$count"
((count=count+1))
echo "Using bzip2"
fi
if [[ $(file "$file" | grep "gzip compressed data") ]]; then
mv "$file" "$file".gz
gzip -dc "$file".gz > gzoutfile"$count"
file="gzoutfile$count"
((count=count+1))
echo "Using gzip"
fi
done
echo "Finished"
mv "$file" "output.txt"
echo "Your content is in output.txt"

View File

@ -0,0 +1,89 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -ne 1 ]; then
echo "Please provide the path to one video file"
$(exit 1); echo "$?"
fi
echo "Getting black screen times"
# reads the output of ffprobe into an array
mapfile -t timings < <(ffprobe -f lavfi -i "movie=$1,blackdetect[out0]" -show_entries frame_tags=lavfi.black_start,lavfi.black_end -of default=nw=1 -v quiet -print_format flat)
#timings=(frames.frame.0.tags.lavfi_black_start="0.389" frames.frame.1.tags.lavfi_black_end="0.431" frames.frame.255.tags.lavfi_black_start="11.025" frames.frame.256.tags.lavfi_black_end="11.067")
seltimings=()
for i in "${!timings[@]}"; do
# cut timing to only output the time
timing="$(echo ${timings[$i]} | cut -d= -f2 | tr -d '"')"
if [ $((${i}%2)) -eq 0 ]; then
starttime=$timing
#echo "Start time: $starttime"
else
endtime=$timing
#echo "End time: $endtime"
timediff="$(echo "(($endtime - $starttime))" | bc -l)"
#echo "Difference: $timediff"
# check for sections longer than 2 seconds
if (( $(echo "$timediff > 2" | bc -l) )); then
echo "Start time: $starttime"
echo "End time: $endtime"
echo "Difference: $timediff"
seltimings+=($starttime)
seltimings+=($endtime)
fi
fi
done
# TODO check whether seltimings is set/filled at all
for i in "${seltimings[@]}"; do
echo $i
done
# track split files created
splitfiles=()
# build command
command="ffmpeg -i "$1" -c copy -map 0 -t ${seltimings[0]} "1.mkv""
splitfiles+=("1.mkv")
echo "file 1.mkv" > "list.txt"
tmp=$(( ${#seltimings[@]} - 2 ))
length=$(( $tmp / 2 ))
selector=1
n=0
while [[ $n -lt $length ]]; do
n=$((n+1))
up=$(( $selector + 1 ))
low=$selector
command+=" -c copy -map 0 -ss ${seltimings[$low]} -t $(echo "${seltimings[$up]} - ${seltimings[$low]}" | bc -l) "$(( $n + 1 )).mkv""
splitfiles+=("$(( $n + 1 )).mkv")
echo "file $(( $n + 1 )).mkv" >> "list.txt"
selector=$(( $selector + 2 ))
done
lastsel=$(( ${#seltimings[@]} - 1 ))
command+=" -c copy -map 0 -ss ${seltimings[$lastsel]} "$(( $n + 2 )).mkv""
splitfiles+=("$(( $n + 2 )).mkv")
echo "file $(( $n + 2)).mkv" >> "list.txt"
echo "Running command"
echo "$command" | tee command.sh
bash command.sh
ffmpeg -f concat -i "list.txt" -c copy -map 0 "out-${1}"
# cleanup
rm command.sh
rm list.txt
for file in ${splitfiles[@]}; do
rm "$file"
done
exit 0

View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -ne 3 ]; then
echo "Please use this script with \"PATH\" \"Input Extension\" \"Output Extension\""
$(exit 1); echo "$?"
fi
# TODO argument sanity check
dir=$1
inext=$2
outext=$3
numjobs=4
# go to target dir
cd "$dir"
# select all files
readarray -d '' infiles < <(find . -name "*\.$inext" -print0)
for file in "${infiles[@]}"; do
# only run $numjobs
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# filename
file="$(basename "$file")"
# no extension
noextfile="${file%.*}"
# new extension
outextfile="${noextfile}.${outext}"
# actually use ffmpeg
ffmpeg -nostdin -i "$file" "${outextfile}" &
done
$(exit 0); echo "$?"

View File

@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail
shopt -s nullglob
for g in /sys/kernel/iommu_groups/*; do
echo "IOMMU Group ${g##*/}:"
for d in $g/devices/*; do
echo -e "\t$(lspci -nns ${d##*/})"
done;
done;
exit 0

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail
# { time tar -c -I"zstd -19 -T0" -f polybar-themes2.tar.zst polybar-themes/ ; } 2> result
# read working directory
workdir="$1"
cd "$workdir"
cd ..
if [[ -f compression-results.txt ]]; then
rm compression-results.txt
fi
# run compression with 4 threads
for i in {1..19}; do
for x in {1..5}; do
# remove previous round
if [[ -f zstd-$i.tar.zst ]]; then
rm zstd-$i.tar.zst
fi
echo "zstd -$i -T4: Run $x" >> compression-results.txt
{ time tar -c -I"zstd -$i -T4" -f zstd-$i.tar.zst "$workdir" 2> /dev/null ; } 2>> compression-results.txt
echo "-----------------------------" >> compression-results.txt
echo "Finished Run $x with zstd -$i -T4"
done
done

View File

@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
# change into music raw folder
cd "$HOME/MusikRaw"
# get directories
ls -d */ > artistdirectories
while read -r artdir; do
cd "$artdir"
# get albums
ls -d */ > directories
# delete normalized from albums
while read -r dir; do
cd "$dir"
rm -rf "transcode"
cd "$HOME/MusikRaw/$artdir"
done < directories
# cleanup
rm directories
cd "$HOME/MusikRaw"
done < artistdirectories
# cleanup
rm artistdirectories
exit

View File

@ -0,0 +1,238 @@
#!/usr/bin/env bash
set -euo pipefail
# change into music raw folder
cd "$HOME/MusikRaw"
# number of parallel jobs can be set on as an argument
numjobs="$1"
##############################
##### OPUS #####
##############################
# array of opus with find
readarray -d '' opusfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.opus" -print0)
for opus in "${opusfiles[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$opus")"
# go to that path for proper output location
cd "$pathname"
# convert file
ffmpeg-normalize "$opus" -v -pr -c:a libopus -b:a 128k -vn -ext opus &
done
# go to musik raw folder
cd "$HOME/MusikRaw"
##############################
##### M4A #####
##############################
# array of m4a with find
readarray -d '' m4afiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.m4a" -print0)
for m4a in "${m4afiles[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$m4a")"
# go to that path for proper output location
cd "$pathname"
# convert file
ffmpeg-normalize "$m4a" -v -pr -c:a libopus -b:a 128k -vn -ext opus &
done
# go to musik raw folder
cd "$HOME/MusikRaw"
##############################
##### FLAC #####
##############################
# array of flac with find
readarray -d '' flacfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.flac" -print0)
for flac in "${flacfiles[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$flac")"
# go to that path for proper output location
cd "$pathname"
# create directory for transcodes
mkdir -p "$pathname/transcode"
# get name of file
file="$(basename "$flac")"
# strip extension
noextfile="${file%.*}"
# add opus extension
opusfile="${noextfile}.opus"
# convert to opus in transcode directory
if [ -f "${pathname}/cover.jpg" ]; then
ffmpeg -nostdin -i "$flac" -i "${pathname}/cover.jpg" -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" &
else
ffmpeg -nostdin -i "$flac" -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" &
fi
done
# wait for previous jobs to finish
while [[ $(jobs | wc -l) -gt 1 ]] ; do sleep 1 ; done
cd "$HOME/MusikRaw"
# convert previously transcoded flacs
for flac in "${flacfiles[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$flac")"
# go to that path for proper output location
cd "$pathname"
# get name of file
file="$(basename "$flac")"
# strip extension
noextfile="${file%.*}"
# add opus extension
opusfile="${noextfile}.opus"
# convert opus in transcode to normalized
ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 384k -vn -ext opus &
done
# go to musik raw folder
cd "$HOME/MusikRaw"
##############################
##### MP3 #####
##############################
# array of mp3 with find
readarray -d '' mp3files < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.mp3" -print0)
for mp3 in "${mp3files[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$mp3")"
# go to that path for proper output location
cd "$pathname"
# create directory for transcodes
mkdir -p "$pathname/transcode"
# get name of file
file="$(basename "$mp3")"
# strip extension
noextfile="${file%.*}"
# add opus extension
opusfile="${noextfile}.opus"
# convert to opus in transcode directory
if [ -f "${pathname}/cover.jpg" ]; then
ffmpeg -nostdin -i "$mp3" -i "${pathname}/cover.jpg" -c:a libopus -b:a 192k "${pathname}/transcode/$opusfile" &
else
ffmpeg -nostdin -i "$mp3" -c:a libopus -b:a 192k "${pathname}/transcode/$opusfile" &
fi
done
# wait for previous jobs to finish
while [[ $(jobs | wc -l) -gt 1 ]] ; do sleep 1 ; done
cd "$HOME/MusikRaw"
# convert previously transcoded mp3s
for mp3 in "${mp3files[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$mp3")"
# go to that path for proper output location
cd "$pathname"
# get name of file
file="$(basename "$mp3")"
# strip extension
noextfile="${file%.*}"
# add opus extension
opusfile="${noextfile}.opus"
# convert opus in transcode to normalized
ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 192k -vn -ext opus &
done
# go to musik raw folder
cd "$HOME/MusikRaw"
##############################
##### WAV #####
##############################
# array of wav with find
readarray -d '' wavfiles < <(find "$HOME/MusikRaw/" -not \( -path *"\/normalized\/"* -prune \) -not \( -path *"\/transcode\/"* -prune \) -name "*\.wav" -print0)
for wav in "${wavfiles[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$wav")"
# go to that path for proper output location
cd "$pathname"
# create directory for transcodes
mkdir -p "$pathname/transcode"
# get name of file
file="$(basename "$wav")"
# strip extension
noextfile="${file%.*}"
# add opus extension
opusfile="${noextfile}.opus"
# convert to opus in transcode directory
if [ -f "${pathname}/cover.jpg" ]; then
ffmpeg -nostdin -i "$wav" -i "${pathname}/cover.jpg" -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" &
else
ffmpeg -nostdin -i "$wav" -c:a libopus -b:a 384k "${pathname}/transcode/$opusfile" &
fi
done
# wait for previous jobs to finish
while [[ $(jobs | wc -l) -gt 1 ]] ; do sleep 1 ; done
cd "$HOME/MusikRaw"
# convert previously transcoded wavs
for wav in "${wavfiles[@]}"; do
# if there are $numjobs or more, dont spawn any new processes
while [[ $(jobs | wc -l) -gt $numjobs ]] ; do sleep 1 ; done
# get directory path
pathname="$(dirname "$wav")"
# go to that path for proper output location
cd "$pathname"
# get name of file
file="$(basename "$wav")"
# strip extension
noextfile="${file%.*}"
# add opus extension
opusfile="${noextfile}.opus"
# convert opus in transcode to normalized
ffmpeg-normalize "transcode/$opusfile" -v -pr -c:a libopus -b:a 384k -vn -ext opus &
done
# go to musik raw folder
cd "$HOME/MusikRaw"
while [[ $(jobs | wc -l) -gt 1 ]] ; do sleep 1 ; done
echo Finished!
exit 0

View File

@ -0,0 +1,14 @@
#!/bin/bash
pacman -Qi |
grep -P '^Pack(ag)?(e)?r' |
cut -d: -f2 |
sort |
uniq -c |
sort -n |
sed 's/^ *//;s/ /:/' |
awk -F: "{printf \"%5.1f%% \",\
100 * \$1 / $(pacman -Qq | wc -l);\
\$1=\"\" }1"
exit 0

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
rm -r /tmp/arduino-sketch-*

View File

@ -0,0 +1,73 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -eq 2 ]; then
alg=$1
target=$2
elif [ $# -eq 3 ]; then
alg=$1
str=$2
target=$3
elif [ $1 == "-h" ] || [ $1 == "--help" ]; then
echo "sc-compress ALGORITHM [STRENGTH] TARGET"
echo "Algorithms: xz, zstd"
echo "Strength: low, medium, high"
exit 0
else
exit 1
fi
command="tar -cv -I\""
# add algorithm
if [ $alg == "xz" ]; then
command+="pxz"
elif [ $alg == "zstd" ]; then
command+="zstd -T0"
else
echo "Unsupported option"
exit 1
fi
# check if something with the strength is set
if [ ! -z "${str+x}" ]; then
if [ $str == "low" ]; then
if [ $alg == "xz" ]; then
command+=" -1"
elif [ $alg == "zstd" ]; then
command+=" -1"
fi
elif [ $str == "medium" ]; then
if [ $alg == "xz" ]; then
command+=" -5"
elif [ $alg == "zstd" ]; then
command+=" -10"
fi
elif [ $str == "high" ]; then
if [ $alg == "xz" ]; then
command+=" -9"
elif [ $alg == "zstd" ]; then
command+=" -19"
fi
else
echo "Unsupported option"
exit 1
fi
fi
command+="\""
# add archive file
if [ $alg == "xz" ]; then
command+=" -f ${target}.tar.xz $target"
elif [ $alg == "zstd" ]; then
command+=" -f ${target}.tar.zst $target"
fi
# output final command
echo $command
# execute command
eval $command
exit 0

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
set -euo pipefail
if [ ! -d "$HOME/GitProjects" ]; then
mkdir "$HOME/GitProjects"
fi
WORKPATH="$HOME/GitProjects"
readarray -t dirs < <(find "$WORKPATH" -mindepth 1 -maxdepth 1 -type d -printf '%P\n')
for dir in "${dirs[@]}"; do
# go into GitProjects directory
cd "$WORKPATH"
# output directory you're currently working on
printf "Working on ${dir}\n"
# change into that directory
cd "$dir"
# try to check out master or main branch
set +e
git checkout -q master 2>/dev/null \
|| git checkout -q main 2>/dev/null
# check whether the previous two commands failed
if [ $? -ne 0 ]; then
printf "Couldn't find master or main branch\n"
# if all is well, fetch and pull
else
git fetch --all
git pull
fi
set -e
done
exit 0

View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
user=exu
server=37.187.76.126
sshkeypath=$HOME/.ssh/id_ed25519
# unlock ssh key
if ! ssh-add -T "${sshkeypath}.pub" &>/dev/null; then
ssh-add -q "$sshkeypath"
fi
# transfer from local storage to input
rsync -uvr --progress --bwlimit=4M "/mnt/storage/MediaLibrary/tdarrready/" ${user}@${server}:/mnt/Media/input/
echo "Finished transfering data"

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
systemctl --user restart --now pipewire.socket

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
mpv --volume=80 \
--af=lavfi=[loudnorm=I=-30:TP=-2:LRA=7] \
--vid=no \
--shuffle \
--loop-playlist=inf \
'https://www.youtube.com/playlist?list=PLw1D9N29TD5KnTi9IWPjsJI1RfcIDf_hU'

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
# INPUT
# To upload new files, symlink/copy them to /mnt/storage/MediaLibrary/_tdarr-input/
# OUTPUT
# Output from tdarr will be downloaded to /mnt/storage/MediaLibrary/_tdarr-output/
echo "uploading new Content"
rsync -uvrL --progress --bwlimit=2M /mnt/storage/MediaLibrary/_tdarr-input/ exu@172.18.50.109:/mnt/tdarrshare/tdarr-share/media/input/
echo "downloading conversions"
rsync -uvr --progress --bwlimit=2M exu@172.18.50.109:/mnt/tdarrshare/tdarr-share/media/output/ /mnt/storage/MediaLibrary/_tdarr-output/

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
cd $HOME/Videos/Interessant
youtube-dl --cookies "$HOME/Nextcloud/youtube-cookie.txt" PLw1D9N29TD5IoVg0O-nWroc0lB28o2lsG
exit 0

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -eq 0 ]; then
echo "Please supply the seed"
$(exit 1); echo "$?"
elif [ $# -ge 2 ]; then
echo "Please only give one argument"
$(exit 1); echo "$?"
fi
seed="$1"
downloadpath="$HOME/Downloads/thisanimedoesnotexist/${seed}"
creativity=(0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0)
mkdir -p "$downloadpath"
cd "$downloadpath"
for creativity in "${creativity[@]}"; do
wget -O - https://thisanimedoesnotexist.ai/results/psi-${creativity}/seed${seed}.png > seed${seed}-${creativity}.png
done
exit

View File

@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -eq 0 ]; then
echo "Please supply one file"
$(exit 1); echo "$?"
elif [ $# -ge 2 ]; then
echo "Please only give one argument"
$(exit 1); echo "$?"
fi
cd "$HOME"
file="$1"
parent="$(dirname "$file")"
extract="${parent}/vpnconfigs"
patched="${file%.*}-patched.zip"
cd "$parent"
mkdir -p "${parent}/vpnconfigs"
unzip "$file" -d "$extract"
readarray -d '' conffiles < <(find "$extract" -name "*\.conf" -print0)
#https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator/
#allowedips="0.0.0.0/1, 128.0.0.0/3, 160.0.0.0/7, 162.0.0.0/11, 162.32.0.0/12, 162.48.0.0/14, 162.52.0.0/15, 162.54.0.0/16, 162.55.0.0/21, 162.55.8.0/23, 162.55.10.0/28, 162.55.10.17/32, 162.55.10.18/31, 162.55.10.20/30, 162.55.10.24/29, 162.55.10.32/27, 162.55.10.64/26, 162.55.10.128/25, 162.55.11.0/24, 162.55.12.0/22, 162.55.16.0/20, 162.55.32.0/19, 162.55.64.0/18, 162.55.128.0/17, 162.56.0.0/13, 162.64.0.0/10, 162.128.0.0/9, 163.0.0.0/8, 164.0.0.0/6, 168.0.0.0/5, 176.0.0.0/4, 192.0.0.0/2, ::/0"
for file in "${conffiles[@]}"; do
# NOTE using "@" as delimiter for sed, as the string "allowedips" contains slashes
#sed -i "s@\(AllowedIPs\s=\s\)\(.*\)@\1${allowedips}@" "$file"
if grep "PostUp" "$file" &>/dev/null; then
echo "Skipping $file"
else
echo "Patching $file"
# NOTE route while being connected into my lan
awk 'NR==5{print "PostUp = ip route add 192.168.1.0/24 via 172.16.7.1 metric 10"}NR==5{print "PreDown = ip route del 192.168.1.0/24"}1' "$file" > "${file}.tmp"
mv "${file}.tmp" "$file"
# hetzner net
awk 'NR==5{print "PostUp = ip route add 172.18.50.0/24 via 172.16.7.1 metric 10"}NR==5{print "PreDown = ip route del 172.18.50.0/24"}1' "$file" > "${file}.tmp"
mv "${file}.tmp" "$file"
# lan1dmz net
awk 'NR==5{print "PostUp = ip route add 172.16.11.0/24 via 172.16.7.1 metric 10"}NR==5{print "PreDown = ip route del 172.16.11.0/24"}1' "$file" > "${file}.tmp"
mv "${file}.tmp" "$file"
# hetzner storage box
awk 'NR==5{print "PostUp = ip route add 162.55.10.16/32 via 172.16.7.1 metric 10"}NR==5{print "PreDown = ip route del 162.55.10.16/32"}1' "$file" > "${file}.tmp"
mv "${file}.tmp" "$file"
# NOTE only one PreDown line is required as we are using a specific table for this
# TODO tables do not work as intended
#awk 'NR==5{print "PostUp = ip route add 192.168.1.0/24 via 192.168.86.1 metric 10 table 7"}NR==5{print "PreDown = ip route flush table 7"}1' "$file" > "${file}.tmp"
# NOTE adds a dns to all configs
#awk 'NR==4{print "DNS = 172.16.16.5"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
# NOTE adds a dns to all configs
#awk 'NR==5{print "DNS = 172.16.52.5"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
# NOTE adds a dns to all configs
#awk 'NR==6{print "DNS = 172.16.16.1"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
# wifi
#awk 'NR==6{print "PostUp = ip route add 192.168.1.0/24 via 172.16.52.1 metric 20 table 7"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
fi
done
zip -r -9 "$patched" "vpnconfigs"
rm -rf "$extract"

View File

@ -0,0 +1,61 @@
#!/usr/bin/env bash
set -euo pipefail
if [ $# -eq 0 ]; then
echo "Please supply one file"
$(exit 1); echo "$?"
elif [ $# -ge 2 ]; then
echo "Please only give one argument"
$(exit 1); echo "$?"
fi
cd "$HOME"
file="$1"
parent="$(dirname "$file")"
extract="${parent}/vpnconfigs"
patched="${file%.*}-patched.zip"
cd "$parent"
mkdir -p "${parent}/vpnconfigs"
unzip "$file" -d "$extract"
readarray -d '' conffiles < <(find "$extract" -name "*\.conf" -print0)
for file in "${conffiles[@]}"; do
if grep "PostUp" "$file" &>/dev/null; then
echo "Skipping $file"
else
echo "Patching $file"
# hetzner net
awk 'NR==5{print "PostUp = ip route add 172.18.50.0/24 dev vladilena-road"}NR==5{print "PreDown = ip route del 172.18.50.0/24"}1' "$file" > "${file}.tmp"
mv "${file}.tmp" "$file"
# lan1dmz net
awk 'NR==5{print "PostUp = ip route add 172.16.11.0/24 dev vladilena-road"}NR==5{print "PreDown = ip route del 172.16.11.0/24"}1' "$file" > "${file}.tmp"
mv "${file}.tmp" "$file"
# lan1dmz net
awk 'NR==5{print "PostUp = ip route add 172.16.11.0/24 via 172.16.7.1 metric 10"}NR==5{print "PreDown = ip route del 172.16.11.0/24"}1' "$file" > "${file}.tmp"
mv "${file}.tmp" "$file"
# NOTE only one PreDown line is required as we are using a specific table for this
# TODO tables do not work as intended
#awk 'NR==5{print "PostUp = ip route add 192.168.1.0/24 via 192.168.86.1 metric 10 table 7"}NR==5{print "PreDown = ip route flush table 7"}1' "$file" > "${file}.tmp"
# NOTE adds a dns to all configs
#awk 'NR==4{print "DNS = 172.16.16.5"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
# NOTE adds a dns to all configs
#awk 'NR==5{print "DNS = 172.16.52.5"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
# NOTE adds a dns to all configs
#awk 'NR==6{print "DNS = 172.16.16.1"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
# wifi
#awk 'NR==6{print "PostUp = ip route add 192.168.1.0/24 via 172.16.52.1 metric 20 table 7"}1' "$file" > "${file}.tmp"
#mv "${file}.tmp" "$file"
fi
done
zip -r -9 "$patched" "vpnconfigs"
rm -rf "$extract"

View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
# You can call this script like this:
# $./dunst-backlight.sh up
# $./dunst-backlight.sh down
get_light() {
#xbacklight -get | cut -f1 -d"."
xbacklight -get
}
send_notification() {
light=$(get_light)
# Make the bar with the special character ─ (it's not dash -)
# https://en.wikipedia.org/wiki/Box-drawing_character
bar=$(seq -s "─" $(($light / 5)) | sed 's/[0-9]//g')
# Send the notification
dunstify -i whitebalance -r 2489 -a backlight-script "$light $bar "
}
case $1 in
up)
# Increase backlight
xbacklight -inc 10 >/dev/null
#xbacklight -inc 10% > /dev/null # legacy xorg-xbacklight
send_notification
#backlightraw=$(xbacklight -get)
#backlight=${backlightraw::-8}
#xbacklight -set "${backlight}0"
;;
down)
# Decrease backlight
xbacklight -dec 10 >/dev/null
#xbacklight -dec 9% > /dev/null # legacy xorg-xbacklight
send_notification
#backlightraw=$(xbacklight -get)
#backlight=${backlightraw::-8}
#xbacklight -set "${backlight}0"
;;
esac

View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
paplay "$HOME/.local/sounds/for-sure-576.ogg"

View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -euo pipefail
# You can call this script like this:
# $./dunst-volume.sh up
# $./dunst-volume.sh down
# $./dunst-volume.sh mute
get_volume() {
amixer -D pipewire get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1
}
is_mute() {
amixer -D pipewire get Master | grep '%' | grep -oE '[^ ]+$' | grep off >/dev/null
}
send_notification() {
volume=$(get_volume)
# Send the notification
dunstify -i audio-volume-high -r 2593 -a volume-script -h int:value:$volume "Volume - ${volume}%"
}
case $1 in
up)
# Set the volume on (if it was muted)
amixer -D pipewire set Master on >/dev/null
# Up the volume (+ 5%)
amixer -D pipewire sset Master 5%+ >/dev/null
send_notification
;;
down)
amixer -D pipewire set Master on >/dev/null
amixer -D pipewire sset Master 5%- >/dev/null
send_notification
;;
mute)
# Toggle mute
amixer -D pipewire set Master 1+ toggle >/dev/null
if is_mute; then
volume=$(get_volume)
dunstify -i audio-volume-muted -r 2593 -a volume-script -h int:value:$volume "Mute"
else
send_notification
fi
;;
esac

View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail
# checking for one argument here
if [ $# -eq 1 ]; then
# check if the argument is "toggle"
if [[ "$1" == "toggle" ]]; then
dunstctl set-paused toggle
status="$(dunstctl is-paused)"
if [[ "$status" == "false" ]]; then
dunstify Notifications "Notifications are enabled" -t 2000 -a dunstify
fi
# exit if something else is provided
else
echo "Wrong argument. Use \"toggle\""
$(exit 1); echo "$?"
fi
# reject too many arguments
elif [ $# -ge 2 ]; then
echo "Too many arguments provided"
$(exit 1); echo "$?"
fi
# get the paused status of dunst
status="$(dunstctl is-paused)"
# if the status is true, dunst is paused
# notifications will wait until you reenable dunst
if [[ "$status" == "true" ]]; then
echo -e "\uf1f6"
# if the status returned false, dunst is running and active.
# you can recieve notifications
elif [[ "$status" == "false" ]]; then
echo -e "\uf0f3"
fi

View File

@ -0,0 +1,44 @@
#!/bin/sh
# from https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/player-cmus
if info=$(cmus-remote -Q 2> /dev/null); then
status=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "status " | cut -d ' ' -f 2)
if [ "$status" = "playing" ] || [ "$status" = "paused" ] || [ "$status" = "stopped" ]; then
title=$(echo "$info" | grep -v 'set ' | grep " title " | cut -d ' ' -f 3-)
artist=$(echo "$info" | grep -v 'set ' | grep " artist " | cut -d ' ' -f 3-)
position=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "position " | cut -d ' ' -f 2)
duration=$(echo "$info" | grep -v "set " | grep -v "tag " | grep "duration " | cut -d ' ' -f 2)
if [ "$artist" ] || [ "$title" ]; then
if [ "$duration" -ge 0 ]; then
pos_minutes=$(printf "%02d" $((position / 60)))
pos_seconds=$(printf "%02d" $((position % 60)))
dur_minutes=$(printf "%02d" $((duration / 60)))
dur_seconds=$(printf "%02d" $((duration % 60)))
info_string="| $pos_minutes:$pos_seconds / $dur_minutes:$dur_seconds"
fi
info_string="$artist - $title $info_string"
if [ "$status" = "playing" ]; then
echo "$info_string"
elif [ "$status" = "paused" ]; then
echo "$info_string"
elif [ "$status" = "stopped" ]; then
echo "$info_string"
else
echo ""
fi
else
echo ""
fi
else
echo ""
fi
else
echo ""
fi

View File

@ -0,0 +1,530 @@
#!/usr/bin/env python3
import sys
import dbus
import os
from operator import itemgetter
import argparse
import re
from urllib.parse import unquote
import time
from dbus.mainloop.glib import DBusGMainLoop
from gi.repository import GLib
DBusGMainLoop(set_as_default=True)
FORMAT_STRING = '{icon} {artist} - {title}'
FORMAT_REGEX = re.compile(r'(\{:(?P<tag>.*?)(:(?P<format>[wt])(?P<formatlen>\d+))?:(?P<text>.*?):\})', re.I)
FORMAT_TAG_REGEX = re.compile(r'(?P<format>[wt])(?P<formatlen>\d+)')
SAFE_TAG_REGEX = re.compile(r'[{}]')
class PlayerManager:
def __init__(self, blacklist = [], connect = True):
self.blacklist = blacklist
self._connect = connect
self._session_bus = dbus.SessionBus()
self.players = {}
self.print_queue = []
self.connected = False
self.player_states = {}
self.refreshPlayerList()
if self._connect:
self.connect()
loop = GLib.MainLoop()
try:
loop.run()
except KeyboardInterrupt:
print("interrupt received, stopping…")
def connect(self):
self._session_bus.add_signal_receiver(self.onOwnerChangedName, 'NameOwnerChanged')
self._session_bus.add_signal_receiver(self.onChangedProperties, 'PropertiesChanged',
path = '/org/mpris/MediaPlayer2',
sender_keyword='sender')
def onChangedProperties(self, interface, properties, signature, sender = None):
if sender in self.players:
player = self.players[sender]
# If we know this player, but haven't been able to set up a signal handler
if 'properties_changed' not in player._signals:
# Then trigger the signal handler manually
player.onPropertiesChanged(interface, properties, signature)
else:
# If we don't know this player, get its name and add it
bus_name = self.getBusNameFromOwner(sender)
if bus_name is None:
return
self.addPlayer(bus_name, sender)
player = self.players[sender]
player.onPropertiesChanged(interface, properties, signature)
def onOwnerChangedName(self, bus_name, old_owner, new_owner):
if self.busNameIsAPlayer(bus_name):
if new_owner and not old_owner:
self.addPlayer(bus_name, new_owner)
elif old_owner and not new_owner:
self.removePlayer(old_owner)
else:
self.changePlayerOwner(bus_name, old_owner, new_owner)
def getBusNameFromOwner(self, owner):
player_bus_names = [ bus_name for bus_name in self._session_bus.list_names() if self.busNameIsAPlayer(bus_name) ]
for player_bus_name in player_bus_names:
player_bus_owner = self._session_bus.get_name_owner(player_bus_name)
if owner == player_bus_owner:
return player_bus_name
def busNameIsAPlayer(self, bus_name):
return bus_name.startswith('org.mpris.MediaPlayer2') and bus_name.split('.')[3] not in self.blacklist
def refreshPlayerList(self):
player_bus_names = [ bus_name for bus_name in self._session_bus.list_names() if self.busNameIsAPlayer(bus_name) ]
for player_bus_name in player_bus_names:
self.addPlayer(player_bus_name)
if self.connected != True:
self.connected = True
self.printQueue()
def addPlayer(self, bus_name, owner = None):
player = Player(self._session_bus, bus_name, owner = owner, connect = self._connect, _print = self.print)
self.players[player.owner] = player
def removePlayer(self, owner):
if owner in self.players:
self.players[owner].disconnect()
del self.players[owner]
# If there are no more players, clear the output
if len(self.players) == 0:
_printFlush(ICON_NONE)
# Else, print the output of the next active player
else:
players = self.getSortedPlayerOwnerList()
if len(players) > 0:
self.players[players[0]].printStatus()
def changePlayerOwner(self, bus_name, old_owner, new_owner):
player = Player(self._session_bus, bus_name, owner = new_owner, connect = self._connect, _print = self.print)
self.players[new_owner] = player
del self.players[old_owner]
# Get a list of player owners sorted by current status and age
def getSortedPlayerOwnerList(self):
players = [
{
'number': int(owner.split('.')[-1]),
'status': 2 if player.status == 'playing' else 1 if player.status == 'paused' else 0,
'owner': owner
}
for owner, player in self.players.items()
]
return [ info['owner'] for info in reversed(sorted(players, key=itemgetter('status', 'number'))) ]
# Get latest player that's currently playing
def getCurrentPlayer(self):
playing_players = [
player_owner for player_owner in self.getSortedPlayerOwnerList()
if
self.players[player_owner].status == 'playing' or
self.players[player_owner].status == 'paused'
]
return self.players[playing_players[0]] if playing_players else None
def print(self, status, player):
self.player_states[player.bus_name] = status
if self.connected:
current_player = self.getCurrentPlayer()
if current_player != None:
_printFlush(self.player_states[current_player.bus_name])
else:
_printFlush(ICON_STOPPED)
else:
self.print_queue.append([status, player])
def printQueue(self):
for args in self.print_queue:
self.print(args[0], args[1])
self.print_queue.clear()
class Player:
def __init__(self, session_bus, bus_name, owner = None, connect = True, _print = None):
self._session_bus = session_bus
self.bus_name = bus_name
self._disconnecting = False
self.__print = _print
self.metadata = {
'artist' : '',
'album' : '',
'title' : '',
'track' : 0
}
self._rate = 1.
self._positionAtLastUpdate = 0.
self._timeAtLastUpdate = time.time()
self._positionTimerRunning = False
self._metadata = None
self.status = 'stopped'
self.icon = ICON_NONE
self.icon_reversed = ICON_PLAYING
if owner is not None:
self.owner = owner
else:
self.owner = self._session_bus.get_name_owner(bus_name)
self._obj = self._session_bus.get_object(self.bus_name, '/org/mpris/MediaPlayer2')
self._properties_interface = dbus.Interface(self._obj, dbus_interface='org.freedesktop.DBus.Properties')
self._introspect_interface = dbus.Interface(self._obj, dbus_interface='org.freedesktop.DBus.Introspectable')
self._media_interface = dbus.Interface(self._obj, dbus_interface='org.mpris.MediaPlayer2')
self._player_interface = dbus.Interface(self._obj, dbus_interface='org.mpris.MediaPlayer2.Player')
self._introspect = self._introspect_interface.get_dbus_method('Introspect', dbus_interface=None)
self._getProperty = self._properties_interface.get_dbus_method('Get', dbus_interface=None)
self._playerPlay = self._player_interface.get_dbus_method('Play', dbus_interface=None)
self._playerPause = self._player_interface.get_dbus_method('Pause', dbus_interface=None)
self._playerPlayPause = self._player_interface.get_dbus_method('PlayPause', dbus_interface=None)
self._playerStop = self._player_interface.get_dbus_method('Stop', dbus_interface=None)
self._playerPrevious = self._player_interface.get_dbus_method('Previous', dbus_interface=None)
self._playerNext = self._player_interface.get_dbus_method('Next', dbus_interface=None)
self._playerRaise = self._media_interface.get_dbus_method('Raise', dbus_interface=None)
self._signals = {}
self.refreshPosition()
self.refreshStatus()
self.refreshMetadata()
if connect:
self.printStatus()
self.connect()
def play(self):
self._playerPlay()
def pause(self):
self._playerPause()
def playpause(self):
self._playerPlayPause()
def stop(self):
self._playerStop()
def previous(self):
self._playerPrevious()
def next(self):
self._playerNext()
def raisePlayer(self):
self._playerRaise()
def connect(self):
if self._disconnecting is not True:
introspect_xml = self._introspect(self.bus_name, '/')
if 'TrackMetadataChanged' in introspect_xml:
self._signals['track_metadata_changed'] = self._session_bus.add_signal_receiver(self.onMetadataChanged, 'TrackMetadataChanged', self.bus_name)
self._signals['seeked'] = self._player_interface.connect_to_signal('Seeked', self.onSeeked)
self._signals['properties_changed'] = self._properties_interface.connect_to_signal('PropertiesChanged', self.onPropertiesChanged)
def disconnect(self):
self._disconnecting = True
for signal_name, signal_handler in list(self._signals.items()):
signal_handler.remove()
del self._signals[signal_name]
def refreshStatus(self):
# Some clients (VLC) will momentarily create a new player before removing it again
# so we can't be sure the interface still exists
try:
self.status = str(self._getProperty('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')).lower()
self.updateIcon()
self.checkPositionTimer()
except dbus.exceptions.DBusException:
self.disconnect()
def refreshMetadata(self):
# Some clients (VLC) will momentarily create a new player before removing it again
# so we can't be sure the interface still exists
try:
self._metadata = self._getProperty('org.mpris.MediaPlayer2.Player', 'Metadata')
self._parseMetadata()
except dbus.exceptions.DBusException:
self.disconnect()
def updateIcon(self):
self.icon = (
ICON_PLAYING if self.status == 'playing' else
ICON_PAUSED if self.status == 'paused' else
ICON_STOPPED if self.status == 'stopped' else
ICON_NONE
)
self.icon_reversed = (
ICON_PAUSED if self.status == 'playing' else
ICON_PLAYING
)
def _print(self, status):
self.__print(status, self)
def _parseMetadata(self):
if self._metadata != None:
# Obtain properties from _metadata
_artist = _getProperty(self._metadata, 'xesam:artist', [''])
_album = _getProperty(self._metadata, 'xesam:album', '')
_title = _getProperty(self._metadata, 'xesam:title', '')
_track = _getProperty(self._metadata, 'xesam:trackNumber', '')
_genre = _getProperty(self._metadata, 'xesam:genre', [''])
_disc = _getProperty(self._metadata, 'xesam:discNumber', '')
_length = _getProperty(self._metadata, 'xesam:length', 0) or _getProperty(self._metadata, 'mpris:length', 0)
_length_int = _length if type(_length) is int else int(float(_length))
_date = _getProperty(self._metadata, 'xesam:contentCreated', '')
_year = _date[0:4] if len(_date) else ''
_url = _getProperty(self._metadata, 'xesam:url', '')
_cover = _getProperty(self._metadata, 'xesam:artUrl', '') or _getProperty(self._metadata, 'mpris:artUrl', '')
_duration = _getDuration(_length_int)
# Update metadata
self.metadata['artist'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _firstIfList(_artist))
self.metadata['album'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _firstIfList(_album))
self.metadata['title'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _firstIfList(_title))
self.metadata['track'] = _track
self.metadata['genre'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _firstIfList(_genre))
self.metadata['disc'] = _disc
self.metadata['date'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _date)
self.metadata['year'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _year)
self.metadata['url'] = _url
self.metadata['filename'] = os.path.basename(_url)
self.metadata['length'] = _length_int
self.metadata['cover'] = re.sub(SAFE_TAG_REGEX, """\1\1""", _firstIfList(_cover))
self.metadata['duration'] = _duration
def onMetadataChanged(self, track_id, metadata):
self.refreshMetadata()
self.printStatus()
def onPropertiesChanged(self, interface, properties, signature):
updated = False
if dbus.String('Metadata') in properties:
_metadata = properties[dbus.String('Metadata')]
if _metadata != self._metadata:
self._metadata = _metadata
self._parseMetadata()
updated = True
if dbus.String('PlaybackStatus') in properties:
status = str(properties[dbus.String('PlaybackStatus')]).lower()
if status != self.status:
self.status = status
self.checkPositionTimer()
self.updateIcon()
updated = True
if dbus.String('Rate') in properties and dbus.String('PlaybackStatus') not in properties:
self.refreshStatus()
if NEEDS_POSITION and dbus.String('Rate') in properties:
rate = properties[dbus.String('Rate')]
if rate != self._rate:
self._rate = rate
self.refreshPosition()
if updated:
self.refreshPosition()
self.printStatus()
def checkPositionTimer(self):
if NEEDS_POSITION and self.status == 'playing' and not self._positionTimerRunning:
self._positionTimerRunning = True
GLib.timeout_add_seconds(1, self._positionTimer)
def onSeeked(self, position):
self.refreshPosition()
self.printStatus()
def _positionTimer(self):
self.printStatus()
self._positionTimerRunning = self.status == 'playing'
return self._positionTimerRunning
def refreshPosition(self):
try:
time_us = self._getProperty('org.mpris.MediaPlayer2.Player', 'Position')
except dbus.exceptions.DBusException:
time_us = 0
self._timeAtLastUpdate = time.time()
self._positionAtLastUpdate = time_us / 1000000
def _getPosition(self):
if self.status == 'playing':
return self._positionAtLastUpdate + self._rate * (time.time() - self._timeAtLastUpdate)
else:
return self._positionAtLastUpdate
def _statusReplace(self, match, metadata):
tag = match.group('tag')
format = match.group('format')
formatlen = match.group('formatlen')
text = match.group('text')
tag_found = False
reversed_tag = False
if tag.startswith('-'):
tag = tag[1:]
reversed_tag = True
if format is None:
tag_is_format_match = re.match(FORMAT_TAG_REGEX, tag)
if tag_is_format_match:
format = tag_is_format_match.group('format')
formatlen = tag_is_format_match.group('formatlen')
tag_found = True
if format is not None:
text = text.format_map(CleanSafeDict(**metadata))
if format == 'w':
formatlen = int(formatlen)
text = text[:formatlen]
elif format == 't':
formatlen = int(formatlen)
if len(text) > formatlen:
text = text[:max(formatlen - len(TRUNCATE_STRING), 0)] + TRUNCATE_STRING
if tag_found is False and tag in metadata and len(metadata[tag]):
tag_found = True
if reversed_tag:
tag_found = not tag_found
if tag_found:
return text
else:
return ''
def printStatus(self):
if self.status in [ 'playing', 'paused' ]:
metadata = { **self.metadata, 'icon': self.icon, 'icon-reversed': self.icon_reversed }
if NEEDS_POSITION:
metadata['position'] = time.strftime("%M:%S", time.gmtime(self._getPosition()))
# replace metadata tags in text
text = re.sub(FORMAT_REGEX, lambda match: self._statusReplace(match, metadata), FORMAT_STRING)
# restore polybar tag formatting and replace any remaining metadata tags after that
try:
text = re.sub(r'􏿿p􏿿(.*?)􏿿p􏿿(.*?)􏿿p􏿿(.*?)􏿿p􏿿', r'%{\1}\2%{\3}', text.format_map(CleanSafeDict(**metadata)))
except:
print("Invalid format string")
self._print(text)
else:
self._print(ICON_STOPPED)
def _dbusValueToPython(value):
if isinstance(value, dbus.Dictionary):
return {_dbusValueToPython(key): _dbusValueToPython(value) for key, value in value.items()}
elif isinstance(value, dbus.Array):
return [ _dbusValueToPython(item) for item in value ]
elif isinstance(value, dbus.Boolean):
return int(value) == 1
elif (
isinstance(value, dbus.Byte) or
isinstance(value, dbus.Int16) or
isinstance(value, dbus.UInt16) or
isinstance(value, dbus.Int32) or
isinstance(value, dbus.UInt32) or
isinstance(value, dbus.Int64) or
isinstance(value, dbus.UInt64)
):
return int(value)
elif isinstance(value, dbus.Double):
return float(value)
elif (
isinstance(value, dbus.ObjectPath) or
isinstance(value, dbus.Signature) or
isinstance(value, dbus.String)
):
return unquote(str(value))
def _getProperty(properties, property, default = None):
value = default
if not isinstance(property, dbus.String):
property = dbus.String(property)
if property in properties:
value = properties[property]
return _dbusValueToPython(value)
else:
return value
def _getDuration(t: int):
seconds = t / 1000000
return time.strftime("%M:%S", time.gmtime(seconds))
def _firstIfList(_value):
return _value[0] if type(_value) is list and len(_value) else _value
class CleanSafeDict(dict):
def __missing__(self, key):
return '{{{}}}'.format(key)
"""
Seems to assure print() actually prints when no terminal is connected
"""
_last_status = ''
def _printFlush(status, **kwargs):
global _last_status
if status != _last_status:
print(status, **kwargs)
sys.stdout.flush()
_last_status = status
parser = argparse.ArgumentParser()
parser.add_argument('command', help="send the given command to the active player",
choices=[ 'play', 'pause', 'play-pause', 'stop', 'previous', 'next', 'status', 'list', 'current', 'metadata', 'raise' ],
default=None,
nargs='?')
parser.add_argument('-b', '--blacklist', help="ignore a player by it's bus name. Can be be given multiple times (e.g. -b vlc -b audacious)",
action='append',
metavar="BUS_NAME",
default=[])
parser.add_argument('-f', '--format', default='{icon} {:artist:{artist} - :}{:title:{title}:}{:-title:{filename}:}')
parser.add_argument('--truncate-text', default='')
parser.add_argument('--icon-playing', default='')
parser.add_argument('--icon-paused', default='')
#parser.add_argument('--icon-stopped', default='⏹')
parser.add_argument('--icon-stopped', default='') # show no icon if stopped
parser.add_argument('--icon-none', default='')
args = parser.parse_args()
FORMAT_STRING = re.sub(r'%\{(.*?)\}(.*?)%\{(.*?)\}', r'􏿿p􏿿\1􏿿p􏿿\2􏿿p􏿿\3􏿿p􏿿', args.format)
NEEDS_POSITION = "{position}" in FORMAT_STRING
TRUNCATE_STRING = args.truncate_text
ICON_PLAYING = args.icon_playing
ICON_PAUSED = args.icon_paused
ICON_STOPPED = args.icon_stopped
ICON_NONE = args.icon_none
if args.command is None:
PlayerManager(blacklist = args.blacklist)
else:
player_manager = PlayerManager(blacklist = args.blacklist, connect = False)
current_player = player_manager.getCurrentPlayer()
if args.command == 'play' and current_player:
current_player.play()
elif args.command == 'pause' and current_player:
current_player.pause()
elif args.command == 'play-pause' and current_player:
current_player.playpause()
elif args.command == 'stop' and current_player:
current_player.stop()
elif args.command == 'previous' and current_player:
current_player.previous()
elif args.command == 'next' and current_player:
current_player.next()
elif args.command == 'status' and current_player:
current_player.printStatus()
elif args.command == 'list':
print("\n".join(sorted([
"{} : {}".format(player.bus_name.split('.')[3], player.status)
for player in player_manager.players.values() ])))
elif args.command == 'current' and current_player:
print("{} : {}".format(current_player.bus_name.split('.')[3], current_player.status))
elif args.command == 'metadata' and current_player:
print(_dbusValueToPython(current_player._metadata))
elif args.command == 'raise' and current_player:
current_player.raisePlayer()

View File

@ -0,0 +1,14 @@
#!/bin/bash
## Created By Aditya Shakya
MENU="$(rofi -sep "|" -dmenu -i -p 'System' -location 7 -xoffset 5 -yoffset -31 -width 10 -hide-scrollbar -line-padding 4 -padding 20 -lines 6 <<< "Lock|Logout|Reboot|Shutdown|Suspend|Hibernate")"
#MENU="$(rofi -sep "|" -dmenu -i -p 'System' -location 3 -xoffset -10 -yoffset 32 -width 10 -hide-scrollbar -line-padding 4 -padding 20 -lines 4 <<< " Lock| Logout| Reboot| Shutdown|Suspend|Hibernate")"
case "$MENU" in
*Lock) betterlockscreen -l ;;
*Logout) i3-msg exit ;;
*Reboot) systemctl reboot ;;
*Shutdown) systemctl poweroff ;;
*Suspend) betterlockscreen -s ;;
*Hibernate) systemctl hibernate
esac

View File

@ -0,0 +1,22 @@
#!/bin/sh
if ! updates_arch=$(checkupdates 2> /dev/null | wc -l ); then
updates_arch=0
fi
# if ! updates_aur=$(yay -Qum 2> /dev/null | wc -l); then
if ! updates_aur=$(paru -Qum 2> /dev/null | wc -l); then
# if ! updates_aur=$(cower -u 2> /dev/null | wc -l); then
# if ! updates_aur=$(trizen -Su --aur --quiet | wc -l); then
# if ! updates_aur=$(pikaur -Qua 2> /dev/null | wc -l); then
# if ! updates_aur=$(rua upgrade --printonly 2> /dev/null | wc -l); then
updates_aur=0
fi
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -ge 0 ]; then
echo "$updates"
else
echo ""
fi

View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -euo pipefail
# NOTE commands allowed
#wg show interfaces
# all active connections will be shown
# parse that
# loop over those and display all active connections
# script copied from polybar-scripts
connection_status() {
if [ -f "$config" ]; then
connection=$(sudo wg show "$config_name" 2>/dev/null | head -n 1 | awk '{print $NF }')
if [ "$connection" = "$config_name" ]; then
echo "1"
else
echo "2"
fi
else
echo "3"
fi
}
config="$HOME/wg/wireguard.conf"
config_name=$(basename "${config%.*}")
case "$1" in
--toggle)
if [ "$(connection_status)" = "1" ]; then
sudo wg-quick down "$config" 2>/dev/null
else
sudo wg-quick up "$config" 2>/dev/null
fi
;;
*)
if [ "$(connection_status)" = "1" ]; then
echo "#1 $config_name"
elif [ "$(connection_status)" = "3" ]; then
echo "#3 Config not found!"
else
echo "#2 down"
fi
;;
esac

View File

@ -0,0 +1,37 @@
#!/bin/python
# -*- coding: utf-8 -*-
# Procedure
# Surf to https://openweathermap.org/city
# Fill in your CITY
# e.g. Antwerp Belgium
# Check url
# https://openweathermap.org/city/2803138
# you will the city code at the end
# create an account on this website
# create an api key (free)
# LANG included thanks to krive001 on discord
import requests
CITY = "7287276"
API_KEY = "756edce7e9d4c385ef9499a53492678c"
UNITS = "Metric"
UNIT_KEY = "C"
#UNIT_KEY = "F"
LANG = "en"
#LANG = "nl"
#LANG = "hu"
REQ = requests.get("http://api.openweathermap.org/data/2.5/weather?id={}&lang={}&appid={}&units={}".format(CITY, LANG, API_KEY, UNITS))
try:
# HTTP CODE = OK
if REQ.status_code == 200:
CURRENT = REQ.json()["weather"][0]["description"].capitalize()
TEMP = int(float(REQ.json()["main"]["temp"]))
print("{} with a temperature of {}°{}".format(CURRENT, TEMP, UNIT_KEY))
else:
print("Error: BAD HTTP STATUS CODE " + str(REQ.status_code))
except (ValueError, IOError):
print("Error: Unable print the data")