Add files via upload

This commit is contained in:
Quinta
2023-03-18 22:21:53 +01:00
committed by GitHub
commit fd733cd338
100 changed files with 8809 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
; vim:ft=dosini
[colors]
background = #282828
buffer = #3c3836
foreground = #ebdbb2
nord6 = #fbf1c7
;yellow lite
nord7 = #8ec07c
;green light
nord8 = #83a598
;blue light
nord9 = #458588
;solaris green
urgent = #fb4934
;red
warning = #fe8019
;orange
notify = #fabd2f
;yellow
success = #b8bb26
; green light
function = #d3869b
; purple
+73
View File
@@ -0,0 +1,73 @@
; vim:ft=dosini
[global-wm]
include-file = $HOME/.config/polybar/dark-colors
include-file = $HOME/.config/polybar/nord-top
include-file = $HOME/.config/polybar/nord-down
include-file = $HOME/.config/polybar/nord-config
[bar/base]
theme = dark
monitor = ${config.monitor}
width = ${config.width}
height = ${config.height}
offset-x = ${config.offset-x}
offset-y = ${config.offset-y}
radius = ${config.radius}
fixed-center = ${config.fixed-center}
dpi = ${config.dpi}
background = ${colors.background}
foreground = ${colors.foreground}
line-size = ${config.line-size}
padding = 0
override-redirect = ${config.override-redirect}
wm-restack = ${config.wm-restack}
tray-padding = 3
tray-detached = false
tray-maxsize = 22
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
[bar/nord-top]
inherit = bar/base
module-margin = 2
font-0 = WenQuanYiMicroHei:size=12
font-1 = FontAwesome6FreeSolid:pixelsize=12;1
font-2 = FontAwesome6FreeRegular:pixelsize=12;1
font-3 = FontAwesome6Brands:pixelsize=8;1
font-4 = FiraCodeRegular:pixelsize=12
modules-left = ${config.top-left}
modules-center = ${config.top-center}
modules-right = ${config.top-right}
tray-position = ${config.systray-top}
[bar/nord-down]
inherit = bar/base
bottom = true
module-margin = 2
font-0 = WenQuanYiMicroHei:size=12
font-1 = FontAwesome6FreeSolid:pixelsize=12;1
font-2 = FontAwesome6Brands:pixelsize=8;1
font-3 = Weather Icons:style=Regular:size=12;1
font-4 = FiraCodeRegular:pixelsize=12
modules-left = ${config.bottom-left}
modules-center = ${config.bottom-center}
modules-right = ${config.bottom-right}
tray-position = ${config.systray-bottom}
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Terminate already running bar instances
killall -q polybar
killall -q glava
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch bar1 and bar2
if [ "$1" == "light" ]
then
polybar -c $HOME/.config/polybar/light-config nord-top &
polybar -c $HOME/.config/polybar/light-config nord-down &
glava --desktop &
else
polybar -c $HOME/.config/polybar/dark-config nord-top &
polybar -c $HOME/.config/polybar/dark-config nord-down &
glava --desktop &
fi
echo "Bars launched..."
+15
View File
@@ -0,0 +1,15 @@
; vim:ft=dosini
[colors]
background = #1D282828
buffer = #3c3836
foreground = #ebdbb2
nord6 = #fbf1c7
nord7 = #8ec07c
nord8 = #83a598
nord9 = #458588
urgent = #fb4934
warning = #fe8019
notify = #fabd2f
success = #b8bb26
function = #d3869b
+73
View File
@@ -0,0 +1,73 @@
; vim:ft=dosini
[global-wm]
include-file = $HOME/.config/polybar/light-colors
include-file = $HOME/.config/polybar/nord-top
include-file = $HOME/.config/polybar/nord-down
include-file = $HOME/.config/polybar/nord-config
[bar/base]
theme = light
monitor = ${config.monitor}
width = ${config.width}
height = ${config.height}
offset-x = ${config.offset-x}
offset-y = ${config.offset-y}
radius = ${config.radius}
fixed-center = ${config.fixed-center}
dpi = ${config.dpi}
background = ${colors.background}
foreground = ${colors.foreground}
line-size = ${config.line-size}
padding = 0
override-redirect = ${config.override-redirect}
wm-restack = ${config.wm-restack}
tray-padding = 3
tray-detached = false
tray-maxsize = 22
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
[bar/nord-top]
inherit = bar/base
module-margin = 1
font-0 = FiraCodeRegular:pixelsize=12
font-1 = FontAwesome6FreeSolid:pixelsize=12;1
font-2 = FontAwesome6FreeRegular:pixelsize=12;1
font-3 = FontAwesome6Brands:pixelsize=8;1
font-4 = WenQuanYiMicroHei:size=12
modules-left = ${config.top-left}
modules-center = ${config.top-center}
modules-right = ${config.top-right}
tray-position = ${config.systray-top}
[bar/nord-down]
inherit = bar/base
bottom = true
padding = 2
module-margin = 2
font-0 = FiraCodeRegular:pixelsize=12
font-1 = FontAwesome6FreeSolid:pixelsize=12;1
font-2 = FontAwesome6FreeRegular:pixelsize=12;1
font-3 = FontAwesome6Brands:pixelsize=8;1
font-4 = Weather Icons:style=Regular:size=12;1
font-5 = WenQuanYiMicroHei:size=12
modules-left = ${config.bottom-left}
modules-center = ${config.bottom-center}
modules-right = ${config.bottom-right}
tray-position = ${config.systray-bottom}
+107
View File
@@ -0,0 +1,107 @@
;vim:ft=dosini
[config]
# DPI value for HiDPI screen
dpi = 87
monitor =
# bar position, apply globally
width = 100%
height = 3%
offset-x = 0
offset-y = 0
radius = 0.0
fixed-center = true
override-redirect = false
wm-restack = i3
# module list:
# alsa: Display current volume
# backlight: Display screen brightness
# date: Display date
# notify: Notify icon, can customize its binding
# network-short: Network connect icon, can customize its binding
# battery: Battery info
# keyboard: CapsLock indicator
# mpd: mpd status and controls
# i3: i3 workspace icons
# bspwm: bspwm workspace icons
# workspace-name: i3 current workspace name, need to be in the format like "1:Home"
# title: title of the active window
# network-detail: Download and upload speed
# weather: Display openweather info
# powermenu: menu to control system power
# info-hackspeed: Numper of characters clicked per minute
# daily-poem: Display poem
# temperature: Display internal temperature
# memory: Display memory usage
# cpu: Display cpu usage
# show-desktop: Display desktop (i3 only)
# clash-widget: showing clash service
# onedrive-widget: showing onedrive service
# clipmenu-widget: showing clipmenu service
# Top modules
top-left = rofi-run i3
top-center = spotify mpd
top-right = keyboard backlight alsa battery network-short date
# Bottom modules
bottom-left = powermenu info-hackspeed weather
bottom-center = title
bottom-right = network-detail temperature memory cpu
systray-top = none
systray-bottom = right
# global style
line-size = 3.5
# Modules configure option
# the default value in this section should work in most cases,
# if some of them doesn't suit your environment, you can change
# it from here.
# network interface, check by `ip link show`
interface = eno1
# when the current battery capacity excess this value,
# the full-capacity format will be displayed.
battery-full-at = 95
# battery and adapter
battery-bat = BAT1
battery-adp = ACAD
# soundcard setting
master-soundcard = default
speaker-soundcard = default
headphone-soundcard = default
master-mixer = Master
# mpd service connection setting
mpd-host = 127.0.0.1
mpd-port = 6600
thermal-zone = 7
# Base temperature for where to start the ramp (in degrees celsius)
base-temperature = 20
# Threshold temperature to display warning label (in degrees celsius)
warn-temperature = 70
# GitHub personal token, generate from https://github.com/settings/tokens/new?scopes=notifications&description=Notifier+for+Polybar
# where select at least `notifications` option
github-token = 00ed987a6d7efd532c5b4ca0849c2803228d1b5d
# notify module setting
notify-click-left = xdotool key control+grave
# network module setting
network-click-left = i3-msg workspace 2
# i3
# Only show workspaces defined on the same output as the bar
#
# Useful if you want to show monitor specific workspaces
# on different bars
#
# Default: false
i3-pin-workspaces = false
+374
View File
@@ -0,0 +1,374 @@
; vim:ft=dosini
[module/i3]
type = internal/i3
pin-workspaces = ${config.i3-pin-workspaces}
strip-wsnumbers = true
index-sort = true
enable-click = true
enable-scroll = true
wrapping-scroll = true
reverse-scroll = true
fuzzy-match = false
; Available tags:
; <label-state> (default) - gets replaced with <label-(focused|unfocused|visible|urgent)>
; <label-mode> (default)
format = <label-state> <label-mode>
; icons
ws-icon-0 = 1:Home;
ws-icon-1 = 2:Browser;
ws-icon-2 = 3:Coding;
ws-icon-3 = 4:Learning;
ws-icon-4 = 5:Fun;
ws-icon-5 = 25:Desktop;
ws-icon-default = 
; color
label-focused = 
label-focused-underline = #fbf1c7
label-focused-foreground = #ebdbb2
label-focused-padding = 2
label-unfocused = •
label-unfocused-foreground = #ebdbb2
label-unfocused-padding = 2
label-urgent = 
label-urgent-foreground = ${colors.urgent}
label-urgent-background = ${colors.foreground}
label-urgent-padding = 2
; seperator
label-separator = |
label-separator-foreground = #ebdbb2
[module/pipewire]
type = custom/ipc
label = "%output%"
label-font = 1
hook-0 = ~/.config/polybar/scripts/sound.sh
hook-1 = ~/.config/polybar/scripts/sound.sh up
hook-2 = ~/.config/polybar/scripts/sound.sh down
hook-3 = ~/.config/polybar/scripts/sound.sh mute
hook-4 = sleep 1 && ~/.config/polybar/scripts/sound.sh
initial = 5
scroll-up = exec polybar-msg action "#pipewire.hook.1"
scroll-down = exec polybar-msg action "#pipewire.hook.2"
click-left = exec polybar-msg action "#pipewire.hook.3"
click-right = exec pavucontrol &
[module/kdeconnect]
type = custom/script
exec = "/home/sourav2k/.config/polybar/scripts/polybar-kdeconnect.sh -d"
tail = true
[module/bspwm]
type = internal/bspwm
ws-icon-0 = I;
ws-icon-1 = II;
ws-icon-2 = III;
ws-icon-3 = IV;
ws-icon-4 = V;
ws-icon-5 = VI;
ws-icon-6 = VII;
ws-icon-7 = VIII;
ws-icon-8 = IX;
ws-icon-9 = X;
label-focused = %icon%
label-focused-underline = ${colors.nord7}
label-focused-foreground = ${colors.nord7}
label-focused-padding = 2
label-occupied = %icon%
label-occupied-underline = ${colors.nord9}
label-occupied-foreground = ${colors.nord9}
label-occupied-padding = 2
label-empty = %icon%
label-empty-foreground = ${colors.buffer}
label-empty-padding = 2
label-urgent = 
label-urgent-foreground = ${colors.urgent}
label-urgent-background = ${colors.foreground}
label-urgent-padding = 2
; seperator
label-separator = |
label-separator-foreground = ${colors.buffer}
[module/workspace-name]
type = internal/i3
strip-wsnumbers = true
format = <label-state>
label-focused = %name%
label-focused-padding = 2
label-focused-foreground = ${colors.nord7}
label-focused-underline = ${colors.nord7}
label-unfocused =
label-urgent = %name%
label-urgent-foreground = ${colors.urgent}
label-urgent-background = ${colors.foreground}
label-urgent-padding = 2
[module/title]
type = internal/xwindow
format-foreground = #fbf1c7
format-underline = #fbf1c7
format-padding = 4
label-maxlen = 30
label-empty = Sourav2k @ Arch Linux (Pavilion)
label-empty-foreground = #00282828
[module/date]
type = internal/date
interval = 1.0
; See "http://en.cppreference.com/w/cpp/io/manip/put_time" for details on how to format the date string
; NOTE: if you want to use syntax tags here you need to use %%{...}
date-alt = %r
date = %Y-%m-%d %a
format = <label>
label =  %date%
label-margin = 1
label-underline = #fbf1c7
[module/battery]
type = internal/battery
full-at = ${config.battery-full-at}
battery = ${config.battery-bat}
adapter = ${config.battery-adp}
format-charging = <animation-charging> <label-charging>
format-charging-underline = ${colors.foreground}
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-3 = 
animation-charging-4 = 
animation-charging-framerate = 750
format-discharging = <ramp-capacity> <label-discharging>
format-discharging-underline = ${colors.notify}
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-3 = 
ramp-capacity-4 = 
ramp-capacity-foreground = ${colors.notify}
label-full = 
label-full-foreground = #fbf1c7
label-full-underline = #fbf1c7
[module/keyboard]
type = internal/xkeyboard
; List of indicators to ignore
bufferlist-0 = num lock
bufferlist-1 = scroll lock
; Format
format = <label-indicator>
label-indicator-on-capslock =  CL
label-indicator-on-capslock-foreground = #fbf1c7
label-indicator-on-capslock-underline = #fbf1c7
; Icons
layout-icon-default = 
[module/alsa]
type = internal/alsa
master-soundcard = ${config.master-soundcard}
speaker-soundcard = ${config.speaker-soundcard}
headphone-soundcard = ${config.headphone-soundcard}
master-mixer = ${config.master-mixer}
; Format
format-volume = <ramp-volume> <label-volume>
format-volume-underline = #fbf1c7
label-muted =  muted
label-muted-foreground = ${colors.urgent}
label-muted-underline = ${colors.urgent}
ramp-volume-0 = 
ramp-volume-0-foreground = #fbf1c7
ramp-volume-1 = 
ramp-volume-1-foreground = #fbf1c7
ramp-volume-2 = 
ramp-volume-2-foreground = ${colors.urgent}
ramp-headphones-0 = 
ramp-volume-foreground = #fbf1c7
[module/backlight]
type = internal/backlight
card = intel_backlight
enable-scroll = true
; Format
format = <ramp> <label>
format-underline = #fbf1c7
ramp-0 = 
label = %{A1:$HOME/.config/polybar/scripts/toggle-redshift.sh:}%percentage%%%{A}
ramp-foreground = #fbf1c7
[module/mpd]
type = internal/mpd
host = ${config.mpd-host}
port = ${config.mpd-port}
; Format
format-online = <toggle> <icon-prev> <label-song> <icon-next> <icon-stop> | <bar-progress> | <icon-repeat> <icon-random>
format-paused = <toggle> <icon-prev> <label-song> <icon-next> <icon-stop>
format-stopped = <toggle>
label-song-underline = #fbf1c7
label-song = %artist:0:10:...% - %title:0:10:...%
icon-play = 
icon-play-foreground = #fbf1c7
icon-play-margin = 1
icon-pause = 
icon-pause-foreground = #fbf1c7
icon-pause-margin = 1
icon-stop = 
icon-stop-foreground = #fbf1c7
icon-stop-margin = 1
icon-prev = 
icon-prev-foreground = #fbf1c7
icon-prev-margin = 1
icon-next = 
icon-next-foreground = #fbf1c7
icon-next-margin = 1
icon-repeat = 
icon-repeat-margin = 1
icon-random = 
icon-random-margin = 1
toggle-on-foreground = #fbf1c7
toggle-off-foreground = #fbf1c7
bar-progress-width = 20
bar-progress-indicator = |
bar-progress-fill = -
bar-progress-empty = -
bar-progress-gradient = true
bar-progress-foreground-0 = #fbf1c7
bar-progress-foreground-1 = #fbf1c7
bar-progress-foreground-2 = #fbf1c7
[module/notify]
type = custom/text
content = 
content-foreground = ${colors.warning}
content-underline = ${colors.warning}
content-padding = 1
click-left = ${config.notify-click-left}
[module/network-short]
type = internal/network
interface = ${config.interface}
interval = 1
format-connected = %{A1:networkmanager_dmenu:}<ramp-signal>%{A}
format-disconnected = %{A1:networkmanager_dmenu:}<label-disconnected>%{A}
label-disconnected = 
label-disconnected-foreground = ${colors.urgent}
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-0-foreground = #fbf1c7
ramp-signal-0-underline = #fbf1c7
ramp-signal-1-foreground = ${colors.notify}
ramp-signal-1-underline = ${colors.notify}
ramp-signal-2-foreground = ${colors.nord7}
ramp-signal-2-underline = ${colors.nord7}
ramp-signal-3-foreground = ${colors.success}
ramp-signal-3-underline = ${colors.success}
[module/clash-widget]
type = custom/script
exec = ~/.config/polybar/scripts/clash.sh
interval = 3
click-left = ~/.config/polybar/scripts/clash.sh toggle
[module/spotify]
type = custom/script
interval = 1
format-prefix = " "
format = <label>
exec = python3 $HOME/.config/polybar/scripts/spotify_status.py -f '{artist}: {song}'
format-underline = #b8bb26
;control players (optional)
click-left = playerctl --player=spotify play-pause
click-right = playerctl --player=spotify next
click-middle = playerctl --player=spotify previous
[module/onedrive-widget]
type = custom/script
exec = ~/.config/polybar/scripts/onedrive.sh
interval = 3
click-left = ~/.config/polybar/scripts/onedrive.sh toggle
[module/clipmenu-widget]
type = custom/script
exec = ~/.config/polybar/scripts/clipmenu.sh
interval = 3
click-left = ~/.config/polybar/scripts/clipmenu.sh menu
click-right = ~/.config/polybar/scripts/clipmenu.sh toggle
[module/rofi-run]
type = custom/text
content = 
content-background = #fbf1c7
content-foreground = #282828
content-padding = 3
click-left = ~/.config/polybar/scripts/rofi_run
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
# this requires a service for clash at /usr/lib/systemd/system
service=$(systemctl is-active --user clash)
case $1 in
"toggle")
if [ $service == 'active' ]
then
systemctl stop --user clash
printf '%s' '%{F#4c566a}%{F-}'
else
systemctl start --user clash
printf '%s' '%{F#a3be8c}%{F-}'
fi
;;
"")
if [ $service == "active" ]
then
printf '%s' '%{F#a3be8c}%{F-}'
else
printf '%s' '%{F#4c566a}%{F-}'
fi
esac
+36
View File
@@ -0,0 +1,36 @@
#!/bin/sh
# this requires a service for clipmenu at /usr/lib/systemd/system
service=$(systemctl is-active --user clipmenud)
dmenu_launcher=rofi
case $1 in
"toggle")
if [ $service == 'active' ]
then
systemctl stop --user clipmenud
printf '%s' '%{F#4c566a}%{F-}'
else
systemctl start --user clipmenud
printf '%s' '%{F#a3be8c}%{F-}'
fi
;;
"menu")
if [ $service == 'active' ]
then
CM_LAUNCHER=$dmenu_launcher clipmenu
printf '%s' '%{F#a3be8c}%{F-}'
else
printf '%s' '%{F#4c566a}%{F-}'
fi
;;
"")
if [ $service == "active" ]
then
printf '%s' '%{F#a3be8c}%{F-}'
else
printf '%s' '%{F#4c566a}%{F-}'
fi
esac
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
# this requires a service for onedrive at /usr/lib/systemd/system
service=$(systemctl is-active --user onedrive)
case $1 in
"toggle")
if [ $service == 'active' ]
then
systemctl stop --user onedrive
printf '%s' '%{F#bf616a}%{F-}'
else
systemctl start --user onedrive
printf '%s' '%{F#bf616a}%{F-}'
fi
;;
"")
if [ $service == "active" ]
then
printf '%s' '%{F#bf616a}%{F-}'
else
printf '%s' '%{F#bf616a}%{F-}'
fi
esac
@@ -0,0 +1,96 @@
#!/bin/sh
get_icon() {
case $1 in
01d) icon="";;
01n) icon="";;
02d) icon="";;
02n) icon="";;
03*) icon="";;
04*) icon="";;
09d) icon="";;
09n) icon="";;
10d) icon="";;
10n) icon="";;
11d) icon="";;
11n) icon="";;
13d) icon="";;
13n) icon="";;
50d) icon="";;
50n) icon="";;
*) icon="";
esac
echo $icon
}
get_duration() {
osname=$(uname -s)
case $osname in
*BSD) date -r "$1" -u +%H:%M;;
*) date --date="@$1" -u +%H:%M;;
esac
}
KEY="62628c16e6247d2c1caf0cb398a3dffa"
CITY="Agartala"
UNITS="metric"
SYMBOL="°"
API="https://api.openweathermap.org/data/2.5"
if [ -n "$CITY" ]; then
if [ "$CITY" -eq "$CITY" ] 2>/dev/null; then
CITY_PARAM="id=$CITY"
else
CITY_PARAM="q=$CITY"
fi
current=$(curl -sf "$API/weather?appid=$KEY&$CITY_PARAM&units=$UNITS")
forecast=$(curl -sf "$API/forecast?appid=$KEY&$CITY_PARAM&units=$UNITS&cnt=1")
else
location=$(curl -sf https://location.services.mozilla.com/v1/geolocate?key=geoclue)
if [ -n "$location" ]; then
location_lat="$(echo "$location" | jq '.location.lat')"
location_lon="$(echo "$location" | jq '.location.lng')"
current=$(curl -sf "$API/weather?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS")
forecast=$(curl -sf "$API/forecast?appid=$KEY&lat=$location_lat&lon=$location_lon&units=$UNITS&cnt=1")
fi
fi
if [ -n "$current" ] && [ -n "$forecast" ]; then
current_temp=$(echo "$current" | jq ".main.temp" | cut -d "." -f 1)
current_icon=$(echo "$current" | jq -r ".weather[0].icon")
forecast_temp=$(echo "$forecast" | jq ".list[].main.temp" | cut -d "." -f 1)
forecast_icon=$(echo "$forecast" | jq -r ".list[].weather[0].icon")
if [ "$current_temp" -gt "$forecast_temp" ]; then
trend=""
elif [ "$forecast_temp" -gt "$current_temp" ]; then
trend=""
else
trend=""
fi
sun_rise=$(echo "$current" | jq ".sys.sunrise")
sun_set=$(echo "$current" | jq ".sys.sunset")
now=$(date +%s)
if [ "$sun_rise" -gt "$now" ]; then
daytime="$(get_duration "$((sun_rise-now))")"
elif [ "$sun_set" -gt "$now" ]; then
daytime="$(get_duration "$((sun_set-now))")"
else
daytime="$(get_duration "$((sun_rise-now))")"
fi
echo "$(get_icon "$current_icon") $current_temp$SYMBOL $trend $(get_icon "$forecast_icon") $forecast_temp$SYMBOL $daytime"
fi
+4
View File
@@ -0,0 +1,4 @@
潮打三更瓜步月,雨荒十里红桥火。
清代-郑燮 满江红·思家
凌晨,晚上
0
+122
View File
@@ -0,0 +1,122 @@
#!/usr/bin/env bash
# CONFIGURATION
LOCATION=0
YOFFSET=0
XOFFSET=0
WIDTH=12
WIDTH_WIDE=24
THEME=$HOME/.local/share/rofi/themes/squared-everforest.rasi
# Color Settings of Icon shown in Polybar
COLOR_DISCONNECTED='#000' # Device Disconnected
COLOR_NEWDEVICE='#ff0' # New Device
COLOR_BATTERY_90='#fabd2f' # Battery >= 90
COLOR_BATTERY_80='#fabd2f' # Battery >= 80
COLOR_BATTERY_70='#fabd2f' # Battery >= 70
COLOR_BATTERY_60='#fabd2f' # Battery >= 60
COLOR_BATTERY_50='#fb493f' # Battery >= 50
COLOR_BATTERY_LOW='#fb493f' # Battery < 50
# Icons shown in Polybar
ICON_SMARTPHONE=''
ICON_TABLET=''
SEPERATOR='|'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
show_devices (){
IFS=$','
devices=""
for device in $(qdbus --literal org.kde.kdeconnect /modules/kdeconnect org.kde.kdeconnect.daemon.devices); do
deviceid=$(echo "$device" | awk -F'["|"]' '{print $2}')
devicename=$(qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$deviceid" org.kde.kdeconnect.device.name)
devicetype=$(qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$deviceid" org.kde.kdeconnect.device.type)
isreach="$(qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$deviceid" org.kde.kdeconnect.device.isReachable)"
istrust="$(qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$deviceid" org.kde.kdeconnect.device.isTrusted)"
if [ "$isreach" = "true" ] && [ "$istrust" = "true" ]
then
battery="$(qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$deviceid/battery" org.kde.kdeconnect.device.battery.charge)"
icon=$(get_icon "$battery" "$devicetype")
devices+="%{A1:$DIR/polybar-kdeconnect.sh -n '$devicename' -i $deviceid -b $battery -m:}$icon%{A}$SEPERATOR"
elif [ "$isreach" = "false" ] && [ "$istrust" = "true" ]
then
devices+="$(get_icon -1 "$devicetype")$SEPERATOR"
else
haspairing="$(qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$deviceid" org.kde.kdeconnect.device.hasPairingRequests)"
if [ "$haspairing" = "true" ]
then
show_pmenu2 "$devicename" "$deviceid"
fi
icon=$(get_icon -2 "$devicetype")
devices+="%{A1:$DIR/polybar-kdeconnect.sh -n $devicename -i $deviceid -p:}$icon%{A}$SEPERATOR"
fi
done
echo "${devices::-1}"
}
show_menu () {
menu="$(rofi -sep "|" -dmenu -i -p "$DEV_NAME" -location $LOCATION -yoffset $YOFFSET -xoffset $XOFFSET -theme $THEME -width $WIDTH -hide-scrollbar -line-padding 4 -padding 20 -lines 5 <<< "Battery: $DEV_BATTERY%|Ping|Find Device|Send File|Browse Files|Unpair")"
case "$menu" in
*Ping) qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID/ping" org.kde.kdeconnect.device.ping.sendPing ;;
*'Find Device') qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID/findmyphone" org.kde.kdeconnect.device.findmyphone.ring ;;
*'Send File') qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID/share" org.kde.kdeconnect.device.share.shareUrl "file://$(zenity --file-selection)" ;;
*'Browse Files')
if "$(qdbus --literal org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID/sftp" org.kde.kdeconnect.device.sftp.isMounted)" == "false"; then
qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID/sftp" org.kde.kdeconnect.device.sftp.mount
fi
qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID/sftp" org.kde.kdeconnect.device.sftp.startBrowsing
;;
*'Unpair' ) qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID" org.kde.kdeconnect.device.unpair
esac
}
show_pmenu () {
menu="$(rofi -sep "|" -dmenu -i -p "$DEV_NAME" -location $LOCATION -yoffset $YOFFSET -xoffset $XOFFSET -theme $THEME -width $WIDTH -hide-scrollbar -line-padding 1 -padding 20 -lines 1<<<"Pair Device")"
case "$menu" in
*'Pair Device') qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$DEV_ID" org.kde.kdeconnect.device.requestPair
esac
}
show_pmenu2 () {
menu="$(rofi -sep "|" -dmenu -i -p "$1 has sent a pairing request" -location $LOCATION -yoffset $YOFFSET -xoffset $XOFFSET -theme $THEME -width $WIDTH_WIDE -hide-scrollbar -line-padding 4 -padding 20 -lines 2 <<< "Accept|Reject")"
case "$menu" in
*'Accept') qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$2" org.kde.kdeconnect.device.acceptPairing ;;
*) qdbus org.kde.kdeconnect "/modules/kdeconnect/devices/$2" org.kde.kdeconnect.device.rejectPairing
esac
}
get_icon () {
if [ "$2" = "tablet" ]
then
icon=$ICON_TABLET
else
icon=$ICON_SMARTPHONE
fi
case $1 in
"-1") ICON="%{F$COLOR_DISCONNECTED}$icon%{F-}" ;;
"-2") ICON="%{F$COLOR_NEWDEVICE}$icon%{F-}" ;;
5*) ICON="%{F$COLOR_BATTERY_50}$icon%{F-}" ;;
6*) ICON="%{F$COLOR_BATTERY_60}$icon%{F-}" ;;
7*) ICON="%{F$COLOR_BATTERY_70}$icon%{F-}" ;;
8*) ICON="%{F$COLOR_BATTERY_80}$icon%{F-}" ;;
9*|100) ICON="%{F$COLOR_BATTERY_90}$icon%{F-}" ;;
*) ICON="%{F$COLOR_BATTERY_LOW}$icon%{F-}" ;;
esac
echo $ICON
}
unset DEV_ID DEV_NAME DEV_BATTERY
while getopts 'di:n:b:mp' c
do
# shellcheck disable=SC2220
case $c in
d) show_devices ;;
i) DEV_ID=$OPTARG ;;
n) DEV_NAME=$OPTARG ;;
b) DEV_BATTERY=$OPTARG ;;
m) show_menu ;;
p) show_pmenu ;;
esac
done
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
rofi -show run -theme nord-oneline
+141
View 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)
+9
View File
@@ -0,0 +1,9 @@
#! /bin/bash
if pgrep -x redshift > /dev/null
then
pgrep redshift | xargs -n1 kill -9 | notify-send 'Redshift stopped'
else
notify-send 'Redshift started'
redshift &
fi
+7
View File
@@ -0,0 +1,7 @@
[Unit]
Description=Clash for Linux
After=network.target
[Service]
ExecStart=/usr/bin/clash -d /home/yucklys/.config/clash
Restart=always
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB