This commit is contained in:
Smirnov Olexandr 2020-12-05 23:27:37 +02:00
parent 0d2b7d6ba3
commit 7cf1432163
50 changed files with 1576 additions and 977 deletions

View file

@ -3,10 +3,16 @@ pseudo-transparency = true
[colors]
; Solarized ========
background = #002B36
foreground = #dfdfdf
secondary = #073642
alert = #268bd2
;background = #002B36
;foreground = #dfdfdf
;secondary = #073642
;alert = #268bd2
; Smirnov-O Sheme ==
background = #262A2B
foreground = #ffffff
secondary = #111B1A
alert = #008dcd
; Nord =============
;background = #2E3440
@ -21,6 +27,7 @@ height = 24
fixed-center = true
wm-restack = i3
;override-redirect = true
background = ${colors.background}
foreground = ${colors.foreground}
@ -28,6 +35,14 @@ foreground = ${colors.foreground}
line-size = 3
line-color = #000000
#padding-left = 2
#padding-right = 2
#radius = 6.0
#border-left-size = 0.2%
#border-top-size = 0.2%
#border-right-size = 0.2%
module-margin-left = 1
module-margin-right = 1
@ -35,11 +50,14 @@ font-0 = Iosevka Nerd Font:style=Medium:size=8;3
font-1 = FontAwesome5Free:style=Solid:size=7.5;2.5
font-2 = Weather Icons:size=7;2
modules-left = i3 title
modules-right = keyboard pulseaudio backlight wifi-signal date time
modules-left = i3
modules-right = keyboard pulseaudio backlight wifi-signal time
tray-position = right
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[settings]
screenchange-reload = true
[module/i3]
type = internal/i3
format = <label-state><label-mode>
@ -108,6 +126,16 @@ exec = ~/.config/polybar/scripts/wifi-signal.sh
interval = 3.0
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
mount-1 = /home
label-mounted =  %mountpoint%: %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground}
[module/pulseaudio]
type = internal/pulseaudio
format-volume = <ramp-volume> <label-volume>
@ -122,6 +150,21 @@ ramp-volume-3 = 
ramp-volume-4 = 
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = " "
format-prefix-foreground = ${colors.foreground}
label =  CPU %percentage%%
[module/memory]
type = internal/memory
interval = 2
format-prefix = " "
label =  MEM %percentage_used%%
[module/weather]
type = custom/script
exec = python3 ~/.config/polybar/scripts/weather.py
@ -129,6 +172,13 @@ interval = 60
label-font = 1
[module/spotify]
type = custom/script
interval = 1
format = <label>
exec = python ~/.config/polybar/scripts/spotify_status.py -f '{artist} - {song}'
format-underline = ${colors.alert}
[module/updates-pacman]
type = custom/script
exec = ~/.config/polybar/scripts/updates-pacman-aur.sh
@ -146,6 +196,14 @@ blacklist-1 = scroll lock
blacklist-2= caps lock
[module/microphone]
type = custom/script
label = %output:0:40:...%
exec = ~/.config/polybar/scripts/microphone.sh  
click-left = ~/.config/polybar/scripts/microphone.sh --click
interval = 0
[module/sp2]
type = custom/text
content = "┇"
@ -167,7 +225,13 @@ label =  %time%
[module/title]
type = internal/xwindow
label = %title%
format-padding = 4
label = %title:0:50:...%
label-empty =
label-maxlen = 50
[module/clipmenu]
type = custom/text
content = ""
click-left = "CM_LAUNCHER=rofi clipmenu"
interval = 0

View file

@ -1,21 +0,0 @@
#!/bin/bash
MICSYMBOL=$1
MICMUTEDSYMBOL=$2
case "$1" in
--click)
amixer -D pulse sset Capture toggle
;;
*)
;;
esac
STATUS=$(amixer -D pulse get Capture | grep -E "\[on\]|\[off\]" | cut -s -d ' ' -f 8 | uniq)
if [[ $STATUS = "[on]" ]]; then
echo $MICSYMBOL
elif [[ $STATUS = "[off]" ]]; then
echo $MICMUTEDSYMBOL
else
echo "Not working, check script."
fi

View file

@ -1,139 +0,0 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import sys, dbus, argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-t',
'--trunclen',
type=int,
metavar='trunclen'
)
parser.add_argument(
'-f',
'--format',
type=str,
metavar='custom format',
dest='custom_format'
)
parser.add_argument(
'-p',
'--playpause',
type=str,
metavar='play-pause indicator',
dest='play_pause'
)
parser.add_argument(
'--font',
type=str,
metavar='the index of the font to use for the main label',
dest='font'
)
parser.add_argument(
'--playpause-font',
type=str,
metavar='the index of the font to use to display the playpause indicator',
dest='play_pause_font'
)
parser.add_argument(
'-q',
'--quiet',
action='store_true',
help="if set, don't show any output when the current song is paused",
dest='quiet',
)
args = parser.parse_args()
def fix_string(string):
# corrects encoding for the python version used
if sys.version_info.major == 3:
return string
else:
return string.encode('utf-8')
def truncate(name, trunclen):
if len(name) > trunclen:
name = name[:trunclen]
name += '...'
if ('(' in name) and (')' not in name):
name += ')'
return name
# Default parameters
output = fix_string(u'{play_pause} {artist}: {song}')
trunclen = 35
play_pause = fix_string(u'\u25B6,\u23F8') # first character is play, second is paused
label_with_font = '%{{T{font}}}{label}%{{T-}}'
font = args.font
play_pause_font = args.play_pause_font
quiet = args.quiet
# parameters can be overwritten by args
if args.trunclen is not None:
trunclen = args.trunclen
if args.custom_format is not None:
output = args.custom_format
if args.play_pause is not None:
play_pause = args.play_pause
try:
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object(
'org.mpris.MediaPlayer2.spotify',
'/org/mpris/MediaPlayer2'
)
spotify_properties = dbus.Interface(
spotify_bus,
'org.freedesktop.DBus.Properties'
)
metadata = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'Metadata')
status = spotify_properties.Get('org.mpris.MediaPlayer2.Player', 'PlaybackStatus')
# Handle play/pause label
play_pause = play_pause.split(',')
if status == 'Playing':
play_pause = play_pause[0]
elif status == 'Paused':
play_pause = play_pause[1]
else:
play_pause = str()
if play_pause_font:
play_pause = label_with_font.format(font=play_pause_font, label=play_pause)
# Handle main label
artist = fix_string(metadata['xesam:artist'][0]) if metadata['xesam:artist'] else ''
song = fix_string(metadata['xesam:title']) if metadata['xesam:title'] else ''
album = fix_string(metadata['xesam:album']) if metadata['xesam:album'] else ''
if (quiet and status == 'Paused') or (not artist and not song and not album):
print('')
else:
if font:
artist = label_with_font.format(font=font, label=artist)
song = label_with_font.format(font=font, label=song)
album = label_with_font.format(font=font, label=album)
# Add 4 to trunclen to account for status symbol, spaces, and other padding characters
print(truncate(output.format(artist=artist,
song=song,
play_pause=play_pause,
album=album), trunclen + 4))
except Exception as e:
if isinstance(e, dbus.exceptions.DBusException):
print('')
else:
print(e)

View file

@ -2,14 +2,13 @@
# -*- encoding: utf-8 -*-
import requests, os
API_KEY = os.getenv("OWM_POLYBAR")
CITY = "Horodnytsya,UA"
try:
JSON = requests.get(f"http://api.openweathermap.org/data/2.5/weather?q={CITY}&lang=EN&&units=metric&appid={API_KEY}").json()
except Exception as e:
print("No connection ")
try: JSON = requests.get(f"http://api.openweathermap.org/data/2.5/weather?q={CITY}&lang=EN&&units=metric&appid={API_KEY}").json()
except Exception as e: print("No connection ")
try:
if JSON['weather'][0]['main'] == "Clear": print("", int(JSON["main"]["temp"]),"°С")
elif JSON['weather'][0]['main'] == "Thunderstorm": print("", int(JSON["main"]["temp"]),"°С")
@ -26,5 +25,4 @@ try:
elif JSON['weather'][0]['main'] == "Squall": print("", int(JSON["main"]["temp"]),"°С")
elif JSON['weather'][0]['main'] == "Tornado": print("", int(JSON["main"]["temp"]),"°С")
elif JSON['weather'][0]['main'] == "Clouds": print("", int(JSON["main"]["temp"]),"°С")
except Exception as e:
print(int(JSON["main"]["temp"]),"°С")
except Exception as e: print(int(JSON["main"]["temp"]),"°С")