Rename scripts

Signed-off-by: Severin Kaderli <severin.kaderli@gmail.com>
This commit is contained in:
Severin Kaderli 2019-03-06 16:53:16 +01:00
parent df6b44e541
commit 410d0b33c6
Signed by: severinkaderli
GPG key ID: F419F8835B72F0C4
46 changed files with 566 additions and 249 deletions

View file

@ -28,7 +28,7 @@ monitor = HDMI-1
width = 100%
height = ${settings.bar-height}
offset-x = 0
offset-y = 0
offset-y = 0
font-0 = Noto Sans:pixelsize=12;3
font-1 = Noto Sans CJK JP:pixelsize=12;3
@ -42,8 +42,8 @@ padding-right = 2
module-margin = 2
modules-left = i3
modules-center = xwindow
modules-right = battery volume backlight wlan date power
modules-center =
modules-right = update gmail todo battery volume backlight wlan date power
tray-position = none
separator = |
@ -106,20 +106,53 @@ label-urgent-background = ${settings.background-color}
label-urgent-padding = ${settings.padding}
#######################################
# Active window title
#######################################
[module/xwindow]
type = internal/xwindow
###############################################################################
# Update count #
###############################################################################
[module/update]
type = custom/script
exec = ${XDG_CONFIG_HOME}/polybar/scripts/update-count
format = <label>
label = %title%
label-maxlen = 50
label =  %output%
interval = 60
click-left = xdg-open "https://www.archlinux.org/"
###############################################################################
# G-Mail #
###############################################################################
[module/gmail]
type = custom/script
exec = ${XDG_CONFIG_HOME}/polybar/scripts/gmail/count.py
format = <label>
label =  %output%
interval = 60
click-left = xdg-open https://mail.google.com
#######################################
# Battery indicator
#######################################
###############################################################################
# Todo #
###############################################################################
[module/todo]
type = custom/script
exec = echo "$(${XDG_BIN_HOME}/todo | wc -l) / 3" | bc
format = <label>
label =  %output%
interval = 60
click-left = xdg-open "https://todoist.com/"
###############################################################################
# Battery indicator #
###############################################################################
[module/battery]
type = internal/battery
full-at = 99
@ -153,9 +186,9 @@ interval = 5
poll-interval = 5
#######################################
# Volume indicator
#######################################
##############################################################################
# Volume indicator #
##############################################################################
[module/volume]
type = internal/pulseaudio
use-ui-max = true
@ -173,9 +206,9 @@ ramp-volume-2 = 
interval = 5
#######################################
# Brightness indicator
#######################################
##############################################################################
# Brightness indicator #
##############################################################################
[module/backlight]
type = custom/script
exec = light -G | cut -d. -f1
@ -189,9 +222,9 @@ scroll-up = light -A 5
scroll-down = light -U 5
#######################################
# WiFi indicator
#######################################
##############################################################################
# WiFi indicator #
##############################################################################
[module/wlan]
type = internal/network
interface = wlp3s0
@ -212,9 +245,9 @@ ramp-signal-foreground = ${settings.foreground-color}
interval = 1
#######################################
# Time and date
#######################################
##############################################################################
# Time and date #
##############################################################################
[module/date]
type = custom/script
exec = date +"%F %H:%M:%S"
@ -227,19 +260,14 @@ interval = 1
click-left = xdg-open "https://calendar.google.com"
#######################################
# Power menu
#######################################
##############################################################################
# Power menu #
##############################################################################
[module/power]
type = custom/script
exec = echo -e "\uf011"
type = custom/text
content = 
format = <label>
label = %output%
interval = 5
click-left = $XDG_BIN_HOME/power.sh
click-left = $XDG_BIN_HOME/power
#######################################
@ -247,7 +275,7 @@ click-left = $XDG_BIN_HOME/power.sh
#######################################
[module/music]
type = custom/script
exec = ${XDG_BIN_HOME}/music.sh
exec = ${XDG_BIN_HOME}/music
format = <label>
label = %output%

View file

@ -1,7 +1,7 @@
#!/bin/bash
#!/usr/bin/env bash
#
# SCRIPT NAME:
# .config/polybar/launch.sh
# .config/polybar/launch
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
@ -10,7 +10,7 @@
# This script kills existing polybar processes and then launches the bars.
#
# USAGE:
# ./launch.sh
# ./launch
# Terminate already running bar instances
killall -q polybar

View file

@ -0,0 +1,28 @@
#!/usr/bin/env python
import os
import pathlib
import httplib2
import webbrowser
from oauth2client import client, file
SCOPE = 'https://www.googleapis.com/auth/gmail.readonly'
REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'
DIR = os.path.dirname(os.path.realpath(__file__))
CLIENT_SECRETS_PATH = os.path.join(DIR, 'client_secrets.json')
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
storage = file.Storage(CREDENTIALS_PATH)
if pathlib.Path(CREDENTIALS_PATH).is_file():
credentials = storage.get()
credentials.refresh(httplib2.Http())
print('Credentials successfully refreshed')
else:
flow = client.flow_from_clientsecrets(CLIENT_SECRETS_PATH, scope=SCOPE,
redirect_uri=REDIRECT_URI)
auth_uri = flow.step1_get_authorize_url()
webbrowser.open(auth_uri)
auth_code = input('Enter the auth code: ')
credentials = flow.step2_exchange(auth_code)
storage.put(credentials)
print('Credentials successfully created')

View file

@ -0,0 +1,11 @@
{
"installed": {
"client_id": "1041679298587-8solnkr9tr8iktrut958if6tsgqt42m2.apps.googleusercontent.com",
"project_id": "polybar-gmail",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "-aZZAslLp6ydldCAFvH9AEwi",
"redirect_uris": ["urn:ietf:wg:oauth:2.0:oob"]
}
}

View file

@ -0,0 +1,19 @@
#!/usr/bin/env python
import os
import pathlib
import subprocess
import time
import argparse
from apiclient import discovery, errors
from oauth2client import client, file
from httplib2 import ServerNotFoundError
DIR = os.path.dirname(os.path.realpath(__file__))
CREDENTIALS_PATH = os.path.join(DIR, 'credentials.json')
gmail = discovery.build(
'gmail', 'v1', credentials=file.Storage(CREDENTIALS_PATH).get())
labels = gmail.users().labels().get(userId='me', id='INBOX').execute()
print(labels['messagesUnread'])

View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
#
# SCRIPT NAME:
# update-count
#
# AUTHOR:
# Severin Kaderli <severin.kaderli@gmail.com>
#
# DESCRIPTION:
# Returns the outstanding system updates.
#
# USAGE:
# ./update-count
UPDATES=$(pacman -Qu | wc -l)
AUR_UPDATES=$(yay -Qua --devel | wc -l)
echo "${UPDATES} / ${AUR_UPDATES}"