diff --git a/configs/eww/README.md b/configs/eww/README.md new file mode 100644 index 0000000..e17e49e --- /dev/null +++ b/configs/eww/README.md @@ -0,0 +1,3 @@ +credits: https://github.com/AlphaTechnolog/dotfiles/tree/openbox + +it has been slightly modified diff --git a/configs/eww/actions/actions.scss b/configs/eww/actions/actions.scss new file mode 100644 index 0000000..d8ee50e --- /dev/null +++ b/configs/eww/actions/actions.scss @@ -0,0 +1,157 @@ +.actions { + background-color: $bg; + color: $fg; + font-family: Product Sans; + border-radius: 30px; + border: 5px solid $contrastbg; + padding: 10px 18px; +} + +.controlsbox { + background-color: $contrastbg; + border-radius: 15px; + 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; + } + .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: MesloLGS NF; + 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/configs/eww/actions/actions.yuck b/configs/eww/actions/actions.yuck new file mode 100644 index 0000000..5e45619 --- /dev/null +++ b/configs/eww/actions/actions.yuck @@ -0,0 +1,207 @@ +(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 "$EWW_PATH/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 "$EWW_PATH/bluetooth toggle" + :active "${bluetooth_state == 'on' ? true : false}" + :label "Bluetooth" + ) + ) + (box :halign "end" + :orientation "h" + :space-evenly true + (sysblock :icon "${network_radio == 'on' ? '' : ''}" + :onclick "$EWW_PATH/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 "$EWW_PATH/redshift toggle" + :active "${redshift_state == 'on' ? true : false}" + :label "Night Light" + ) + ) + (box :halign "center" + :orientation "h" + :space-evenly true + (sysblock :icon "${volume_icon}" + :onclick "$EWW_PATH/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 "$EWW_PATH/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 "$EWW_PATH/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 "$EWW_PATH/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") + ) + ) + ) +) + +(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 close closer && $EWW_PATH/open.sh powermenu && eww open closer" + :tooltip "Logout" + :halign "end" + "" + ) + ) + ) + ) +) + +(defwidget actions [] + (box :class "actions" + :orientation "v" + :space-evenly false + :spacing 20 + (user) + (sysbuttons) + (controls) + (poweractions) + ) +) + +(defvar actions-visible false) + +(defwindow actions-reveal + :monitor "0" + :stacking "overlay" + :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") + + (revealer :transition "crossfade" + :reveal actions-visible + :duration "550ms" + (actions) + ) +) diff --git a/configs/eww/closer/README.md b/configs/eww/closer/README.md new file mode 100644 index 0000000..50be92f --- /dev/null +++ b/configs/eww/closer/README.md @@ -0,0 +1 @@ +always open this widget last diff --git a/configs/eww/closer/closer.yuck b/configs/eww/closer/closer.yuck new file mode 100644 index 0000000..b0cd63f --- /dev/null +++ b/configs/eww/closer/closer.yuck @@ -0,0 +1,9 @@ +(defwidget closer [] + (eventbox :onclick "$EWW_PATH/close-opened.sh && eww close closer")) + +(defwindow closer + :monitor 0 + :geometry (geometry :width "100%" :height "100%") + :stacking "overlay" + :focusable false + (closer :window "")) diff --git a/configs/eww/colors.scss b/configs/eww/colors.scss new file mode 100644 index 0000000..276d10e --- /dev/null +++ b/configs/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/configs/eww/date/date.scss b/configs/eww/date/date.scss new file mode 100644 index 0000000..dfeb91f --- /dev/null +++ b/configs/eww/date/date.scss @@ -0,0 +1,72 @@ +.date { + background-color: $bg; + color: $fg; + border-radius: 30px; + border: 5px solid $contrastbg; +} + +.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: 15px; + 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; +} diff --git a/configs/eww/date/date.yuck b/configs/eww/date/date.yuck new file mode 100644 index 0000000..f02c4e7 --- /dev/null +++ b/configs/eww/date/date.yuck @@ -0,0 +1,63 @@ +(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) + ) +) + +(defvar date-visible false) + +(defwindow date-reveal + :monitor 0 + :stacking "overlay" + :geometry (geometry :x "70px" + :y "4px" + :width "0px" ; automatically generated + :height "0px" ; automatically generated + :anchor "top right") + (revealer + :transition "crossfade" + :reveal date-visible + :duration "550ms" +(date))) diff --git a/configs/eww/eww.scss b/configs/eww/eww.scss new file mode 100644 index 0000000..7e56d41 --- /dev/null +++ b/configs/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 "traybuttons/traybuttons.scss"; diff --git a/configs/eww/eww.yuck b/configs/eww/eww.yuck new file mode 100644 index 0000000..dbbec3e --- /dev/null +++ b/configs/eww/eww.yuck @@ -0,0 +1,6 @@ +(include "variables.yuck") +(include "date/date.yuck") +(include "actions/actions.yuck") +(include "powermenu/powermenu.yuck") +(include "closer/closer.yuck") +(include "traybuttons/traybuttons.yuck") diff --git a/configs/eww/powermenu/powermenu.scss b/configs/eww/powermenu/powermenu.scss new file mode 100644 index 0000000..c77e43d --- /dev/null +++ b/configs/eww/powermenu/powermenu.scss @@ -0,0 +1,28 @@ +.powermenu { + background-color: $bg; + color: $fg; + padding: 20px; + font-family: MesloLGS NF; + /*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/configs/eww/powermenu/powermenu.yuck b/configs/eww/powermenu/powermenu.yuck new file mode 100644 index 0000000..32ccc4b --- /dev/null +++ b/configs/eww/powermenu/powermenu.yuck @@ -0,0 +1,55 @@ +(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 "hyprctl dispatch exit" + (label :text "" :class "content") + ) + ) +) + +(defwidget powermenu-clickhandler [] + (button :class "powermenu-clickhandler" + :onclick "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) +) + +(defvar powermenu-visible false) + +(defwindow powermenu-reveal + :monitor 0 + :stacking "overlay" + :geometry (geometry :x "0px" + :y "0px" + :width "500px" + :height "150px" + :anchor "center") + (revealer + :transition "crossfade" + :reveal powermenu-visible + :duration "550ms" + (powermenu) + ) +) diff --git a/configs/eww/scripts/bluetooth b/configs/eww/scripts/bluetooth new file mode 100755 index 0000000..e735c62 --- /dev/null +++ b/configs/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/configs/eww/scripts/brightness.sh b/configs/eww/scripts/brightness.sh new file mode 100755 index 0000000..4bb980d --- /dev/null +++ b/configs/eww/scripts/brightness.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env 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 + brightnessctl set $2% +fi diff --git a/configs/eww/scripts/close-opened.sh b/configs/eww/scripts/close-opened.sh new file mode 100755 index 0000000..2c28d6d --- /dev/null +++ b/configs/eww/scripts/close-opened.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# Store the output of the command in an array, keeping only lines with '*' +readarray -t array <<< "$(eww windows | grep '^\*')" + +# Remove the '*' from each element +for ((i=0; i<${#array[@]}; i++)) +do + array[i]=${array[i]#'*'} + array[i]=${array[i]%-reveal} +done + +# Close every window except permanent ones +for element in "${array[@]}" +do + if [[ "$element" != "tablet-toggle" ]]; then + $HOME/.nix/configs/eww/scripts/close.sh "$element" + fi +done diff --git a/configs/eww/scripts/close.sh b/configs/eww/scripts/close.sh new file mode 100755 index 0000000..d03dc30 --- /dev/null +++ b/configs/eww/scripts/close.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +WINDOW="$1" +( +eww update $WINDOW-visible=false +sleep .55 +eww close $WINDOW-reveal +) & diff --git a/configs/eww/scripts/cpu.sh b/configs/eww/scripts/cpu.sh new file mode 100755 index 0000000..0afb9e3 --- /dev/null +++ b/configs/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/configs/eww/scripts/disk.sh b/configs/eww/scripts/disk.sh new file mode 100755 index 0000000..5717c07 --- /dev/null +++ b/configs/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/configs/eww/scripts/exec b/configs/eww/scripts/exec new file mode 100755 index 0000000..b821a3c --- /dev/null +++ b/configs/eww/scripts/exec @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cd ~ +${@} 2>&1 >/dev/null & diff --git a/configs/eww/scripts/mic b/configs/eww/scripts/mic new file mode 100755 index 0000000..8853778 --- /dev/null +++ b/configs/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/configs/eww/scripts/network.sh b/configs/eww/scripts/network.sh new file mode 100755 index 0000000..ba03b4a --- /dev/null +++ b/configs/eww/scripts/network.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env 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/configs/eww/scripts/notif.sh b/configs/eww/scripts/notif.sh new file mode 100755 index 0000000..4c42ad7 --- /dev/null +++ b/configs/eww/scripts/notif.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +state () { + if [[ $(hyprctl layers | grep swaync-control-center) == "" ]]; then + eww update notif-panel-state=false + fi +} + +icon () { + local COUNT=$(swaync-client -c) + + if [[ $(swaync-client -D) == "true" ]]; then + echo " 󱏨" + elif [[ $COUNT == "0" ]]; then + echo "$COUNT 󰂜" + else + echo "$COUNT 󰂚" + fi + state +} + +if [[ $1 == "icon" ]]; then + icon +fi + diff --git a/configs/eww/scripts/on-release.sh b/configs/eww/scripts/on-release.sh new file mode 100755 index 0000000..fa7d75f --- /dev/null +++ b/configs/eww/scripts/on-release.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +function run() { + echo "touch up" + exit 0 +} + +while IFS='$\n' read -r line; do + [[ $(echo "$line" | grep TOUCH_UP) != "" ]] && run +done < <(stdbuf -oL journalctl --user -feu libinput-events) diff --git a/configs/eww/scripts/open.sh b/configs/eww/scripts/open.sh new file mode 100755 index 0000000..5831cdd --- /dev/null +++ b/configs/eww/scripts/open.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +WINDOW="$1" + +eww open $WINDOW-reveal +eww update $WINDOW-visible=true diff --git a/configs/eww/scripts/ram.sh b/configs/eww/scripts/ram.sh new file mode 100755 index 0000000..a2f0065 --- /dev/null +++ b/configs/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/configs/eww/scripts/redshift b/configs/eww/scripts/redshift new file mode 100755 index 0000000..38ce6a9 --- /dev/null +++ b/configs/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/configs/eww/scripts/temp.sh b/configs/eww/scripts/temp.sh new file mode 100755 index 0000000..92be642 --- /dev/null +++ b/configs/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/configs/eww/scripts/user.sh b/configs/eww/scripts/user.sh new file mode 100755 index 0000000..29568c8 --- /dev/null +++ b/configs/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/configs/eww/scripts/volume.sh b/configs/eww/scripts/volume.sh new file mode 100755 index 0000000..bbd6cd9 --- /dev/null +++ b/configs/eww/scripts/volume.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env 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/configs/eww/traybuttons/traybuttons.scss b/configs/eww/traybuttons/traybuttons.scss new file mode 100644 index 0000000..e403d46 --- /dev/null +++ b/configs/eww/traybuttons/traybuttons.scss @@ -0,0 +1,32 @@ +.notif-panel { +/* min-width: 110px; + min-height: 34px; */ + font-size: 20px; + padding: 2px 25px 2px 35px; +} + +.tablet-toggle { + font-size: 26px; + padding: 2px 13px 2px 16px; +} + +.toggle-off { + background-color: $bg; + transition: border-color 0.5s ease-in-out; + color: #CBA6F7; + border-radius: 80px; + border: 3px solid $contrastbg; +} + +.toggle-off:hover { + background-color: rgba(127, 132, 156, 0.4); + transition: background-color 0.5s ease-in-out; +} + +.toggle-on { + background-color: $bg; + transition: border-color 0.5s ease-in-out; + color: #CBA6F7; + border-radius: 80px; + border: 3px solid #CBA6F7; +} diff --git a/configs/eww/traybuttons/traybuttons.yuck b/configs/eww/traybuttons/traybuttons.yuck new file mode 100644 index 0000000..cb77fc1 --- /dev/null +++ b/configs/eww/traybuttons/traybuttons.yuck @@ -0,0 +1,55 @@ +(defvar toggle-state false) + +(defwidget tablet-toggle [] + (eventbox :class {toggle-state ? "toggle-on" : "toggle-off"} + :onclick {toggle-state ? "$HYPR_PATH/laptop-mode.sh &" : + "$HYPR_PATH/tablet-mode.sh &"} + (box :class "tablet-toggle" + :space-evenly true + :spacing 6 + :orientation "h" + (label :text " 󰦧 ") + ) + ) +) + +(defwindow tablet-toggle + :monitor 0 + :stacking "overlay" + :exclusive "ignore" + :geometry (geometry :x "66px" + :y "9px" + :width "0px" + :height "0px" + :anchor "top left" + ) + (tablet-toggle) +) + +(defvar notif-panel-state false) + +(defwidget notif-panel [] + (button :class {notif-panel-state ? "toggle-on" : "toggle-off"} + :onclick {notif-panel-state ? "swaync-client -cp; eww update notif-panel-state=false" : + "swaync-client -op; eww update notif-panel-state=true"} + (box :class "notif-panel" + :space-evenly true + :spacing 6 + :orientation "h" + (label :text " ${notif_icon} ") + ) + ) +) + +(defwindow notif-panel + :monitor 0 + :stacking "overlay" + :exclusive "ignore" + :geometry (geometry :x "50px" + :y "10px" + :width "0px" + :height "0px" + :anchor "top right" + ) + (notif-panel) +) diff --git a/configs/eww/variables.yuck b/configs/eww/variables.yuck new file mode 100644 index 0000000..2a1ffe2 --- /dev/null +++ b/configs/eww/variables.yuck @@ -0,0 +1,39 @@ +(defpoll network_status :interval "1s" "$EWW_PATH/network.sh status") +(defpoll network_icon :interval "1s" "$EWW_PATH/network.sh icon") +(defpoll network_radio :interval "1s" "$EWW_PATH/network.sh radio-status") +(defpoll network_ssid :interval "1s" "$EWW_PATH/network.sh ssid") + +(defpoll volume_icon :interval "1s" "$EWW_PATH/volume.sh icon") +(defpoll volume :interval "1s" "$EWW_PATH/volume.sh percentage") +(defpoll volume_value :interval "1s" "$EWW_PATH/volume.sh vol") +(defpoll is_muted :interval "1s" "$EWW_PATH/volume.sh muted") + +(defpoll mic :interval "1s" "$EWW_PATH/mic get") +(defpoll mic_status :interval "1s" "$EWW_PATH/mic status") + +(defpoll bluetooth_state :interval "1s" "$EWW_PATH/bluetooth state") +(defpoll redshift_state :interval "1s" "$EWW_PATH/redshift state") + +(defpoll rawuser :interval "30s" "whoami") +(defpoll hostname :interval "30s" "cat /etc/hostname") +(defpoll uptime :interval "30s" "uptime -p") + +(defpoll br_icon :interval "1s" "$EWW_PATH/brightness.sh icon") +(defpoll br :interval "1s" "$EWW_PATH/brightness.sh br") + +(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" "$EWW_PATH/cpu.sh") +(defpoll ram :interval "3s" "$EWW_PATH/ram.sh ram") +(defpoll temp :interval "3s" "$EWW_PATH/temp.sh get") +(defpoll disk :interval "3s" "$EWW_PATH/disk.sh") + +(defpoll notif_icon :interval "1s" "$EWW_PATH/notif.sh icon") diff --git a/configs/hypr/hyprpaper.conf b/configs/hypr/hyprpaper.conf new file mode 100644 index 0000000..d37a22f --- /dev/null +++ b/configs/hypr/hyprpaper.conf @@ -0,0 +1,2 @@ +preload = ~/Pictures/BG/bonzai.jpg +wallpaper = eDP-1, ~/Pictures/BG/bonzai.jpg diff --git a/configs/hypr/main.conf b/configs/hypr/main.conf new file mode 100644 index 0000000..c6061a8 --- /dev/null +++ b/configs/hypr/main.conf @@ -0,0 +1,232 @@ +# Plugins +plugin { + touch_gestures { + # default sensitivity is probably too low on tablet screens, + # I recommend turning it up to 4.0 + sensitivity = 20.0 + } +} + +# See https://wiki.hyprland.org/Configuring/Monitors/ +monitor=eDP-1,1920x1200@60,0x0,1 + +$menu = "$HOME/.config/rofi/launcher.sh" + +exec-once = $HOME/.config/lisgd/config & + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more + +# Execute your favorite apps at launch +exec-once = bash -c "sleep 3; nm-applet" +exec-once = bash -c "sleep 4; blueman-applet" +exec-once = bash -c "sleep 5; nextcloud --background" +exec-once = bash -c "sleep 6; tutanota-desktop -a" +exec-once = bash -c "sleep 7; GalaxyBudsClient /StartMinimized" + +exec-once = eww daemon +exec-once = eww open tablet-toggle +exec-once = eww open notif-panel + +exec-once = gnome-keyring-daemon --start --components=secrets +exec-once = squeekboard + +exec-once = $menu +exec-once = hyprpaper +exec-once = $HYPR_PATH/lose-focus.sh + +# after boot, there are 2 bars for some reason, so I kill them and rerun the command +exec-once = bash -c "killall -r -0 waybar && killall -r waybar; waybar" +exec-once = swaync + +exec-once = wl-paste --watch cliphist store + +# OSD window +exec-once = swayosd + +# Change HandleLidSwitch to lock in logind.conf +exec-once = swayidle -w lock $HOME/.config/gtklock/scripts/lock.sh + +# Some default env vars. +env = XCURSOR_SIZE,24 + +# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ +input { + kb_layout = ca + kb_variant = multix + kb_model = + kb_options = + kb_rules = + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + gaps_in = 5 + gaps_out = 5 + border_size = 2 + col.active_border = rgb(411C6C) + #col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg + col.inactive_border = rgba(595959aa) + + layout = dwindle +} + +misc { + disable_hyprland_logo = true + disable_splash_rendering = true + vfr = true +} + +decoration { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + + rounding = 20 + blur = yes + blur_size = 3 + blur_passes = 1 + blur_new_optimizations = on + + drop_shadow = false + #shadow_range = 4 + #shadow_render_power = 3 + #col.shadow = rgba(1a1a1aee) +} + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = myBezier, 0.05, 0.9, 0.1, 1.05 + + animation = windows, 1, 7, myBezier + animation = windowsOut, 1, 7, default, popin 80% + animation = border, 1, 10, default + animation = borderangle, 1, 8, default + animation = fade, 1, 7, default + animation = workspaces, 1, 6, default +} + +dwindle { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes # you probably want this +} + +master { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true +} + +gestures { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = yes + workspace_swipe_fingers = 3 + workspace_swipe_cancel_ratio = 0.15 + #workspace_swipe_forever = yes +} + +# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + +windowrule = float,^(org.kde.polkit-kde-authentication-agent-1)$ +windowrule = size 741 288,^(org.kde.polkit-kde-authentication-agent-1)$ +windowrule = center,^(org.kde.polkit-kde-authentication-agent-1)$ + +windowrule = size 741 288,^(org.kde.ksshaskpass)$ +windowrule = move cursor -370 -144,^(org.kde.ksshaskpass)$ + +windowrule = float,^(org.gnome.Calculator)$ +windowrule = float,^(GalaxyBudsClient)$ + +windowrule = size 1231 950,title:^(Open Folder)$ +windowrule = float,title:^(Open Folder)$ + +windowrule = size 1231 950,title:^(Open File)$ +windowrule = float,title:^(Open File)$ + +windowrule = pin,^(nm-tray)$ +#windowrule = move cursor 0 -35,^(nm-tray)$ + +windowrule = float,^(.blueman-manager-wrapped)$ +windowrule = move cursor 0 0,^(.blueman-manager-wrapped)$ +windowrule = size 400 581,^(.blueman-manager-wrapped)$ + +# See https://wiki.hyprland.org/Configuring/Keywords/ for more +$mainMod = SUPER + +bind = SUPER, F, fullscreen + +bind = $mainMod, V, exec, cliphist list | ~/.config/rofi/dmenu.sh | cliphist decode | wl-copy + +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Q, exec, alacritty +bind = $mainMod, C, killactive, + +bind = $mainMod, L, exec, $HOME/.config/gtklock/scripts/lock.sh +bind = $mainMod SHIFT, E, exec, eww open closer && $EWW_PATH/open.sh powermenu +bindn =, Escape, exec, $EWW_PATH/close-opened.sh +bind = $mainMod SHIFT, SPACE, togglefloating, +bind = $mainMod, D, exec, $menu +bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle + +# Move focus with mainMod + arrow keys +bind = $mainMod, left, movefocus, l +bind = $mainMod, right, movefocus, r +bind = $mainMod, up, movefocus, u +bind = $mainMod, down, movefocus, d + +# Switch workspaces with mainMod + [0-9] +bind = $mainMod, 1, workspace, 1 +bind = $mainMod, 2, workspace, 2 +bind = $mainMod, 3, workspace, 3 +bind = $mainMod, 4, workspace, 4 +bind = $mainMod, 5, workspace, 5 +bind = $mainMod, 6, workspace, 6 +bind = $mainMod, 7, workspace, 7 +bind = $mainMod, 8, workspace, 8 +bind = $mainMod, 9, workspace, 9 +bind = $mainMod, 0, workspace, 10 + +# Move active window to a workspace with mainMod + SHIFT + [0-9] +bind = $mainMod SHIFT, 1, movetoworkspace, 1 +bind = $mainMod SHIFT, 2, movetoworkspace, 2 +bind = $mainMod SHIFT, 3, movetoworkspace, 3 +bind = $mainMod SHIFT, 4, movetoworkspace, 4 +bind = $mainMod SHIFT, 5, movetoworkspace, 5 +bind = $mainMod SHIFT, 6, movetoworkspace, 6 +bind = $mainMod SHIFT, 7, movetoworkspace, 7 +bind = $mainMod SHIFT, 8, movetoworkspace, 8 +bind = $mainMod SHIFT, 9, movetoworkspace, 9 +bind = $mainMod SHIFT, 0, movetoworkspace, 10 + +# Scroll through existing workspaces with mainMod + scroll +bind = $mainMod, mouse_down, workspace, e+1 +bind = $mainMod, mouse_up, workspace, e-1 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +# Take a screenshot +bind =, Print, exec, bash -c 'grim -g "$(slurp)" - | swappy -f -' + +# Volume control +binde =, XF86AudioRaiseVolume, exec, swayosd --output-volume raise +binde =, XF86AudioLowerVolume, exec, swayosd --output-volume lower +bind =, XF86AudioMute, exec, swayosd --output-volume mute-toggle +bind =, XF86AudioMicMute, exec, swayosd --input-volume mute-toggle + +bindr = CAPS, Caps_Lock, exec, swayosd --caps-lock + +# Brightness control +binde =, XF86MonBrightnessUp, exec, swayosd --brightness raise +binde =, XF86MonBrightnessDown, exec, swayosd --brightness lower diff --git a/configs/hypr/scripts/autorotate.sh b/configs/hypr/scripts/autorotate.sh new file mode 100755 index 0000000..e81d310 --- /dev/null +++ b/configs/hypr/scripts/autorotate.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# This script was forked from https://gitlab.com/snippets/1793649 by Fishonadish + + +SCREEN="eDP-1" +WAYLANDINPUT=("wacom-hid-52eb-finger" + "wacom-hid-52eb-pen") + + + +function rotate_ms { + if [[ $(hyprctl activewindow | grep Waydroid) == "" ]]; then + case $1 in + "normal") + rotate 0 + ;; + "right-up") + rotate 3 + ;; + "bottom-up") + rotate 2 + ;; + "left-up") + rotate 1 + ;; + esac + elif [[ $(hyprctl monitors | grep "transform: 0") == "" ]]; then + rotate 0 + fi +} + +function rotate { + TARGET_ORIENTATION=$1 + + echo "Rotating to" $TARGET_ORIENTATION + + hyprctl keyword monitor $SCREEN,transform,$TARGET_ORIENTATION + + for i in "${WAYLANDINPUT[@]}" + do + hyprctl keyword device:"$i":transform $TARGET_ORIENTATION + done + + /home/matt/.config/lisgd/config & +} + +while IFS='$\n' read -r line; do + rotation="$(echo $line | sed -En "s/^.*orientation changed: (.*)/\1/p")" + [[ ! -z $rotation ]] && rotate_ms $rotation +done < <(stdbuf -oL monitor-sensor) diff --git a/configs/hypr/scripts/laptop-mode.sh b/configs/hypr/scripts/laptop-mode.sh new file mode 100755 index 0000000..f70860e --- /dev/null +++ b/configs/hypr/scripts/laptop-mode.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +eww update toggle-state=false + +gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false + +brightnessctl -d tpacpi::kbd_backlight s 2 + +killall -r autorotate.sh +killall -r evtest diff --git a/configs/hypr/scripts/lose-focus.sh b/configs/hypr/scripts/lose-focus.sh new file mode 100755 index 0000000..fb20bef --- /dev/null +++ b/configs/hypr/scripts/lose-focus.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +while true +do + while killall -0 .blueman-manage > /dev/null 2>&1 + do + if [[ $(bluetoothctl show | grep Powered | grep yes) ]]; then + if [[ $(hyprctl activewindow | grep blueman-manager) == "" && $(hyprctl clients | grep blueman-manager) != "" ]]; then + killall .blueman-manage + break + fi + sleep 0.1 + fi + done + sleep 0.1 +done diff --git a/configs/hypr/scripts/osk-toggle.sh b/configs/hypr/scripts/osk-toggle.sh new file mode 100755 index 0000000..e59b03c --- /dev/null +++ b/configs/hypr/scripts/osk-toggle.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +if [[ $(busctl get-property --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 Visible) == "b true" ]] +then + echo "Running" + busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false +else + echo "Stopped" + busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true +fi diff --git a/configs/hypr/scripts/tablet-mode.sh b/configs/hypr/scripts/tablet-mode.sh new file mode 100755 index 0000000..51b50e1 --- /dev/null +++ b/configs/hypr/scripts/tablet-mode.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +eww update toggle-state=true + +echo $XDG_DATA_DIRS >> ~/log.log +gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true + +brightnessctl -d tpacpi::kbd_backlight s 0 + +$HYPR_PATH/autorotate.sh & + +evtest --grab "/dev/input/by-path/platform-i8042-serio-0-event-kbd" & +evtest --grab "/dev/input/by-path/platform-i8042-serio-1-event-mouse" & +evtest --grab "/dev/input/by-path/platform-AMDI0010:02-event-mouse" & +evtest --grab "/dev/input/by-path/platform-thinkpad_acpi-event" & +evtest --grab "/dev/video-bus" & diff --git a/nixos/home/bashdots.nix b/nixos/home/bashdots.nix index 9874e93..f599b70 100644 --- a/nixos/home/bashdots.nix +++ b/nixos/home/bashdots.nix @@ -50,11 +50,8 @@ jelly = "mosh matt@10.0.0.121 -- ssh -t matt@10.0.0.123 'tmux -2u new -At laptop'"; qbit = "mosh matt@10.0.0.121 -- ssh -t matt@10.0.0.128 'tmux -2u new -At laptop'"; }; - sessionVariables = { + sessionVariables = { # see hyprland.nix TERM = "xterm-color"; - #MOZ_ENABLE_WAYLAND = 1; - #QT_QPA_PLATFORM = "wayland-egl"; - XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:\$XDG_DATA_DIRS"; }; profileExtra = '' diff --git a/nixos/home/dotfiles.nix b/nixos/home/dotfiles.nix new file mode 100644 index 0000000..ea1fa0f --- /dev/null +++ b/nixos/home/dotfiles.nix @@ -0,0 +1,54 @@ +{ ... }: + +let + configDir = "/home/matt/.nix/configs"; +in + +{ + programs.eww = { + enable = true; + configDir = "${configDir}/eww"; # see hyprland.nix for scripts path + package = + (builtins.getFlake "github:matt1432/eww-exclusiver").packages.x86_64-linux.default; + }; + + programs.alacritty = { + enable = true; + settings = { + env = { + POKE = "true"; + }; + + window = { + padding = { + x = 0; + y = 10; + }; + + opacity = 0.8; + }; + + colors = { + primary = { + background = "0x0c0c0c"; + foreground = "0xfcfcfc"; + + dim_foreground = "0xeff0f1"; + bright_foreground = "0xffffff"; + dim_background = "0x31363b"; + bright_background = "0x000000"; + }; + normal = { + black = "0x232627"; + red = "0xed1515"; + green = "0x11d116"; + yellow = "0xf67400"; + blue = "0x1d99f3"; + magenta = "0x9b59b6"; + cyan = "0x1abc9c"; + white = "0xfcfcfc"; + }; + }; + }; + }; +} diff --git a/nixos/home/hyprland.nix b/nixos/home/hyprland.nix index 43fe6bf..4e3c0c6 100644 --- a/nixos/home/hyprland.nix +++ b/nixos/home/hyprland.nix @@ -1,4 +1,7 @@ { pkgs, ... }: let + + configDir = "/home/matt/.nix/configs"; + flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz"; hyprland = (import flake-compat { @@ -30,9 +33,18 @@ in ]; extraConfig = '' + env = XDG_DATA_DIRS, ${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:$XDG_DATA_DIRS + + env = EWW_PATH, $HOME/.nix/configs/eww/scripts + env = HYPR_PATH, $HOME/.nix/configs/hypr/scripts + exec-once = ${pkgs.plasma5Packages.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1 source = ~/.config/hypr/main.conf - env = XDG_DATA_DIRS, ${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:$XDG_DATA_DIRS ''; }; + + xdg.configFile = { + "hypr/main.conf".source = "${configDir}/hypr/main.conf"; + "hypr/hyprpaper.conf".source = "${configDir}/hypr/hyprpaper.conf"; + }; } diff --git a/nixos/home/main.nix b/nixos/home/main.nix index 71813ec..337465d 100644 --- a/nixos/home/main.nix +++ b/nixos/home/main.nix @@ -22,8 +22,9 @@ home-manager.users.matt = { imports = [ - ./bashdots.nix ./hyprland.nix + ./bashdots.nix + ./dotfiles.nix ./packages.nix ./misc.nix ]; diff --git a/nixos/home/packages.nix b/nixos/home/packages.nix index 33600c2..8a8a9f3 100644 --- a/nixos/home/packages.nix +++ b/nixos/home/packages.nix @@ -42,7 +42,7 @@ [ (writeShellScriptBin "Gparted" '' ( - sleep 0.5 + sleep 1.5 while killall -r -0 ksshaskpass > /dev/null 2>&1 do sleep 0.1 @@ -55,7 +55,6 @@ exec env SUDO_ASKPASS=${pkgs.plasma5Packages.ksshaskpass}/bin/${pkgs.plasma5Packages.ksshaskpass.pname} sudo -k -EA "${gparted}/bin/${gparted.pname}" "$@" '') - (builtins.getFlake "github:matt1432/eww-exclusiver").packages.x86_64-linux.default swayosd qt5.qtwayland qt6.qtwayland @@ -79,7 +78,6 @@ spicetify-cli # TODO vlc discord - alacritty brightnessctl pulseaudio alsa-utils