diff --git a/dolphinrc b/dolphinrc new file mode 100644 index 00000000..349b1d41 --- /dev/null +++ b/dolphinrc @@ -0,0 +1,21 @@ +[$Version] +update_info=dolphin_detailsmodesettings.upd:rename-leading-padding + +[General] +Version=202 +ViewPropsTimestamp=2023,5,12,19,59,9.33 + +[Icons] +Theme=Adwaita:dark + +[KFileDialog Settings] +Places Icons Auto-resize=false +Places Icons Static Size=22 + +[KPropertiesDialog] +1920x1200 screen: Height=567 +1920x1200 screen: Width=604 + +[MainWindow] +MenuBar=Disabled +ToolBarsMovable=Disabled diff --git a/eww/README.md b/eww/README.md new file mode 100644 index 00000000..e17e49ea --- /dev/null +++ b/eww/README.md @@ -0,0 +1,3 @@ +credits: https://github.com/AlphaTechnolog/dotfiles/tree/openbox + +it has been slightly modified diff --git a/eww/actions/actions.scss b/eww/actions/actions.scss new file mode 100644 index 00000000..b3a9047a --- /dev/null +++ b/eww/actions/actions.scss @@ -0,0 +1,159 @@ +.actions { + background-color: $bg; + color: $fg; + //font-family: Product Sans; + font-family: Ubuntu Mono; + border-radius: 30px; + border: 5px solid $contrastbg; + padding: 10px 18px; +} + +.controlsbox { + background-color: $contrastbg; + border-radius: 7px; + padding: 7px 12px; + + .vol-slider { + .vol-label { + min-width: 25px; /* Set the width according to your icons */ + font-size: 26px; + font-family: Iosevka Nerd Font; + margin-right: 15px; + color: $blue; + } + & scale trough { + all: unset; + border-radius: 10px; + background-color: $black; + border: none; + min-height: 16px; + min-width: 250px; + margin-left: 3px; + & highlight { + all: unset; + background: linear-gradient(to right, $blue, $cyan); + color: #000000; + border-radius: 10px; + } + } + } + + .br-slider { + .br-label { + min-width: 25px; /* Set the width according to your icons */ + font-size: 26px; + font-family: Iosevka Nerd Font; + margin-right: 15px; + color: $yellow; + } + & scale trough { + all: unset; + border-radius: 10px; + background-color: $black; + border: none; + min-height: 16px; + min-width: 250px; + margin-left: 3px; + & highlight { + all: unset; + background: linear-gradient(to right, $red, $yellow); + color: #000000; + border-radius: 10px; + } + } + } +} + +.userinfobox { + .time { + font-size: 42px; + } + .pfp { + background-position: center; + background-size: cover; + background-repeat: no-repeat; + border-radius: 50px; + min-width: 30px; + min-height: 30px; + } + .daybox { + margin-top: 8px; + font-size: 14px; + } + .username { + //font-family: Product Sans; + font-family: Ubuntu Mono; + } + .useractions { + .logout { + background-color: $black; + font-family: Iosevka Nerd Font; + font-size: 18px; + padding: 6px 12px 6px 6px; + border-radius: 4px; + transition: all ease .2s; + &:hover { background-color: $dimblack; } + &:active { background-color: $black; } + } + } +} + +.sysbuttonsbox { + .block-container { + .block { + background-color: $contrastbg; + padding: 0px 6px; + border-radius: 50px; + transition: all ease .2s; + color: $fg; + &:hover { background-color: $bgSecondary; } + &:active { background-color: $contrastbg; } + &.active { + background-color: $black; + &:hover { background-color: $dimblack; } + &:active { background-color: $black; } + .sepbox .sep { + background-color: $lightblack; + } + } + .iconbox .icon { + font-family: Iosevka Nerd Font; + padding: 7px 14px 7px 14px; + font-size: 20px; + min-width: 20px; + } + .sepbox .sep { + background-color: $black; + margin: 0px 4px; + padding: 0px 1px; + } + .chevronbox { + font-family: Iosevka Nerd Font; + padding: 0px 12px; + } + } + .label { + font-family: Product Sans; + font-size: 14px; + } + } +} + +.poweractionsbox { + .info { + font-size: 26px; + } + .buttons { + font-family: Iosevka Nerd Font; + font-size: 22px; + button { + padding: 1px 9px 1px 9px; + background-color: $bgSecondary; + border-radius: 5px; + transition: all ease .2s; + &:hover { background-color: $black; } + &:active { background-color: $bg; } + &.do-logout { color: $yellow; } + } + } +} diff --git a/eww/actions/actions.yuck b/eww/actions/actions.yuck new file mode 100644 index 00000000..59e7ee4f --- /dev/null +++ b/eww/actions/actions.yuck @@ -0,0 +1,209 @@ +(defwidget sysblock [icon onclick active label] + (box :class "block-container" + :orientation "v" + :space-evenly false + :spacing 5 + (button :class "block ${active ? 'active' : ''}" :onclick "${onclick}" + (box :orientation "h" + :space-evenly false + (box :class "iconbox" + :halign "start" + :space-evenly true + :orientation "h" + (label :text "${icon}" :class "icon") + ) + (box :class "sepbox" + :halign "center" + :space-evenly true + :orientation "h" + (box :class "sep") + ) + (box :class "chevronbox" + :halign "end" + :space-evenly true + :orientation "h" + (label :text "") + ) + ) + ) + (label :halign "center" :text "${label}" :class "label") + ) +) + +(defwidget sysbuttons [] + (box :class "sysbuttonsbox" + :orientation "v" + :space-evenly false + :spacing 20 + (box :class "firstrow" + :orientation "h" + :space-evenly true + (box :halign "start" + :orientation "h" + :space-evenly true + (sysblock :icon "${network_icon}" + :onclick "~/.config/eww/scripts/network.sh toggle" + :active "${network_status == 'Connected' ? true : false}" + :label "${network_ssid}") + ) + (box :halign "center" + :orientation "h" + :space-evenly true + (sysblock :icon "${bluetooth_state == 'on' ? '' : ''}" + :onclick "~/.config/eww/scripts/bluetooth toggle" + :active "${bluetooth_state == 'on' ? true : false}" + :label "Bluetooth") + ) + (box :halign "end" + :orientation "h" + :space-evenly true + (sysblock :icon "${network_radio == 'on' ? '' : ''}" + :onclick "~/.config/eww/scripts/network.sh toggle-radio" + :active "${network_radio == 'on' ? false : true}" + :label "Airplane") + ) + ) + (box :class "lastrow" + :orientation "h" + :space-evenly true + (box :halign "start" + :orientation "h" + :space-evenly true + (sysblock :icon "${redshift_state == 'on' ? '' : ''}" + :onclick "~/.config/eww/scripts/redshift toggle" + :active "${redshift_state == 'on' ? true : false}" + :label "Night Light") + ) + (box :halign "center" + :orientation "h" + :space-evenly true + (sysblock :icon "${volume_icon}" + :onclick "~/.config/eww/scripts/volume.sh toggle-muted" + :active "${is_muted == 'yes' ? false : true}" + :label "Volume") + ) + (box :halign "end" + :orientation "h" + :space-evenly true + (sysblock :icon "${mic_status == 'yes' ? '' : ''}" + :onclick "~/.config/eww/scripts/mic toggle" + :active "${mic_status == 'yes' ? true : false}" + :label "Micro") + ) + ) + ) +) + +(defwidget controls [] + (box :class "controlsbox" + :orientation "v" + :space-evenly false + :spacing 10 + (box :orientation "h" + :space-evenly "false" + :class "vol-slider" + (box :class "vol-label" + volume_icon + ) + (scale :value volume_value + :onchange "~/.config/eww/scripts/volume.sh set {}" + :min 0 + :max 101) + ) + (box :orientation "h" + :space-evenly "false" + :class "br-slider" + (box :class "br-label" + br_icon + ) + (scale :value br + :onchange "~/.config/eww/scripts/brightness.sh set {}" + :min 0 + :max 101) + ) + ) +) + +(defwidget user [] + (box :class "userinfobox" + :orientation "h" + :space-evenly false + (box :class "info" + :space-evenly false + :orientation "h" + :halign "start" + :valign "center" + :spacing 10 + (label :text "${lithour}:${litmin}" :class "time") + (box :class "daybox" + :orientation "v" + :space-evenly false + (label :text "${shortday}" :halign "start") + (label :text "${weekday}" :halign "start") + ) + ) + (box :orientation "h" + :space-evenly false + :halign "end" + :valign "center" + :hexpand true + (box :class "pfp" + :style "background-image: url('${pfp}');") + ) + ) +) + +(defwidget poweractions [] + (box :class "poweractionsbox" + :orientation "h" + :space-evenly true + (box :class "buttons-container" + :space-evenly true + :halign "end" + :orientation "h" + (box :class "buttons" + :orientation "h" + :space-evenly true + :spacing 10 + (button :class "do-logout" + :onclick "eww open powermenu && eww open powermenu-closer && eww close actions && eww close actions-closer" + :tooltip "Logout" + :halign "end" + "" + ) + ) + ) + ) +) + +(defwidget actions [] + (box :class "actions" + :orientation "v" + :space-evenly false + :spacing 20 + (user) + (sysbuttons) + (controls) + (poweractions) + ) +) + +(defwindow actions + :monitor "0" + :geometry (geometry :x "10px" + :y "4px" + :width "320px" ; this isn't respected btw, so it's auto-adjusted by eww lol. + :height "10px" ; automatically generated by eww. + :anchor "top right") + +(actions)) + +(defwidget closer [window] + (eventbox :onclick "eww close ${window} && eww close ${window}-closer")) + +(defwindow actions-closer + :monitor 0 + :geometry (geometry :width "100%" :height "100%") + :stacking "fg" + :focusable false + (closer :window "actions")) diff --git a/eww/assets/default-pfp.png b/eww/assets/default-pfp.png new file mode 100644 index 00000000..3d864927 Binary files /dev/null and b/eww/assets/default-pfp.png differ diff --git a/eww/assets/fallback.png b/eww/assets/fallback.png new file mode 100644 index 00000000..1dae900d Binary files /dev/null and b/eww/assets/fallback.png differ diff --git a/eww/colors.scss b/eww/colors.scss new file mode 100644 index 00000000..276d10e0 --- /dev/null +++ b/eww/colors.scss @@ -0,0 +1,31 @@ +$darkbg: #0b0d16; +$bg: rgb(24, 27, 35); //rgba(69, 71, 90, 0.3); #0d0f18; +$contrastbg: #0f111a; +$bgSecondary: #11131c; +$bgSecondaryAlt: #a5b6cf; +$fg: #a5b6cf; +$fgDim: #a5b6cf; +$watermelon: #dd6777; + +// Aliases +$background: $bg; +$backgroundSecondary: $bgSecondary; +$backgroundSecondaryAlt: $bgSecondaryAlt; +$foreground: $fg; +$foregroundDim: $fgDim; + +$black: #151720; +$dimblack: #1a1c25; +$lightblack: #262831; +$red: #dd6777; +$blue: #86aaec; +$cyan: #93cee9; +$blue-desaturated: #93cee9; +$magenta: #c296eb; +$purple: #c296eb; +$green: #90ceaa; +$aquamarine: #90ceaa; +$yellow: #ecd3a0; +$accent: $blue; +$javacafeMagenta: #c296eb; +$javacafeBlue: #86aaec; diff --git a/eww/dashboard/dashboard.scss b/eww/dashboard/dashboard.scss new file mode 100644 index 00000000..5263e24e --- /dev/null +++ b/eww/dashboard/dashboard.scss @@ -0,0 +1,305 @@ +.dashboardbox { + background-color: $black; + color: $fg; +} + +.headerbox { + padding: 8px 10px 6px; + .userbox { + .pfp { + background-position: center; + background-repeat: no-repeat; + background-size: cover; + min-height: 32px; + min-width: 32px; + border-radius: 50px; + } + .pcname { + font-family: Product Sans; + .sep { + color: $blue; + } + } + } + .searchbox { + .searchinput { + background-color: $bg; + padding: 5px 0px; + border-radius: 50px; + transition: all ease .2s; + &:hover { background-color: $bgSecondary; } + &:active { background-color: $contrastbg; } + .searchinput-content { + padding: 0px 200px 0px 10px; + font-family: Product Sans; + .icon { + font-family: Iosevka Nerd Font; + color: $blue; + margin-right: 12px; + } + .placeholder { + color: $lightblack; + } + } + } + } +} + +.content-container { + .contentbox { + background-color: $bg; + border-top-left-radius: 12px; + border-top-right-radius: 12px; + padding: 25px; + + .firstcol { + .usercard { + background-color: $black; + border-radius: 12px; + padding: 10px; + .user-content { + font-family: Product Sans; + .pfp { + background-size: cover; + background-position: center; + background-repeat: no-repeat; + min-height: 64px; + min-width: 64px; + border-radius: 50px; + } + .username { + font-weight: bolder; + font-size: 20px; + } + .uptime { + font-size: 12px; + } + } + .user-powerbuttons { + button { + background-color: $dimblack; + border-radius: 7px; + padding: 2px 10px 2px 7px; + font-family: Iosevka Nerd Font; + font-size: 16px; + transition: all ease .2s; + &:hover { background-color: $lightblack; } + &:active { background-color: $dimblack; } + } + .poweroff { color: $red; } + .reboot { color: $magenta; } + } + } + .controlscard { + background-color: $black; + padding: 10px; + border-radius: 12px; + .control-container { + .control-item { + transition: all ease .2s; + border-radius: 50px; + + background-color: $dimblack; + color: $blue; + + &:hover { background-color: $lightblack; } + &:active { background-color: $dimblack; } + + &.active { + background: $blue; + color: $bg; + } + + .control-icon { + font-family: Iosevka Nerd Font; + font-size: 14px; + } + + // solving nerd fonts alignment issues + &.network { padding: 9px 19px 9px 10px; } + &.network-disconnected { padding: 9px 18px 9px 11px; } + &.airplane { padding: 9px 17px 9px 12px; } + &.volume { padding: 9px 18px 9px 11px; } + &.volume-muted { padding: 9px 17px 9px 12px; } + &.mic { padding: 9px 16px 9px 13px; } + &.mic-on { padding: 9px 15px 9px 14px; } + &.redshift { padding: 9px 18px 9px 11px; } + &.redshift-on { padding: 9px 17px 9px 12px; } + &.bluetooth { padding: 9px 16px 9px 13px; } + &.bluetooth-on { padding: 9px 15px 9px 14px; } + &.fullscreensht { padding: 9px 17px 9px 12px; } + &.areascreensht { padding: 9px 17px 9px 12px; } + } + } + } + .slidersbox { + .vol-slider { + .vol-label { + font-size: 16px; + font-family: Iosevka Nerd Font; + color: $bg; + margin-left: 10px; + } + & scale trough { + all: unset; + border-radius: 10px; + background-color: $black; + border: none; + min-height: 25px; + min-width: 245px; + margin-left: 3px; + & highlight { + all: unset; + background: $blue; + color: #000000; + border-radius: 10px; + } + } + } + .br-slider { + .br-label { + font-size: 16px; + font-family: Iosevka Nerd Font; + color: $bg; + margin-left: 10px; + } + & scale trough { + all: unset; + border-radius: 100px; + background-color: $black; + border: none; + min-height: 25px; + min-width: 245px; + margin-left: 3px; + & highlight { + all: unset; + background: $blue; + color: #000000; + border-radius: 10px; + } + } + } + .mic-slider { + .mic-label { + font-size: 16px; + font-family: Iosevka Nerd Font; + color: $bg; + margin-left: 10px; + } + & scale trough { + all: unset; + border-radius: 100px; + background-color: $black; + border: none; + min-height: 25px; + min-width: 245px; + margin-left: 3px; + & highlight { + all: unset; + background: $blue; + color: #000000; + border-radius: 10px; + } + } + } + } + } + .lastcol { + .musicbox { + background-color: $black; + border-radius: 12px; + .firstrow { + padding: 10px; + .picbox { + background-size: cover; + background-repeat: no-repeat; + background-position: center; + min-width: 64px; + min-height: 64px; + border-radius: 10px; + } + .info { + font-family: Product Sans; + .music-title { + font-weight: bolder; + } + .music-artist { + color: $lightblack; + } + } + } + .lastrow { + padding: 10px 0px; + background-color: $dimblack; + border-bottom-right-radius: 12px; + border-bottom-left-radius: 12px; + .controls-container { + font-size: 16px; + font-family: Iosevka Nerd Font; + button { + transition: all ease .2s; + border-radius: 7px; + &:hover { background-color: $lightblack; } + &:active { background-color: transparent; } + &.previousbutton, &.nextbutton { padding: 1px 11px 1px 10px; } + &.pausebutton { + font-size: 20px; + padding: 1px 12px 1px 9px; + &.playing { + padding: 1px 14px 1px 7px; + } + } + } + } + } + } + .chart-container { + background-color: $black; + border-radius: 12px; + .header { + padding: 5px 10px; + font-family: Product Sans; + font-size: 14px; + color: $lightblack; + } + .body .container { + padding: 10px; + .chart-container { + background-color: $lightblack; + border-radius: 3em; + .chart { + color: $blue; + label { + padding: 1em; + font-size: 23px; + } + } + .chart-icon { + background-color: $black; + border-radius: 3em; + padding: 12px 5px; + margin: 0.5em; + font-family: Iosevka Nerd Font; + // nf alignment issues (again). + &.cpu { padding: 12px 9px 12px 4px; } + &.ram { padding: 12px 8px 12px 5px; } + &.temp { padding: 13px 9px 12px 3px; } + &.disk { padding: 13px 8px 12px 4px; } + } + } + } + } + } + } + .footer { + background-color: $bg; + padding: 10px 0px; + font-family: Product Sans; + .protipbox { + .icon { + font-family: Iosevka Nerd Font; + color: $yellow; + } + } + } +} diff --git a/eww/dashboard/dashboard.yuck b/eww/dashboard/dashboard.yuck new file mode 100644 index 00000000..749c30ab --- /dev/null +++ b/eww/dashboard/dashboard.yuck @@ -0,0 +1,385 @@ +(defwidget header [] + (box :class "headerbox" + :orientation "h" + :space-evenly false + (box :class "userbox" + :orientation "h" + :space-evenly false + :halign "start" + :valign "center" + :spacing 10 + (box :class "pfp" + :style "background-image: url('${pfp}');") + (box :class "pcname" + :orientation "h" + :space-evenly false + (label :text "${rawuser}" :class "username") + (label :text "@" :class "sep") + (label :text "${hostname}" :class "hostname") + ) + ) + (box :class "searchbox" + :orientation "h" + :space-evenly true + :halign "end" + :hexpand true + :valign "center" + (button :class "searchinput" + :onclick "~/.config/eww/scripts/exec rofi -show drun" + (box :class "searchinput-content" + :orientation "h" + :space-evenly false + :hexpand true + :halign "start" + :valign "center" + :vexpand true + (label :text "" :class "icon") + (label :text "Search Applications" :class "placeholder") + ) + ) + ) + ) +) + +(defwidget usercard [] + (box :class "usercard" + :orientation "v" + :space-evenly false + (box :class "user-content" + :orientation "h" + :space-evenly false + :vexpand true + :spacing 15 + (box :class "pfp" + :style "background-image: url('${pfp}');") + (box :class "info" + :hexpand true + :vexpand true + :valign "center" + :halign "start" + :orientation "v" + :space-evenly false + :spacing 3 + (label :text "${username}" :class "username" :halign "start") + (label :text "${uptime}" :class "uptime" :halign "start") + ) + ) + (box :class "user-powerbuttons" + :orientation "h" + :space-evenly false + :hexpand true + :halign "end" + :valign "end" + :spacing 5 + (button :class "reboot" + :onclick "doas poweroff" + "勒" + ) + (button :class "poweroff" + :onclick "doas poweroff" + "襤" + ) + ) + ) +) + +(defwidget control [name icon tooltip onclick active] + (box :class "control-container" + :orientation "h" + :hexpand true + :valign "center" + :space-evenly true + (button :class "control-item ${name} ${active ? 'active' : ''}" + :orientation "h" + :space-evenly true + :halign "center" + :hexpand false + :valign "center" + :onclick "${onclick}" + :tooltip "${tooltip}" + (label :text "${icon}" :class "control-icon") + ) + ) +) + +(defwidget quicksettings [] + (box :class "controlscard" + :orientation "v" + :space-evenly false + :spacing 20 + (box :class "firstrow" + :orientation "h" + :space-evenly true + (control :name "network${network_status == 'Connected' ? '' : '-disconnected'}" + :icon "${network_icon}" + :tooltip "Toggle network" + :active "${network_status == 'Connected' ? 'true' : 'false'}" + :onclick "~/.config/eww/scripts/network.sh toggle") + + (control :name "airplane" + :icon "${network_radio == 'on' ? '' : ''}" + :tooltip "Airplane Mode" + :active "${network_radio == 'on' ? false : true}" + :onclick "~/.config/eww/scripts/network.sh toggle-radio") + + (control :name "volume${is_muted == 'yes' ? '-muted' : ''}" + :icon "${volume_icon}" + :tooltip "Toggle muted" + :active "${is_muted == 'yes' ? false : true}" + :onclick "~/.config/eww/scripts/volume.sh toggle-muted") + + (control :name "mic${mic_status == 'yes' ? '-on' : ''}" + :icon "${mic_status == 'yes' ? '' : ''}" + :tooltip "Toggle microphone" + :active "${mic_status == 'yes' ? true : false}" + :onclick "~/.config/eww/scripts/mic toggle") + ) + (box :class "lastrow" + :orientation "h" + :space-evenly true + (control :name "redshift${redshift_state == 'on' ? '-on' : ''}" + :icon "${redshift_state == 'on' ? '' : ''}" + :tooltip "Toggle night light" + :active "${redshift_state == 'on' ? true : false}" + :onclick "~/.config/eww/scripts/redshift toggle") + + (control :name "bluetooth${bluetooth_state == 'on' ? '-on' : ''}" + :icon "${bluetooth_state == 'on' ? '' : ''}" + :tooltip "Toggle bluetooth" + :active "${bluetooth_state == 'on' ? true : false}" + :onclick "~/.config/eww/scripts/bluetooth toggle") + + (control :name "fullscreensht" + :icon "" + :tooltip "Take a full screenshot" + :active false + :onclick "~/.config/eww/scripts/screensht full") + + (control :name "areascreensht" + :icon "" + :tooltip "Take a screenshot of a selected area" + :active false + :onclick "~/.config/eww/scripts/screensht area") + ) + ) +) + +(defwidget sliders [] + (box :class "slidersbox" + :orientation "v" + :space-evenly false + :spacing 25 + (box :orientation "h" + :space-evenly "false" + :class "vol-slider" + (overlay + (scale :value volume_value + :onchange "~/.config/eww/scripts/volume.sh set {}" + :min 0 + :max 101) + (label :class "vol-label" + :text "${volume_icon} " + :valign "top" + :halign "start") + ) + ) + (box :orientation "h" + :space-evenly "false" + :class "br-slider" + (overlay + (scale :value br + :onchange "~/.config/eww/scripts/brightness.sh set {}" + :min 0 + :max 101) + (label :class "br-label" + :text "${br_icon} " + :valign "top" + :halign "start") + ) + ) + (box :orientation "h" + :space-evenly "false" + :class "mic-slider" + (overlay + (scale :value mic + :onchange "~/.config/eww/scripts/mic set {}" + :min 0 + :max 101) + (label :class "mic-label" + :text "${mic_status == 'yes' ? '' : ''} " + :valign "top" + :halign "start") + ) + ) + ) +) + +(defwidget music [] + (box :class "musicbox" + :orientation "v" + :space-evenly false + (box :class "firstrow" + :orientation "h" + :space-evenly false + :vexpand true + (box :class "picbox" + :orientation "v" + :space-evenly true + :style "background-image: url('${music_url}');" + music_pic + ) + (box :class "info" + :space-evenly false + :hexpand true + :valign "center" + :orientation "v" + :spacing 5 + (label :text "${music_title}" :class "music-title") + (label :text "${music_artist}" :class "music-artist") + ) + ) + (box :class "lastrow" + :orientation "h" + :space-evenly true + (box :class "controls-container" + :orientation "h" + :space-evenly true + (button :onclick "~/.config/eww/scripts/music/control.sh prev" + :class "previousbutton" + :halign "center" + "玲" + ) + (button :onclick "~/.config/eww/scripts/music/control.sh play-pause" + :class "pausebutton ${music_status == 'Playing' ? 'playing' : ''}" + :halign "center" + "${music_status == 'Playing' ? '' : ''}" + ) + (button :onclick "~/.config/eww/scripts/music/control.sh next" + :class "nextbutton" + :halign "center" + "怜" + ) + ) + ) + ) +) + +(defwidget chart [label value icon icon-class] + (box :class "chart-container" + :orientation "v" + :space-evenly false + (box :class "header" + :space-evenly true + :orientation "v" + (label :text "${label}" :class "label" :halign "start") + ) + (box :class "body" + :space-evenly true + :orientation "h" + (box :class "container" + :space-evenly true + :halign "center" + :hexpand true + :orientation "h" + (box :class "chart-container" :space-evenly false + (overlay + (circular-progress :value value + :thickness 50 + :class "chart" + :start-at 75 + (label :text "L") + ) + (label :text "${icon}" :class "chart-icon ${icon-class}") + ) + ) + ) + ) + ) +) + +(defwidget charts [] + (box :class "chartsbox" + :orientation "v" + :space-evenly false + :spacing 25 + (box :class "firstrow" + :orientation "h" + :space-evenly true + :spacing 25 + (chart :label "Cpu" :icon "" :icon-class "cpu" :value cpu) + (chart :label "Ram" :icon "" :icon-class "ram" :value ram) + ) + (box :class "lastrow" + :orientation "h" + :space-evenly true + :spacing 25 + (chart :label "Temp" :icon "" :icon-class "temp" :value temp) + (chart :label "Disk" :icon "" :icon-class "disk" :value disk) + ) + ) +) + +(defwidget footer [] + (box :class "footer" + :space-evenly true + :orientation "h" + :valign "end" + (box :class "protipbox" + :orientation "h" + :space-evenly false + :halign "center" + :spacing 15 + (label :text "ﯦ " :class "icon") + (label :text "Press the menu icon again to close this popup." :class "placeholder") + ) + ) +) + +(defwidget content [] + (box :class "content-container" + :orientation "v" + :space-evenly false + (box :class "contentbox" + :orientation "h" + :space-evenly true + :spacing 25 + :vexpand true + (box :class "firstcol" + :orientation "v" + :space-evenly false + :spacing 25 + (usercard) + (quicksettings) + (sliders) + ) + (box :class "lastcol" + :orientation "v" + :space-evenly false + :spacing 25 + (music) + (charts) + ) + ) + (footer) + ) +) + +(defwidget dashboard [] + (box :class "dashboardbox" + :orientation "v" + :space-evenly false + (header) + (content) + ) +) + +(defwindow dashboard + :monitor 0 + :geometry (geometry :x "6px" + :y "-44px" + :width "10px" ; automatically adjusted by eww + :height "10px" ; automatically adjusted by eww + :anchor "bottom center") + :type "dock" + :wm-ignore false +(dashboard)) diff --git a/eww/date/date.scss b/eww/date/date.scss new file mode 100644 index 00000000..991cc169 --- /dev/null +++ b/eww/date/date.scss @@ -0,0 +1,71 @@ +.date { + background-color: $bg; + color: $fg; + border-radius: 4px; +} + +.timebox { + margin: 30px 0px; + .time-container { + .content { + font-family: Product Sans; + font-weight: bolder; + font-size: 60px; + } + .divider { + margin: 8px 15px; + padding: 0px 1px; + background: linear-gradient($red, $magenta, $blue, $cyan); + } + } + .date-container { + font-family: Product Sans; + margin-top: 2px; + } +} + +.cal-box { + font-family: Product Sans; + background-color: $bg; + border-radius: 4px; + padding: 0 1rem .2rem; + color: $fg; + background-color: $contrastbg; + margin: 0px 12px 12px 12px; + + .cal { + background-color: inherit; + padding: .5rem .10rem 0rem; + margin-left: 10px; + + & > * { + border: solid 0px transparent; + } + + &.highlight { + padding: 10rem; + } + } +} + +calendar:selected { + color: $cyan; +} + +calendar.header { + color: $cyan; + font-weight: bold; +} + +calendar.button { + color: $cyan; +} + +calendar.highlight { + color: $green; + font-weight: bold; +} + +calendar:indeterminate { + color: $lightblack; +} \ No newline at end of file diff --git a/eww/date/date.yuck b/eww/date/date.yuck new file mode 100644 index 00000000..1617ea04 --- /dev/null +++ b/eww/date/date.yuck @@ -0,0 +1,57 @@ +(defwidget divider [] + (box :class "divider" + :orientation "v" + :space-evenly true) +) + +(defwidget time [] + (box :class "timebox" + :orientation "v" + :space-evenly false + (box :class "time-container" + :orientation "h" + :space-evenly false + :halign "center" + :valign "center" + (label :text "${lithour}" :class "content") + (divider) + (label :text "${litmin}" :class "content") + ) + (box :class "date-container" + :orientation "h" + :space-evenly true + :halign "center" + (label :text "${completeday}") + ) + ) +) + +(defwidget cal [] + (box :class "cal-box" + :orientation "v" + :space-evenly false + (calendar :class "cal" + :day calendar_day + :month calendar_month + :year calendar_year) + ) +) + +(defwidget date [] + (box :class "date" + :orientation "v" + :space-evenly false + (time) + (cal) + ) +) + +(defwindow date + :monitor 0 + :geometry (geometry :x "6px" + :y "-44px" + :width "0px" ; automatically generated + :height "0px" ; automatically generated + :anchor "left bottom") + :wm-ignore true +(date)) diff --git a/eww/eww.scss b/eww/eww.scss new file mode 100644 index 00000000..0a4190be --- /dev/null +++ b/eww/eww.scss @@ -0,0 +1,9 @@ +* { + all: unset; +} + +@import "colors.scss"; +@import "date/date.scss"; +@import "actions/actions.scss"; +@import "powermenu/powermenu.scss"; +@import "dashboard/dashboard.scss"; diff --git a/eww/eww.yuck b/eww/eww.yuck new file mode 100644 index 00000000..88a0dfed --- /dev/null +++ b/eww/eww.yuck @@ -0,0 +1,5 @@ +(include "variables.yuck") +(include "date/date.yuck") +(include "actions/actions.yuck") +(include "powermenu/powermenu.yuck") +(include "dashboard/dashboard.yuck") diff --git a/eww/powermenu/powermenu.scss b/eww/powermenu/powermenu.scss new file mode 100644 index 00000000..9f258927 --- /dev/null +++ b/eww/powermenu/powermenu.scss @@ -0,0 +1,27 @@ +.powermenu { + background-color: $bg; + color: $fg; + padding: 20px; + font-family: Iosevka Nerd Font; + font-size: 70px; + border-radius: 30px; + border: 5px solid $contrastbg; + button { + border-radius: 12px; + min-width: 80px; + transition: all ease .2s; + &:hover { background-color: $bgSecondary; } + &:active { background-color: $bg; } + .content { + border-radius: 4px; + padding: 0px 15px 0px 15px; + } + } + .shutdown { color: $red; } + .reboot { color: $magenta; } + .logout { color: $yellow; } +} + +.powermenu-clickhandler { + background-color: black; +} diff --git a/eww/powermenu/powermenu.yuck b/eww/powermenu/powermenu.yuck new file mode 100644 index 00000000..2abfffa6 --- /dev/null +++ b/eww/powermenu/powermenu.yuck @@ -0,0 +1,56 @@ +(defwidget powermenu [] + (box :class "powermenu" + :orientation "h" + :space-evenly true + :spacing 20 + (button :class "shutdown" + :onclick "systemctl poweroff" + (label :text "襤" :class "content") + ) + (button :class "reboot" + :onclick "systemctl reboot" + (label :text "勒" :class "content") + ) + (button :class "logout" + :onclick "swaymsg exit" + (label :text "" :class "content") + ) + ) +) + +(defwidget powermenu-clickhandler [] + (button :class "powermenu-clickhandler" + :onclick "eww -c ~/.config/eww close powermenu powermenu-clickhandler" + "" + ) +) + +(defwindow powermenu-clickhandler + :monitor 0 + :geometry (geometry :x "0px" + :y "0px" + :width "100%" + :height "100%" + :anchor "center") + :wm-ignore true +(powermenu-clickhandler)) + +(defwindow powermenu + :monitor 0 + :geometry (geometry :x "0px" + :y "0px" + :width "500px" + :height "150px" + :anchor "center") + :wm-ignore true +(powermenu)) + +(defwidget closer [window] + (eventbox :onclick "eww close ${window} && eww close ${window}-closer")) + +(defwindow powermenu-closer + :monitor 0 + :geometry (geometry :width "100%" :height "100%") + :stacking "fg" + :focusable false + (closer :window "powermenu")) diff --git a/eww/scripts/bluetooth b/eww/scripts/bluetooth new file mode 100755 index 00000000..e735c626 --- /dev/null +++ b/eww/scripts/bluetooth @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +get_state () { + state=$(bluetoothctl show | grep 'Powered' | awk '{print $2}') + if [[ $state == "yes" ]]; then + echo on + else + echo off + fi +} + +turn_off () { + bluetoothctl power off 2>&1 > /dev/null +} + +turn_on () { + bluetoothctl power on 2>&1 > /dev/null +} + +toggle () { + state=$(get_state) + if [[ $state == "on" ]]; then + turn_off + else + turn_on + fi +} + +if [[ $1 == "state" ]]; then + get_state +fi + +if [[ $1 == "toggle" ]]; then + toggle +fi diff --git a/eww/scripts/brightness.sh b/eww/scripts/brightness.sh new file mode 100755 index 00000000..a14734c7 --- /dev/null +++ b/eww/scripts/brightness.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# @requires: brightnessctl + +percentage () { + local val=$(echo $1 | tr '%' ' ' | awk '{print $1}') + local icon1=$2 + local icon2=$3 + local icon3=$4 + local icon4=$5 + if [ "$val" -le 15 ]; then + echo $icon1 + elif [ "$val" -le 30 ]; then + echo $icon2 + elif [ "$val" -le 60 ]; then + echo $icon3 + else + echo $icon4 + fi +} + +get_brightness () { + (( br = $(brightnessctl get) * 100 / $(brightnessctl max) )) + echo $br +} + +get_percent () { + echo $(get_brightness)% +} + +get_icon () { + local br=$(get_percent) + echo $(percentage "$br" "" "" "" "") +} + +if [[ $1 == "br" ]]; then + get_brightness +fi + +if [[ $1 == "percent" ]]; then + get_percent +fi + +if [[ $1 == "icon" ]]; then + get_icon +fi + +if [[ $1 == "set" ]]; then + light -S $2 +fi \ No newline at end of file diff --git a/eww/scripts/cpu.sh b/eww/scripts/cpu.sh new file mode 100755 index 00000000..0afb9e36 --- /dev/null +++ b/eww/scripts/cpu.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}' | tr '.' ' ' | awk '{print $1}' \ No newline at end of file diff --git a/eww/scripts/disk.sh b/eww/scripts/disk.sh new file mode 100755 index 00000000..5717c074 --- /dev/null +++ b/eww/scripts/disk.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +df --output=pcent / | tail -n 1 | sed 's/%//g' | awk '{print $1}' \ No newline at end of file diff --git a/eww/scripts/exec b/eww/scripts/exec new file mode 100755 index 00000000..b821a3c9 --- /dev/null +++ b/eww/scripts/exec @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cd ~ +${@} 2>&1 >/dev/null & diff --git a/eww/scripts/mic b/eww/scripts/mic new file mode 100755 index 00000000..8853778a --- /dev/null +++ b/eww/scripts/mic @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +# @requires: pactl + +SINK=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1) + +status () { + status=$(pactl get-source-mute $SINK | awk '{print $2}') + if [[ $status == 'yes' ]]; then + echo no + else + echo yes + fi +} + +set_volume () { + local max_db=65536 + local percent=$1 + + # getting the $percent% of $max_db + local value=$(jq -n ${percent}/100*${max_db} | sed 's/\./ /g' | awk '{print $1}') + + # set volume + pacmd set-source-volume $SINK $value +} + +get () { + local enabled=$(status) + if [[ $enabled == 'no' ]]; then + echo '0' + else + pacmd list short sinks | grep volume:\ front | tail -n 1 | awk '{print $5}' | sed 's/%//g' + fi +} + +percentage () { + local val=$(get) + echo "${val}%" +} + +_ () { + ${@} + exit 0 +} + +if [[ $1 == "status" ]]; then + _ status +fi + +if [[ $1 == "toggle" ]]; then + _ pactl set-source-mute $SINK toggle +fi + +if [[ $1 == "set" ]]; then + _ set_volume ${2} +fi + +if [[ $1 == "get" ]]; then + _ get +fi + +if [[ $1 == "percent" ]]; then + _ percentage +fi diff --git a/eww/scripts/music/control.sh b/eww/scripts/music/control.sh new file mode 100755 index 00000000..8f1d108c --- /dev/null +++ b/eww/scripts/music/control.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +if [[ $1 == "prev" ]]; then + playerctl previous +fi + +if [[ $1 == "play-pause" ]]; then + playerctl play-pause +fi + +if [[ $1 == "next" ]]; then + playerctl next +fi diff --git a/eww/scripts/music/songart.sh b/eww/scripts/music/songart.sh new file mode 100755 index 00000000..7ddb2fb5 --- /dev/null +++ b/eww/scripts/music/songart.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# thanks to kizu + +get_song_art () { + TMP_DIR="$HOME/.cache/eww" + TMP_COVER_PATH=$TMP_DIR/cover.png + TMP_TEMP_PATH=$TMP_DIR/temp.png + + if [[ ! -d $TMP_DIR ]]; then + mkdir -p $TMP_DIR + fi + + ART_FROM_SPOTIFY="$(playerctl -p %any,spotify metadata mpris:artUrl | sed -e 's/open.spotify.com/i.scdn.co/g')" + ART_FROM_BROWSER="$(playerctl -p %any,mpd,firefox,chromium,brave metadata mpris:artUrl | sed -e 's/file:\/\///g')" + + if [[ $(playerctl -p spotify,%any,firefox,chromium,brave,mpd metadata mpris:artUrl) ]]; then + curl -s "$ART_FROM_SPOTIFY" --output $TMP_TEMP_PATH + elif [[ -n $ART_FROM_BROWSER ]]; then + cp $ART_FROM_BROWSER $TMP_TEMP_PATH + else + cp $HOME/.config/eww/assets/fallback.png $TMP_TEMP_PATH + fi + + cp $TMP_TEMP_PATH $TMP_COVER_PATH + + # an epic effekt + # convert $TMP_TEMP_PATH -alpha set -channel A -evaluate multiply 1.0 $TMP_COVER_PATH + # convert $TMP_TEMP_PATH -gravity center +repage -alpha set -channel A \ + # -sparse-color Barycentric '%[fx:w*2/32],0 transparent %[fx:w+0.5],0 opaque' \ + # -evaluate multiply 0.45 \ + # $TMP_COVER_PATH +} + +echo_song_art_url () { + echo "$HOME/.cache/eww/cover.png" +} + +if [[ $1 == "echo" ]]; then + echo_song_art_url +fi + +if [[ $1 == "get" ]]; then + get_song_art +fi diff --git a/eww/scripts/music/songdata.sh b/eww/scripts/music/songdata.sh new file mode 100755 index 00000000..71d4b131 --- /dev/null +++ b/eww/scripts/music/songdata.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +capitalize () { + toshow="$1" + maxlen="$2" + + sufix="" + + if test $(echo $toshow | wc -c) -ge $maxlen ; then + sufix=" ..." + fi + + echo "${toshow:0:$maxlen}$sufix" +} + +withSafe () { + local txt="$1" + local safe="$2" + if [[ $txt == "" ]]; then + echo $safe + else + echo $txt + fi +} + +if [[ $1 == "title" ]]; then + capitalize "$(playerctl metadata --format "{{title}}" || echo "Nothing playing")" 18 +fi + +if [[ $1 == "artist" ]]; then + withSafe "$(capitalize "$(playerctl metadata --format "{{artist}}" || echo "No artist")" 18)" "No artist detected" +fi + +if [[ $1 == "status" ]]; then + playerctl status || echo 'Paused' +fi diff --git a/eww/scripts/network.sh b/eww/scripts/network.sh new file mode 100755 index 00000000..f8bb27a2 --- /dev/null +++ b/eww/scripts/network.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +symbol() { + [ $(cat /sys/class/net/w*/operstate) = down ] && echo 睊 && exit + echo  +} + +name() { + iwgetid -r +} + +cut () { + toshow="$1" + maxlen="$2" + + sufix="" + + if test $(echo $toshow | wc -c) -ge $maxlen ; then + sufix=" ..." + fi + + echo "${toshow:0:$maxlen}$sufix" +} + +[ "$1" = "icon" ] && symbol + +if [[ $1 == "ssid" ]]; then + ssid=$(name) + if [[ "$ssid" == "" ]]; then + cut "Disconnected" 10 + else + cut "$ssid" 10 + fi +fi + +if [[ $1 == "name" || $1 == "class" ]]; then + wifiname=$(name) + if [[ $wifiname == "" ]]; then + if [[ $1 == "name" ]]; then + echo "Disconnected" + elif [[ $1 == "class" ]]; then + echo "disconnected" + fi + else + if [[ $1 == "name" ]]; then + echo "Connected to $wifiname" + elif [[ $1 == "class" ]]; then + echo "connected" + fi + fi +fi + +if [[ $1 == "status" ]]; then + name=$(name) + if [[ $name != "" ]]; then + echo "Connected" + else + echo "Disconnected" + fi +fi + +if [[ $1 == "disconnect" ]]; then + wifiname=$(nmcli d | grep wifi | sed 's/^.*wifi.*connected//g' | xargs) + nmcli con down id "${wifiname}" +fi + +if [[ $1 == "connect" ]]; then + nmcli con up ifname "$(/usr/bin/ls /sys/class/ieee80211/*/device/net/)" +fi + +if [[ $1 == "toggle" ]]; then + name=$(name) + if [[ "$name" == "" ]]; then + nmcli con up ifname "$(/usr/bin/ls /sys/class/ieee80211/*/device/net/)" + else + wifiname=$(nmcli d | grep wifi | sed 's/^.*wifi.*connected//g' | xargs) + nmcli con down id "${wifiname}" + fi +fi + +radio_status () { + radio_status=$(nmcli radio wifi) + if [[ $radio_status == "enabled" ]]; then + echo "on" + else + echo "off" + fi +} + +if [[ $1 == "radio-status" ]]; then + radio_status +fi + +if [[ $1 == "toggle-radio" ]]; then + stat=$(radio_status) + if [[ $stat == "on" ]]; then + nmcli radio wifi off + else + nmcli radio wifi on + fi +fi diff --git a/eww/scripts/pfp.sh b/eww/scripts/pfp.sh new file mode 100755 index 00000000..c2105170 --- /dev/null +++ b/eww/scripts/pfp.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +declare -a profiles_photos=("$HOME/.face.jpg" "$HOME/.face.png") + +for pfp in ${profiles_photos[@]}; do + if test -f $pfp; then + echo $pfp + exit 0 + fi +done + +echo $HOME/.config/dk/eww/assets/default-pfp.png diff --git a/eww/scripts/ram.sh b/eww/scripts/ram.sh new file mode 100755 index 00000000..a2f00652 --- /dev/null +++ b/eww/scripts/ram.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +percentage () { + local val=$(echo $1 | tr '%' ' ' | awk '{print $1}') + local icon1=$2 + local icon2=$3 + local icon3=$4 + local icon4=$5 + if [ "$val" -le 15 ]; then + echo $icon1 + elif [ "$val" -le 30 ]; then + echo $icon2 + elif [ "$val" -le 60 ]; then + echo $icon3 + else + echo $icon4 + fi +} + +get_ram () { + free -m | grep Mem | awk '{print ($3/$2)*100}' | tr '.' ' ' | awk '{print $1}' +} + +get_percent () { + echo $(get_ram)% +} + +get_class () { + local percent=$(get_percent) + echo $(percentage "$percent" "yellow" "magenta" "purple" "red") +} + +if [[ $1 == "ram" ]]; then + get_ram +fi + +if [[ $1 == "percent" ]]; then + get_percent +fi + +if [[ $1 == "class" ]]; then + get_class +fi \ No newline at end of file diff --git a/eww/scripts/redshift b/eww/scripts/redshift new file mode 100755 index 00000000..38ce6a99 --- /dev/null +++ b/eww/scripts/redshift @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +cache_file=$HOME/.cache/eww/services/redshift_state + +initial_hook () { + if [ ! -d $(dirname $cache_file) ]; then + mkdir -p $(dirname $cache_file) + fi + if [ ! -f $cache_file ]; then + echo off > $cache_file + fi +} + +get_state () { + # check if redshift is running + cat $cache_file +} + +restore () { + local state=$(get_state) + if [[ $state == "on" ]]; then + enable_redshift + else + disable_redshift + fi +} + +disable_redshift () { + redshift -x 2>&1 > /dev/null + # saving state + echo off > $cache_file +} + +enable_redshift () { + redshift -x 2>&1 > /dev/null + redshift -O 5000 2>&1 > /dev/null + # saving new state + echo on > $cache_file +} + +toggle () { + local state=$(get_state) + if [[ $state == "on" ]]; then + disable_redshift + else + enable_redshift + fi +} + +initial_hook + +if [[ $1 == "state" ]]; then + get_state +fi + +if [[ $1 == "enable" ]]; then + enable_redshift +fi + +if [[ $1 == "disable" ]]; then + disable_redshift +fi + +if [[ $1 == "toggle" ]]; then + toggle +fi + +if [[ $1 == "restore" ]]; then + restore +fi diff --git a/eww/scripts/screensht b/eww/scripts/screensht new file mode 100755 index 00000000..85de3a78 --- /dev/null +++ b/eww/scripts/screensht @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +TMP_PATH="$HOME/.cache/eww/tmp-screenshot.png" + +report () { + xclip -selection clipboard -target image/png -i $TMP_PATH + notify-send -i $TMP_PATH -a Screenshot "Screenshot" "Screenshot copied successfully" +} + +recollect () { + rm $TMP_PATH +} + +full () { + maim $TMP_PATH +} + +area () { + maim --select $TMP_PATH +} + +if [[ $1 == "full" ]]; then + full + report + recollect +fi + +if [[ $1 == "area" ]]; then + area + report + recollect +fi + +exit 0 diff --git a/eww/scripts/temp.sh b/eww/scripts/temp.sh new file mode 100755 index 00000000..92be6424 --- /dev/null +++ b/eww/scripts/temp.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# thanks to rxyhn + +path () { + local temp_path=null + for i in /sys/class/hwmon/hwmon*/temp*_input; + do + temp_path="$(echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || + echo $(basename ${i%_*})) $(readlink -f $i)");" + label="$(echo $temp_path | awk '{print $2}')" + if [ "$label" = "Package" ]; + then + echo ${temp_path} | awk '{print $5}' | tr -d ';\n' + exit; + fi + done +} + +get () { + local path=$(path) + if [[ $path == "" ]]; then + path="/sys/class/thermal/thermal_zone0/temp" + fi + + local max_temp=100 + local temp=$(cat $path) + + jq -n $(jq -n $temp/1000)/$max_temp*100 +} + +_ () { + ${@} + exit 0 +} + +if [[ $1 == "get" ]]; then + _ get +fi \ No newline at end of file diff --git a/eww/scripts/user.sh b/eww/scripts/user.sh new file mode 100755 index 00000000..29568c80 --- /dev/null +++ b/eww/scripts/user.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +name () { + username=$(whoami) + echo ${username^} +} + +name \ No newline at end of file diff --git a/eww/scripts/volume.sh b/eww/scripts/volume.sh new file mode 100755 index 00000000..9befb47f --- /dev/null +++ b/eww/scripts/volume.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +# @requires: pactl + +#SINK=$(pactl list short sinks | sed -e 's,^\([0-9][0-9]*\)[^0-9].*,\1,' | head -n 1) +SINK="@DEFAULT_SINK@" + +percentage () { + local val=$(echo $1 | tr '%' ' ' | awk '{print $1}') + local icon1=$2 + local icon2=$3 + local icon3=$4 + local icon4=$5 + if [ "$val" -le 15 ]; then + echo $icon1 + elif [ "$val" -le 30 ]; then + echo $icon2 + elif [ "$val" -le 60 ]; then + echo $icon3 + else + echo $icon4 + fi +} + +is_muted () { + pacmd list-sinks | awk '/muted/ { print $2 }' +} + +get_percentage () { + local muted=$(is_muted) + if [[ $muted == 'yes' ]]; then + echo 0% + else + vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | awk '{print $5}' | tr % " ") + echo "${vol}%" + fi +} + +get_icon () { + local vol=$(get_percentage) + if [[ $vol == "0%" ]]; then + echo "婢" + else + echo $(percentage "$vol" "" "" "墳" "") + fi +} + +get_class () { + local vol=$(get_percentage) + if [[ $vol == "0%" ]]; then + echo "red" + else + echo $(percentage "$vol" "red" "magenta" "yellow" "blue") + fi +} + +get_vol () { + #local percent=$(get_percentage) + #echo $percent | tr -d '%' + echo $(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | awk '{print $5}' | tr % " ") +} + +if [[ $1 == "icon" ]]; then + get_icon +fi + +if [[ $1 == "class" ]]; then + get_class +fi + +if [[ $1 == "percentage" ]]; then + get_percentage +fi + +if [[ $1 == "vol" ]]; then + get_vol +fi + +if [[ $1 == "muted" ]]; then + is_muted +fi + +if [[ $1 == "toggle-muted" ]]; then + pactl set-sink-mute $SINK toggle +fi + +if [[ $1 == "set" ]]; then + val=$(echo $2 | tr '.' ' ' | awk '{print $1}') + if test $val -gt 100; then + val=100 + fi + pactl set-sink-volume $SINK $val% +fi diff --git a/eww/scripts/volume.sh.bak b/eww/scripts/volume.sh.bak new file mode 100755 index 00000000..e025a13e --- /dev/null +++ b/eww/scripts/volume.sh.bak @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | awk '{print $5}' | tr % " ") + +function icon { + if [[ $VOLUME -ge 66 ]]; then echo '󰕾' + elif [[ $VOLUME -ge 33 ]]; then echo '󰖀' + elif [[ $VOLUME -ge 1 ]]; then echo '󰕿' + else echo '󰝟' + fi +} + +function level { + echo $(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | awk '{print $5}' | tr % " ") +} + + +function lower { + pactl set-sink-volume @DEFAULT_SINK@ -5% + update +} + +function raise { + pactl set-sink-volume @DEFAULT_SINK@ +5% + update +} + +function update { + eww update volume="$(get)" + ~/.config/eww/scripts/osd $(icon) $(level) +} + +function type_icon { + SINK=$(pactl get-default-sink) + if [[ $SINK == *'bluez_output'* ]]; then echo "󰋋" + else echo "󰓃" + fi +} + +function mute_state { + STATE=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk '{print $2}') + if [[ $STATE == 'no' ]]; then echo 'off' + else echo 'on'; fi +} + +function mute_icon { + STATE=$(mute_state) + if [[ $STATE == 'off' ]]; then echo '󰍬' + else echo '󰍭'; fi +} + +function mute_toggle { + pactl set-source-mute @DEFAULT_SOURCE@ toggle + eww update volume="$(get)" +} + +function set { + pactl set-sink-volume @DEFAULT_SINK@ $1"%" + eww update volume="$(get)" +} + +function get { + echo "{ + \"level\": \"$(level)\", + \"icon\": \"$(icon)\", + \"type_icon\": \"$(type_icon)\", + \"mute\": { + \"state\": \"$(mute_state)\", + \"icon\": \"$(mute_icon)\" + } + }" +} + +if [[ $1 == 'mute_toggle' ]]; then mute_toggle; fi +if [[ $1 == 'down' ]]; then lower; fi +if [[ $1 == 'up' ]]; then raise; fi +if [[ $1 == 'set' ]]; then set $2; fi +if [[ $1 == 'get' ]]; then get; fi diff --git a/eww/variables.yuck b/eww/variables.yuck new file mode 100644 index 00000000..1cb8c11b --- /dev/null +++ b/eww/variables.yuck @@ -0,0 +1,46 @@ +(defpoll network_status :interval "1s" "~/.config/eww/scripts/network.sh status") +(defpoll network_icon :interval "1s" "~/.config/eww/scripts/network.sh icon") +(defpoll network_radio :interval "1s" "~/.config/eww/scripts/network.sh radio-status") +(defpoll network_ssid :interval "1s" "~/.config/eww/scripts/network.sh ssid") + +(defpoll volume_icon :interval "1s" "~/.config/eww/scripts/volume.sh icon") +(defpoll volume :interval "1s" "~/.config/eww/scripts/volume.sh percentage") +(defpoll volume_value :interval "1s" "~/.config/eww/scripts/volume.sh vol") +(defpoll is_muted :interval "1s" "~/.config/eww/scripts/volume.sh muted") + +(defpoll mic :interval "1s" "~/.config/eww/scripts/mic get") +(defpoll mic_status :interval "1s" "~/.config/eww/scripts/mic status") + +(defpoll bluetooth_state :interval "1s" "~/.config/eww/scripts/bluetooth state") +(defpoll redshift_state :interval "1s" "~/.config/eww/scripts/redshift state") + +(defpoll pfp :interval "1s" "~/.config/eww/scripts/pfp.sh") +(defpoll rawuser :interval "30s" "whoami") +(defpoll username :interval "30s" "~/.config/eww/scripts/user.sh") +(defpoll hostname :interval "30s" "cat /etc/hostname") +(defpoll uptime :interval "30s" "uptime -p") + +(defpoll br_icon :interval "1s" "~/.config/eww/scripts/brightness.sh icon") +(defpoll br :interval "1s" "~/.config/eww/scripts/brightness.sh br") + +(defpoll music_pic :interval "2s" "~/.config/eww/scripts/music/songart.sh get") +(defpoll music_url :interval "2s" "~/.config/eww/scripts/music/songart.sh echo") + +(defpoll music_title :interval "1s" "~/.config/eww/scripts/music/songdata.sh title") +(defpoll music_artist :interval "1s" "~/.config/eww/scripts/music/songdata.sh artist") +(defpoll music_status :interval "1s" "~/.config/eww/scripts/music/songdata.sh status") + +(defpoll completeday :interval "1h" "date '+%A, %d %B'") +(defpoll lithour :interval "30m" "date +%H") +(defpoll litmin :interval "30s" "date +%M") +(defpoll calendar_day :interval "10h" "date '+%d'") +(defpoll calendar_month :interval "10h" "date '+%m") +(defpoll calendar_year :interval "10h" "date '+%Y'") +(defpoll date :interval "30s" "date '+%d %b, %I:%M %p'") +(defpoll shortday :interval "1h" "date '+%d %b %y'") +(defpoll weekday :interval "24h" "date +%A") + +(defpoll cpu :interval "3s" "~/.config/eww/scripts/cpu.sh") +(defpoll ram :interval "3s" "~/.config/eww/scripts/ram.sh ram") +(defpoll temp :interval "3s" "~/.config/eww/scripts/temp.sh get") +(defpoll disk :interval "3s" "~/.config/eww/scripts/disk.sh") \ No newline at end of file