Restructure files

This commit is contained in:
Marco Thomas
2021-04-03 11:58:19 +02:00
parent ede3bd8006
commit feb1d7b0be
21 changed files with 447 additions and 21 deletions

View File

@@ -1,157 +0,0 @@
# ___ _____
# / (_)___ /
# / /| | |_ \
# _ / / | |___) |
# (_)_/ |_|____/
#
# ~ M. Thomas
# ============================== General Setup
# Set Mod Keys
set $mod Mod4
floating_modifier $mod
# Font for Window Titles
font pango:Product Sans 10
# Remove title
new_window 1pixel
for_window [class="^.*"] border pixel 0
# Colors
set $text "#ffffff"
set $red "#e06c75"
set $termbg "#282c34"
set $border "#666666"
set $acc "#98C379"
# Class Border Backgr. Text Indic. Child_border
client.focused $acc $termbg $text $border $border
client.focused_inactive $acc $termbg $text $termbg $termbg
client.unfocused $termbg $termbg $text $termbg $termbg
client.urgent $red $termbg $text $red $red
client.background $border
# i3-gaps
gaps inner 6
smart_gaps on
# ============================== Keybinds
#Terminal
bindsym $mod+Return exec --no-startup-id alacritty
bindsym $mod+Ctrl+Return exec --no-startup-id xterm
# Config refresh
bindsym $mod+Shift+c reload
bindsym $mod+Shift+r restart
# Windows
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
bindsym $mod+Shift+q kill
#bindsym $mod+f fullscreen toggle
bindsym $mod+Shift+space floating toggle
bindsym $mod+s split v
bindsym $mod+v split h
bindsym $mod+f layout toggle stacking splith
bindsym $mod+comma workspace prev
bindsym $mod+period workspace next
# dmenu
bindsym $mod+d exec "dmenu_run"
# Screenhot
bindsym $mod+Shift+s exec "flameshot gui"
# Screen brightness with light
bindsym XF86MonBrightnessUp exec light -A 5 # increase
bindsym XF86MonBrightnessDown exec light -U 5 # decrease
# Volume with pactl
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
# Music Control with playerctl
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
# Monitor control
bindsym $mod+Ctrl+Left move workspace to output left
bindsym $mod+Ctrl+Right move workspace to output right
bindsym $mod+Ctrl+h move workspace to output left
bindsym $mod+Ctrl+l move workspace to output right
# Launch Applications
bindsym $mod+e exec alacritty -e ranger
bindsym $mod+Ctrl+c exec google-calendar-dark
bindsym $mod+Ctrl+d exec discord
bindsym $mod+Ctrl+Shift+d exec pkill Discord
bindsym $mod+Ctrl+f exec firefox-nightly
bindsym $mod+Ctrl+m exec thunderbird
bindsym $mod+Ctrl+n exec notion-app
bindsym $mod+Ctrl+p exec pavucontrol
bindsym $mod+Ctrl+s exec spotify
bindsym $mod+Ctrl+t exec telegram-desktop
# Shutdown
bindsym $mod+BackSpace exec "~/scripts/lock.sh"
bindsym $mod+Shift+BackSpace exec "i3-nagbar -t warning -m 'Logout?' -B 'Yes!' 'i3-msg exit'"
# ======================================== Workspaces
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# Move to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10
# Move window to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10
# ============================== Startup
exec ~/scripts/polybar.sh

View File

@@ -1,246 +0,0 @@
# _ _
# | | | |
# _ __ ___ | |_ _| |__ __ _ _ __
# | '_ \ / _ \| | | | | '_ \ / _` | '__|
# | |_) | (_) | | |_| | |_) | (_| | |
# | .__/ \___/|_|\__, |_.__/ \__,_|_|
# | | __/ |
# |_| |___/
#
# ~ M. Thomas
# vim:ft=dosini
# ======================================== COLORS
[colors]
background = #1C1B1D
foreground = #ffffff
foreground-alt = #999999
black = "#24272a"
red = "#E06C75"
green ="#98C379"
yellow = "#E5C07B"
blue = "#61AFEF"
magenta = "#C678DD"
cyan = "#56B6C2"
white = "#D8D8D8"
clear = "#00000000"
urgent = ${colors.red}
accent = ${colors.green}
# ======================================== BARS
[bar/main]
monitor = ${env:MONITOR}
height = 30
width = 100%
padding-left = 3
padding-right = 3
module-margin-left = 5
module-margin-center = 5
foreground = ${colors.foreground}
background = ${colors.background}
fixed-center = true
line-size = 0
tray-position = right
font-0 = "Product Sans:pixelsize=10:weight=regular;2"
font-1 = "Stick:pixelsize=13;2"
font-2 = "Material Design Icons:size=10;3"
wm-restack = i3
modules-left = i3 spotify
modules-center = date
modules-right = volume sep
[bar/laptop]
inherit = bar/main
modules-right = volume battery sep
# ======================================== MODULES
[module/i3]
type = internal/i3
pin-workspaces = true
wrapping-scroll = false
format = <label-state> <label-mode>
ws-icon-0 = 1;一
ws-icon-1 = 2;二
ws-icon-2 = 3;三
ws-icon-3 = 4;四
ws-icon-4 = 5;五
ws-icon-5 = 6;六
ws-icon-6 = 7;七
ws-icon-7 = 8;八
ws-icon-8 = 9;九
ws-icon-9 = 10;十
label-focused = "%icon%"
label-focused-foreground = ${colors.foreground}
label-focused-background = ${colors.background}
label-focused-padding = 2
label-unfocused = "%icon%"
label-unfocused-foreground = ${colors.foreground-alt}
label-unfocused-background = ${colors.background}
label-unfocused-padding = 2
label-visible = "%icon%"
label-visible-padding = 2
label-urgent = "%icon%"
label-urgent-foreground = ${colors.urgent}
label-urgent-background = ${colors.background}
label-urgent-padding = 2
label-mode = "%mode%"
label-mode-padding = 2
label-mode-foreground = ${colors.urgent}
[module/xwindow]
type = internal/xwindow
label = %title%
label-maxlen = 100
label-underline = ${colors.accent}
[module/clock]
type = internal/date
label = %time%
time = %H:%M
format-prefix = "󰥔 "
[module/date]
type = internal/date
label = %date%
date = %A, %d %b %Y, %H:%M
#format-prefix = "󰃭 "
[module/backlight]
type = internal/backlight
# ls -1 /sys/class/backlight
card = amdgpu_bl0
label = %percentage%%
format-prefix = "󰃟 "
[module/battery]
type = internal/battery
battery = BAT0
apdapter = ADP1
bar-capacity-width = 10
bar-capacity-indicator =
bar-capacity-fill = ━
bar-capacity-empty = ━
bar-capacity-fill-foreground = ${colors.green}
format-discharging = 󰋑 <bar-capacity>
label-discharging = %percentage%%
format-charging = <animation-charging> <bar-capacity>
label-charging = %percentage%%
format-full = 󰋑 <bar-capacity>
animation-charging-0 = 󰋑
animation-charging-1 = 󰋕
animation-charging-framerate = 1000
[module/volume]
type = internal/pulseaudio
format-volume = <label-volume>
#<bar-volume>
interval = 2
label-volume = %percentage%%
format-volume-prefix = "󰕾 "
bar-volume-width = 5
bar-volume-gradient = false
bar-volume-indicator =
bar-volume-fill = ━
bar-volume-fill-foreground = ${colors.blue}
bar-volume-empty = ━
click-right = pavucontrol
label-muted = Muted
format-muted-prefix = "󰖁 "
format-muted-foreground = ${colors.urgent}
[module/spotify]
type = custom/script
exec = ~/.config/polybar/scripts/song.sh 2>/dev/null || echo "Not running"
interval = 1
tail = true
format-prefix = "󰓇 "
format-prefix-foreground = ${colors.green}
[module/cpu]
type = internal/cpu
interval = 3
format = <bar-load>
bar-load-indicator =
bar-load-fill = ━
bar-load-empty = ━
bar-load-fill-foreground = ${colors.cyan}
bar-load-width = 7
format-prefix = "󰌣 "
[module/memory]
type = internal/memory
interval = 3
format = <bar-used>
bar-used-indicator =
bar-used-fill = ━
bar-used-empty = ━
bar-used-fill-foreground = ${colors.magenta}
bar-used-width = 7
format-prefix = "󰍛 "
[module/wlan]
type = internal/network
interface = wlo1
interval = 3.0
format-connected = <label-connected>
format-connected-prefix = "󰤨 "
label-connected = %essid%
format-disconnected = "󰤮 No Connection"
[module/sep]
type = custom/text
content = |

View File

@@ -1,9 +0,0 @@
#!/bin/sh
case "$1" in
--popup)
notify-send "CPU time (%)" "$(ps axch -o cmd:10,pcpu k -pcpu | head | awk '$0=$0"%"' )"
;;
*)
echo "$(grep 'cpu ' /proc/stat | awk '{cpu_usage=($2+$4)*100/($2+$4+$5)} END {printf "%0.2f%", cpu_usage}')"
;;
esac

View File

@@ -1,9 +0,0 @@
#!/bin/sh
case "$1" in
--popup)
notify-send "Memory (%)" "$(ps axch -o cmd:10,pmem k -pmem | head | awk '$0=$0"%"' )"
;;
*)
echo "$(free -h --si | awk '/^Mem:/ {print $3 "/" $2}')"
;;
esac

View File

@@ -1,37 +0,0 @@
#!/bin/sh
function scroll () {
prefix="$1"
scrolling="$2"
temp="$(echo "$scrolling"| sed "s/^\(.\{20\}\)\(.*\)$/\1[\2]/"| sed "s/\[ *\]$//"| sed "s/\[.*\]$//")"
suffix="$3"
if [ "$(echo -n $scrolling |wc -c)" -gt 20 ]; then
echo "$prefix%{T7}$temp%{T-}$suffix"
sleep 0.5
zscroll -l 20 \
--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/^\(.\{20\}[^ ]*\)\(.*\)$/\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 "$artist - " "$title" "%{F-}" ) \
|| exit 1

View File

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

@@ -1,3 +0,0 @@
#!/bin/sh
echo "$(sensors | grep Tctl | head -1 | awk '{print $2}')"

View File

@@ -1,11 +0,0 @@
#!/bin/sh
if ! updates=$(yay -Qu 2> /dev/null | wc -l); then
updates=0
fi
if [ "$updates" -gt 0 ]; then
echo "$updates"
else
echo ""
fi