diff --git a/sway/.config/sway/config b/sway/.config/sway/config index 787dbe4..77b3fc2 100644 --- a/sway/.config/sway/config +++ b/sway/.config/sway/config @@ -1,4 +1,7 @@ # LEL +# +# SWAY +# # Variables {{{ # @@ -11,20 +14,22 @@ set $right l set $term kitty - set $menu swaymsg exec 'rofi -show drun -display-drun Iniciar:' + set $menu swaymsg exec 'wofi --show drun -i -p Iniciar:' font pango:Hack 14px # }}} # Output configuration {{{ # - output * bg ~/.config/sway/minimalistic_interjection.jpg fill + output * bg '#303030' solid_color # output HDMI-A-1 resolution 720x576 #Disable laptop screen if closed, --reload is important set $laptop eDP-1 - bindswitch --reload lid:on output $laptop disable; reload - bindswitch --reload lid:off output $laptop enable; reload + bindswitch --reload lid:on output $laptop disable + bindswitch --reload lid:off output $laptop enable + # output $laptop disable + # bindsym $mod+o output eDP-1 toggle # Backlight settings for laptops exec sudo light -N 1 @@ -127,8 +132,8 @@ bindsym $mod+Shift+0 move container to workspace 10 # Assign programs to their workspace - assign [class=qutebrowser] workspace 2 - assign [class=TelegramDesktop] workspace 10 + assign [app_id=org.qutebrowser.qutebrowser] workspace 2 + assign [app_id=telegramdesktop] workspace 10 assign [class=discord] workspace 10 # }}} @@ -227,14 +232,16 @@ exec udiskie # Blue light filter exec redshift + # Bluetooth Daemon + exec blueberry-tray # lock screen after a period of inactivity execp for fullscreen for_window [class=.*] inhibit_idle fullscreen exec swayidle -w \ before-sleep 'swaylock -f' \ lock swaylock \ timeout 900 'swaylock -f' \ - timeout 1800 'swaymsg "output * dpms off"' \ - resume 'swaymsg "output * dpms on;reload"' \ + # timeout 1800 'swaymsg "output * dpms off"' \ + # resume 'swaymsg "output * dpms on;reload"' \ #}}} include /etc/sway/config.d/* diff --git a/sway/.config/waybar/config b/sway/.config/waybar/config index 021f8f5..767fbd4 100644 --- a/sway/.config/waybar/config +++ b/sway/.config/waybar/config @@ -8,7 +8,7 @@ // Choose the order of the modules "modules-left": ["sway/workspaces", "sway/mode", "sway/window"], "modules-center": ["clock"], - "modules-right": ["mpd", "pulseaudio", "network", "battery","custom/weather", "tray"], + "modules-right": ["mpd", "pulseaudio", "network", "battery","custom/weather","custom/mail", "tray"], //Modules configuration "sway/workspaces": { // "disable-scroll": true, @@ -82,7 +82,7 @@ }, "battery": { "states": { - // "good": 95, + "good": 95, "warning": 30, "critical": 15 }, @@ -90,7 +90,7 @@ "format-charging": "{capacity}% ", "format-plugged": "{capacity}% ", "format-alt": "{time} {icon}", - // "format-good": "", // An empty format will hide the module + "format-good": "", "format-full": "", "format-icons": ["", "", "", "", ""] }, @@ -127,6 +127,13 @@ "tooltip":false, "exec": "$HOME/.config/waybar/custom/weather", "interval": 1800 + }, + "custom/mail": { + "format":"{} ", + "tooltip":false, + "exec": "$HOME/.config/waybar/custom/mail", + "interval": 1800 } } +# vim:ft=json diff --git a/sway/.config/waybar/custom/mail b/sway/.config/waybar/custom/mail new file mode 100755 index 0000000..528cd11 --- /dev/null +++ b/sway/.config/waybar/custom/mail @@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright © 2016 Anton Karmanov + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import configparser +import subprocess +import argparse +import imaplib +from getpass import getpass +import os +try: + import keyring + keyring_loaded = True +except ImportError: + keyring_loaded = False + +# _Settings____________________________________________________________________ + +config = { + 'HOST': 'disroot.org', + 'PORT': 993, + 'USER': 'lelgenio@disroot.org', + 'PASS': '', + 'URL': 'https://mail.disroot.org' +} +# _____________________________________________________________________________ + + +def get_args(): + parser = argparse.ArgumentParser( + description='In interactive mode you able to manage your keys.' + ) + parser.add_argument( + '-a', '--add', type=str, help='add key to keyring' + ) + parser.add_argument( + '-r', '--remove', type=str, help='remove key from keyring' + ) + args = parser.parse_args() + if args.add: + match = False + while not match: + pass_1 = getpass('Type password : ') + pass_2 = getpass('Type password again: ') + if pass_1 == pass_2: + match = True + keyring.set_password('tray-email', args.add, pass_1) + else: + print('\nPasswords do not match!\n') + return(True) + elif args.remove: + ack = input( + 'Are you sure want to delete key for {}? '.format(args.remove) + ) + if ack.lower() in ('y', 'yes'): + keyring.delete_password('tray-email', args.remove) + else: + print('Cancel.') + return(True) + return(False) + + +def parse_instance(): + INSTANCE = '' + try: + INSTANCE = os.environ['BLOCK_INSTANCE'] + except KeyError: + pass + finally: + if len(INSTANCE): + parse_config(INSTANCE) + + +def parse_config(INSTANCE): + global config + HOME = os.environ['HOME'] + config_file = configparser.ConfigParser() + CONFIG_PATH = HOME + '/.config/tray-email/' + INSTANCE + config_file.read(CONFIG_PATH) + for ITEM in config_file['MAIL']: + ITEM = ITEM.upper() + config[ITEM] = config_file['MAIL'][ITEM] + + +def get_PASS(): + return(keyring.get_password('tray-email', config['USER'])) + + +def serf(): + box = imaplib.IMAP4_SSL(host=config['HOST'], port=config['PORT']) + box.login(config['USER'], config['PASS']) + box.select() + result, ids = box.search(None, 'UNSEEN') + box.logout() + return(len(ids[0].split())) + + +if (keyring_loaded and not get_args()) or not keyring_loaded: + parse_instance() + if not config['PASS']: + config['PASS'] = get_PASS() + amt = serf() + if amt == 0: exit() + print(amt) diff --git a/sway/.config/waybar/style.css b/sway/.config/waybar/style.css index cfda5a1..e5802df 100644 --- a/sway/.config/waybar/style.css +++ b/sway/.config/waybar/style.css @@ -80,6 +80,7 @@ window#waybar.termite { #pulseaudio, #custom-media, #custom-weather, +#custom-mail, #tray, #mode, #idle_inhibitor { @@ -155,6 +156,11 @@ label:focus { /*background-color: #2980b9;*/ } +#custom-mail { + border-top: 2px solid #67334d; + /*background-color: #2980b9;*/ +} + #tray { border-top: 2px solid #2980b9; /*background-color: #2980b9;*/