feat: redesign the project structure

This commit is contained in:
ryan4yin
2023-05-26 19:25:44 +08:00
parent ab11958597
commit f971ec030d
124 changed files with 711 additions and 540 deletions

View File

@@ -0,0 +1,55 @@
{
pkgs,
config,
lib,
...
}: {
imports = [
./wayland-apps.nix
];
# hyprland configs, based on https://github.com/notwidow/hyprland
home.file.".config/hypr" = {
source = ./hypr-conf;
# copy the scripts directory recursively
recursive = true;
};
home.file.".config/gtk-3.0" = {
source = ./gtk-3.0;
recursive = true;
};
home.file.".gtkrc-2.0".source = ./gtkrc-2.0;
home.file.".config/hypr/wallpapers/wallpaper.png".source = ../wallpapers/wallpaper.png;
# allow fontconfig to discover fonts and configurations installed through home.packages
fonts.fontconfig.enable = true;
systemd.user.sessionVariables = {
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
"MOZ_WEBRENDER" = "1";
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
"LIBVA_DRIVER_NAME" = "nvidia";
"XDG_SESSION_TYPE" = "wayland";
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
"WLR_NO_HARDWARE_CURSORS" = "1";
"WLR_EGL_NO_MODIFIRES" = "1";
};
# this is for xwayland
# set dpi for 4k monitor
xresources.properties = {
"Xft.dpi" = 162;
};
# set Xcursor.theme & Xcursor.size in ~/.Xresources automatically
home.pointerCursor = {
name = "Qogir-dark";
package = pkgs.qogir-theme;
size = 64;
};
}

View File

@@ -0,0 +1,16 @@
[Settings]
gtk-theme-name=Arc-Dark
gtk-icon-theme-name=Qogir-dark
gtk-font-name=Noto Sans 10
gtk-cursor-theme-name=Qogir-dark
gtk-cursor-theme-size=64
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintmedium
gtk-xft-rgba=rgb

View File

@@ -0,0 +1,19 @@
# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.
include "~/.gtkrc-2.0.mine"
gtk-theme-name="Arc-Dark"
gtk-icon-theme-name="Qogir-dark"
gtk-font-name="Noto Sans 10"
gtk-cursor-theme-name="Qogir-dark"
gtk-cursor-theme-size=64
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=0
gtk-menu-images=0
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintmedium"
gtk-xft-rgba="rgb"

View File

@@ -0,0 +1,211 @@
## Hyprland configuration file for Archcraft
#-- Output ----------------------------------------------------
# Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info.
# format:
# monitor=name,resolution,position,scale
monitor=DP-2,3840x2160@144,0x0,1.6
workspace=DP-2,1
#-- Input ----------------------------------------------------
# Configure mouse and touchpad here.
input {
kb_layout=us
kb_variant=
kb_model=
kb_options=
kb_rules=
follow_mouse=1
natural_scroll=0
force_no_accel=0
# repeat_rate=
# repeat_delay=
numlock_by_default=1
}
#-- General ----------------------------------------------------
# General settings like MOD key, Gaps, Colors, etc.
general {
sensitivity=2.0
apply_sens_to_raw=0
gaps_in=5
gaps_out=10
border_size=4
col.active_border=0xFFB4A1DB
col.inactive_border=0xFF343A40
}
#-- Decoration ----------------------------------------------------
# Decoration settings like Rounded Corners, Opacity, Blur, etc.
decoration {
rounding=8 # Original: rounding=-1
multisample_edges=0
active_opacity=1.0
inactive_opacity=0.9
fullscreen_opacity=1.0
blur=0
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
blur_ignore_opacity=0
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
}
#-- Animations ----------------------------------------------------
animations {
enabled=1
animation=windows,1,8,default,popin 80%
animation=fadeOut,1,8,default
animation=fadeIn,1,8,default
animation=workspaces,1,8,default
#animation=workspaces,1,6,overshot
}
#-- Dwindle ----------------------------------------------------
dwindle {
pseudotile=0 # enable pseudotiling on dwindle
}
#-- Window Rules ----------------------------------------------------
windowrule=float,foot-float
windowrule=float,yad|nm-connection-editor|pavucontrolk
windowrule=float,xfce-polkit|kvantummanager|qt5ct
windowrule=float,feh|imv|Gpicview|Gimp|nomacs
windowrule=float,VirtualBox Manager|qemu|Qemu-system-x86_64
windowrule=float,xfce4-appfinder
windowrule=float,foot-full
windowrule=move 0 0,foot-full
windowrule=size 100% 100%,foot-full
windowrule=float,wlogout
windowrule=move 0 0,wlogout
windowrule=size 100% 100%,wlogout
windowrule=animation slide,wlogout
#-- Keybindings ----------------------------------------------------
$term = alacritty
$app_launcher = ~/.config/hypr/scripts/menu
$volume = ~/.config/hypr/scripts/volume
$backlight = ~/.config/hypr/scripts/brightness
$screenshot = ~/.config/hypr/scripts/screenshot
$lockscreen = ~/.config/hypr/scripts/lockscreen
$wlogout = ~/.config/hypr/scripts/wlogout
$colorpicker = ~/.config/hypr/scripts/colorpicker
$files = thunar
$editor = code # vscode
$browser = firefox
# -- Terminal --
bind=SUPER,Return,exec,$term
# -- Wofi --
bind=SUPER,D,exec,$app_launcher
# -- Hyprland --
bind=SUPER,Q,killactive,
bind=CTRLALT,Delete,exit,
bind=SUPER,F,fullscreen,
bind=SUPER,Space,togglefloating,
bind=SUPER,S,pseudo,
# -- Misc --
bind=SUPER,N,exec,nm-connection-editor # need install network-manager-applet
bind=SUPER,P,exec,$colorpicker
bind=CTRLALT,L,exec,$lockscreen
bind=SUPERSHIFT,X,exec,$wlogout
# -- Some nice mouse binds --
bindm=SUPER,mouse:272,movewindow
bindm=SUPER,mouse:273,resizewindow
# -- Function keys --
bind=,XF86MonBrightnessUp,exec,$backlight --inc
bind=,XF86MonBrightnessDown,exec,$backlight --dec
bind=,XF86AudioRaiseVolume,exec,$volume --inc
bind=,XF86AudioLowerVolume,exec,$volume --dec
bind=,XF86AudioMute,exec,$volume --toggle
bind=,XF86AudioMicMute,exec,$volume --toggle-mic
bind=,XF86AudioNext,exec,mpc next
bind=,XF86AudioPrev,exec,mpc prev
bind=,XF86AudioPlay,exec,mpc toggle
bind=,XF86AudioStop,exec,mpc stop
# -- Screenshots --
bind=,Print,exec,$screenshot --now
bind=SUPER,Print,exec,$screenshot --win
bind=CTRL,Print,exec,$screenshot --area
# Focus
bind=SUPER,left,movefocus,l
bind=SUPER,right,movefocus,r
bind=SUPER,up,movefocus,u
bind=SUPER,down,movefocus,d
# Move
bind=SUPERSHIFT,left,movewindow,l
bind=SUPERSHIFT,right,movewindow,r
bind=SUPERSHIFT,up,movewindow,u
bind=SUPERSHIFT,down,movewindow,d
# Resize
bind=SUPERCTRL,left,resizeactive,-20 0
bind=SUPERCTRL,right,resizeactive,20 0
bind=SUPERCTRL,up,resizeactive,0 -20
bind=SUPERCTRL,down,resizeactive,0 20
# Workspaces
bind=SUPER,1,workspace,1
bind=SUPER,2,workspace,2
bind=SUPER,3,workspace,3
bind=SUPER,4,workspace,4
bind=SUPER,5,workspace,5
bind=SUPER,6,workspace,6
bind=SUPER,7,workspace,7
bind=SUPER,8,workspace,8
bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
# Send to Workspaces
bind=SUPERSHIFT,1,movetoworkspace,1
bind=SUPERSHIFT,2,movetoworkspace,2
bind=SUPERSHIFT,3,movetoworkspace,3
bind=SUPERSHIFT,4,movetoworkspace,4
bind=SUPERSHIFT,5,movetoworkspace,5
bind=SUPERSHIFT,6,movetoworkspace,6
bind=SUPERSHIFT,7,movetoworkspace,7
bind=SUPERSHIFT,8,movetoworkspace,8
bind=SUPERSHIFT,9,movetoworkspace,9
bind=SUPERSHIFT,0,movetoworkspace,10
bind=SUPER,mouse_down,workspace,e+1
bind=SUPER,mouse_up,workspace,e-1
#-- Startup ----------------------------------------------------
exec-once=~/.config/hypr/scripts/startup
#-- Fcitx5 input method ----------------------------------------------------
windowrule=pseudo,fcitx # enable this will make fcitx5 works, but fcitx5-configtool will not work!
exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore fcitx5 profile manged by nixos
exec-once=fcitx5 -d --replace # start fcitx5 daemon
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r
# -- Fix input method in vscode
exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24
# 效果是 wayland 原生窗口缩放完全正常
# xwayland 窗口先渲染到 200% 再降到 hyprland config 里 monitor 设置的值,看上去和原生没啥区别
# 相比较一开始的方案输入法字体大小也正确了.唯一有点问题的可能是 xwayland 窗口下的鼠标指针大小不对
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
exec-once = xrdb -merge ~/.Xresources
# env = GDK_SCALE,2
env = XCURSOR_SIZE,48
env = XCURSOR_THEME,"Bibata-Modern-Ice"

View File

@@ -0,0 +1,56 @@
## Mako configuration file
# GLOBAL CONFIGURATION OPTIONS
max-history=100
sort=-time
# BINDING OPTIONS
on-button-left=dismiss
on-button-middle=none
on-button-right=dismiss-all
on-touch=dismiss
on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga
# STYLE OPTIONS
font=JetBrains Mono 10
width=300
height=100
margin=10
padding=15
border-size=2
border-radius=0
icons=1
max-icon-size=48
icon-location=left
markup=1
actions=1
history=1
text-alignment=left
default-timeout=5000
ignore-timeout=0
max-visible=5
layer=overlay
anchor=top-right
background-color=#1e1e2e
text-color=#d9e0ee
border-color=#313244
progress-color=over #89b4fa
[urgency=low]
border-color=#313244
default-timeout=2000
[urgency=normal]
border-color=#313244
default-timeout=5000
[urgency=high]
border-color=#f38ba8
text-color=#f38ba8
default-timeout=0
[category=mpd]
border-color=#f9e2af
default-timeout=2000
group-by=category

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
## Script To Manage Brightness For Archcraft (in Wayland).
iDIR="$HOME/.config/hypr/mako/icons"
# Get brightness
get_backlight() {
LIGHT=$(printf "%.0f\n" $(light -G))
echo "${LIGHT}%"
}
# Get icons
get_icon() {
backlight="$(get_backlight)"
current="${backlight%%%}"
if [[ ("$current" -ge "0") && ("$current" -le "20") ]]; then
icon="$iDIR/brightness-20.png"
elif [[ ("$current" -ge "20") && ("$current" -le "40") ]]; then
icon="$iDIR/brightness-40.png"
elif [[ ("$current" -ge "40") && ("$current" -le "60") ]]; then
icon="$iDIR/brightness-60.png"
elif [[ ("$current" -ge "60") && ("$current" -le "80") ]]; then
icon="$iDIR/brightness-80.png"
elif [[ ("$current" -ge "80") && ("$current" -le "100") ]]; then
icon="$iDIR/brightness-100.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Brightness : $(get_backlight)"
}
# Increase brightness
inc_backlight() {
light -A 5 && get_icon && notify_user
}
# Decrease brightness
dec_backlight() {
light -U 5 && get_icon && notify_user
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_backlight
elif [[ "$1" == "--inc" ]]; then
inc_backlight
elif [[ "$1" == "--dec" ]]; then
dec_backlight
else
get_backlight
fi

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
## Simple Script To Pick Color Quickly.
color=$(grim -g "$(slurp -b 1B1F2800 -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n1 | cut -d' ' -f4)
image=/tmp/${color}.png
main() {
if [[ "$color" ]]; then
# copy color code to clipboard
echo $color | tr -d "\n" | wl-copy
# generate preview
convert -size 48x48 xc:"$color" ${image}
# notify about it
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i ${image} "$color, copied to clipboard."
fi
}
# Run the script
main

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Times the screen off and puts it to background
swayidle \
timeout 300 'swaymsg "output * power off"' \
resume 'swaymsg "output * power on"' &
# Locks the screen immediately
swaylock
# Kills last background task so idle timer doesn't keep running
kill %%

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
## launch wofi with alt config
CONFIG="$HOME/.config/hypr/wofi/config"
STYLE="$HOME/.config/hypr/wofi/style.css"
COLORS="$HOME/.config/hypr/wofi/colors"
if [[ ! $(pidof wofi) ]]; then
wofi --show drun --prompt 'Search...' --conf ${CONFIG} --style ${STYLE} --color ${COLORS}
else
pkill wofi
fi

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
## launch mako with alt config
CONFIG="$HOME/.config/hypr/mako/config"
if [[ ! $(pidof mako) ]]; then
mako --config ${CONFIG}
fi

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env bash
## Script to take screenshots with grim, slurp (in Wayland)
iDIR="$HOME/.config/hypr/mako/icons"
time=$(date +%Y-%m-%d-%H-%M-%S)
dir="$(xdg-user-dir PICTURES)/Screenshots" # need
file="Screenshot_${time}_${RANDOM}.png"
# notify and view screenshot
notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png"
notify_view () {
${notify_cmd_shot} "Copied to clipboard."
imv ${dir}/"$file"
if [[ -e "$dir/$file" ]]; then
${notify_cmd_shot} "Screenshot Saved."
else
${notify_cmd_shot} "Screenshot Deleted."
fi
}
# take shots
shotnow () {
cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
shotwin () {
w_pos=$(hyprctl activewindow | grep 'at:' | cut -d':' -f2 | tr -d ' ' | tail -n1)
w_size=$(hyprctl activewindow | grep 'size:' | cut -d':' -f2 | tr -d ' ' | tail -n1 | sed s/,/x/g)
cd ${dir} && grim -g "$w_pos $w_size" - | tee "$file" | wl-copy
notify_view
}
shotarea () {
cd ${dir} && grim -g "$(slurp -b 1B1F28CC -c E06B74ff -s C778DD0D -w 2)" - | tee "$file" | wl-copy
notify_view
}
if [[ ! -d "$dir" ]]; then
mkdir -p "$dir"
fi
if [[ "$1" == "--now" ]]; then
shotnow
elif [[ "$1" == "--area" ]]; then
shotarea
elif [[ "$1" == "--win" ]]; then
shotwin
else
echo -e "Available Options : --now --win --area"
fi
exit 0

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
## Autostart Programs
# Kill already running process
_ps=(waybar mako mpd)
for _prs in "${_ps[@]}"; do
if [[ $(pidof ${_prs}) ]]; then
killall -9 ${_prs}
fi
done
# Set wallpaper
swaybg --output '*' --mode fill --image ~/.config/hypr/wallpapers/wallpaper.png &
# Lauch notification daemon (mako)
~/.config/hypr/scripts/notifications &
# Lauch statusbar (waybar)
~/.config/hypr/scripts/statusbar &
# Start mpd
exec mpd &

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
## launch waybar with alt config
CONFIG="$HOME/.config/hypr/waybar/config"
STYLE="$HOME/.config/hypr/waybar/style.css"
if [[ ! $(pidof waybar) ]]; then
waybar --bar main-bar --log-level error --config ${CONFIG} --style ${STYLE}
fi

View File

@@ -0,0 +1,76 @@
#!/usr/bin/env bash
## Script To Manage Speaker Volume For Archcraft (in Wayland).
iDIR="$HOME/.config/hypr/mako/icons"
# Get Volume
get_volume() {
volume=$(amixer get Master | tail -n1 | awk -F ' ' '{print $5}' | tr -d '[]')
echo "$volume"
}
# Get icons
get_icon() {
vol="$(get_volume)"
current="${vol%%%}"
if [[ "$current" -eq "0" ]]; then
icon="$iDIR/volume-mute.png"
elif [[ ("$current" -ge "0") && ("$current" -le "30") ]]; then
icon="$iDIR/volume-low.png"
elif [[ ("$current" -ge "30") && ("$current" -le "60") ]]; then
icon="$iDIR/volume-mid.png"
elif [[ ("$current" -ge "60") && ("$current" -le "100") ]]; then
icon="$iDIR/volume-high.png"
fi
}
# Notify
notify_user() {
notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Volume : $(get_volume)"
}
# Increase Volume
inc_volume() {
amixer -Mq set Master,0 5%+ unmute && get_icon && notify_user
}
# Decrease Volume
dec_volume() {
amixer -Mq set Master,0 5%- unmute && get_icon && notify_user
}
# Toggle Mute
toggle_mute() {
amixer get Master | grep '\[on\]' &>/dev/null
if [[ "$?" == 0 ]]; then
amixer set Master toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/volume-mute.png" "Mute"
else
amixer set Master toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$icon" "Unmute"
fi
}
# Toggle Mic
toggle_mic() {
amixer get Capture | grep '\[on\]' &>/dev/null
if [[ "$?" == 0 ]]; then
amixer -D pulse sset Capture toggle && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone-mute.png" "Microphone Switched OFF"
else
amixer -D pulse sset Capture toggle && get_icon && notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$iDIR/microphone.png" "Microphone Switched ON"
fi
}
# Execute accordingly
if [[ "$1" == "--get" ]]; then
get_volume
elif [[ "$1" == "--inc" ]]; then
inc_volume
elif [[ "$1" == "--dec" ]]; then
dec_volume
elif [[ "$1" == "--toggle" ]]; then
toggle_mute
elif [[ "$1" == "--toggle-mic" ]]; then
toggle_mic
else
get_volume
fi

View File

@@ -0,0 +1,120 @@
#!/usr/bin/env python
import subprocess
from pyquery import PyQuery # install using `pip install pyquery`
import json
# weather icons
weather_icons = {
"sunnyDay": "滛",
"clearNight": "望",
"cloudyFoggyDay": "",
"cloudyFoggyNight": "",
"rainyDay": "",
"rainyNight": "",
"snowyIcyDay": "",
"snowyIcyNight": "",
"severe": "",
"default": "",
}
# get location_id
# to get your own location_id, go to https://weather.com & search your location.
# once you choose your location, you can see the location_id in the URL(64 chars long hex string)
# Shenzen, Guangdong's location id: https://weather.com/en-IN/weather/today/l/7a4684e0789c881e79935986f2e9e5ab05b0104ac4310fd8818006dfb66092c3
location_id = "7a4684e0789c881e79935986f2e9e5ab05b0104ac4310fd8818006dfb66092c3"
# get html page
url = "https://weather.com/en-IN/weather/today/l/" + location_id
html_data = PyQuery(url=url)
# current temperature
temp = html_data("span[data-testid='TemperatureValue']").eq(0).text()
# print(temp)
# current status phrase
status = html_data("div[data-testid='wxPhrase']").text()
status = f"{status[:16]}.." if len(status) > 17 else status
# print(status)
# status code
status_code = html_data("#regionHeader").attr("class").split(" ")[2].split("-")[2]
# print(status_code)
# status icon
icon = (
weather_icons[status_code]
if status_code in weather_icons
else weather_icons["default"]
)
# print(icon)
# temperature feels like
temp_feel = html_data(
"div[data-testid='FeelsLikeSection'] > span[data-testid='TemperatureValue']"
).text()
temp_feel_text = f"Feels like {temp_feel}c"
# print(temp_feel_text)
# min-max temperature
temp_min = (
html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']")
.eq(0)
.text()
)
temp_max = (
html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']")
.eq(1)
.text()
)
temp_min_max = f" {temp_min}\t\t {temp_max}"
# print(temp_min_max)
# wind speed
wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[1]
wind_text = f"煮 {wind_speed}"
# print(wind_text)
# humidity
humidity = html_data("span[data-testid='PercentageValue']").text()
humidity_text = f" {humidity}"
# print(humidity_text)
# visibility
visbility = html_data("span[data-testid='VisibilityValue']").text()
visbility_text = f" {visbility}"
# print(visbility_text)
# air quality index
air_quality_index = html_data("text[data-testid='DonutChartValue']").text()
# print(air_quality_index)
# hourly rain prediction
prediction = html_data("section[aria-label='Hourly Forecast']")(
"div[data-testid='SegmentPrecipPercentage'] > span"
).text()
prediction = prediction.replace("Chance of Rain", "")
prediction = f"\n\n  (hourly) {prediction}" if len(prediction) > 0 else prediction
# print(prediction)
# tooltip text
tooltip_text = str.format(
"\t\t{}\t\t\n{}\n{}\n{}\n\n{}\n{}\n{}{}",
f'<span size="xx-large">{temp}</span>',
f"<big>{icon}</big>",
f"<big>{status}</big>",
f"<small>{temp_feel_text}</small>",
f"<big>{temp_min_max}</big>",
f"{wind_text}\t{humidity_text}",
f"{visbility_text}\tAQI {air_quality_index}",
f"<i>{prediction}</i>",
)
# print waybar module data
out_data = {
"text": f"{icon} {temp}",
"alt": status,
"tooltip": tooltip_text,
"class": status_code,
}
print(json.dumps(out_data))

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
## wlogout with alt layout and style file
LAYOUT="$HOME/.config/hypr/wlogout/layout"
STYLE="$HOME/.config/hypr/wlogout/style.css"
if [[ ! $(pidof wlogout) ]]; then
wlogout --layout ${LAYOUT} --css ${STYLE} \
--column-spacing 20 \
--row-spacing 20 \
--margin-top 200 \
--margin-bottom 200 \
--margin-left 150 \
--margin-right 150
else
pkill wlogout
fi

View File

@@ -0,0 +1,222 @@
{
"name": "main-bar",
"id": "main-bar",
"layer": "top",
"mode": "dock",
"exclusive": true,
"passthrough": false,
"height": 32,
"spacing": 6,
"margin": 0,
"margin-top": 0,
"margin-bottom": 0,
"margin-left": 0,
"margin-right": 0,
"fixed-center": true,
"ipc": true,
"modules-left": [
"custom/menu",
"wlr/workspaces",
"cpu",
"memory",
"disk"
],
"modules-center": [
"mpd",
"tray"
],
"modules-right": [
"pulseaudio",
"custom/weather",
"network",
"battery",
"clock",
"custom/power"
],
// waybar-backlight
"backlight": {
"interval": 2,
"align": 0,
"rotate": 0,
//"device": "amdgpu_bl0",
"format": "{icon} {percent}%",
"format-icons": [
"",
"",
"",
""
],
// Commands to execute on events
"on-click": "",
"on-click-middle": "",
"on-click-right": "",
"on-update": "",
"on-scroll-up": "light -A 5%",
"on-scroll-down": "light -U 5%",
"smooth-scrolling-threshold": 1,
},
"wlr/workspaces": {
"format": "{icon}",
"on-click": "activate",
"all-outputs": true,
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "ﭮ",
"6": "",
"7": "",
"8": "",
"9": "",
"10": "﮼",
"focused": "",
"default": ""
}
},
// waybar-battery
"battery": {
"interval": 60,
"align": 0,
"rotate": 0,
//"bat": "BAT1",
//"adapter": "ACAD",
"full-at": 100,
"design-capacity": false,
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-full": "{icon} Full",
//"format-good": "",
"format-alt": "{icon} {time}",
"format-icons": [
"",
"",
"",
"",
""
],
"format-time": "{H}h {M}min",
"tooltip": true,
},
// waybar-clock
"clock": {
"interval": 60,
"align": 0,
"rotate": 0,
"tooltip-format": "<big>{:%B %Y}</big>\n<tt><small>{calendar}</small></tt>",
"format": " {:%H:%M}",
"format-alt": " {:%a %b %d, %G}"
},
// waybar-cpu
"cpu": {
"interval": 5,
"format": " LOAD: {usage}%",
},
// waybar-custom
"custom/menu": {
"format": "",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/menu",
},
"custom/power": {
"format": " ",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/wlogout",
},
// waybar-disk
"disk": {
"interval": 30,
"format": " FREE: {free}",
},
// waybar-memory
"memory": {
"interval": 10,
"format": " USED: {used:0.1f}G",
},
// waybar-mpd
"mpd": {
"interval": 2,
"unknown-tag": "N/A",
"format": "{stateIcon} {artist} - {title}",
"format-disconnected": " Disconnected",
"format-paused": "{stateIcon} {artist} - {title}",
"format-stopped": "Stopped ",
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)",
// Commands to execute on events
"on-click": "mpc toggle",
"on-click-middle": "mpc prev",
"on-click-right": "mpc next",
"on-update": "",
"on-scroll-up": "mpc seek +00:00:01",
"on-scroll-down": "mpc seek -00:00:01",
"smooth-scrolling-threshold": 1,
},
// waybar-network
"network": {
"interval": 5,
//"interface": "wlan*", // (Optional) To force the use of this interface, set it for netspeed to work
"format-wifi": " {essid}",
"format-ethernet": " {ipaddr}/{cidr}",
"format-linked": " {ifname} (No IP)",
"format-disconnected": "睊 Disconnected",
"format-disabled": "睊 Disabled",
"format-alt": " {bandwidthUpBits} |  {bandwidthDownBits}",
"tooltip-format": " {ifname} via {gwaddr}",
},
// weather-custom
"custom/weather": {
// "format": "{}",
// "format-alt": "{alt}: {}",
"format-alt-click": "click-right",
"interval": 300,
"return-type": "json",
"exec": "~/.config/hypr/scripts/weather",
// "on-click": "xdg-open https://weather.com/en-IN/weather/today/l/$(location_id)"
},
// waybar-pulseaudio
"pulseaudio": {
//"format": "{volume}% {icon} {format_source}",
"format": "{icon} {volume}%",
"format-muted": " Mute",
"format-bluetooth": " {volume}% {format_source}",
"format-bluetooth-muted": " Mute",
"format-source": " {volume}%",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": [
"",
"",
""
]
},
"scroll-step": 5.0,
// Commands to execute on events
"on-click": "amixer set Master toggle",
"on-click-right": "pavucontrol",
"smooth-scrolling-threshold": 1,
},
// waybar-tray
"tray": {
"icon-size": 16,
"spacing": 10
}
}

View File

@@ -0,0 +1,216 @@
/** ********** Fonts ********** **/
* {
font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif;
font-size: 12px;
}
/** ********** Waybar Window ********** **/
window#waybar {
background-color: #1e1e2e;
color: #1e1e2e;
border-bottom: 2px solid #313244;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.5;
}
/** ********** Backlight ********** **/
#backlight {
background-color: #cba6f7;
}
/** ********** Battery ********** **/
#battery {
background-color: #f9e2af;
}
#battery.charging {
}
#battery.plugged {
}
@keyframes blink {
to {
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f38ba8;
color: #f38ba8;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
/** ********** Clock ********** **/
#clock {
background-color: #a6e3a1;
}
/** ********** CPU ********** **/
#cpu {
background-color: #89dceb;
}
/** ********** Memory ********** **/
#memory {
background-color: #eba0ac;
}
/** ********** Disk ********** **/
#disk {
background-color: #b4befe;
}
/** ********** Tray ********** **/
#tray {
background-color: #cdd6f4;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
}
#tray > .active {
}
/** ********** MPD ********** **/
#mpd {
background-color: #94e2d5;
}
#mpd.disconnected {
background-color: #f38ba8;
}
#mpd.stopped {
background-color: #f5c2e7;
}
#mpd.playing {
background-color: #74c7ec;
}
#mpd.paused {
}
/** ********** Pulseaudio ********** **/
#pulseaudio {
background-color: #fab387;
}
#pulseaudio.bluetooth {
background-color: #f5c2e7;
}
#pulseaudio.muted {
background-color: #313244;
color: #cdd6f4;
}
/** ********** Network ********** **/
#network {
background-color: #89b4fa;
}
#network.disconnected,#network.disabled {
background-color: #313244;
color: #cdd6f4;
}
#network.linked {
}
#network.ethernet {
}
#network.wifi {
}
/** ********** Custom ********** **/
#custom-menu, #custom-power, #custom-weather, #custom-updater {
border-radius: 4px;
margin: 6px 0px;
padding: 2px 8px;
}
#custom-menu {
background-color: #f5c2e7;
margin-left: 6px;
padding: 2px 6px;
font-size: 16px;
}
#custom-power {
background-color: #f38ba8;
margin-right: 6px;
padding: 2px 8px;
font-size: 16px;
}
#custom-updater {
background-color: #e6ed7b;
margin-right: 6px;
padding: 2px 8px;
font-size: 12px;
}
/** Common style **/
#backlight,
#battery,
#clock,
#cpu,
#disk,
#mode,
#memory,
#mpd,
#tray,
#pulseaudio,
#network {
border-radius: 4px;
margin: 6px 0px;
padding: 2px 8px;
}
/** ********** Weather ********** **/
#custom-weather {
background-color: #5d388b;
margin-right: 6px;
padding: 2px 8px;
font-size: 12px;
}
#custom-weather.severe {
color: #eb937d;
}
#custom-weather.sunnyDay {
color: #c2ca76;
}
#custom-weather.clearNight {
color: #2b2b2a;
}
#custom-weather.cloudyFoggyDay, #custom-weather.cloudyFoggyNight {
color: #c2ddda;
}
#custom-weather.rainyDay, #custom-weather.rainyNight {
color: #5aaca5;
}
#custom-weather.showyIcyDay, #custom-weather.snowyIcyNight {
color: #d6e7e5;
}
#custom-weather.default {
color: #dbd9d8;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -0,0 +1,36 @@
{
"label" : "lock",
"action" : "~/.config/hypr/scripts/lockscreen",
"text" : "Lock",
"keybind" : "l"
}
{
"label" : "hibernate",
"action" : "systemctl hibernate",
"text" : "Hibernate",
"keybind" : "h"
}
{
"label" : "logout",
"action" : "loginctl terminate-user $USER",
"text" : "Logout",
"keybind" : "e"
}
{
"label" : "shutdown",
"action" : "systemctl poweroff",
"text" : "Shutdown",
"keybind" : "s"
}
{
"label" : "suspend",
"action" : "systemctl suspend",
"text" : "Suspend",
"keybind" : "u"
}
{
"label" : "reboot",
"action" : "systemctl reboot",
"text" : "Reboot",
"keybind" : "r"
}

View File

@@ -0,0 +1,52 @@
/** ********** Fonts ********** **/
* {
font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif;
font-size: 14px;
font-weight: bold;
}
/** ********** Main Window ********** **/
window {
background-color: #1E1E2E;
}
/** ********** Buttons ********** **/
button {
background-color: #242434;
color: #FFFFFF;
border: 2px solid #282838;
border-radius: 20px;
background-repeat: no-repeat;
background-position: center;
background-size: 35%;
}
button:focus, button:active, button:hover {
background-color: #89B4FA;
outline-style: none;
}
/** ********** Icons ********** **/
#lock {
background-image: image(url("icons/lock.png"), url("/usr/share/wlogout/icons/lock.png"));
}
#logout {
background-image: image(url("icons/logout.png"), url("/usr/share/wlogout/icons/logout.png"));
}
#suspend {
background-image: image(url("icons/suspend.png"), url("/usr/share/wlogout/icons/suspend.png"));
}
#hibernate {
background-image: image(url("icons/hibernate.png"), url("/usr/share/wlogout/icons/hibernate.png"));
}
#shutdown {
background-image: image(url("icons/shutdown.png"), url("/usr/share/wlogout/icons/shutdown.png"));
}
#reboot {
background-image: image(url("icons/reboot.png"), url("/usr/share/wlogout/icons/reboot.png"));
}

View File

@@ -0,0 +1,6 @@
#1e1e2e
#262636
#d9e0ee
#89b4fa
#f38ba8
#cba6f7

View File

@@ -0,0 +1,39 @@
## Wofi Config
## General
show=drun
prompt=Apps
normal_window=true
layer=top
term=alacritty
## Geometry
width=500px
height=305px
location=0
orientation=vertical
halign=fill
line_wrap=off
dynamic_lines=false
## Images
allow_markup=true
allow_images=true
image_size=24
## Search
exec_search=false
hide_search=false
parse_search=false
insensitive=false
## Other
hide_scroll=true
no_actions=true
sort_order=default
gtk_dark=true
filter_rate=100
## Keys
key_expand=Tab
key_exit=Escape

View File

@@ -0,0 +1,60 @@
/** ********** Fonts ********** **/
* {
font-family: "JetBrains Mono", "Iosevka Nerd Font", archcraft, sans-serif;
font-size: 12px;
}
#window {
background-color: --wofi-color0;
color: --wofi-color2;
border: 2px solid --wofi-color1;
border-radius: 0px;
}
#outer-box {
padding: 20px;
}
#input {
background-color: --wofi-color1;
border: 0px solid --wofi-color3;
padding: 8px 12px;
}
#scroll {
margin-top: 20px;
}
#inner-box {
}
#img {
padding-right: 8px;
}
#text {
color: --wofi-color2;
}
#text:selected {
color: --wofi-color0;
}
#entry {
padding: 6px;
}
#entry:selected {
background-color: --wofi-color3;
color: --wofi-color0;
}
#unselected {
}
#selected {
}
#input, #entry:selected {
border-radius: 4px;
}

View File

@@ -0,0 +1,55 @@
{
pkgs,
nixpkgs-stable,
config,
...
}: let
pkgs-stable = import nixpkgs-stable {
system = pkgs.system;
config.allowUnfree = true;
};
in {
home.packages = with pkgs-stable; [
firefox-wayland # firefox with wayland support
wineWowPackages.wayland
];
# TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it.
programs = {
# source code: https://github.com/nix-community/home-manager/blob/master/modules/programs/chromium.nix
google-chrome = {
enable = true;
# chrome wayland support was broken on nixos-unstable branch, so fallback to stable branch for now
# https://github.com/swaywm/sway/issues/7562
package = pkgs-stable.google-chrome;
commandLineArgs = [
# make it use GTK_IM_MODULE if it runs with Gtk4, so fcitx5 can work with it.
# (only supported by chromium/chrome at this time, not electron)
"--gtk-version=4"
# make it use text-input-v1, which works for kwin 5.27 and weston
# "--enable-wayland-ime"
# enable hardware acceleration - vulkan api
# "--enable-features=Vulkan"
];
};
vscode = {
enable = true;
# use the stable version
package = pkgs-stable.vscode.override {
commandLineArgs = [
# make it use text-input-v1, which works for kwin 5.27 and weston
# "--enable-wayland-ime"
];
};
# let vscode sync and update its configuration & extensions across devices, using github account.
# userSettings = {};
};
};
}