Beautify Things
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
## Programs
|
||||
+ Editor: nvim
|
||||
+ Image-Viewer: viewnior
|
||||
+ Info: [fet.sh](https://github.com/6gk/fet.sh)
|
||||
+ Info: [fet.sh](https://github.com/6gk/fet.sh) and neofetch
|
||||
+ Launcher: dmenu
|
||||
+ Pdf-Viewer: epdfview
|
||||
+ Screenshots: Flameshot
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
+ [vim-plug](https://github.com/junegunn/vim-plug)
|
||||
+ fzf
|
||||
+ [Adapta-Nokto-Eta-Maia](https://github.com/adapta-project/adapta-gtk-theme) GTK-Theme
|
||||
|
||||
### Nvim LSP
|
||||
|
||||
@@ -37,5 +36,6 @@
|
||||
|
||||
To get a siji icon: `clone, ./install.sh, ./view.sh, echo "\ue002"`
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
@@ -91,6 +91,7 @@ mode "Open" {
|
||||
bindsym s exec spotify
|
||||
bindsym d exec discord; exec Discord
|
||||
bindsym c exec gsimplecal
|
||||
bindsym p exec pavucontrol
|
||||
|
||||
bindsym Escape mode "default"
|
||||
bindsym Return mode "default"
|
||||
@@ -146,14 +147,14 @@ bindsym $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace number $ws10
|
||||
|
||||
# ============================== Monitor
|
||||
set $monitor_1 "DP-3"
|
||||
set $monitor_2 "DP-1"
|
||||
workspace $ws1 output left
|
||||
workspace $ws10 output right
|
||||
|
||||
workspace $ws1 output $monitor_1
|
||||
workspace $ws10 output $monitor_2
|
||||
bindsym $mod+Ctrl+1 move workspace to output left
|
||||
bindsym $mod+Ctrl+2 move workspace to output right
|
||||
|
||||
bindsym $mod+Ctrl+1 move workspace to output $monitor_2
|
||||
bindsym $mod+Ctrl+2 move workspace to output $monitor_1
|
||||
bindsym $mod+Ctrl+Left move workspace to output left
|
||||
bindsym $mod+Ctrl+Right move workspace to output right
|
||||
|
||||
# ============================== Design
|
||||
# Remove title
|
||||
|
||||
@@ -25,6 +25,7 @@ padding-right = 1
|
||||
separator = /
|
||||
|
||||
modules-left = i3 xwindow
|
||||
modules-center = spotify
|
||||
modules-right = network volume backlight battery date
|
||||
|
||||
tray-position = right
|
||||
@@ -39,7 +40,7 @@ wm-restack = i3
|
||||
[bar/desktop]
|
||||
inherit = bar/laptop
|
||||
|
||||
modules-right = networkupdown volume date
|
||||
modules-right = update_yay networkupdown volume date
|
||||
|
||||
[bar/desktop_second]
|
||||
inherit = bar/desktop
|
||||
@@ -163,3 +164,16 @@ interval = 3.0
|
||||
accumulate-stats = true
|
||||
unknown-as-up = true
|
||||
label-connected = %upspeed% %downspeed%
|
||||
|
||||
[module/update_yay]
|
||||
type = custom/script
|
||||
exec = ~/.config/polybar/scripts/yay_updates.sh
|
||||
format-prefix = " "
|
||||
click-left = alacritty -e yay -Syu
|
||||
interval = 60
|
||||
|
||||
[module/spotify]
|
||||
type = custom/script
|
||||
interval = 1
|
||||
format-prefix = " "
|
||||
exec = python ~/.config/polybar/scripts/spotify_status.py -f '{artist}: {song}'
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "$USER@$HOSTNAME"
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`
|
||||
WLO1=`hostname -I | awk '{print $1}'`
|
||||
SSID=`iwgetid -r`
|
||||
|
||||
echo "$PUBLIC_IP - $WLO1 - $SSID"
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
function load() {
|
||||
echo -n "$(cat /proc/loadavg | awk -F ' ' '{print $1,$2,$3}')"
|
||||
}
|
||||
|
||||
load
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
length=20
|
||||
|
||||
function scroll () {
|
||||
prefix="$1"
|
||||
scrolling="$2"
|
||||
temp="$(echo "$scrolling"| sed "s/^\(.\{$length\}\)\(.*\)$/\1[\2]/"| sed "s/\[ *\]$//"| sed "s/\[.*\]$//")"
|
||||
suffix="$3"
|
||||
if [ "$(echo -n $scrolling |wc -c)" -gt $length ]; then
|
||||
echo "$prefix%{T7}$temp%{T-}$suffix"
|
||||
sleep 0.5
|
||||
|
||||
zscroll -l $length \
|
||||
--delay 0.2 \
|
||||
--before-text "$prefix%{T7}" \
|
||||
--after-text "%{T-}$suffix" \
|
||||
--scroll-padding " " \
|
||||
--update-check true "echo '$(get_title)'" &
|
||||
|
||||
wait
|
||||
else
|
||||
echo "$prefix%{T8} $temp %{T-}$suffix"
|
||||
fi
|
||||
} #
|
||||
|
||||
function get_artist () {
|
||||
echo "$(playerctl -p spotify metadata --format "{{ artist }}"| sed -e "s/[[(]....*[])]*//g" | sed "s/ *$//"| sed "s/^\(.\{$length\}[^ ]*\)\(.*\)$/\1[\2]/"| sed "s/\[ *\]$//"| sed "s/\[.*\]$/.../")"
|
||||
} #
|
||||
|
||||
function get_title () {
|
||||
echo "$(playerctl -p spotify metadata --format "{{title}}" | sed 's/'\''/\\'\''/g')"
|
||||
} #
|
||||
|
||||
[ ! -z "$(playerctl -p spotify status 2>/dev/null)" ] \
|
||||
&& artist=$(get_artist) \
|
||||
&& title=$(get_title) \
|
||||
&& ([ -z "$artist$title" ] && scroll "" "Spotify is not connected on this pc" "" || scroll "%{F#79e6f3}$artist%{F#FFF} [" "$title" "]%{F-}" ) \
|
||||
|| exit 1
|
||||
@@ -3,7 +3,7 @@
|
||||
main() {
|
||||
if ! pgrep -x spotify >/dev/null; then
|
||||
echo ""; exit
|
||||
fi
|
||||
fi
|
||||
|
||||
cmd="org.freedesktop.DBus.Properties.Get"
|
||||
domain="org.mpris.MediaPlayer2"
|
||||
|
||||
141
files/.config/polybar/scripts/spotify_status.py
Executable file
141
files/.config/polybar/scripts/spotify_status.py
Executable file
@@ -0,0 +1,141 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import dbus
|
||||
import 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)
|
||||
3
files/.config/polybar/scripts/yay_updates.sh
Executable file
3
files/.config/polybar/scripts/yay_updates.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
yay -Qu | wc -l
|
||||
1411
files/.config/polybar/typescript
Normal file
1411
files/.config/polybar/typescript
Normal file
File diff suppressed because one or more lines are too long
@@ -33,7 +33,12 @@ if [[ -x $(which nvim 2> /dev/null) ]]; then
|
||||
alias vim="nvim"
|
||||
fi
|
||||
|
||||
alias updoot="yay -Syu"
|
||||
# im either using manjaro or fedora
|
||||
if [[ -f "/etc/manjaro-release" ]]; then
|
||||
alias updoot="yay -Syu"
|
||||
else
|
||||
alias updoot="sudo dnf upgrade"
|
||||
fi
|
||||
|
||||
alias s="cd ~/scripts/"
|
||||
alias c='clear'
|
||||
|
||||
BIN
screenshots/code.png
Normal file
BIN
screenshots/code.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 227 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 MiB After Width: | Height: | Size: 122 KiB |
Reference in New Issue
Block a user