diff --git a/.hgignore b/.hgignore index 9805b02..952e1fc 100644 --- a/.hgignore +++ b/.hgignore @@ -4,3 +4,4 @@ __pycache__ temp .scr +fetchers diff --git a/applications/imv-dir.desktop b/applications/imv-dir.desktop new file mode 100644 index 0000000..1f27bad --- /dev/null +++ b/applications/imv-dir.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Name=imv-folder +Name[en_US]=imv +GenericName=Image viewer +GenericName[en_US]=Image viewer +Comment=Fast freeimage-based Image Viewer | Open all images on a folder +Exec=imv-dir %f +NoDisplay=true +Terminal=false +Type=Application +Categories=Graphics;2DGraphics;Viewer; +MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-tga;image/x-xbitmap; +Icon=multimedia-photo-viewer +Keywords=photo;picture; diff --git a/aur-restore.sh b/aur-restore.sh deleted file mode 100755 index bdfc6e5..0000000 --- a/aur-restore.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This script restores local aur repository after fuckup with cleaning which -# happens way too often for me - -echo "Creating custom repository..." -sudo install -d /var/cache/pacman/custom -o lanxu -repo-add /var/cache/pacman/custom/custom.db.tar -aur sync -u - -echo "Retrieving aur packages which are installed..." -pacman -Qm | cut -f 1 -d " " > aur-packages.txt - -echo "Installing..." -xargs -a aur-packages.txt aur sync - -echo "Done." diff --git a/docker-clean b/docker-clean new file mode 100755 index 0000000..d3aff8b --- /dev/null +++ b/docker-clean @@ -0,0 +1,10 @@ +#!/bin/sh + +# Stop everything +docker stop $(docker ps -a -q) + +# Remove all containers +docker rm $(docker ps -a -q) + +# Remove all imagesa +docker rmi $(docker images -q) diff --git a/i3-disable-standby-fs.py b/i3-disable-standby-fs.py new file mode 100644 index 0000000..66fdc8d --- /dev/null +++ b/i3-disable-standby-fs.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 + +from argparse import ArgumentParser +from subprocess import call +import i3ipc + +i3 = i3ipc.Connection() + +parser = ArgumentParser(prog='disable-standby-fs', + description=''' + Disable standby (dpms) and screensaver when a window becomes fullscreen + or exits fullscreen-mode. Requires `xorg-xset`. + ''') + +args = parser.parse_args() + + +def find_fullscreen(con): + # XXX remove me when this method is available on the con in a release + return [c for c in con.descendents() if c.type == 'con' and c.fullscreen_mode] + + +def set_dpms(state): + if state: + print('setting dpms on') + call(['xset', 's', 'on']) + call(['xset', '+dpms']) + else: + print('setting dpms off') + call(['xset', 's', 'off']) + call(['xset', '-dpms']) + + +def on_fullscreen_mode(i3, e): + set_dpms(not len(find_fullscreen(i3.get_tree()))) + + +def on_window_close(i3, e): + if not len(find_fullscreen(i3.get_tree())): + set_dpms(True) + + +i3.on('window::fullscreen_mode', on_fullscreen_mode) +i3.on('window::close', on_window_close) + +i3.main() diff --git a/imv-dir b/imv-dir new file mode 100755 index 0000000..151fc51 --- /dev/null +++ b/imv-dir @@ -0,0 +1,9 @@ +#!/bin/bash +image="$1" +declare -a ARGS +for a in "$(dirname "$image")"/*; do + if [ -f "$a" ]; then + ARGS+=("$a") + fi +done +exec imv "${ARGS[@]}" -n "$image" diff --git a/keepass.sh b/keepass.sh new file mode 100755 index 0000000..3e858f8 --- /dev/null +++ b/keepass.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +# Store password like this: +# ´´secret-tool store --label='KeepassPassword' password keepass`` + +DATABASE=~/Nextcloud/Avaimet/Passwords.kdbx +PW=$(secret-tool lookup password keepass) +PASSWORDS=$(echo $PW | keepassxc-cli ls -R $DATABASE) + +for pass in $PASSWORDS; do + found=$(echo $pass | grep --ignore-case $1) + if [ -n "$found" ]; then + echo $PW | keepassxc-cli show -s -q $DATABASE $found & + fi +done diff --git a/killwine b/killwine new file mode 100755 index 0000000..9ce2957 --- /dev/null +++ b/killwine @@ -0,0 +1,12 @@ +#!/bin/sh + +killall -9 conhost.exe +killall -9 svchost.exe +killall -9 explorer.exe +killall -9 winedevice.exe +killall -9 plugplay.exe +killall -9 winedevice.exe +killall -9 services.exe +killall -9 wineboot.exe +killall -9 wineserver +killall -9 wine diff --git a/lock.sh b/lock.sh new file mode 100755 index 0000000..af813a3 --- /dev/null +++ b/lock.sh @@ -0,0 +1,2 @@ +#!/bin/sh +i3lock -k -i /usr/share/backgrounds/archlinux/wave.png --time-color FFFFFF --date-color FFFFFF --ignore-empty-password --show-failed-attempts -C diff --git a/maintenance/aur-restore.sh b/maintenance/aur-restore.sh new file mode 100755 index 0000000..46e273b --- /dev/null +++ b/maintenance/aur-restore.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +#REPOSITORY=/home/lanxu/Arch/localrepo +REPOSITORY=/var/cache/pacman/localrepo +# This script restores local aur repository after fuckup with cleaning which +# happens way too often for me + +#echo "Creating custom repository..." +#sudo install -d $REPOSITORY -o lanxu +repo-add $REPOSITORY/localrepo.db.tar.gz +aur sync -u + +#echo "Retrieving aur packages which are installed..." +#pacman -Qm | cut -f 1 -d " " > aur-packages.txt + +echo "Installing..." +xargs -a aur-packages.txt aur sync -n + +#echo "Done." diff --git a/md_create_eplist.py b/md_create_eplist.py new file mode 100755 index 0000000..6450385 --- /dev/null +++ b/md_create_eplist.py @@ -0,0 +1,8 @@ +#!/bin/python + +import sys +if __name__ == "__main__": + ret = '- [ ] ' + sys.argv[1] + "\n" + for ep in range(1, int(sys.argv[2])+1): + ret += " - [ ] Ep. "+str(ep)+"\n" + print(ret) diff --git a/powermenu.sh b/powermenu.sh new file mode 100755 index 0000000..4ba5128 --- /dev/null +++ b/powermenu.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +op=$( echo -e " Poweroff\n Reboot\n Suspend\n Lock\n Logout" | wofi -i --dmenu | awk '{print tolower($2)}' ) + +case $op in + poweroff) + ;& + reboot) + ;& + suspend) + systemctl $op + ;; + lock) + #loginctl lock-session + swaylock -f -c 221122 + ;; + logout) + swaymsg exit + ;; +esac diff --git a/screenoff.sh b/screenoff.sh new file mode 100755 index 0000000..ce3e6cd --- /dev/null +++ b/screenoff.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# Only exported variables can be used within the timer's command. +#export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')" + +# Run xidlehook +xidlehook \ + `# Don't lock when there's a fullscreen application` \ + --not-when-fullscreen \ + `# Don't lock when there's audio playing` \ + --not-when-audio \ + `# Dim the screen after 60 seconds, undim if user becomes active` \ + --timer 15 \ + 'xset dpms force off' \ + 'xset dpms force on' \ + #--timer 300 \ + # 'systemctl suspend' \ + # '' diff --git a/screensaver.sh b/screensaver.sh new file mode 100755 index 0000000..b7f31df --- /dev/null +++ b/screensaver.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# Only exported variables can be used within the timer's command. +#export PRIMARY_DISPLAY="$(xrandr | awk '/ primary/{print $1}')" + +# Run xidlehook +xidlehook \ + --not-when-fullscreen \ + --not-when-audio \ + --timer 180 \ + 'notify-send -u low "Locking in 15 seconds..."' \ + '' \ + --timer 15 \ + 'xset dpms force off' \ + 'xset dpms force on' +# --timer 300 \ +# 'systemctl suspend' \ +# '' +# --timer 15 \ +# 'loginctl lock-session' \ +# '' \ +# --timer 15 \ +# 'i3lock -k -i /usr/share/backgrounds/archlinux/wave.png --timecolor FFFFFF --datecolor FFFFFF --ignore-empty-password --show-failed-attempts -C' \ +# '' \ diff --git a/setup_table_sway.sh b/setup_table_sway.sh new file mode 100644 index 0000000..5247423 --- /dev/null +++ b/setup_table_sway.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Get inputs +# swaymsg -t get_inputs + +# Get ouputs +# swaymsg -t get_outputs +PAD_ID="9580:110:HID_256c:006e_Pad" +OUTPUT="DP-2" + +echo "swaymsg 'input $PAD_ID map_to_output $OUTPUT'" +swaymsg 'input '$PAD_ID' map_to_output '$OUTPUT diff --git a/steam b/steam new file mode 100755 index 0000000..0698f29 --- /dev/null +++ b/steam @@ -0,0 +1,4 @@ +#!/bin/sh +XDG_CURRENT_DESKTOP=XFCE xdg-dbus-proxy "$DBUS_SESSION_BUS_ADDRESS" "$XDG_RUNTIME_DIR/steam-bus-proxy" --filter --call="org.freedesktop.DBus.*=*" --call="org.freedesktop.IBus.*=*" --call="org.freedesktop.portal.*=*" --call="com.feralinteractive.GameMode.*=*" --call="com.canonical.*=*" --broadcast="*=*" --call="org.kde.*=*" --call="org.gtk.*=*" & +DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/steam-bus-proxy" /usr/bin/steam +kill %1 diff --git a/sway_lock.sh b/sway_lock.sh new file mode 100755 index 0000000..65a904a --- /dev/null +++ b/sway_lock.sh @@ -0,0 +1,3 @@ +#!/bin/sh +#i3lock -k -i /usr/share/backgrounds/archlinux/wave.png --time-color FFFFFF --date-color FFFFFF --ignore-empty-password --show-failed-attempts -C +swaylock -f -c 000000