Compare commits
10 Commits
anor-londo
...
master
Author | SHA1 | Date | |
---|---|---|---|
7084f45067 | |||
d93a1b62db | |||
35c42caf4d | |||
d4db40e2e8 | |||
4ab5d0a4aa | |||
a2f420b929 | |||
2f8f009291 | |||
6cea9ad7db | |||
b5b5c9b056 | |||
abde6bb8f3 |
@ -1,24 +1,33 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#:clean temp dir
|
##:clean temp dir
|
||||||
rm -Rf $HOME/.tmp/lscreen
|
#rm -Rf $HOME/.tmp/lscreen
|
||||||
#:make temp dir
|
##:make temp dir
|
||||||
mkdir -p $HOME/.tmp/lscreen
|
#mkdir -p $HOME/.tmp/lscreen
|
||||||
|
|
||||||
#:define paths as variables
|
##:define paths as variables
|
||||||
screen=$HOME/.tmp/lscreen/screen.png
|
#screen=$HOME/.tmp/lscreen/screen.png
|
||||||
lbg=$HOME/.tmp/lscreen/lbg.png
|
#lbg=$HOME/.tmp/lscreen/lbg.png
|
||||||
|
|
||||||
#:take screenshot
|
##:take screenshot
|
||||||
grim $screen
|
#grim $screen
|
||||||
|
|
||||||
#:stretch the screenshot to pixelate - fast
|
##:stretch the screenshot to pixelate - fast
|
||||||
convert $screen -scale 10% -scale 1000% $lbg
|
#convert $screen -scale 10% -scale 1000% $lbg
|
||||||
#:simple bidirectional blur - slow
|
##:simple bidirectional blur - slow
|
||||||
#convert $screen -blur 0x8 $lbg
|
##convert $screen -blur 0x8 $lbg
|
||||||
#:remove original screenshot
|
##:remove original screenshot
|
||||||
rm $screen
|
#rm $screen
|
||||||
|
|
||||||
#:execute lock with created background
|
##:execute lock with created background
|
||||||
swaylock -f -e -i "$lbg"
|
#swaylock -f -e -i "$lbg"
|
||||||
|
|
||||||
|
revert() {
|
||||||
|
killall swayidle
|
||||||
|
}
|
||||||
|
trap revert HUP INT TERM
|
||||||
|
swayidle -w \
|
||||||
|
timeout 5 'swaymsg "output * dpms off"' \
|
||||||
|
resume 'swaymsg "output * dpms on"' &
|
||||||
|
swaylock --screenshots --clock --indicator --indicator-radius 100 --indicator-thickness 10 --effect-blur 7x5 --effect-vignette 0.4:0.4 --ring-color bb00cc --key-hl-color 880033 --line-color 00000000 --inside-color 00000088 --separator-color 00000000 --grace 2 --fade-in 0.2
|
||||||
|
revert
|
||||||
|
133
.local/bin/mediaplayer.py
Executable file
133
.local/bin/mediaplayer.py
Executable file
@ -0,0 +1,133 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import argparse
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
import signal
|
||||||
|
import gi
|
||||||
|
import json
|
||||||
|
gi.require_version('Playerctl', '2.0')
|
||||||
|
from gi.repository import Playerctl, GLib
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def write_output(text, player):
|
||||||
|
logger.info('Writing output')
|
||||||
|
|
||||||
|
output = {'text': text,
|
||||||
|
'class': 'custom-' + player.props.player_name,
|
||||||
|
'alt': player.props.player_name}
|
||||||
|
|
||||||
|
sys.stdout.write(json.dumps(output) + '\n')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def on_play(player, status, manager):
|
||||||
|
logger.info('Received new playback status')
|
||||||
|
on_metadata(player, player.props.metadata, manager)
|
||||||
|
|
||||||
|
|
||||||
|
def on_metadata(player, metadata, manager):
|
||||||
|
logger.info('Received new metadata')
|
||||||
|
track_info = ''
|
||||||
|
|
||||||
|
if player.props.player_name == 'spotify' and \
|
||||||
|
'mpris:trackid' in metadata.keys() and \
|
||||||
|
':ad:' in player.props.metadata['mpris:trackid']:
|
||||||
|
track_info = 'AD PLAYING'
|
||||||
|
elif player.get_artist() == None and player.get_title() != '':
|
||||||
|
track_info = player.get_title()
|
||||||
|
elif player.get_artist() != '' and player.get_title() != '':
|
||||||
|
track_info = '{artist} - {title}'.format(artist=player.get_artist(),
|
||||||
|
title=player.get_title())
|
||||||
|
else:
|
||||||
|
track_info = player.get_title()
|
||||||
|
|
||||||
|
if player.props.status != 'Playing' and track_info:
|
||||||
|
track_info = ' ' + track_info
|
||||||
|
|
||||||
|
if player.props.status == 'Playing' and track_info:
|
||||||
|
track_info = 'ď…„ ' + track_info
|
||||||
|
|
||||||
|
write_output(track_info, player)
|
||||||
|
|
||||||
|
|
||||||
|
def on_player_appeared(manager, player, selected_player=None):
|
||||||
|
if player is not None and (selected_player is None or player.name == selected_player):
|
||||||
|
init_player(manager, player)
|
||||||
|
else:
|
||||||
|
logger.debug("New player appeared, but it's not the selected player, skipping")
|
||||||
|
|
||||||
|
|
||||||
|
def on_player_vanished(manager, player):
|
||||||
|
logger.info('Player has vanished')
|
||||||
|
sys.stdout.write('\n')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def init_player(manager, name):
|
||||||
|
logger.debug('Initialize player: {player}'.format(player=name.name))
|
||||||
|
player = Playerctl.Player.new_from_name(name)
|
||||||
|
player.connect('playback-status', on_play, manager)
|
||||||
|
player.connect('metadata', on_metadata, manager)
|
||||||
|
manager.manage_player(player)
|
||||||
|
on_metadata(player, player.props.metadata, manager)
|
||||||
|
|
||||||
|
|
||||||
|
def signal_handler(sig, frame):
|
||||||
|
logger.debug('Received signal to stop, exiting')
|
||||||
|
sys.stdout.write('\n')
|
||||||
|
sys.stdout.flush()
|
||||||
|
# loop.quit()
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
def parse_arguments():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
|
# Increase verbosity with every occurence of -v
|
||||||
|
parser.add_argument('-v', '--verbose', action='count', default=0)
|
||||||
|
|
||||||
|
# Define for which player we're listening
|
||||||
|
parser.add_argument('--player')
|
||||||
|
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
arguments = parse_arguments()
|
||||||
|
|
||||||
|
# Initialize logging
|
||||||
|
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG,
|
||||||
|
format='%(name)s %(levelname)s %(message)s')
|
||||||
|
|
||||||
|
# Logging is set by default to WARN and higher.
|
||||||
|
# With every occurrence of -v it's lowered by one
|
||||||
|
logger.setLevel(max((3 - arguments.verbose) * 10, 0))
|
||||||
|
|
||||||
|
# Log the sent command line arguments
|
||||||
|
logger.debug('Arguments received {}'.format(vars(arguments)))
|
||||||
|
|
||||||
|
manager = Playerctl.PlayerManager()
|
||||||
|
loop = GLib.MainLoop()
|
||||||
|
|
||||||
|
manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player))
|
||||||
|
manager.connect('player-vanished', on_player_vanished)
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
signal.signal(signal.SIGTERM, signal_handler)
|
||||||
|
|
||||||
|
for player in manager.props.player_names:
|
||||||
|
if arguments.player is not None and arguments.player != player.name:
|
||||||
|
logger.debug('{player} is not the filtered player, skipping it'
|
||||||
|
.format(player=player.name)
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
|
init_player(manager, player)
|
||||||
|
|
||||||
|
loop.run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
@ -1,12 +1,70 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import json,sys,subprocess
|
import sys
|
||||||
|
from i3ipc import Connection
|
||||||
|
|
||||||
args = sys.argv
|
PRIMARY = "eDP-1"
|
||||||
msg = json.loads(subprocess.run(["swaymsg", "-t", "get_workspaces"], stdout=subprocess.PIPE).stdout.decode('utf-8'))
|
|
||||||
for i in range(len(msg)):
|
class Switcher():
|
||||||
if msg[i]["focused"] == True:
|
def __init__(self, connection):
|
||||||
if msg[i]["output"] == "DP-1":
|
self.sway = connection
|
||||||
subprocess.run(["swaymsg", "workspace", str(args[1])])
|
if len(sys.argv) > 1:
|
||||||
if msg[i]["output"] == "DVI-D-1":
|
self.ws = sys.argv[1]
|
||||||
subprocess.run(["swaymsg", "workspace", "P" + str(args[1])])
|
else:
|
||||||
|
raise TypeError("At least one argument is required")
|
||||||
|
|
||||||
|
def find_focused_out(self):
|
||||||
|
outputs = self.sway.get_outputs()
|
||||||
|
for output in outputs:
|
||||||
|
if output.focused:
|
||||||
|
focused_out = output.name
|
||||||
|
return focused_out
|
||||||
|
|
||||||
|
def move_to_next(self):
|
||||||
|
focused_out = self.find_focused_out()
|
||||||
|
if focused_out == PRIMARY:
|
||||||
|
self.sway.command("move container to workspace {}".format(self.ws + "s"))
|
||||||
|
else:
|
||||||
|
self.sway.command("move container to workspace {}".format(self.ws))
|
||||||
|
|
||||||
|
def move_to(self):
|
||||||
|
focused_out = self.find_focused_out()
|
||||||
|
if focused_out == PRIMARY:
|
||||||
|
self.sway.command("move container to workspace {}".format(self.ws))
|
||||||
|
else:
|
||||||
|
self.sway.command("move container to workspace {}".format(self.ws + "s"))
|
||||||
|
|
||||||
|
def switch_ws(self):
|
||||||
|
focused_out = self.find_focused_out()
|
||||||
|
if focused_out == PRIMARY:
|
||||||
|
self.sway.command("workspace {}".format(self.ws))
|
||||||
|
else:
|
||||||
|
self.sway.command("workspace {}".format(self.ws + "s"))
|
||||||
|
|
||||||
|
def switch_other_ws(self):
|
||||||
|
focused_out = self.find_focused_out()
|
||||||
|
if focused_out == PRIMARY:
|
||||||
|
self.sway.command("workspace {}".format(self.ws + "s"))
|
||||||
|
else:
|
||||||
|
self.sway.command("workspace {}".format(self.ws))
|
||||||
|
|
||||||
|
def main():
|
||||||
|
switcher = Switcher(Connection())
|
||||||
|
if len(sys.argv) > 2:
|
||||||
|
flag = sys.argv[2]
|
||||||
|
else:
|
||||||
|
flag = None
|
||||||
|
|
||||||
|
if not flag:
|
||||||
|
switcher.switch_ws()
|
||||||
|
if flag == "-m":
|
||||||
|
switcher.move_to()
|
||||||
|
if flag == "-n":
|
||||||
|
switcher.move_to_next()
|
||||||
|
if flag == "-o":
|
||||||
|
switcher.switch_other_ws()
|
||||||
|
else:
|
||||||
|
raise ValueError("Unknown operation")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
30
.xinitrc
Normal file
30
.xinitrc
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# ~/.xinitrc
|
||||||
|
#
|
||||||
|
# Executed by startx (run your window manager from here)
|
||||||
|
|
||||||
|
userresources=$HOME/.Xresources
|
||||||
|
#usermodmap=$HOME/.Xmodmap
|
||||||
|
sysresources=/etc/X11/xinit/.Xresources
|
||||||
|
#sysmodmap=/etc/X11/xinit/.Xmodmap
|
||||||
|
|
||||||
|
export XDG_SESSION_TYPE=x11
|
||||||
|
export XDG_CURRENT_DESKTOP=X-cinnamon
|
||||||
|
export XDG_SESSION_DESKTOP=X-cinnamon
|
||||||
|
|
||||||
|
export CLUTTER_BACKEND=x11
|
||||||
|
export ECORE_EVAS_ENGINE=x11
|
||||||
|
export ELM_ENGINE=x11
|
||||||
|
export SDL_VIDEODRIVER=x11
|
||||||
|
export QT_QPA_PLATFORMTHEME="qt5ct"
|
||||||
|
#export QT_STYLE_OVERRIDE=gtk2
|
||||||
|
export QT_QPA_PLATFORM=xcb
|
||||||
|
export QT_AUTO_SCREEN_SCALE_FACTOR=0
|
||||||
|
#export QT_SCREEN_SCALE_FACTORS=1
|
||||||
|
export EDITOR=/usr/bin/nvim
|
||||||
|
#export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
|
||||||
|
|
||||||
|
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
|
||||||
|
export SSH_AUTH_SOCK
|
||||||
|
exec cinnamon-session
|
28
.zprofile
28
.zprofile
@ -1,16 +1,36 @@
|
|||||||
# Adds `~/.local/bin` to $PATH
|
# Adds `~/.local/bin` to $PATH
|
||||||
export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')"
|
export PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')"
|
||||||
|
|
||||||
|
# Session
|
||||||
|
export XDG_SESSION_TYPE=wayland
|
||||||
|
export XDG_SESSION_DESKTOP=sway
|
||||||
|
export XDG_CURRENT_DESKTOP=sway
|
||||||
|
|
||||||
# Default programs:
|
# Default programs:
|
||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
export TERMINAL="gnome-terminal"
|
export TERMINAL="kitty"
|
||||||
export BROWSER="brave"
|
export BROWSER="chromium --enable-features=UseOzonePlatform --ozone-platform=wayland"
|
||||||
export READER="xreader"
|
export READER="zathura"
|
||||||
|
|
||||||
|
# Env vars
|
||||||
|
export CLUTTER_BACKEND=wayland
|
||||||
|
export QT_QPA_PLATFORM=wayland-egl
|
||||||
|
export ECORE_EVAS_ENGINE=wayland-egl
|
||||||
|
export ELM_ENGINE=wayland_egl
|
||||||
|
export SDL_VIDEODRIVER=wayland
|
||||||
|
export NO_AT_BRIDGE=1
|
||||||
|
export QT_QPA_PLATFORMTHEME="qt5ct"
|
||||||
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||||
|
export MOZ_ENABLE_WAYLAND=1
|
||||||
|
export MOZ_DBUS_REMOTE=1
|
||||||
|
export TDESKTOP_USE_PORTAL=1
|
||||||
|
|
||||||
# ~/ Clean-up:
|
# ~/ Clean-up:
|
||||||
export XDG_CONFIG_HOME="$HOME/.config"
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
export XDG_DATA_HOME="$HOME/.local/share"
|
export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
export XDG_CACHE_HOME="$HOME/.cache"
|
export XDG_CACHE_HOME="$HOME/.cache"
|
||||||
|
export XDG_RUNTIME_DIR="$HOME/.local/temp"
|
||||||
|
|
||||||
# Start graphical server on tty1 if not already running.
|
# Start graphical server on tty1 if not already running.
|
||||||
[ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec startx
|
[ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec sway
|
||||||
|
[ "$(tty)" = "/dev/tty2" ] && ! ps -e | grep -qw sway && exec startx
|
||||||
|
14
.zshrc
14
.zshrc
@ -71,6 +71,20 @@ export LANG=en_US.UTF-8
|
|||||||
# Compilation flags
|
# Compilation flags
|
||||||
# export ARCHFLAGS="-arch x86_64"
|
# export ARCHFLAGS="-arch x86_64"
|
||||||
|
|
||||||
|
# ssh auth stuffs
|
||||||
|
if [ ! -S ~/.ssh/ssh_auth_sock ]; then
|
||||||
|
eval `ssh-agent` > /dev/null
|
||||||
|
ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
|
||||||
|
fi
|
||||||
|
export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
|
||||||
|
ssh-add -l > /dev/null || ssh-add > /dev/null
|
||||||
|
|
||||||
|
if [ -n "$DESKTOP_SESSION" ];then
|
||||||
|
eval $(gnome-keyring-daemon --start --components=ssh)
|
||||||
|
export SSH_AUTH_SOCK
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Lines configured by zsh-newuser-install
|
# Lines configured by zsh-newuser-install
|
||||||
HISTFILE=~/.histfile
|
HISTFILE=~/.histfile
|
||||||
HISTSIZE=10000
|
HISTSIZE=10000
|
||||||
|
Loading…
Reference in New Issue
Block a user