Compare commits

..

2 Commits

Author SHA1 Message Date
5861e2da9b
update zshrc 2020-09-07 17:41:54 +02:00
877b5069a6
update sway config 2020-09-07 15:20:53 +02:00
7 changed files with 58 additions and 302 deletions

@ -14,7 +14,8 @@ set {
$menu wofi --show drun | xargs swaymsg exec -- $menu wofi --show drun | xargs swaymsg exec --
$runmenu wofi --show run | xargs swaymsg exec -- $runmenu wofi --show run | xargs swaymsg exec --
$gnome-schema org.gnome.desktop.interface $gnome-schema org.gnome.desktop.interface
$gtk_theme "Adapta-Nokto-Eta" #$gtk_theme "Adapta-Nokto-Eta"
$gtk_theme "Matcha-dark-azul"
$icon_theme "Papirus-Dark" $icon_theme "Papirus-Dark"
$bg ~/Pictures/drain.png $bg ~/Pictures/drain.png
#$lockscreen exec '~/.local/bin/lockscreen' #$lockscreen exec '~/.local/bin/lockscreen'
@ -34,15 +35,20 @@ set {
# #
exec_always --no-startup-id { exec_always --no-startup-id {
pkill flashfocus pkill flashfocus
pkill autotiling
pulseaudio --daemonize
eval $(/usr/bin/gnome-keyring-daemon --start --components=ssh)
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
gsettings set $gnome-schema gtk-theme $gtk_theme gsettings set $gnome-schema gtk-theme $gtk_theme
gsettings set $gnome-schema icon-theme $icon_theme gsettings set $gnome-schema icon-theme $icon_theme
gsettings set $gnome-schema font-name 'Cantarell 10' gsettings set $gnome-schema font-name 'Cantarell 10'
gsettings set $gnome-schema monospace=font-name 'Anka/Coder 11' gsettings set $gnome-schema monospace=font-name 'Anka/Coder 11'
mako --anchor top-right > /tmp/mako.log 2>&1 mako --anchor top-right > /tmp/mako.log 2>&1
flashfocus flashfocus
autotiling
swaymsg focus output $primary swaymsg focus output $primary
evolution evolution
telegram-desktop Telegram
swayidle -w timeout 1200 exec $lockscreen\ swayidle -w timeout 1200 exec $lockscreen\
timeout 1201 'swaymsg "output * dpms off"'\ timeout 1201 'swaymsg "output * dpms off"'\
resume 'swaymsg "output * dpms on"'\ resume 'swaymsg "output * dpms on"'\
@ -92,10 +98,10 @@ output * bg $bg fill
bindsym $mod+Shift+c reload bindsym $mod+Shift+c reload
# Exit sway (logs you out of your Wayland session) # Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' bindsym $mod+Shift+e exec wlogout #swaynag -t warning -m 'Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
#Lock the session #Lock the session
bindsym Control+Shift+l exec $lockscreen bindsym Control+alt+l exec $lockscreen
# #
# Program shortcuts # Program shortcuts
@ -227,7 +233,7 @@ bindsym {
# Assign programs to workspaces # Assign programs to workspaces
assign [app_id="evolution"] comm assign [app_id="evolution"] comm
assign [instance="telegram-desktop"] comm assign [app_id="telegramdesktop"] comm
# #
# Layout stuff: # Layout stuff:
# #

@ -1,33 +1,24 @@
#!/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

@ -1,133 +0,0 @@
#!/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,70 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
import sys import json,sys,subprocess
from i3ipc import Connection
PRIMARY = "eDP-1" args = sys.argv
msg = json.loads(subprocess.run(["swaymsg", "-t", "get_workspaces"], stdout=subprocess.PIPE).stdout.decode('utf-8'))
class Switcher(): for i in range(len(msg)):
def __init__(self, connection): if msg[i]["focused"] == True:
self.sway = connection if msg[i]["output"] == "DP-1":
if len(sys.argv) > 1: subprocess.run(["swaymsg", "workspace", str(args[1])])
self.ws = sys.argv[1] if msg[i]["output"] == "DVI-D-1":
else: subprocess.run(["swaymsg", "workspace", "P" + str(args[1])])
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()

@ -1,30 +0,0 @@
#!/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

@ -1,36 +1,16 @@
# 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="kitty" export TERMINAL="gnome-terminal"
export BROWSER="chromium --enable-features=UseOzonePlatform --ozone-platform=wayland" export BROWSER="brave"
export READER="zathura" export READER="xreader"
# 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 sway [ "$(tty)" = "/dev/tty1" ] && ! ps -e | grep -qw Xorg && exec startx
[ "$(tty)" = "/dev/tty2" ] && ! ps -e | grep -qw sway && exec startx

28
.zshrc

@ -45,6 +45,19 @@ COMPLETION_WAITING_DOTS="true"
# see 'man strftime' for details. # see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy" # HIST_STAMPS="mm/dd/yyyy"
# 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
# Would you like to use another custom folder than $ZSH/custom? # Would you like to use another custom folder than $ZSH/custom?
ZSH_CUSTOM=~/.config/zsh ZSH_CUSTOM=~/.config/zsh
@ -67,24 +80,11 @@ source $ZSH/oh-my-zsh.sh
# User configuration # User configuration
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
export MOZ_ENABLE_WAYLAND=1
# 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