diff --git a/.gitignore b/.gitignore index 550c01b..b998062 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/result +result .vscode/ # Added by cargo diff --git a/default.nix b/default.nix index d01b345..89ff011 100644 --- a/default.nix +++ b/default.nix @@ -1,10 +1,10 @@ { pkgs ? import { } }: pkgs.rustPlatform.buildRustPackage { - pname = "ewwbar"; + pname = "desktop-utils"; version = "1.0.0"; - src = builtins.path { path = ./.; name = "ewwbar"; }; + src = builtins.path { path = ./.; name = "desktop-utils"; }; cargoLock = { lockFile = ./Cargo.lock; @@ -16,20 +16,18 @@ pkgs.rustPlatform.buildRustPackage { buildInputs = [ pkgs.libxkbcommon - pkgs.eww ]; - postInstall = '' - mkdir -p $out/bin - cp -r $src/eww $out/bin/eww - ''; + # installPhase = '' + # mkdir -p $out/bin + # cp clients $out/bin/clients + #''; meta = with pkgs.lib; { - description = "Top bar using ElKowars Wacky Widgets"; + description = "utils for my desktop"; homepage = " git.huwe.mooo.com/willifan/desktop-utils"; license = licenses.gpl3; platforms = platforms.unix; - mainProgram = "ewwbar"; }; } diff --git a/eww/eww.yuck b/eww/eww.yuck index 50e242f..ecaf453 100644 --- a/eww/eww.yuck +++ b/eww/eww.yuck @@ -12,79 +12,79 @@ (defwidget normalWorkspaces [monitor] - (box - :space-evenly false - :spacing 3 - :valign "center" - :height 20 - (for workspace in workspaces - (workspace - :activeOn {workspace.normal.activeOn} - :occupied {workspace.normal.occupied} - :id {workspace.normal.id} - :cmd {workspace.normal.id} - :icon {workspace.normal.icon} - :monitor {monitor})))) + (box + :space-evenly false + :spacing 3 + :valign "center" + :height 20 + (for workspace in workspaces + (workspace + :activeOn {workspace.normal.activeOn} + :occupied {workspace.normal.occupied} + :id {workspace.normal.id} + :cmd {workspace.normal.id} + :icon {workspace.normal.icon} + :monitor {monitor})))) ;; right (defwidget cpu [] - (icon - :widgetclass "cpu" - :hover "${round(EWW_CPU.avg, 1)}%" - :percentage {round(EWW_CPU.avg, 1)} - :image "./images/cpu.png")) + (icon + :widgetclass "cpu" + :hover "${round(EWW_CPU.avg, 1)}%" + :percentage {round(EWW_CPU.avg, 1)} + :image "../images/cpu.png")) (defwidget ram [] - (icon - :widgetclass "ram" - :hover "${round(EWW_RAM.used_mem /(1024*1024*1024), 1)} GiB | ${round(EWW_RAM.used_mem_perc, 1)}%" - :percentage {round(EWW_RAM.used_mem_perc, 1)} - :image "./images/ram.png")) + (icon + :widgetclass "ram" + :hover "${round(EWW_RAM.used_mem /(1024*1024*1024), 1)} GiB | ${round(EWW_RAM.used_mem_perc, 1)}%" + :percentage {round(EWW_RAM.used_mem_perc, 1)} + :image "../images/ram.png")) (defwidget audio [] - (icon - :widgetclass {volume.muted == 1 ? "muted" : "volume"} - :hover "${volume.volume}%" - :percentage {volume.volume >= 0 && volume.volume <= 100 ? volume.volume : 0} - :image {volume.muted == 1 ? "./images/volumeMuted.png" : "./images/volume.png"})) + (icon + :widgetclass {volume.muted == 1 ? "muted" : "volume"} + :hover "${volume.volume}%" + :percentage {volume.volume >= 0 && volume.volume <= 100 ? volume.volume : 0} + :image {volume.muted == 1 ? "../images/volumeMuted.png" : "../images/volume.png"})) (defwidget brightness [] - (icon - :widgetclass "brightness" - :hover "${brightnessValue / 960}%" - :percentage {brightnessValue / 960} - :image "./images/brightness.png")) + (icon + :widgetclass "brightness" + :hover "${brightnessValue / 960}%" + :percentage {brightnessValue / 960} + :image "../images/brightness.png")) (defwidget network [] - (icon - :widgetclass "network" - :hover {network.name} - :percentage "100" - :image "./images/${network.image}.png")) + (icon + :widgetclass "network" + :hover {network.name} + :percentage "100" + :image "../images/${network.image}.png")) (defwidget bluetooth [] - (icon - :widgetclass "bluetooth" - :hover {bluetooth.name} - :percentage {bluetooth.battery} - :image "./images/bluetooth.png")) + (icon + :widgetclass "bluetooth" + :hover {bluetooth.name} + :percentage {bluetooth.battery} + :image "../images/bluetooth.png")) (defwidget battery [] - (icon - :widgetclass {EWW_BATTERY.BAT1.status == "Charging" ? "battery" : EWW_BATTERY.total_avg > 25 ? "battery" : "batteryLow"} - :hover "${round(EWW_BATTERY.total_avg, 1)}%" - :percentage {EWW_BATTERY.total_avg <= 90 ? round(EWW_BATTERY.total_avg, 1)/0.9 : 100} - :image {EWW_BATTERY.BAT1.status == "Charging" ? "./images/charging.png" : EWW_BATTERY.total_avg > 25 ? "./images/battery.png" : "./images/batteryLow.png"})) + (icon + :widgetclass {EWW_BATTERY.BAT1.status == "Charging" ? "battery" : EWW_BATTERY.total_avg > 25 ? "battery" : "batteryLow"} + :hover "${round(EWW_BATTERY.total_avg, 1)}%" + :percentage {EWW_BATTERY.total_avg <= 90 ? round(EWW_BATTERY.total_avg, 1)/0.9 : 100} + :image {EWW_BATTERY.BAT1.status == "Charging" ? "../images/charging.png" : EWW_BATTERY.total_avg > 25 ? "../images/battery.png" : "../images/batteryLow.png"})) (defwidget power [] - (icon - :widgetclass "power" - :hover "placeholder" - :percentage "0" - :image "./images/power.png")) + (icon + :widgetclass "power" + :hover "placeholder" + :percentage "0" + :image "../images/power.png")) @@ -92,243 +92,243 @@ ;; Widget blocks (defwidget media [] - (box - :class "smallBox" - :height 20 - :valign "center" - :spacing 1 - :space-evenly false - (space) - (label - :text "${media.title} - ${media.artist}" - :tooltip "${media.title} - ${media.artist} | ${media.album}" - :truncate true) - (space))) + (box + :class "smallBox" + :height 20 + :valign "center" + :spacing 1 + :space-evenly false + (space) + (label + :text "${media.title} - ${media.artist}" + :tooltip "${media.title} - ${media.artist} | ${media.album}" + :truncate true) + (space))) (defwidget processing [] - (eventbox - :onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty bpytop -b proc"' - :class "smallBox" - :halign "end" - :valign "center" - :height 20 - (box - :space-evenly false - :halign "end" - :valign "center" - :height 20 - (smallSpacer) - (cpu) - (space) - (ram) - (smallSpacer)))) + (eventbox + :onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty bpytop -b proc"' + :class "smallBox" + :halign "end" + :valign "center" + :height 20 + (box + :space-evenly false + :halign "end" + :valign "center" + :height 20 + (smallSpacer) + (cpu) + (space) + (ram) + (smallSpacer)))) (defwidget controlls [] - (eventbox - :onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty pulsemixer"' - :class "smallBox" - :halign "end" - :valign "center" - :height 20 - (box - :space-evenly false - :halign "end" - :valign "center" - :height 20 - (smallSpacer) - (audio) - (space) - (brightness) - (smallSpacer)))) + (eventbox + :onclick 'hyprctl dispatch exec "[float; pin; size 40% 40%; move 100%-41% 40] kitty pulsemixer"' + :class "smallBox" + :halign "end" + :valign "center" + :height 20 + (box + :space-evenly false + :halign "end" + :valign "center" + :height 20 + (smallSpacer) + (audio) + (space) + (brightness) + (smallSpacer)))) (defwidget wireless [] - (eventbox - :onclick "`networkmanager_dmenu`" - :class "smallBox" - :halign "end" - :valign "center" - :height 20 - (box - :space-evenly false - :halign "end" - :valign "center" - :height 24 - (smallSpacer) - (network) - (space) - (bluetooth) - (smallSpacer)))) + (eventbox + :onclick "`networkmanager_dmenu`" + :class "smallBox" + :halign "end" + :valign "center" + :height 20 + (box + :space-evenly false + :halign "end" + :valign "center" + :height 24 + (smallSpacer) + (network) + (space) + (bluetooth) + (smallSpacer)))) (defwidget energy [] - (eventbox - :onclick `wlogout -r 25 -c 25 -m 300 &` - :class "smallBox" - :valign "center" - :height 20 - (box - :space-evenly false - :halign "end" - :valign "center" - :height 20 - (smallSpacer) - (battery) - (space) - (power) - (smallSpacer)))) + (eventbox + :onclick `wlogout -r 25 -c 25 -m 300 &` + :class "smallBox" + :valign "center" + :height 20 + (box + :space-evenly false + :halign "end" + :valign "center" + :height 20 + (smallSpacer) + (battery) + (space) + (power) + (smallSpacer)))) ;; Boxes (defwidget timeBox [] - (box - :class "barbox" - :spacing 3 - :space-evenly false - :halign "end" - :valign "center" - :height 30 - (space) - (testtime) - (space))) + (box + :class "barbox" + :spacing 3 + :space-evenly false + :halign "end" + :valign "center" + :height 30 + (space) + (testtime) + (space))) (defwidget mediaBox [] - (box - :class "barbox" - :visible {media.status == "Playing" ? true : false} - :spacing 3 - :space-evenly false - :halign "end" - :valign "center" - :height 30 - (space) - (media) - (space))) + (box + :class "barbox" + :visible {media.status == "Playing" ? true : false} + :spacing 3 + :space-evenly false + :halign "end" + :valign "center" + :height 30 + (space) + (media) + (space))) (defwidget start [] - (box - :orientation "h" - :space-evenly false - :height 30 - :halign "start" - :valign "center" - :spacing 3 - (timeBox) - (mediaBox) - (box))) + (box + :orientation "h" + :space-evenly false + :height 30 + :halign "start" + :valign "center" + :spacing 3 + (timeBox) + (mediaBox) + (box))) (defwidget center [monitor] - (box - :class "barbox" - :orientation "h" - :space-evenly false - :spacing 3 - :height 30 - :halign "center" - :valign "center" - (space) - (workspace - :activeOn {workspaces[0].special.activeOn} - :occupied {workspaces[0].special.occupied} - :id {workspaces[0].special.id} - :icon {workspaces[0].special.icon} - :monitor {monitor}) - (workspace - :activeOn {workspaces[1].special.activeOn} - :occupied {workspaces[1].special.occupied} - :id {workspaces[1].special.id} - :icon {workspaces[1].special.icon} - :monitor {monitor}) - (seperator) - (normalWorkspaces - :monitor {monitor}) - (seperator) - (workspace - :activeOn {workspaces[2].special.activeOn} - :occupied {workspaces[2].special.occupied} - :id {workspaces[2].special.id} - :icon {workspaces[2].special.icon} - :monitor {monitor}) - (workspace - :activeOn {workspaces[3].special.activeOn} - :occupied {workspaces[3].special.occupied} - :id {workspaces[3].special.id} - :icon {workspaces[3].special.icon} - :monitor {monitor}) - (space))) + (box + :class "barbox" + :orientation "h" + :space-evenly false + :spacing 3 + :height 30 + :halign "center" + :valign "center" + (space) + (workspace + :activeOn {workspaces[0].special.activeOn} + :occupied {workspaces[0].special.occupied} + :id {workspaces[0].special.id} + :icon {workspaces[0].special.icon} + :monitor {monitor}) + (workspace + :activeOn {workspaces[1].special.activeOn} + :occupied {workspaces[1].special.occupied} + :id {workspaces[1].special.id} + :icon {workspaces[1].special.icon} + :monitor {monitor}) + (seperator) + (normalWorkspaces + :monitor {monitor}) + (seperator) + (workspace + :activeOn {workspaces[2].special.activeOn} + :occupied {workspaces[2].special.occupied} + :id {workspaces[2].special.id} + :icon {workspaces[2].special.icon} + :monitor {monitor}) + (workspace + :activeOn {workspaces[3].special.activeOn} + :occupied {workspaces[3].special.occupied} + :id {workspaces[3].special.id} + :icon {workspaces[3].special.icon} + :monitor {monitor}) + (space))) (defwidget end [] - (box - :orientation "h" - :space-evenly false - :spacing 3 - :height 30 - :valign "center" - :halign "end" (box - :class "barbox" - :space-evenly false - :spacing 2 - (space) - (testtime - :timezone "US/Eastern" - :image "./images/USTime.png") - (seperator) - (testtime - :timezone "Asia/Seoul" - :image "./images/SamGuk-by_Sang_Min.png") - (space)) - (box - :class "barbox" - :spacing 2 - :orientation "h" - :space-evenly false - :height 30 - :valign "center" - :halign "end" - - (space) - ;; (systray - ;; :spacing 2 - ;; :orientation "h" - ;; :space-evenly true - ;; :icon-size 16) - ;; - ;; (seperator) - - (processing) - - (seperator) - - (controlls) - - (seperator) - - (wireless) - - (seperator) - - (energy) - - (space)))) + :orientation "h" + :space-evenly false + :spacing 3 + :height 30 + :valign "center" + :halign "end" + (box + :class "barbox" + :space-evenly false + :spacing 2 + (space) + (testtime + :timezone "US/Eastern" + :image "../images/USTime.png") + (seperator) + (testtime + :timezone "Asia/Seoul" + :image "../images/SamGuk-by_Sang_Min.png") + (space)) + (box + :class "barbox" + :spacing 2 + :orientation "h" + :space-evenly false + :height 30 + :valign "center" + :halign "end" + + (space) +;; (systray +;; :spacing 2 +;; :orientation "h" +;; :space-evenly true +;; :icon-size 16) +;; +;; (seperator) + + (processing) + + (seperator) + + (controlls) + + (seperator) + + (wireless) + + (seperator) + + (energy) + + (space)))) (defwidget bar [monitor] - (centerbox - :orientation "h" - (start) - (center - :monitor {monitor}) - (end))) + (centerbox + :orientation "h" + (start) + (center + :monitor {monitor}) + (end))) (defwindow bar [monitor width height] - :monitor {monitor} - :geometry (geometry - :x "0%" - :y "5px" - :width "${width}px" - :height "${height}px" - :anchor "top center") - :stacking "fg" - :exclusive true - (bar - :monitor {monitor})) + :monitor {monitor} + :geometry (geometry + :x "0%" + :y "5px" + :width "${width}px" + :height "${height}px" + :anchor "top center") + :stacking "fg" + :exclusive true + (bar + :monitor {monitor})) diff --git a/eww/variables.yuck b/eww/variables.yuck index 93fd5cf..35fef92 100644 --- a/eww/variables.yuck +++ b/eww/variables.yuck @@ -1,25 +1,25 @@ (deflisten brightnessValue - :initial "0" -`./scripts/brightness.sh`) + :initial "0" + `../ewwScripts/brightness.sh`) (deflisten network - :initial '{"name":"No Connection","image":"n.A."}' -`./scripts/network.sh`) + :initial '{"name":"No Connection","image":"n.A."}' + `../ewwScripts/network.sh`) (deflisten workspaces - :initial '' -`./scripts/client`) + :initial '' + `../ewwScripts/client`) (defpoll bluetooth - :initial '{"name":"","battery":"0"}' - :interval "2s" -`./scripts/bluetooth.sh`) + :initial '{"name":"","battery":"0"}' + :interval "2s" + `../ewwScripts/bluetooth.sh`) (deflisten volume - :initial '{"volume":"0","muted":"0"}' -`./scripts/volume.sh`) + :initial '{"volume":"0","muted":"0"}' + `../ewwScripts/volume.sh`) (defpoll media - :initial '{"status":"","name":""}' - :interval "2s" -`./scripts/media.sh`) + :initial '{"status":"","name":""}' + :interval "2s" + `../ewwScripts/media.sh`) diff --git a/eww/scripts/bluetooth.sh b/ewwScripts/bluetooth.sh similarity index 100% rename from eww/scripts/bluetooth.sh rename to ewwScripts/bluetooth.sh diff --git a/eww/scripts/brightness.sh b/ewwScripts/brightness.sh similarity index 100% rename from eww/scripts/brightness.sh rename to ewwScripts/brightness.sh diff --git a/eww/scripts/client b/ewwScripts/client similarity index 100% rename from eww/scripts/client rename to ewwScripts/client diff --git a/eww/scripts/media.sh b/ewwScripts/media.sh similarity index 100% rename from eww/scripts/media.sh rename to ewwScripts/media.sh diff --git a/ewwScripts/monitors.sh b/ewwScripts/monitors.sh new file mode 100755 index 0000000..6696090 --- /dev/null +++ b/ewwScripts/monitors.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + + + +unset id name horizontal vertical scale activeWorkspace + +i=0 + +while read -r k n h v s t; do + id[i]="$k" + name[i]="$n" + horizontal[i]="$h" + vertical[i]="$v" + scale[i]="$s" + if [[ $((t%2)) == 1 ]]; then + temp=${vertical[$i]} + vertical[i]=${horizontal[$i]} + horizontal[i]=$temp + fi + ((i=i+1)) +done < <(hyprctl monitors -j | jq -r '.[]|"\(.id) \(.name) \(.width) \(.height) \(.scale) \(.transform)"') + +eww close-all --config ../eww + +sleep 2 + +for ((i = 0; i < ${#id[@]}; i++)); do + scale_value=$(echo "${scale[$i]}" | bc -l) + + new_width_float=$(echo "(${horizontal[$i]} / ${scale_value}) -10" | bc) + + new_width=$(echo "$new_width_float / 1" | bc) + + monitorID=$(xrandr --listactivemonitors | grep +"${name[$i]}" | awk '{sub(/.$/,"",$1); print $1}') + + eww open bar --id bar"${monitorID}" --arg monitor="${monitorID}" --arg width="${new_width}" --arg height=30 --config ../eww + sleep 2 +done diff --git a/eww/scripts/network.sh b/ewwScripts/network.sh similarity index 100% rename from eww/scripts/network.sh rename to ewwScripts/network.sh diff --git a/ewwScripts/test.sh b/ewwScripts/test.sh new file mode 100755 index 0000000..f40915a --- /dev/null +++ b/ewwScripts/test.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +getIcon() { + local desktop="" + + # Search for desktop files by WM class + if [ -n "$1" ]; then + desktop=$(grep -l "StartupWMClass.*$1$" /run/current-system/sw/share/applications/*.desktop) + [ -z "$desktop" ] && desktop=$(grep -Pl "Name\s*=\s*$1$" /run/current-system/sw/share/applications/*.desktop) + [ -z "$desktop" ] && desktop=$(ls /run/current-system/sw/share/applications/"${1}".desktop 2>/dev/null) + fi + + # If not found by WM class, search by process name + if [ -z "$desktop" ] && [ -n "$2" ]; then + process=$(ps -p "${2}" -o comm=) + desktop=$(grep -Pl "$process" /run/current-system/sw/share/applications/*.desktop) + [ -n "$desktop" ] + fi + + # If not found by WM class or process name, search by name or description + if [ -z "$desktop" ] && [ -n "$1" ]; then + desktop=$(grep -Pl "$1" /run/current-system/sw/share/applications/*.desktop) + fi + + echo "$desktop" +} + +desktop=$(getIcon "$1" "$2") +if [ -n "$desktop" ]; then + desktop=$(echo "$desktop" | awk 'NR==1') + icon=$(awk -F'[[:space:]]*=[[:space:]]*' '/Icon[[:space:]]*=/ && !seen[$2]++ {print $2; exit}' "$desktop") + echo -n "${icon}.svg" +fi diff --git a/eww/scripts/volume.sh b/ewwScripts/volume.sh similarity index 100% rename from eww/scripts/volume.sh rename to ewwScripts/volume.sh diff --git a/eww/images/Bob Ross.png b/images/Bob Ross.png similarity index 100% rename from eww/images/Bob Ross.png rename to images/Bob Ross.png diff --git a/eww/images/SamGuk-by_Sang_Min.png b/images/SamGuk-by_Sang_Min.png similarity index 100% rename from eww/images/SamGuk-by_Sang_Min.png rename to images/SamGuk-by_Sang_Min.png diff --git a/eww/images/USTime.png b/images/USTime.png similarity index 100% rename from eww/images/USTime.png rename to images/USTime.png diff --git a/eww/images/battery.png b/images/battery.png similarity index 100% rename from eww/images/battery.png rename to images/battery.png diff --git a/eww/images/batteryLow.png b/images/batteryLow.png similarity index 100% rename from eww/images/batteryLow.png rename to images/batteryLow.png diff --git a/eww/images/bluetooth.png b/images/bluetooth.png similarity index 100% rename from eww/images/bluetooth.png rename to images/bluetooth.png diff --git a/eww/images/bluetoothOriginal.png b/images/bluetoothOriginal.png similarity index 100% rename from eww/images/bluetoothOriginal.png rename to images/bluetoothOriginal.png diff --git a/eww/images/brightness.png b/images/brightness.png similarity index 100% rename from eww/images/brightness.png rename to images/brightness.png diff --git a/eww/images/brightnessOriginal.png b/images/brightnessOriginal.png similarity index 100% rename from eww/images/brightnessOriginal.png rename to images/brightnessOriginal.png diff --git a/eww/images/charging.png b/images/charging.png similarity index 100% rename from eww/images/charging.png rename to images/charging.png diff --git a/eww/images/chargingOriginal.png b/images/chargingOriginal.png similarity index 100% rename from eww/images/chargingOriginal.png rename to images/chargingOriginal.png diff --git a/eww/images/cpu.png b/images/cpu.png similarity index 100% rename from eww/images/cpu.png rename to images/cpu.png diff --git a/eww/images/cpuOriginal.png b/images/cpuOriginal.png similarity index 100% rename from eww/images/cpuOriginal.png rename to images/cpuOriginal.png diff --git a/eww/images/ethernet.png b/images/ethernet.png similarity index 100% rename from eww/images/ethernet.png rename to images/ethernet.png diff --git a/eww/images/ethernetOriginal.png b/images/ethernetOriginal.png similarity index 100% rename from eww/images/ethernetOriginal.png rename to images/ethernetOriginal.png diff --git a/eww/images/hibernate.png b/images/hibernate.png similarity index 100% rename from eww/images/hibernate.png rename to images/hibernate.png diff --git a/eww/images/lock.png b/images/lock.png similarity index 100% rename from eww/images/lock.png rename to images/lock.png diff --git a/eww/images/logout.png b/images/logout.png similarity index 100% rename from eww/images/logout.png rename to images/logout.png diff --git a/eww/images/power.png b/images/power.png similarity index 100% rename from eww/images/power.png rename to images/power.png diff --git a/eww/images/powerOriginal.png b/images/powerOriginal.png similarity index 100% rename from eww/images/powerOriginal.png rename to images/powerOriginal.png diff --git a/eww/images/ram.png b/images/ram.png similarity index 100% rename from eww/images/ram.png rename to images/ram.png diff --git a/eww/images/ramOriginal.png b/images/ramOriginal.png similarity index 100% rename from eww/images/ramOriginal.png rename to images/ramOriginal.png diff --git a/eww/images/reboot.png b/images/reboot.png similarity index 100% rename from eww/images/reboot.png rename to images/reboot.png diff --git a/eww/images/shutdown.png b/images/shutdown.png similarity index 100% rename from eww/images/shutdown.png rename to images/shutdown.png diff --git a/eww/images/suspend.png b/images/suspend.png similarity index 100% rename from eww/images/suspend.png rename to images/suspend.png diff --git a/eww/images/test.png b/images/test.png similarity index 100% rename from eww/images/test.png rename to images/test.png diff --git a/eww/images/volume.png b/images/volume.png similarity index 100% rename from eww/images/volume.png rename to images/volume.png diff --git a/eww/images/volumeMuted.png b/images/volumeMuted.png similarity index 100% rename from eww/images/volumeMuted.png rename to images/volumeMuted.png diff --git a/eww/images/volumeOriginal.png b/images/volumeOriginal.png similarity index 100% rename from eww/images/volumeOriginal.png rename to images/volumeOriginal.png diff --git a/eww/images/wifiHigh.png b/images/wifiHigh.png similarity index 100% rename from eww/images/wifiHigh.png rename to images/wifiHigh.png diff --git a/eww/images/wifiLow.png b/images/wifiLow.png similarity index 100% rename from eww/images/wifiLow.png rename to images/wifiLow.png diff --git a/eww/images/wifiMedium.png b/images/wifiMedium.png similarity index 100% rename from eww/images/wifiMedium.png rename to images/wifiMedium.png diff --git a/eww/images/wifiOriginal.png b/images/wifiOriginal.png similarity index 100% rename from eww/images/wifiOriginal.png rename to images/wifiOriginal.png diff --git a/eww/images/wifiVeryLow.png b/images/wifiVeryLow.png similarity index 100% rename from eww/images/wifiVeryLow.png rename to images/wifiVeryLow.png diff --git a/result b/result new file mode 120000 index 0000000..c1fabef --- /dev/null +++ b/result @@ -0,0 +1 @@ +/nix/store/mp0zkc5iaf73f3yiq606qvfpqvs48q5i-desktop-utils-1.0.0 \ No newline at end of file diff --git a/scripts/idle.sh b/scripts/idle.sh new file mode 100755 index 0000000..36435af --- /dev/null +++ b/scripts/idle.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +if [[ $(acpi -a | awk '{print $3}') == "on-line" ]]; then + swaylock +else + systemctl suspend-then-hibernate +fi \ No newline at end of file diff --git a/scripts/lock.sh b/scripts/lock.sh new file mode 100755 index 0000000..d936785 --- /dev/null +++ b/scripts/lock.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +swaylock & + +sleep 0.1 + +hyprctl dispatch dpms off \ No newline at end of file diff --git a/scripts/scale.sh b/scripts/scale.sh new file mode 100755 index 0000000..fba2355 --- /dev/null +++ b/scripts/scale.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +while read -r f s; do + if [[ $f == true && $(awk -v s="$s" 'BEGIN{ if (s > 1.5) print 1; else print 0; }') == 1 ]]; then + export GDK_SCALE=2 + export QT_SCALE_FACTOR=2 + fi +done < <(hyprctl monitors -j | jq -r '.[]|"\(.focused) \(.scale)"') + +wofi --show drun \ No newline at end of file diff --git a/scripts/startup.sh b/scripts/startup.sh new file mode 100644 index 0000000..e69de29 diff --git a/shell.nix b/shell.nix index 8b1c54e..524c7da 100644 --- a/shell.nix +++ b/shell.nix @@ -7,7 +7,6 @@ pkgs.mkShell { pkgs.cargo pkgs.pkg-config pkgs.libxkbcommon - pkgs.eww pkgs.rust-analyzer pkgs.clippy diff --git a/src/main.rs b/src/main.rs index 4140e2c..6ab3f22 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use smithay_client_toolkit::{ use wayland_client::{globals::registry_queue_init, protocol::wl_output, Connection, QueueHandle}; -const CONFIG_DIR: &str = "./eww"; +const CONFIG_DIR: &str = "/home/willifan/.config/desktop-utils/eww"; fn main() -> Result<(), Box> { // We initialize the logger for the purpose of debugging.