Migrate from qtile bar to eww widgets

This commit is contained in:
Şahin Akkaya 2022-03-25 19:10:57 +03:00
parent c2c1a13ed3
commit 375bf79693
23 changed files with 1451 additions and 188 deletions

530
.config/eww/bar/eww.scss Normal file
View File

@ -0,0 +1,530 @@
/** EWW.SCSS
Created by saimoom **/
*{
all: unset;
font-family: "Iosevka Nerd Font", feather;
// font-family: DaddyTimeMono NF;
}
// Variable Color's
$background: #1A1B26;
$foreground: #A9B1D6;
$black: #24283B;
$gray: #565F89;
$red: #F7768E;
$green: #73DACA;
$yellow: #E0AF68;
$blue: #7AA2F7;
$magenta: #BB9AF7;
$cyan: #7DCFFF;
$white: $foreground;
/** General **/
.bar_class {
background-color: #0f0f17;
border-radius: 16px;
}
.module {
margin: 0px 0px 0px 0px;
border-radius: 10px 16px 0px 10px;
}
/** tooltip!! **/
tooltip.background {
background-color: #0f0f17;
font-size: 18;
border-radius: 10px;
color: #bfc9db;
}
tooltip label {
margin: 6px;
}
/** Widgets **/
.clock_time_sep {
font-size: 27;
color: #bfc9db;
margin: 0px 4px 1px 4px;
}
.clock_time_class, .clock_minute_class {
font-size: 23;
}
.clock_date_class {
font-size: 18;
margin: 0px 20px 0px -1px;
color: #d7beda;
}
.clock_minute_class {
margin: 0px 20px 0px 3px;
color: #bfc9db;
}
.clock_time_class {
color: #bfc9db;
font-weight: bold;
margin: 0px 5px 0px 0px;
}
.diskbar {
color: #AD5C6C;
background-color: #38384d;
border-radius: 10px;
}
.cpubar {
color: #297379;
background-color: #38384d;
border-radius: 10px;
}
.membar {
color: #e0b089;
background-color: #38384d;
border-radius: 10px;
}
.bat{
// font-family: JetBrainsMono Nerd Font;
font-family: Iosevka Nerd Font;
font-size: 1.2em;
padding-right: .5rem;
color: $blue;
}
.brightbar trough highlight {
background-image: linear-gradient(to right, #e4c9af 30%, #f2cdcd 50%, #e0b089 100% *50);
border-radius: 10px;
}
.volbar trough highlight {
background-image: linear-gradient(to right, #afcee0 30%, #a1bdce 50%, #77a5bf 100% *50);
border-radius: 10px;
}
.volume_icon {
font-size: 22;
color: #a1bdce;
margin: 0px 10px 0px 10px;
}
.module_essid {
font-size: 18;
color: #a1bdce;
margin: 0px 10px 0px 0px;
}
.module_vpn {
font-size: 18;
color: #77DD77;
margin: 0px 10px 0px 0px;
}
.module-wif {
font-size: 22;
color: #a1bdce;
border-radius: 100%;
margin: 0px 10px 0px 5px;
}
.iconcpu {
color: #297379;
}
.icondisk {
color: #AD5C6C;
}
.iconmem {
color: #e0b089;
}
.iconbat {
color: #afbea2;
}
.iconbat, .iconmem, .iconcpu, .icondisk {
font-size: 15;
margin: 10px;
}
.bright_icon {
font-size: 22;
color: #e4c9af;
margin: 0px 10px 0px 10px;
}
.separ {
color: #3e424f;
font-weight: bold;
font-size: 22px;
margin: 0px 8px 0px 8px;
}
.mem_module, .cpu_module, .disk_module{
background-color: #0f0f17;
border-radius: 16px;
margin: 0px 10px 0px 3px;
}
scale trough {
all: unset;
background-color: #22242b;
box-shadow: 0 2px 3px 2px #06060b;
border-radius: 16px;
min-height: 10px;
min-width: 70px;
margin: 0px 10px 0px 0px;
}
.works {
font-size: 27px;
// font-size: 45px;
font-weight: normal;
font-family: Iosevka Nerd Font;
margin: 5px 0px 0px 20px;
background-color: #0f0f17;
}
.0 , .01, .02, .03, .04, .05, .06, .07, .08, .09, .00,
.011, .022, .033, .044, .055, .066, .077, .088, .099, .000 {
margin: 0px 10px 0px 0px;
}
/* Unoccupied */
.0 {
color:#131d2c;
}
/* Occupied */
.01, .02, .03, .04, .05, .06, .07, .08, .09, .00 {
color: #5c6c82;
}
/* Focused */
.011, .022, .033, .044, .055, .066, .077, .088, .099, .000 {
color: #e4e6ea
}
.033.thunderbird {
color: #1E5EBB;
}
.066.twitter {
color: #1C9CEA;
}
.firefox.077 {
color: #DF5D00;
}
.twitch.088 {
color: #613F9F;
}
.discord.099 {
color:#5661EF;
}
.telegram.000 {
color: #0084C6;
}
.song_cover_art {
background-size: cover;
background-position: center;
min-height: 24px;
min-width: 24px;
margin: 10px;
border-radius: 100px;
}
.song {
color: #a1bdce;
font-size : 18px;
font-weight : bold;
margin : 3px 5px 0px 0px;
}
.song_btn_play {
color: #a1bdce;
font-size : 28px;
margin : 3px 0px 0px 5px;
}
.song_btn_prev, .song_btn_next {
color: #bfc9db;
font-size : 24px;
margin : 3px 0px 0px 5px;
}
// Calendar
.cal {
background-color: #0f0f17;
font-family: "JetBrainsMono Nerd Font";
font-size: 18px;
font-weight: normal;
.cal-in {
padding: 0px 10px 0px 10px;
color: #bfc9db;
.cal {
&.highlight {
padding: 20px;
}
padding: 5px 5px 5px 5px;
margin-left: 10px;
}
}
}
calendar:selected {
color: $blue;
font-size: 24px;
background: $background;
}
calendar.header {
color: $blue;
font-weight: bold;
}
calendar.button {
color: $magenta;
}
calendar.highlight {
color: $magenta;
font-weight: bold;
}
calendar:indeterminate {
color: $background;
}
.sys_sep {
color: #38384d;
font-size: 18;
margin: 0px 10px 0px 10px;
}
.sys_text_bat_sub, .sys_text_mem_sub {
font-size: 16;
color: #bbc5d7;
margin: 5px 0px 0px 25px;
}
.sys_text_bat, .sys_text_mem {
font-size: 21;
font-weight: bold;
margin: 14px 0px 0px 25px;
}
.sys_icon_bat, .sys_icon_mem {
font-size: 30;
margin: 30px;
}
.sys_win {
background-color: #0f0f17;
}
.sys_bat {
color: #afbea2;
background-color: #38384d;
border-radius: 10px;
}
.sys_mem {
color: #e4c9af;
background-color: #38384d;
border-radius: 10px;
}
.sys_icon_bat, .sys_text_bat {
color: #afbea2;
}
.sys_icon_mem, .sys_text_mem {
color: #e4c9af;
}
.sys_bat_box {
border-radius: 16px;
margin: 15px 10px 10px 20px;
}
.sys_mem_box {
border-radius: 16px;
margin: 10px 10px 15px 20px;
}
.music_pop {
background-color: #0f0f17;
border-radius: 16px;
}
.music_cover_art {
background-size: cover;
background-position: center;
min-height: 100px;
box-shadow: 5px 5px 5px 5px #06060b;
min-width: 170px;
margin: 20px;
border-radius: 20px;
}
.music {
color: #a1bdce;
font-size : 20px;
font-weight : bold;
margin : 20px 0px 0px -15px;
}
.music_artist {
color: #bbc5d7;
font-size : 16px;
font-weight : normal;
margin : 0px 0px 0px 0px;
}
.music_btn_prev, .music_btn_play, .music_btn_next {
font-family: Iosevka Nerd Font;
}
.music_btn_prev {
color: #bbc5d7;
font-size : 32px;
font-weight : normal;
margin: 0px 0px 0px 0px;
}
.music_btn_play {
color: #a1bdce;
font-size : 48px;
font-weight : normal;
margin: 0px 0px 0px 0px;
}
.music_btn_next {
color: #bbc5d7;
font-size : 32px;
font-weight : normal;
margin: 0px 0px 0px 0px;
}
.music_bar scale trough highlight {
all: unset;
background-image: linear-gradient(to right, #afcee0 30%, #a1bdce 50%, #77a5bf 100% *50);
border-radius: 24px;
}
.music_bar scale trough {
all: unset;
background-color: #232232;
box-shadow: 0 6px 5px 2px #06060b;
border-radius: 24px;
min-height: 13px;
min-width: 190px;
margin : -10px 10px 20px 0px;
}
.audio-box {
background-color: #0f0f17;
border-radius: 16px;
}
.speaker_icon {
background-size: cover;
background-image: url('images/speaker.png');
background-position: center;
min-height: 70px;
min-width: 75px;
margin: 10px 20px 5px 20px;
border-radius: 12px;
}
.speaker_text {
color: #a1bdce;
font-size : 26px;
font-weight : bold;
margin: 20px 0px 0px 0px;
}
.speaker_bar scale trough highlight {
all: unset;
background-image: linear-gradient(to right, #afcee0 30%, #a1bdce 50%, #77a5bf 100% *50);
border-radius: 24px;
}
.speaker_bar scale trough {
all: unset;
background-color: #232232;
box-shadow: 0 6px 5px 2px #06060b;
border-radius: 24px;
min-height: 13px;
min-width: 120px;
margin : 0px 0px 5px 0px;
}
.mic_icon {
background-size: cover;
background-image: url('images/mic.png');
background-position: center;
min-height: 70px;
min-width: 75px;
margin: 5px 20px 20px 20px;
border-radius: 12px;
}
.mic_text {
color: #a1bdce;
font-size : 26px;
font-weight : bold;
margin: 0px 0px 0px 0px;
}
.mic_bar scale trough highlight {
all: unset;
background-image: linear-gradient(to right, #afcee0 30%, #a1bdce 50%, #77a5bf 100% *50);
border-radius: 24px;
}
.mic_bar scale trough {
all: unset;
box-shadow: 0 6px 5px 2px #06060b;
background-color: #232232;
border-radius: 24px;
min-height: 13px;
min-width: 120px;
margin : 0px 0px 20px 0px;
}
.audio_sep {
color: #38384d;
font-size: 18;
margin : 0px 0px 0px 0px;
}
// Powermenu
.powermenu {
font-family: feather;
font-size: 1.3em;
font-weight: bold;
}
.button-qtres, .button-reb, .button-lock,
.button-quit, .button-off{
padding: .5rem .2rem .5rem .2rem;
// transition: all .2s ease-in-out;
}
.button-off{
color: $red;
}
.button-qtres:hover, .button-reb:hover, .button-lock:hover,
.button-quit:hover, .button-off:hover{
font-size: 1.2em;
box-shadow: inset 0 0 0 10em $background;
}
.button-bspres{
color: $green;
}
.button-reb{
color: $yellow
}
.button-quit{
color: $magenta;
}
.button-lock{
color: $blue;
}

463
.config/eww/bar/eww.yuck Normal file
View File

@ -0,0 +1,463 @@
;; Variables
(defpoll clock_time :interval "5s" "date +\%H")
(defpoll clock_minute :interval "5s" "date +\%M")
(defpoll clock_date :interval "5s" "date '+%d/%m'")
(defpoll volume_percent :interval "3s" :run-while vol_reveal "amixer -D pulse sget Master | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
(defpoll mic_percent :interval "3s" :run-while vol_reveal "amixer -D pulse sget Capture | grep 'Left:' | awk -F'[][]' '{ print $2 }' | tr -d '%'")
(defpoll brightness_percent :interval "5s" :run-while br_reveal "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
(defpoll caps_num_scroll_indicator :interval "300ms" "scripts/indicator")
(defvar vol_reveal false)
(defvar bat_rev false)
(defvar cpu_rev false)
(defvar mem_rev false)
(defvar disk_rev false)
(defvar br_reveal false)
(defvar vpn_reveal false)
(defvar bluetooth_rev false)
(defvar music_reveal false)
(defvar wifi_rev false)
(defvar time_rev false)
(defvar power_rev false)
(deflisten workspace "scripts/workspace")
(deflisten CURRENT_LAYOUT_SYMBOL "scripts/layout")
(defvar eww "$HOME/scripts/eww -c $HOME/.config/eww/bar")
(defpoll COL_WLAN :interval "1m" "~/.config/eww/bar/scripts/wifi --COL")
(defpoll ESSID_WLAN :interval "1m" "~/.config/eww/bar/scripts/wifi --ESSID")
(defpoll VPN_NAME :interval "1s" "rofi-wireguard")
(defpoll BLUETOOTHDEV :interval "1s" "rofi-bluetooth --status")
(defpoll WLAN_ICON :interval "1m" "~/.config/eww/bar/scripts/wifi --ICON")
(defpoll song :interval "2s" "~/.config/eww/bar/scripts/music_info --song")
(defpoll song_artist :interval "2s" "~/.config/eww/bar/scripts/music_info --artist")
(defpoll current_status :interval "1s" "~/.config/eww/bar/scripts/music_info --time")
(defpoll song_status :interval "2s" "~/.config/eww/bar/scripts/music_info --status")
(defpoll cover_art :interval "2s" "~/.config/eww/bar/scripts/music_info --cover")
;; widgets
(defwidget wifi []
(eventbox :onhover "${eww} update wifi_rev=true"
:onhoverlost "${eww} update wifi_rev=false"
(box :vexpand "false" :hexpand "false" :space-evenly "false"
(button :class "module-wif" :onclick "networkmanager_dmenu" :wrap "false" :limit-width 12 :style "color: ${COL_WLAN};" WLAN_ICON)
(revealer :transition "slideleft"
:reveal wifi_rev
:duration "350ms"
(label :class "module_essid"
:text ESSID_WLAN
)))))
(defwidget workspaces []
(literal :content workspace))
(defwidget sep []
(box :class "module-2" :vexpand "false" :hexpand "false"
(label :class "separ" :text "|")))
(defwidget clock_module []
(eventbox :onhover "${eww} update time_rev=true"
:onhoverlost "${eww} update time_rev=false"
(box :class "module" :space-evenly "false" :orientation "h" :spacing "3"
(label :text clock_time :class "clock_time_class" )
(label :text ":" :class "clock_time_sep" )
(label :text clock_minute :class "clock_minute_class")
(revealer :transition "slideleft"
:reveal time_rev
:duration "350ms"
(button :class "clock_date_class"
:onclick "$HOME/.config/eww/bar/scripts/pop calendar" clock_date
)
))))
(defwidget volume []
(eventbox :onhover "${eww} update vol_reveal=true"
:onhoverlost "${eww} update vol_reveal=false"
(box :class "module-2" :space-evenly "false" :orientation "h" :spacing "3"
(button :onclick "scripts/pop audio" :class "volume_icon" "${BLUETOOTHDEV=="" ? "": ""}")
(revealer :transition "slideleft"
:reveal vol_reveal
:duration "350ms"
(scale :class "volbar"
:value volume_percent
:orientation "h"
:tooltip "${volume_percent}%"
:max 100
:min 0
:onchange "amixer -D pulse sset Master {}%" )))))
(defwidget bright []
(eventbox :onhover "${eww} update br_reveal=true" :onhoverlost "${eww} update br_reveal=false"
(box :class "module-2" :space-evenly "false" :orientation "h" :spacing "3"
(label :text "" :class "bright_icon" :tooltip "brightness")
(revealer :transition "slideleft"
:reveal br_reveal
:duration "350ms"
(scale :class "brightbar"
:value brightness_percent
:orientation "h"
:tooltip "${brightness_percent}%"
:max 100
:min 0
:onchange "brightnessctl set {}%" )))))
;; Battery Widgets ;;
(defwidget bat []
(eventbox :onhover "${eww} update bat_rev=true"
:onhoverlost "${eww} update bat_rev=false"
(box :space-evenly "false"
(label :class "bat"
:text battery
:tooltip "Battery: ${EWW_BATTERY["BAT0"].capacity}%")
(revealer :transition "slideleft"
:reveal bat_rev
:duration "350ms"
:class "bat"
(label :text "${battery==""? "Charging": "Battery"}: ${EWW_BATTERY["BAT0"].capacity}%"))
)))
(defpoll battery :interval "1s" "scripts/battery icon")
(defwidget metric [widget widget_rev value tooltip_text]
(eventbox
:onhover "${eww} update ${widget}_rev=true"
:onhoverlost "${eww} update ${widget}_rev=false"
(box :class "${widget}_module" :vexpand "false" :hexpand "false"
(circular-progress
:value value
:class "${widget}bar"
:thickness 4
(button
:class "icon${widget}"
:limit-width 9
:tooltip tooltip_text
:onclick "$HOME/.config/eww/bar/scripts/pop system"
:show_truncated false
:wrap false
(revealer
:transition "slideleft"
:reveal widget_rev
:duration "350ms"
:class "icon${widget}"
(label
:text value
:tooltip "${tooltip_text}: ${value}%"
)
)
)
)
)
)
)
(defwidget metrics []
(box :orientation "h"
:space-evenly false
(metric :widget "disk" :widget_rev disk_rev :value "${round((1 - (EWW_DISK["/"].free / EWW_DISK["/"].total)) * 100, 0)}" :tooltip_text "Disk usage")
(metric :widget "cpu" :widget_rev cpu_rev :value "${round(EWW_CPU.avg, 0)}" :tooltip_text "CPU usage")
(metric :widget "mem" :widget_rev mem_rev :value "${round(EWW_RAM.used_mem_perc, 0)}" :tooltip_text "RAM usage")
))
(defwidget keyboard []
(box :class "volume_icon"
:orientation "v"
(label :text caps_num_scroll_indicator
:style "font-size: 7;"
:valign "end"
)
(label :text CURRENT_LAYOUT_SYMBOL
:valign "start"
:vexpand false
)
))
(defwidget vpn []
(eventbox :onhover "${eww} update vpn_reveal=true"
:onhoverlost "${eww} update vpn_reveal=false"
(box :vexpand "false" :hexpand "false" :space-evenly "false"
(button :class "module-wif" :timeout "10s" :onclick "rofi-wireguard --toggle" :wrap "false"
:limit-width 12 :style "color: ${VPN_NAME=="" ? "#3e424f": "#77DD77"};" "")
(revealer :transition "slideright"
:reveal vpn_reveal
:duration "350ms"
(button :class "module-wif" :timeout "10s" :onclick "rofi-wireguard --toggle" :wrap "false"
:limit-width 12 :style "color: ${VPN_NAME=="" ? "#3e424f": "#77DD77"};" VPN_NAME)
))))
(defwidget bluetooth []
(eventbox :onhover "${eww} update bluetooth_rev=true"
:onhoverlost "${eww} update bluetooth_rev=false"
(box :vexpand "false" :hexpand "false" :space-evenly "false"
(button :class "module-wif" :timeout "30s" :onclick "rofi-bluetooth" :wrap "false" :limit-width 12
:style "color: ${BLUETOOTHDEV=="" ? "#3e424f": "#77DD77"};" {BLUETOOTHDEV=="" ? "" : ""})
(revealer :transition "slideright"
:reveal bluetooth_rev
:duration "350ms"
(button :class "module-wif" :timeout "30s" :onclick "rofi-bluetooth" :wrap "false" :limit-width 12
:style "color: ${BLUETOOTHDEV=="" ? "#3e424f": "#77DD77"};" BLUETOOTHDEV)
))))
(defwidget power []
(eventbox :onhover "${eww} update power_rev=true"
:onhoverlost "${eww} update power_rev=false"
(box :orientation "h"
:space-evenly "false"
:vexpand "false"
:class "powermenu"
(revealer :transition "slideleft"
:reveal power_rev
:duration "550ms"
(box :orientation "h"
:space-evenly "false"
(button :class "button-qtres"
:tooltip "Restart qtile"
:onclick "scripts/qtile restart" "" )
(button :class "button-reb"
:tooltip "Reboot"
:onclick "reboot" "")
(button :class "button-quit"
:tooltip "Logout"
:onclick "scripts/qtile shutdown" "")
(button :class "button-lock"
:tooltip "Lock Screen"
:onclick "lock-screen" "")))
(button :class "button-off"
:tooltip "Shutdown"
:onclick "shutdown now" ""))))
;; Music
(defwidget music []
(eventbox :onhover "${eww} update music_reveal=true"
:onhoverlost "${eww} update music_reveal=false"
(box :class "module-2" :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :class "song_cover_art" :vexpand "false" :hexpand "false" :style "background-image: url('${cover_art}');")
(button :class "song" :onclick "~/.config/eww/bar/scripts/pop music" song)
(revealer :transition "slideright"
:reveal music_reveal
:duration "350ms"
(box :vexpand "false" :hexpand "false" :orientation "h"
(button :class "song_btn_prev" :onclick "~/.config/eww/bar/scripts/music_info --prev" "")
(button :class "song_btn_play" :onclick "~/.config/eww/bar/scripts/music_info --toggle" song_status)
(button :class "song_btn_next" :onclick "~/.config/eww/bar/scripts/music_info --next" ""))))))
(defwidget left []
(box :orientation "h"
:space-evenly false
:halign "end"
:class "left_modules"
(keyboard)
(vpn)
(bluetooth)
(bright)
(volume)
(wifi)
(sep)
(metrics)
(bat)
(sep)
(clock_module)
(power)))
(defwidget right []
(box :orientation "h"
:space-evenly false
:halign "start"
:class "right_modules"
(workspaces)))
(defwidget center []
(box :orientation "h"
:space-evenly false
:halign "center"
:class "center_modules"
(music)))
(defwidget topbar []
(centerbox
:orientation "h"
:class "bar_class"
(right)
(center)
(left)
)
)
(defwindow bar
:monitor 0
:geometry (geometry :x "0%"
:y "4px"
:width "99%"
:height "50px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance "58px" :side "top")
:windowtype "dock"
:wm-ignore false
(topbar))
(defwidget system []
(box :class "sys_win" :orientation "v" :space-evenly "false" :hexpand "false" :vexpand "false" :spacing 0
(box :class "sys_bat_box" :orientation "h" :space-evenly "false"
(circular-progress :value "${EWW_BATTERY["BAT0"].capacity}"
:class "sys_bat"
:thickness 9
(label :text ""
:class "sys_icon_bat"
:limit-width 2
:show_truncated false
:wrap false))
(box :orientation "v" :space-evenly "false" :spacing 0 :hexpand "false" :vexpand "false"
(label :text "battery"
:halign "start"
:class "sys_text_bat"
:limit-width 9
:show_truncated false
:wrap false)
(label :text "${EWW_BATTERY["BAT0"].capacity}%"
:halign "start"
:class "sys_text_bat_sub"
:limit-width 22
:show_truncated false
:wrap false)
(label :text "${EWW_BATTERY["BAT0"].status}"
:halign "start"
:class "sys_text_bat_sub"
:limit-width 22
:show_truncated false
:wrap false)))
(label :text "" :class "sys_sep" :halign "center")
(box :class "sys_mem_box" :orientation "h" :space-evenly "false" :halign "start"
(circular-progress :value "${round(EWW_RAM.used_mem_perc, 0)}"
:class "sys_mem"
:thickness 9
(label :text ""
:class "sys_icon_mem"
:limit-width 2
:show_truncated false
:wrap false
:angle 0.0))
(box :orientation "v" :space-evenly "false" :spacing 0 :hexpand "false" :vexpand "false"
(label :text "memory"
:halign "start"
:class "sys_text_mem"
:limit-width 9
:show_truncated false
:wrap false)
(label :text "${round(EWW_RAM.used_mem/1024, 0)} | ${round(EWW_RAM.total_mem/1024, 0)}mb "
:halign "start"
:class "sys_text_mem_sub"
:limit-width 22
:show_truncated false
:wrap false)
(label :text "${round(EWW_RAM.free_mem/1024,0)}mb free"
:halign "start"
:class "sys_text_mem_sub"
:limit-width 22
:show_truncated false
:wrap false)))))
(defwidget cal []
(box :class "cal" :orientation "v"
(box :class "cal-in"
(calendar :class "cal"
; :onclick "echo {} is selected >> /home/sahin/caltest"
:show-day-names true
:show-heading true
:show-details true
:show-week-numbers true
))))
(defwindow calendar
:geometry (geometry :x "-20px"
:y "7%"
:anchor "top right"
:width "270px"
:height "60px")
(cal))
(defwidget audio []
(box :class "audio-box" :orientation "v" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :halign "v" :space-evenly "false" :hexpand "false" :vexpand "false"
(box :class "speaker_icon" :orientation "v")
(box :orientation "v" :halign "center" :vexpand "false" :hexpand "false"
(label :class "speaker_text" :text "speaker" :valign "center" :halign "left" )
(box :class "speaker_bar" :halign "center" :vexpand "false" :hexpand "false"
(scale :value volume_percent
:space-evenly "false"
:orientation "h"
:onchange "amixer -D pulse sset Master {}%"
:tooltip "volume on ${volume_percent}%"
:max 100
:min 0))))
(label :text "" :class "audio_sep" :halign "center")
(box :halign "v" :space-evenly "false" :hexpand "false" :vexpand "false"
(box :class "mic_icon" :orientation "v")
(box :orientation "v" :halign "center" :vexpand "false" :hexpand "false"
(label :class "mic_text" :text "mic" :valign "center" :halign "left" )
(box :class "mic_bar" :halign "center" :vexpand "false" :hexpand "false"
(scale :value mic_percent
:space-evenly "false"
:orientation "h"
:tooltip "mic on ${mic_percent}%"
:onchange "amixer -D pulse sset Capture {}%"
:max 100
:min 0))))))
(defwindow audio_ctl
:geometry (geometry :x "-20px"
:y "7%"
:anchor "top right"
:width "280px"
:height "60px")
(audio))
(defwindow system
:geometry (geometry :x "-20px"
:y "7%"
:anchor "top right"
:width "290px"
:height "120px")
(system))
;; Music
(defwidget music_pop []
(box :class "music_pop" :orientation "h" :space-evenly "false" :vexpand "false" :hexpand "false"
(box :class "music_cover_art" :vexpand "false" :hexpand "false" :style "background-image: url('${cover_art}');")
(box :orientation "v" :spacing 20 :space-evenly "false" :vexpand "false" :hexpand "false"
(label :halign "center" :class "music" :wrap "true" :limit-width 13 :text song)
(label :halign "center" :class "music_artist" :wrap "true" :limit-width 15 :text song_artist)
(box :orientation "h" :spacing 15 :halign "center" :space-evenly "false" :vexpand "false" :hexpand "false"
(button :class "music_btn_prev" :onclick "~/.config/eww/bar/scripts/music_info --prev" "")
(button :class "music_btn_play" :onclick "~/.config/eww/bar/scripts/music_info --toggle" song_status)
(button :class "music_btn_next" :onclick "~/.config/eww/bar/scripts/music_info --next" ""))
(box :class "music_bar" :halign "center" :vexpand "false" :hexpand "false" :space-evenly "false"
(scale :onscroll "mpc -q seek {}" :min 0 :active "true" :max 100 :value current_status)))))
;; music
(defwindow music_win :stacking "fg" :focusable "false" :screen 1
:geometry (geometry :x "0" :y "7%" :width 428 :height 104 :anchor "top center")
(music_pop))

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

43
.config/eww/bar/scripts/battery Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
bat=/sys/class/power_supply/BAT0/
per="$(cat "$bat/capacity")"
icon() {
[ $(cat "$bat/status") = Charging ] && echo "" && exit
if [ "$per" -gt "90" ]; then
icon=""
elif [ "$per" -gt "80" ]; then
icon=""
elif [ "$per" -gt "70" ]; then
icon=""
elif [ "$per" -gt "60" ]; then
icon=""
elif [ "$per" -gt "50" ]; then
icon=""
elif [ "$per" -gt "40" ]; then
icon=""
elif [ "$per" -gt "30" ]; then
icon=""
elif [ "$per" -gt "20" ]; then
icon=""
elif [ "$per" -gt "10" ]; then
icon=""
elif [ "$per" -gt "0" ]; then
icon=""
else
echo  && exit
fi
echo "$icon"
}
percent() {
echo $per
}
[ "$1" = "icon" ] && icon && exit
[ "$1" = "percent" ] && percent && exit
exit

View File

@ -0,0 +1,14 @@
#!/bin/bash
query=$(xset q | grep -Po "(?:Caps|Num|Scroll)\s+Lock:\s*(\w*)" | grep -Po "(off|on)")
result=""
for i in $query
do
[ $i = "off" ] && result+="ﰊ "|| result+="ﰉ "
done
# somehow results are shown reversed. So i am reversing them here to fix it
echo $result | rev | xargs

9
.config/eww/bar/scripts/layout Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
xprop -spy -root _XKB_RULES_NAMES | while read -r line; do
variant=$(echo $line | cut -d',' -f4 | tr -d '"')
if [[ "$variant" == " cdhpt" ]]; then
echo ""
else
echo ""
fi
done

View File

@ -0,0 +1,98 @@
#!/bin/bash
# scripts by adi1090x
## Get data
STATUS="$(mpc status)"
COVER="/tmp/.music_cover.png"
MUSIC_DIR="$HOME/Music"
## Get status
get_status() {
if [[ $STATUS == *"[playing]"* ]]; then
echo ""
else
echo "奈"
fi
}
## Get song
get_song() {
song=`mpc -f %title% current`
if [[ -z "$song" ]]; then
echo "Offline"
else
echo "$song"
fi
}
## Get artist
get_artist() {
artist=`mpc -f %artist% current`
if [[ -z "$artist" ]]; then
echo ""
else
echo "$artist"
fi
}
## Get time
get_time() {
time=`mpc status | grep "%)" | awk '{print $4}' | tr -d '(%)'`
if [[ -z "$time" ]]; then
echo "0"
else
echo "$time"
fi
}
get_ctime() {
ctime=`mpc status | grep "#" | awk '{print $3}' | sed 's|/.*||g'`
if [[ -z "$ctime" ]]; then
echo "0:00"
else
echo "$ctime"
fi
}
get_ttime() {
ttime=`mpc -f %time% current`
if [[ -z "$ttime" ]]; then
echo "0:00"
else
echo "$ttime"
fi
}
## Get cover
get_cover() {
ffmpeg -i "${MUSIC_DIR}/$(mpc current -f %file%)" "${COVER}" -y &> /dev/null
STATUS=$?
# Check if the file has a embbeded album art
if [ "$STATUS" -eq 0 ];then
echo "$COVER"
else
echo "images/music.png"
fi
}
## Execute accordingly
if [[ "$1" == "--song" ]]; then
get_song
elif [[ "$1" == "--artist" ]]; then
get_artist
elif [[ "$1" == "--status" ]]; then
get_status
elif [[ "$1" == "--time" ]]; then
get_time
elif [[ "$1" == "--ctime" ]]; then
get_ctime
elif [[ "$1" == "--ttime" ]]; then
get_ttime
elif [[ "$1" == "--cover" ]]; then
get_cover
elif [[ "$1" == "--toggle" ]]; then
mpc -q toggle
elif [[ "$1" == "--next" ]]; then
{ mpc -q next; get_cover; }
elif [[ "$1" == "--prev" ]]; then
{ mpc -q prev; get_cover; }
fi

92
.config/eww/bar/scripts/pop Executable file
View File

@ -0,0 +1,92 @@
#!/bin/bash
calendar() {
LOCK_FILE="$HOME/.cache/eww-calendar.lock"
EWW_BIN="$HOME/scripts/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open calendar
}
# Open widgets
if [[ ! -f "$LOCK_FILE" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close system music_win audio_ctl
touch "$LOCK_FILE"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close calendar
rm "$LOCK_FILE" && echo "closed"
fi
}
system() {
LOCK_FILE_MEM="$HOME/.cache/eww-system.lock"
EWW_BIN="$HOME/scripts/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open system
}
# Open widgets
if [[ ! -f "$LOCK_FILE_MEM" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close calendar music_win audio_ctl
touch "$LOCK_FILE_MEM"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close system
rm "$LOCK_FILE_MEM" && echo "closed"
fi
}
music() {
LOCK_FILE_SONG="$HOME/.cache/eww-song.lock"
EWW_BIN="$HOME/scripts/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open music_win
}
# Open widgets
if [[ ! -f "$LOCK_FILE_SONG" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close system calendar
touch "$LOCK_FILE_SONG"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close music_win
rm "$LOCK_FILE_SONG" && echo "closed"
fi
}
audio() {
LOCK_FILE_AUDIO="$HOME/.cache/eww-audio.lock"
EWW_BIN="$HOME/scripts/eww"
run() {
${EWW_BIN} -c $HOME/.config/eww/bar open audio_ctl
}
# Open widgets
if [[ ! -f "$LOCK_FILE_AUDIO" ]]; then
${EWW_BIN} -c $HOME/.config/eww/bar close system calendar music
touch "$LOCK_FILE_AUDIO"
run && echo "ok good!"
else
${EWW_BIN} -c $HOME/.config/eww/bar close audio_ctl
rm "$LOCK_FILE_AUDIO" && echo "closed"
fi
}
if [ "$1" = "calendar" ]; then
calendar
elif [ "$1" = "system" ]; then
system
elif [ "$1" = "music" ]; then
music
elif [ "$1" = "audio" ]; then
audio
fi

12
.config/eww/bar/scripts/qtile Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
case "$1" in
switch) qtile cmd-obj -o group $2 -f toscreen
;;
restart) qtile cmd-obj -o cmd -f restart
;;
shutdown) qtile cmd-obj -o cmd -f shutdown
;;
esac

26
.config/eww/bar/scripts/wifi Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
status=$(nmcli g | grep -oE "disconnected")
essid=$(nmcli c | grep wlan0 | awk '{print ($1)}')
if [ $status ] ; then
icon=""
text=""
col="#575268"
else
icon=""
text="${essid}"
col="#a1bdce"
fi
if [[ "$1" == "--COL" ]]; then
echo $col
elif [[ "$1" == "--ESSID" ]]; then
echo $text
elif [[ "$1" == "--ICON" ]]; then
echo $icon
fi

View File

@ -0,0 +1,6 @@
#!/bin/bash
dir=`dirname $0`
python3 $dir/workspaces.py
tail -F -n1 ~/.cache/workspaces | while read -r; do
python3 $dir/workspaces.py
done

View File

@ -0,0 +1,53 @@
from libqtile.command.client import CommandClient
c = CommandClient()
groups = {}
for name, group in c.call('groups').items():
if name == "scratchpad":
continue
occupied = len(group["windows"]) > 0
focused = group['screen'] is not None
groups[name] = {"occupied": occupied, "focused": focused}
output = '(box :class "works" :orientation "h" :spacing 5 :space-evenly "false" '
for name, prop in groups.items():
command = f"scripts/qtile switch {name}"
class_ = "0"
focused, occupied = prop['focused'], prop['occupied']
if focused:
class_ += name * 2
elif occupied:
class_ += name
if occupied:
if name == "3":
class_ += " thunderbird"
elif name == "6":
class_ += " twitter"
elif name == "7":
class_ += " firefox"
elif name == "8":
class_ += " twitch"
elif name == "9":
class_ += " discord"
elif name == "0":
class_ += " telegram"
icons = {
"1": "1",
"2": "",
"3": "",
"4": "",
"5": "",
"6": "",
"7": "",
"8": "",
"9": "",
"0": "",
}
icon = icons[name]
output += f'(button :onclick "{command}" :class "{class_}" "{icon}") '
output += ')'
print(output)

View File

@ -1,7 +1,7 @@
import subprocess
import os
from libqtile import hook
from libqtile.command.client import InteractiveCommandClient
@hook.subscribe.startup
@ -9,12 +9,19 @@ def autostart():
subprocess.call(["autostart.sh"])
@hook.subscribe.startup_complete
def focus_group():
c = InteractiveCommandClient()
c.group["4"].toscreen()
@hook.subscribe.client_managed
def show_window(window):
window.group.cmd_toscreen()
@hook.subscribe.client_managed
@hook.subscribe.client_urgent_hint_changed
@hook.subscribe.client_killed
@hook.subscribe.setgroup
@hook.subscribe.group_window_add
@hook.subscribe.current_screen_change
@hook.subscribe.changegroup
def hook_response(*args, **kwargs):
file = os.path.expanduser('~/.cache/workspaces')
with open(file, 'a') as f:
print('workspace changed', file=f)

View File

@ -50,7 +50,7 @@ keys = [
Key([mod], "l", lazy.layout.right(), desc="Move focus to right"),
Key([mod], "j", lazy.layout.down(), desc="Move focus down"),
Key([mod], "k", lazy.layout.up(), desc="Move focus up"),
Key([mod], "u", explore, desc="Move focus up"),
Key([mod], "u", explore, desc="Open app related with current group"),
Key(
[mod],
"Tab",

View File

@ -1,163 +1,3 @@
import re
import subprocess
from subprocess import check_output
from libqtile import bar, widget
from libqtile.config import Screen
from libqtile.command import lazy
# from libqtile.log_utils import logger
def create_sep():
return widget.Sep(foreground="707880", size_percent=60)
def run_shell_command(command):
def inner():
res = check_output(command.split()).decode("utf-8").strip()
return res or " "
return inner
class CapsNumScrollLockIndicator(widget.CapsNumLockIndicator):
def get_indicators(self):
"""Return a list with the current state of the keys."""
try:
output = self.call_process(["xset", "q"])
except subprocess.CalledProcessError as err:
output = err.output
return []
indicators = re.findall(r"(?:Caps|Num|Scroll)\s+Lock:\s*(\w*)", output)
return indicators
def poll(self):
"""Poll content for the text box."""
indicators = self.get_indicators()
on, off = "", ""
status = " ".join(indicators)
status = status.replace("off", off).replace("on", on)[::-1]
# reversed because it cames backwards somehow.
return status
screens = [
Screen(
top=bar.Bar(
[
# widget.CurrentLayout(),
widget.GroupBox(
active="62AEEF", # Active group font colour
block_highlight_text_color="62AEFF", # Selected group font colour
disable_drag=True, # Disable dragging and dropping of group names on widget
font="Iosevka Nerd Font",
fontsize=20,
foreground="ff0000", # Foreground colour
highlight_color=[
"373B41",
# "282828",
], # Active group highlight color when using 'line' highlight method.
highlight_method="line", # Method of highlighting ('border', 'block', 'text', or 'line')Uses *_border color settings
inactive="707880", # Inactive group font colour
invert_mouse_wheel=True, # Whether to invert mouse wheel group movement
padding_x=8, # X Padding. Overrides 'padding' if set
),
widget.Prompt(),
create_sep(),
widget.WindowName(),
widget.Chord(
chords_colors={
"launch": ("#ff0000", "#ffffff"),
},
name_transform=lambda name: name.upper(),
),
widget.GenPollText(
func=run_shell_command("wgd"),
fontsize=23,
font="Iosevka Nerd Font",
foreground="62AEEF",
fmt="{}",
update_interval=1,
mouse_callbacks={"Button1": lazy.spawn("wgd --toggle")},
),
create_sep(),
widget.GenPollText(
func=run_shell_command("rofi-bluetooth --status"),
fontsize=18,
font="Iosevka Nerd Font",
foreground="62AEEF",
update_interval=1,
mouse_callbacks={"Button1": lazy.spawn("rofi-bluetooth")},
),
create_sep(),
widget.PulseVolume(
emoji=True,
limit_max_volume=True,
step=4,
update_interval=0.1,
fmt='<span foreground="#62AEEF">VOL</span> {}',
),
create_sep(),
widget.KeyboardLayout(
configured_keyboards=["us cdhpt", "us cdhisopt"],
font="Iosevka Nerd Font Mono",
fontsize=23,
display_map={"us cdhpt": "", "us cdhisopt": ""},
foreground="62AEFF",
),
CapsNumScrollLockIndicator(update_interval=0.5, foreground="62AEFF"),
create_sep(),
widget.WidgetBox(
widgets=[
widget.DF(
visible_on_warn=False,
format='<span foreground="#62AEEF">{p}</span> {r:.0f}%',
),
create_sep(),
widget.Memory(
fmt='<span foreground="#62AEEF">RAM</span> {}',
format="{MemPercent: .0f}%",
),
create_sep(),
widget.CPU(
format="{load_percent: .0f}%",
fmt='<span foreground="#62AEEF">CPU</span> {}',
),
create_sep(),
],
text_closed="[S<]",
text_open="[S>]",
foreground="62AEEF",
close_button_location="right",
),
widget.WidgetBox(
widgets=[
widget.Net(interface=["enp3s0"]),
widget.Wlan(format="{essid} {percent:2.0%}"),
create_sep(),
],
text_closed="[N<]",
text_open="[N>]",
foreground="62AEEF",
close_button_location="right",
),
widget.Battery(format="{char} {percent:2.0%} {hour:d}:{min:02d}"),
widget.Clock(format="%Y-%m-%d %a %I:%M %p"),
widget.Systray(),
],
size=30,
background="#282A2E",
border_width=[0, 0, 0, 0],
margin=[4, 4, 4, 4],
border_color=[
"000000",
"000000",
"000000",
"000000",
],
opacity=0.95,
),
),
]
screens = [Screen()]

8
.gitmodules vendored
View File

@ -4,9 +4,11 @@
[submodule ".config/nvim"]
path = .config/nvim
url = https://github.com/Asocia/nvim-config.git
[submodule "GitRepositories/rofi-bluetooth"]
path = GitRepositories/rofi-bluetooth
url = https://github.com/nickclyde/rofi-bluetooth.git
[submodule "GitRepositories/polybar-wireguard"]
path = GitRepositories/polybar-wireguard
url = https://github.com/mil-ad/polybar-wireguard.git
ignore = dirty
[submodule "GitRepositories/rofi-bluetooth"]
path = GitRepositories/rofi-bluetooth
url = https://github.com/nickclyde/rofi-bluetooth.git
ignore = dirty

View File

@ -1,18 +1,64 @@
diff --git a/polybar-wireguard b/polybar-wireguard
index 6712185..b770d44 100755
deleted file mode 100755
index 6712185..0000000
--- a/polybar-wireguard
+++ b/polybar-wireguard
@@ -6,11 +6,11 @@
# https://github.com/polybar/polybar/wiki/Formatting#format-tags-inside-polybar-config
green=#55aa55
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env sh
-
-# Unfortunately it's not easy to directly use Polybar colour values in this
-# script so I have to redefine some of my colours here. See the link below for
-# more details:
-# https://github.com/polybar/polybar/wiki/Formatting#format-tags-inside-polybar-config
-green=#55aa55
-
-configs_path="/PATH/TO/CONF/FILES"
+configs_path="$HOME/.config/wireguard"
connected_interface=$(sudo wg | grep interface | cut -d " " -f2)
connect() {
-connected_interface=$(sudo wg | grep interface | cut -d " " -f2)
-
-connect() {
- selected_config=$(ls $configs_path/*.conf | xargs basename -a -s .conf | dmenu)
+ selected_config=$(ls $configs_path/*.conf | xargs basename -a -s .conf | rofi -i -dmenu -p "Connect to: ")
[[ $selected_config ]] && sudo wg-quick up "$configs_path"/"$selected_config".conf
}
- [[ $selected_config ]] && sudo wg-quick up "$configs_path"/"$selected_config".conf
-}
-
-disconnect() {
- # Normally we should have a single connected interface but technically
- # there's nothing stopping us from having multiple active intgerfaces so
- # let's do this in a loop:
- for connected_config in $(sudo wg | grep interface | cut -d " " -f2)
- do
- sudo wg-quick down $configs_path/"$connected_config".conf
- done
-}
-
-toggle() {
- if [[ $connected_interface ]]
- then
- disconnect
- else
- connect
- fi
-}
-
-print() {
- if [[ $connected_interface ]]
- then
- echo %{u"$green"}%{+u}%{T4}%{F"$green"}%{T-}%{F-} "$connected_interface"
- else
- echo %{T4}%{T-}
- fi
-}
-
-case "$1" in
- --connect)
- connect
- ;;
- --disconnect)
- disconnect
- ;;
- --toggle)
- toggle
- ;;
- *)
- print
- ;;
-esac

View File

@ -1,5 +1,5 @@
diff --git a/rofi-bluetooth b/rofi-bluetooth
index 5c52fd8..cebb5c1 100755
index 5c52fd8..012e612 100755
--- a/rofi-bluetooth
+++ b/rofi-bluetooth
@@ -33,7 +33,6 @@ power_on() {
@ -51,3 +51,21 @@ index 5c52fd8..cebb5c1 100755
fi
}
@@ -183,8 +175,6 @@ toggle_trust() {
# Useful for status bars like polybar, etc.
print_status() {
if power_on; then
- printf ''
-
mapfile -t paired_devices < <(bluetoothctl paired-devices | grep Device | cut -d ' ' -f 2)
counter=0
@@ -202,8 +192,6 @@ print_status() {
fi
done
printf "\n"
- else
- echo ""
fi
}

View File

@ -9,7 +9,11 @@ function run {
#feh --bg-scale /usr/share/endeavouros/backgrounds/endeavouros-wallpaper.png
rm ~/.cache/workspaces
nitrogen --save --set-zoom-fill ~/Pictures/Wallpapers/default.jpg
run picom & disown # --experimental-backends --vsync should prevent screen tearing on most setups if needed
eww -c ~/.config/eww/bar/ close-all
eww -c ~/.config/eww/bar/ open bar
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & disown # start polkit agent from GNOME

View File

@ -1 +0,0 @@
/home/sahin/GitRepositories/polybar-wireguard/polybar-wireguard

1
scripts/rofi-wireguard Symbolic link
View File

@ -0,0 +1 @@
/home/sahin/GitRepositories/rofi-wireguard/rofi-wireguard