fix scripts and services
This commit is contained in:
parent
fda0771ef5
commit
24de2671df
|
@ -1,3 +0,0 @@
|
||||||
[custom]
|
|
||||||
start=$HOME/bin/__on-gamemode start
|
|
||||||
end=$HOME/bin/__on-gamemode end
|
|
|
@ -1 +0,0 @@
|
||||||
/home/marchambault/.config/systemd/user/spotifyd.service
|
|
|
@ -1,8 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=mpv - a media player
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/mpv --idle --really-quiet --no-video --input-ipc-server /tmp/mpv.sock
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
|
@ -0,0 +1 @@
|
||||||
|
/usr/lib/systemd/user/pipewire-media-session.service
|
|
@ -1,15 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=A spotify playing daemon
|
|
||||||
Documentation=https://github.com/Spotifyd/spotifyd
|
|
||||||
Wants=sound.target
|
|
||||||
After=sound.target
|
|
||||||
Wants=network-online.target
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/spotifyd --no-daemon
|
|
||||||
Restart=always
|
|
||||||
RestartSec=12
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
|
@ -6,9 +6,9 @@ PartOf=graphical-session.target
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/usr/bin/swayidle -w \
|
ExecStart=/usr/bin/swayidle -w \
|
||||||
timeout 600 'echo RELOADAGENT | gpg-connect-agent; swaylock -f' \
|
timeout 600 'echo RELOADAGENT | gpg-connect-agent; swaylock -f' \
|
||||||
timeout 30 'if pgrep swaylock; then swaymsg "output * dpms off"; fi' \
|
timeout 60 'swaymsg "output * dpms off"' \
|
||||||
resume 'if pgrep swaylock; then swaymsg "output * dpms on"; fi' \
|
resume 'swaymsg "output * dpms on"' \
|
||||||
before-sleep 'echo RELOADAGENT | gpg-connect-agent; swaylock -f'
|
before-sleep 'echo RELOADAGENT | gpg-connect-agent; swaylock -f'
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Start tmux in detached session
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=forking
|
|
||||||
ExecStart=/usr/bin/tmux new-session -s %u -d
|
|
||||||
ExecStop=/usr/bin/tmux kill-session -t %u
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ PartOf=graphical-session.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
ExecStart=/bin/bash -c "exec $HOME/bin/wob"
|
ExecStart=%h/.local/bin/wob
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=sway-session.target
|
WantedBy=sway-session.target
|
||||||
|
|
|
@ -64,7 +64,7 @@ gamemode() {
|
||||||
done
|
done
|
||||||
|
|
||||||
#LD_PRELOAD="/usr/\$LIB/libgamemodeauto.so" until-success looking-glass-client -p 0 -c /tmp/win10.sock app:renderer=opengl egl:vsync=yes win:fullScreen=yes -k $@
|
#LD_PRELOAD="/usr/\$LIB/libgamemodeauto.so" until-success looking-glass-client -p 0 -c /tmp/win10.sock app:renderer=opengl egl:vsync=yes win:fullScreen=yes -k $@
|
||||||
gamemoderun until-sucess looking-glass-client
|
gamemoderun until-success looking-glass-client
|
||||||
|
|
||||||
echo "Restore system"
|
echo "Restore system"
|
||||||
# irq
|
# irq
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 476f6ca69922c9e67c408ae92dff0eb0ccb8ee51
|
Subproject commit 42bb2bf48bef881be504278cf5156371b542cf81
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#unset XDG_SESSION_TYPE
|
|
||||||
#unset SDL_VIDEODRIVER
|
|
||||||
/bin/looking-glass-client $@
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
function stop() {
|
|
||||||
echo "Stopping"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
echo "Starting $1"
|
|
||||||
trap - SIGINT
|
|
||||||
$@
|
|
||||||
trap stop SIGINT
|
|
||||||
echo -e "\nPress enter to restart $1..."
|
|
||||||
read
|
|
||||||
done
|
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
#!/usr/bin/env python3
|
|
||||||
# PYTHON_ARGCOMPLETE_OK
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import logging
|
|
||||||
import re
|
|
||||||
import subprocess
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
def main(**kwargs):
|
|
||||||
if kwargs.get('detach'):
|
|
||||||
virsh_subcommand = 'detach-device'
|
|
||||||
virsh_action = 'detach'
|
|
||||||
else:
|
|
||||||
virsh_subcommand = 'attach-device'
|
|
||||||
virsh_action = 'attach'
|
|
||||||
|
|
||||||
for device in kwargs.get('device_ids'):
|
|
||||||
bus, dev = device.split(':')
|
|
||||||
with tempfile.NamedTemporaryFile('w+') as f:
|
|
||||||
f.write(f"""
|
|
||||||
<hostdev mode='subsystem' type='usb'>
|
|
||||||
<source>
|
|
||||||
<vendor id='0x{bus}'/>
|
|
||||||
<product id='0x{dev}' />
|
|
||||||
</source>
|
|
||||||
</hostdev>
|
|
||||||
""")
|
|
||||||
f.flush()
|
|
||||||
logging.info('%s %s',virsh_action, device)
|
|
||||||
subprocess.run(['virsh', virsh_subcommand, kwargs.get('domain'), f.name, '--live'], check=False)
|
|
||||||
|
|
||||||
def regex_arg_type(regex):
|
|
||||||
pat = re.compile(regex)
|
|
||||||
def regex_type(value):
|
|
||||||
if pat.match(value):
|
|
||||||
return value
|
|
||||||
else:
|
|
||||||
raise argparse.ArgumentTypeError('argument "%s" must match regex "%s"' % (value, regex))
|
|
||||||
return regex_type
|
|
||||||
|
|
||||||
def get_libvirt_domains():
|
|
||||||
sp = subprocess.run(['virsh', 'list', '--name'], capture_output=True, encoding='utf8', check=True)
|
|
||||||
for line in sp.stdout.split('\n'):
|
|
||||||
if line:
|
|
||||||
yield line.strip()
|
|
||||||
|
|
||||||
def get_usb_devices():
|
|
||||||
sp = subprocess.run(['lsusb'], capture_output=True, encoding='utf8', check=True)
|
|
||||||
for line in sp.stdout.split('\n'):
|
|
||||||
if line:
|
|
||||||
yield line.split()[5]
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
logging.basicConfig(format='%(message)s', level=logging.INFO)
|
|
||||||
parser = argparse.ArgumentParser()
|
|
||||||
action_group = parser.add_mutually_exclusive_group()
|
|
||||||
action_group.add_argument('--attach',
|
|
||||||
action='store_true',
|
|
||||||
help='attach the usb devices (default)')
|
|
||||||
action_group.add_argument('--detach',
|
|
||||||
action='store_true',
|
|
||||||
help='detach the usb devices')
|
|
||||||
parser.add_argument('-d', '--domain',
|
|
||||||
choices=list(get_libvirt_domains()),
|
|
||||||
default=next(get_libvirt_domains(), None),
|
|
||||||
help='the libvirt domain on which to attach/detach the usb devices (default: %(default)s)')
|
|
||||||
parser.add_argument('device_ids',
|
|
||||||
metavar='device_ids',
|
|
||||||
nargs='+',
|
|
||||||
choices=list(get_usb_devices()),
|
|
||||||
help='a list of usb vendor:product ids in hexadecimal to attach/detach to the vm')
|
|
||||||
try:
|
|
||||||
import argcomplete
|
|
||||||
argcomplete.autocomplete(parser)
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
main(**args.__dict__)
|
|
Loading…
Reference in New Issue