diff --git a/README.md b/README.md
index db369e94..dbeeae90 100644
--- a/README.md
+++ b/README.md
@@ -7,8 +7,6 @@ This repository is home to the nix code that builds my systems.
- fix wayland related problems
- fcitx5 input method - currently not work in vscode, and failed to add flypy input method
-- status bar and other hyprland scripts
- - some of them do not work
- [sops-nix](https://github.com/Mic92/sops-nix): secret management
- [devShell](https://github.com/numtide/devshell): manage development environments
diff --git a/flake.lock b/flake.lock
index b9083974..309dd7b8 100644
--- a/flake.lock
+++ b/flake.lock
@@ -224,11 +224,11 @@
},
"nixpkgs-stable": {
"locked": {
- "lastModified": 1683207485,
- "narHash": "sha256-gs+PHt/y/XQB7S8+YyBLAM8LjgYpPZUVFQBwpFSmJro=",
+ "lastModified": 1683383741,
+ "narHash": "sha256-rAQSBnFGNKNomUUyVl+7v0tnp45677t4Ovlh9f57k6Q=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "cc45a3f8c98e1c33ca996e3504adefbf660a72d1",
+ "rev": "adc7c6f1bbaa73cda26be2323353b63a05b42f61",
"type": "github"
},
"original": {
diff --git a/fonts/archcraft-icon-font.nix b/fonts/archcraft-icon-font.nix
new file mode 100644
index 00000000..fd5aac70
--- /dev/null
+++ b/fonts/archcraft-icon-font.nix
@@ -0,0 +1,35 @@
+{ lib, stdenvNoCC, fetchgit }:
+
+stdenvNoCC.mkDerivation rec {
+ pname = "archcraft-font";
+ version = "2023-05-07";
+
+ src = fetchgit {
+ url = "https://github.com/archcraft-os/archcraft-packages.git";
+ rev = "88030ee6d2df80db958541b53bd3673e081720cf"; # git commit id
+ sparseCheckout = [ "archcraft-fonts/files/icon-fonts/archcraft.ttf" ]; # only fetch the feather.ttf file
+
+ # the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
+ # so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
+ # specify sha256 to empty and build it, then an error will indicate the correct sha256
+ sha256 = "sha256-DrGN8lN4Yr1RTyCUZhJjzKgCuC0vTnSWjOKovNg3T/U=";
+ };
+
+ installPhase = ''
+ runHook preInstall
+
+ install -Dm644 archcraft-fonts/files/icon-fonts/archcraft.ttf -t $out/share/fonts/truetype/
+
+ runHook postInstall
+ '';
+
+ meta = with lib; {
+ homepage = "https://github.com/archcraft-os/archcraft-packages";
+ description = "Archcraft icon font";
+ version = version;
+ longDescription = ''Archcraft icon font'';
+ license = licenses.mit;
+ maintainers = [ maintainers.ryan4yin ];
+ platforms = platforms.all;
+ };
+}
\ No newline at end of file
diff --git a/home/hyprland/icomoon-feather-font.nix b/fonts/icomoon-feather-icon-font.nix
similarity index 53%
rename from home/hyprland/icomoon-feather-font.nix
rename to fonts/icomoon-feather-icon-font.nix
index 289bf143..dfeb8825 100644
--- a/home/hyprland/icomoon-feather-font.nix
+++ b/fonts/icomoon-feather-icon-font.nix
@@ -1,16 +1,21 @@
-{ lib, stdenvNoCC, fetchzip }:
+{ lib, stdenvNoCC, fetchgit }:
stdenvNoCC.mkDerivation rec {
pname = "icomoon-feather-font";
version = "2023-05-06";
# 参考 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-icomoon-feather
- src = fetchzip {
- url = "https://github.com/adi1090x/polybar-themes/archive/47b66337a92a1afd2240ed7094ffcb039cc686cf.zip";
- # sha256 generated by ` nix-prefetch-url --unpack http://...`
- sha256 = "1dw7k0ds3z6nkqxi09pjgxl45xcfi2y0khrawxl96hcnawy3qbg8";
- };
+ src = fetchgit {
+ url = "https://github.com/adi1090x/polybar-themes.git";
+ rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id
+ sparseCheckout = [ "fonts/feather.ttf" ]; # only fetch the feather.ttf file
+ # the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
+ # so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
+ # specify sha256 to empty and build it, then an error will indicate the correct sha256
+ sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4=";
+ };
+
installPhase = ''
runHook preInstall
diff --git a/home/fcitx5/default.nix b/home/fcitx5/default.nix
index c72a531b..4ab94352 100644
--- a/home/fcitx5/default.nix
+++ b/home/fcitx5/default.nix
@@ -18,9 +18,10 @@
with pkgs; [
# for flypy chinese input method
fcitx5-rime
+ # needed enable rime using configtool after installed
fcitx5-configtool
- fcitx5-chinese-addons
- fcitx5-mozc # japanese input method
+ # fcitx5-chinese-addons
+ # fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module
];
};
diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix
index 0fc58dd0..d706505c 100644
--- a/home/hyprland/default.nix
+++ b/home/hyprland/default.nix
@@ -9,44 +9,11 @@
# copy the scripts directory recursively
recursive = true;
};
- home.file.".config/hypr/wallpapers/lockscreen.png".source = ../wallpapers/lockscreen.png;
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;
- home.packages =
- let
- icomoon-feather-font = pkgs.callPackage ./icomoon-feather-font.nix { };
- in
- with pkgs; [
- icomoon-feather-font
-
- waybar # for the status bar
- swaybg # for setting the wallpaper
- swayidle # for setting the idle timeout
- swaylock # for locking the screen
- wl-clipboard # for copying and pasting
-
- wf-recorder # for screen recording
- grim # for taking screenshots
- slurp # for selecting a region to screenshot
- # TODO replace by `flameshot gui --raw | wl-copy`
-
- xfce.xfce4-appfinder # for the application launcher
-
- wofi # for the application launcher
- mako # for the notification daemon
-
- light # for changing the screen brightness
- yad # for the brightness popup
-
- # 用于播放系统音效
- mpd # for playing system sounds
- mpc-cli # command-line mpd client
- ncmpcpp # a mpd client with a UI
- ];
-
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
diff --git a/home/hyprland/hypr-conf/hyprland.conf b/home/hyprland/hypr-conf/hyprland.conf
index a9393800..4788db50 100644
--- a/home/hyprland/hypr-conf/hyprland.conf
+++ b/home/hyprland/hypr-conf/hyprland.conf
@@ -90,22 +90,9 @@ windowrule=move 0 0,wlogout
windowrule=size 100% 100%,wlogout
windowrule=animation slide,wlogout
-#windowrule=move 69 420,abc
-#windowrule=size 420 69,abc
-#windowrule=tile,xyz
-#windowrule=pseudo,abc
-#windowrule=monitor 0,xyz
-#windowrule=workspace 12,abc
-#windowrule=opacity 1.0,abc
-#windowrule=animation slide left,abc
-#windowrule=rounding 10,abc
-
#-- Keybindings ----------------------------------------------------
$term = alacritty
-$menu1 = xfce4-appfinder --collapsed
-$menu2 = ~/.config/hypr/scripts/menu
-$menu3 = xfce4-appfinder
-$powermenu = ~/.config/hypr/scripts/powermenu
+$app_launcher = ~/.config/hypr/scripts/menu
$volume = ~/.config/hypr/scripts/volume
$backlight = ~/.config/hypr/scripts/brightness
$screenshot = ~/.config/hypr/scripts/screenshot
@@ -113,39 +100,27 @@ $lockscreen = ~/.config/hypr/scripts/lockscreen
$wlogout = ~/.config/hypr/scripts/wlogout
$colorpicker = ~/.config/hypr/scripts/colorpicker
$files = thunar
-$editor = geany
+$editor = code # vscode
$browser = firefox
# -- Terminal --
bind=SUPER,Return,exec,$term
-bind=SUPERSHIFT,Return,exec,$term -s
-bind=SUPERALT,Return,exec,$term -f
-bind=SUPER,T,exec,$term -F
-
-# -- Apps --
-bind=SUPERSHIFT,F,exec,$files
-bind=SUPERSHIFT,E,exec,$editor
-bind=SUPERSHIFT,W,exec,$browser
# -- Wofi --
-bind=ALT,F1,exec,$menu1
-bind=SUPER,D,exec,$menu2
-bind=ALT,F3,exec,$menu3
-#bind=SUPER,X,exec,$powermenu
+bind=SUPER,D,exec,$app_launcher
# -- Hyprland --
bind=SUPER,Q,killactive,
-bind=SUPER,C,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
+bind=SUPER,N,exec,nm-connection-editor # need install network-manager-applet
bind=SUPER,P,exec,$colorpicker
-bind=SUPER,X,exec,$wlogout
bind=CTRLALT,L,exec,$lockscreen
+bind=SUPERSHIFT,X,exec,$wlogout
# -- Some nice mouse binds --
bindm=SUPER,mouse:272,movewindow
@@ -165,10 +140,8 @@ bind=,XF86AudioStop,exec,mpc stop
# -- Screenshots --
bind=,Print,exec,$screenshot --now
-bind=SUPER,Print,exec,$screenshot --in5
-bind=SHIFT,Print,exec,$screenshot --in10
-bind=CTRL,Print,exec,$screenshot --win
-bind=SUPERCTRL,Print,exec,$screenshot --area
+bind=SUPER,Print,exec,$screenshot --win
+bind=CTRL,Print,exec,$screenshot --area
# Focus
bind=SUPER,left,movefocus,l
@@ -201,16 +174,16 @@ bind=SUPER,9,workspace,9
bind=SUPER,0,workspace,10
# Send to Workspaces
-bind=ALT,1,movetoworkspace,1
-bind=ALT,2,movetoworkspace,2
-bind=ALT,3,movetoworkspace,3
-bind=ALT,4,movetoworkspace,4
-bind=ALT,5,movetoworkspace,5
-bind=ALT,6,movetoworkspace,6
-bind=ALT,7,movetoworkspace,7
-bind=ALT,8,movetoworkspace,8
-bind=ALT,9,movetoworkspace,9
-bind=ALT,0,movetoworkspace,10
+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
diff --git a/home/hyprland/hypr-conf/scripts/lockscreen b/home/hyprland/hypr-conf/scripts/lockscreen
index 46fc2195..423be188 100755
--- a/home/hyprland/hypr-conf/scripts/lockscreen
+++ b/home/hyprland/hypr-conf/scripts/lockscreen
@@ -1,70 +1,10 @@
#!/usr/bin/env bash
-# Background Image
-IMAGE="$HOME/.config/hypr/wallpapers/lockscreen.png"
-
-# Colors
-bg='1e1e2e' bgl='313244' fg='d9e0ee'
-red='f38ba8' green='a6e3a1' yellow='f9e2af'
-blue='89b4fa' magenta='cba6f7' cyan='89dceb'
-alpha='00000000'
-
-# CMD
-swaylock -f \
- \
- `# General` \
- --ignore-empty-password \
- --show-failed-attempts \
- --hide-keyboard-layout \
- --indicator-caps-lock \
- \
- `# Appearance` \
- --color ${bg}E6 \
- `#--image ${IMAGE} --scaling fill` \
- --font 'JetBrainsMono Nerd Font' --font-size 18 \
- \
- `# Backspace Key` \
- --key-hl-color ${green} \
- --caps-lock-key-hl-color ${blue} \
- --bs-hl-color ${red} \
- --caps-lock-bs-hl-color ${red} \
- \
- `# Indicator` \
- --indicator-radius 120 \
- --indicator-thickness 10 \
- \
- `# Inside Circle Colors` \
- --inside-color ${alpha} \
- --inside-clear-color ${alpha} \
- --inside-caps-lock-color ${alpha} \
- --inside-ver-color ${blue} \
- --inside-wrong-color ${red} \
- \
- `# Layout Colors` \
- --layout-bg-color ${cyan} \
- --layout-border-color ${cyan} \
- --layout-text-color ${bg} \
- \
- `# Line Colors` \
- --line-color ${bg} \
- --line-clear-color ${red} \
- --line-caps-lock-color ${bg} \
- --line-ver-color ${bg} \
- --line-wrong-color ${bg} \
- \
- `# Ring Colors` \
- --ring-color ${cyan} \
- --ring-clear-color ${bg} \
- --ring-caps-lock-color ${magenta} \
- --ring-ver-color ${blue} \
- --ring-wrong-color ${red} \
- \
- `# Separator Color` \
- --separator-color ${bg} \
- \
- `# Text Colors` \
- --text-color ${fg} \
- --text-clear-color ${fg} \
- --text-caps-lock-color ${fg} \
- --text-ver-color ${bg} \
- --text-wrong-color ${bg}
+# 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 %%
\ No newline at end of file
diff --git a/home/hyprland/hypr-conf/scripts/powermenu b/home/hyprland/hypr-conf/scripts/powermenu
deleted file mode 100755
index 99cd369a..00000000
--- a/home/hyprland/hypr-conf/scripts/powermenu
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env bash
-
-## Wofi Powermenu
-
-## Files
-CONFIG="$HOME/.config/hypr/wofi/config"
-STYLE="$HOME/.config/hypr/wofi/style.css"
-COLORS="$HOME/.config/hypr/wofi/colors"
-
-## Wofi Command
-wofi_command="wofi --show dmenu \
- --conf ${CONFIG} --style ${STYLE} --color ${COLORS} \
- --width=300 --height=165 \
- --cache-file=/dev/null \
- --hide-scroll --no-actions \
- --define=matching=fuzzy"
-
-uptime=$(uptime -p | sed -e 's/up //g')
-
-## Entries
-shutdown=" Shutdown"
-reboot=" Restart"
-lock=" Lock"
-suspend=" Sleep"
-logout=" Logout"
-
-# Ask for confirmation
-cdialog () {
- yad --title='Confirm?' --borders=15 --center --fixed --undecorated --button=Yes:0 --button=No:1 --text="Are you sure?" --text-align=center
-}
-
-# Variable passed to rofi
-open_menu () {
- options="$lock\n$suspend\n$logout\n$reboot\n$shutdown"
-
- chosen="$(echo -e "$options" | $wofi_command --prompt "UP - $uptime")"
- case $chosen in
- $shutdown)
- cdialog
- if [[ "$?" == 0 ]]; then
- systemctl poweroff
- else
- exit
- fi
- ;;
- $reboot)
- cdialog
- if [[ "$?" == 0 ]]; then
- systemctl reboot
- else
- exit
- fi
- ;;
- $lock)
- ~/.config/hypr/scripts/lockscreen
- ;;
- $suspend)
- cdialog
- if [[ "$?" == 0 ]]; then
- mpc -q pause
- amixer set Master mute
- ~/.config/hypr/scripts/lockscreen
- systemctl suspend
- else
- exit
- fi
- ;;
- $logout)
- cdialog
- if [[ "$?" == 0 ]]; then
- kill -9 -1
- else
- exit
- fi
- ;;
- esac
-}
-
-if [[ ! $(pidof wofi) ]]; then
- open_menu
-else
- pkill wofi
-fi
diff --git a/home/hyprland/hypr-conf/scripts/screenshot b/home/hyprland/hypr-conf/scripts/screenshot
index 5638dc9d..851f3341 100755
--- a/home/hyprland/hypr-conf/scripts/screenshot
+++ b/home/hyprland/hypr-conf/scripts/screenshot
@@ -5,7 +5,7 @@
iDIR="$HOME/.config/hypr/mako/icons"
time=$(date +%Y-%m-%d-%H-%M-%S)
-dir="$(xdg-user-dir PICTURES)/Screenshots"
+dir="$(xdg-user-dir PICTURES)/Screenshots" # need
file="Screenshot_${time}_${RANDOM}.png"
# notify and view screenshot
@@ -20,32 +20,12 @@ notify_view () {
fi
}
-# countdown
-countdown () {
- for sec in $(seq $1 -1 1); do
- notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR"/timer.png "Taking shot in : $sec"
- sleep 1
- done
-}
-
# take shots
shotnow () {
cd ${dir} && grim - | tee "$file" | wl-copy
notify_view
}
-shot5 () {
- countdown '5'
- sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy
- notify_view
-}
-
-shot10 () {
- countdown '10'
- sleep 1 && 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)
@@ -64,16 +44,12 @@ fi
if [[ "$1" == "--now" ]]; then
shotnow
-elif [[ "$1" == "--in5" ]]; then
- shot5
-elif [[ "$1" == "--in10" ]]; then
- shot10
-elif [[ "$1" == "--win" ]]; then
- shotwin
elif [[ "$1" == "--area" ]]; then
shotarea
+elif [[ "$1" == "--win" ]]; then
+ shotwin
else
- echo -e "Available Options : --now --in5 --in10 --win --area"
+ echo -e "Available Options : --now --win --area"
fi
exit 0
diff --git a/home/hyprland/hypr-conf/scripts/terminal b/home/hyprland/hypr-conf/scripts/terminal
deleted file mode 100755
index 5dd573ad..00000000
--- a/home/hyprland/hypr-conf/scripts/terminal
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env bash
-
-## launch terminal with alt config
-
-CONFIG="$HOME/.config/hypr/foot/foot.ini"
-
-if [ "$1" == "-f" ]; then
- foot --app-id='foot-float' --config="$CONFIG"
-elif [ "$1" == "-F" ]; then
- foot --fullscreen --app-id='foot-full' --font="Iosevka Nerd Font:size=14" --override=pad=35x35 --config="$CONFIG"
-elif [ "$1" == "-s" ]; then
- foot --app-id='foot-float' --config="$CONFIG" \
- --window-size-pixels=$(slurp -b 1B1F28CC -c E06B74ff -s C778DD0D -w 2 -f "%wx%h")
-else
- foot --config="$CONFIG"
-fi
diff --git a/home/hyprland/hypr-conf/scripts/weather b/home/hyprland/hypr-conf/scripts/weather
new file mode 100755
index 00000000..9e250d34
--- /dev/null
+++ b/home/hyprland/hypr-conf/scripts/weather
@@ -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'{temp}',
+ f"{icon}",
+ f"{status}",
+ f"{temp_feel_text}",
+ f"{temp_min_max}",
+ f"{wind_text}\t{humidity_text}",
+ f"{visbility_text}\tAQI {air_quality_index}",
+ f"{prediction}",
+)
+
+# print waybar module data
+out_data = {
+ "text": f"{icon} {temp}",
+ "alt": status,
+ "tooltip": tooltip_text,
+ "class": status_code,
+}
+print(json.dumps(out_data))
\ No newline at end of file
diff --git a/home/hyprland/hypr-conf/scripts/weather.sh b/home/hyprland/hypr-conf/scripts/weather.sh
deleted file mode 100755
index 262c5547..00000000
--- a/home/hyprland/hypr-conf/scripts/weather.sh
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env bash
-
-cachedir=~/.cache/rbn
-cachefile=${0##*/}-$1
-
-if [ ! -d $cachedir ]; then
- mkdir -p $cachedir
-fi
-
-if [ ! -f $cachedir/$cachefile ]; then
- touch $cachedir/$cachefile
-fi
-
-# Save current IFS
-SAVEIFS=$IFS
-# Change IFS to new line.
-IFS=$'\n'
-
-cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile")))
-if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then
- data=($(curl -s https://en.wttr.in/$1\?0qnT 2>&1))
- echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile
- echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
- echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile
-fi
-
-weather=($(cat $cachedir/$cachefile))
-
-# Restore IFSClear
-IFS=$SAVEIFS
-
-temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]])+\.\./\1 to /g')
-
-#echo ${weather[1]##*,}
-
-# https://fontawesome.com/icons?s=solid&c=weather
-case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in
-"clear" | "sunny")
- condition=""
- ;;
-"partly cloudy")
- condition="杖"
- ;;
-"cloudy")
- condition=""
- ;;
-"overcast")
- condition=""
- ;;
-"mist" | "fog" | "freezing fog")
- condition=""
- ;;
-"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "rain")
- condition=""
- ;;
-"moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower")
- condition=""
- ;;
-"patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers")
- condition="ﭽ"
- ;;
-"blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers")
- condition="流"
- ;;
-"blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers")
- condition="ﰕ"
- ;;
-"thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder")
- condition=""
- ;;
-*)
- condition=""
- echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
- ;;
-esac
-
-#echo $temp $condition
-
-echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}"
diff --git a/home/hyprland/hypr-conf/scripts/wlogout b/home/hyprland/hypr-conf/scripts/wlogout
index e423c937..0a654eca 100755
--- a/home/hyprland/hypr-conf/scripts/wlogout
+++ b/home/hyprland/hypr-conf/scripts/wlogout
@@ -7,11 +7,10 @@ STYLE="$HOME/.config/hypr/wlogout/style.css"
if [[ ! $(pidof wlogout) ]]; then
wlogout --layout ${LAYOUT} --css ${STYLE} \
- --buttons-per-row 5 \
- --column-spacing 50 \
- --row-spacing 50 \
- --margin-top 390 \
- --margin-bottom 390 \
+ --column-spacing 20 \
+ --row-spacing 20 \
+ --margin-top 200 \
+ --margin-bottom 200 \
--margin-left 150 \
--margin-right 150
else
diff --git a/home/hyprland/hypr-conf/waybar/config b/home/hyprland/hypr-conf/waybar/config
index 1a32172e..316a2199 100644
--- a/home/hyprland/hypr-conf/waybar/config
+++ b/home/hyprland/hypr-conf/waybar/config
@@ -111,7 +111,6 @@
"interval": 60,
"align": 0,
"rotate": 0,
- //"timezone": "America/New_York",
"tooltip-format": "{:%B %Y}\n{calendar}",
"format": " {:%H:%M}",
"format-alt": " {:%a %b %d, %G}"
@@ -128,7 +127,7 @@
"on-click": "$HOME/.config/hypr/scripts/menu",
},
"custom/power": {
- "format": "襤",
+ "format": " ",
"tooltip": false,
"on-click": "$HOME/.config/hypr/scripts/wlogout",
},
@@ -179,13 +178,13 @@
},
// weather-custom
"custom/weather": {
- "format": "{}",
- "format-alt": "{alt}: {}",
+ // "format": "{}",
+ // "format-alt": "{alt}: {}",
"format-alt-click": "click-right",
- "interval": 1800,
+ "interval": 300,
"return-type": "json",
- "exec": "~/.config/hypr/scripts/weather.sh",
- "exec-if": "ping wttr.in -c1"
+ "exec": "~/.config/hypr/scripts/weather",
+ // "on-click": "xdg-open https://weather.com/en-IN/weather/today/l/$(location_id)"
},
// waybar-pulseaudio
"pulseaudio": {
diff --git a/home/hyprland/hypr-conf/waybar/style.css b/home/hyprland/hypr-conf/waybar/style.css
index 37918e02..33f94791 100644
--- a/home/hyprland/hypr-conf/waybar/style.css
+++ b/home/hyprland/hypr-conf/waybar/style.css
@@ -159,13 +159,6 @@ window#waybar.hidden {
font-size: 12px;
}
-#custom-weather {
- background-color: #cba6f7;
- margin-right: 6px;
- padding: 2px 8px;
- font-size: 12px;
-}
-
/** Common style **/
#backlight,
#battery,
@@ -181,4 +174,43 @@ window#waybar.hidden {
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;
}
\ No newline at end of file
diff --git a/home/hyprland/hypr-conf/wlogout/actions b/home/hyprland/hypr-conf/wlogout/actions
deleted file mode 100644
index 426dcb80..00000000
--- a/home/hyprland/hypr-conf/wlogout/actions
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env bash
-
-## wlogout actions
-
-# Ask for confirmation
-cdialog () {
- yad --title='Confirm?' --borders=15 --center --fixed --undecorated --button=Yes:0 --button=No:1 --text="Are you sure?" --text-align=center
-}
-
-if [[ "$1" == '--shutdown' ]]; then
- cdialog
- if [[ "$?" == 0 ]]; then
- systemctl poweroff
- else
- exit
- fi
-elif [[ "$1" == '--reboot' ]]; then
- cdialog
- if [[ "$?" == 0 ]]; then
- systemctl reboot
- else
- exit
- fi
-elif [[ "$1" == '--hibernate' ]]; then
- cdialog
- if [[ "$?" == 0 ]]; then
- systemctl hibernate
- else
- exit
- fi
-elif [[ "$1" == '--lock' ]]; then
- ~/.config/hypr/scripts/lockscreen
-elif [[ "$1" == '--suspend' ]]; then
- cdialog
- if [[ "$?" == 0 ]]; then
- mpc -q pause
- amixer set Master mute
- ~/.config/hypr/scripts/lockscreen
- systemctl suspend
- else
- exit
- fi
-elif [[ "$1" == '--logout' ]]; then
- cdialog
- if [[ "$?" == 0 ]]; then
- kill -9 -1
- else
- exit
- fi
-fi
diff --git a/home/hyprland/hypr-conf/wlogout/layout b/home/hyprland/hypr-conf/wlogout/layout
index c0afb9ab..bb6e594a 100644
--- a/home/hyprland/hypr-conf/wlogout/layout
+++ b/home/hyprland/hypr-conf/wlogout/layout
@@ -1,30 +1,36 @@
-{
- "label" : "suspend",
- "text" : "Suspend",
- "action" : "~/.config/hypr/wlogout/actions --suspend",
- "keybind" : "u"
-}
-{
- "label" : "logout",
- "text" : "Logout",
- "action" : "~/.config/hypr/wlogout/actions --logout",
- "keybind" : "e"
-}
{
"label" : "lock",
+ "action" : "~/.config/hypr/scripts/lockscreen",
"text" : "Lock",
- "action" : "~/.config/hypr/wlogout/actions --lock",
"keybind" : "l"
}
{
- "label" : "reboot",
- "text" : "Reboot",
- "action" : "~/.config/hypr/wlogout/actions --reboot",
- "keybind" : "r"
+ "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",
- "action" : "~/.config/hypr/wlogout/actions --shutdown",
"keybind" : "s"
}
+{
+ "label" : "suspend",
+ "action" : "systemctl suspend",
+ "text" : "Suspend",
+ "keybind" : "u"
+}
+{
+ "label" : "reboot",
+ "action" : "systemctl reboot",
+ "text" : "Reboot",
+ "keybind" : "r"
+}
\ No newline at end of file
diff --git a/home/programs/browsers.nix b/home/programs/browsers.nix
index 23b6cda4..aa5b2bea 100644
--- a/home/programs/browsers.nix
+++ b/home/programs/browsers.nix
@@ -17,6 +17,7 @@
# chrome wayland support was broken on nixos-unstable branch, so fallback to stable branch for now
# https://github.com/swaywm/sway/issues/7562
google-chrome
+ vscode
];
# programs = {
diff --git a/home/programs/common.nix b/home/programs/common.nix
index b22f5daf..dd26ade9 100644
--- a/home/programs/common.nix
+++ b/home/programs/common.nix
@@ -38,9 +38,6 @@
# cloud provider
awscli
- # python
- conda
-
# C
clang-tools
clang-analyzer
diff --git a/home/programs/default.nix b/home/programs/default.nix
index a1684e21..5a6729f4 100644
--- a/home/programs/default.nix
+++ b/home/programs/default.nix
@@ -9,7 +9,6 @@
./git.nix
./media.nix
./nixos-cn.nix
- ./vscode.nix
./xdg.nix
];
}
\ No newline at end of file
diff --git a/home/programs/vscode.nix b/home/programs/vscode.nix
deleted file mode 100644
index 2cc74cff..00000000
--- a/home/programs/vscode.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- config,
- pkgs,
- home-manager,
- nix-vscode-extensions,
- ...
-}:
-
-{
- programs.vscode = {
- enable = true;
-
- # let vscode sync and update its configuration & extensions across devices, using github account.
-
- # userSettings = {};
- };
-}
\ No newline at end of file
diff --git a/home/wallpapers/lockscreen.png b/home/wallpapers/lockscreen.png
deleted file mode 100644
index 8804c9d4..00000000
Binary files a/home/wallpapers/lockscreen.png and /dev/null differ
diff --git a/modules/hyprland.nix b/modules/hyprland.nix
index f4c2913c..1b3598ce 100644
--- a/modules/hyprland.nix
+++ b/modules/hyprland.nix
@@ -34,6 +34,7 @@
nvidiaPatches = true;
};
+ programs.light.enable = true; # monitor backlight control
# thunar file manager(part of xfce) related options
@@ -44,6 +45,32 @@
services.gvfs.enable = true; # Mount, trash, and other functionalities
services.tumbler.enable = true; # Thumbnail support for images
+ # List packages installed in system profile. To search, run:
+ # $ nix search wget
+ environment.systemPackages = with pkgs; [
+ waybar # the status bar
+ swaybg # the wallpaper
+ swayidle # the idle timeout
+ swaylock # locking the screen
+ wlogout # logout menu
+ wl-clipboard # copying and pasting
+
+ wf-recorder # creen recording
+ grim # taking screenshots
+ slurp # selecting a region to screenshot
+ # TODO replace by `flameshot gui --raw | wl-copy`
+
+ wofi # A rofi inspired launcher for wlroots compositors such as sway/hyprland
+ mako # the notification daemon, the same as dunst
+
+ yad # a fork of zenity, for creating dialogs
+
+ # 用于播放系统音效
+ mpd # for playing system sounds
+ mpc-cli # command-line mpd client
+ ncmpcpp # a mpd client with a UI
+ networkmanagerapplet # provide GUI app: nm-connection-editor
+ ];
xdg.portal = {
enable = true;
@@ -51,8 +78,8 @@
xdgOpenUsePortal = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr # for wlroots based compositors
+ xdg-desktop-portal-gtk # for gtk
# xdg-desktop-portal-kde # for kde
- # xdg-desktop-portal-gtk # for gtk
];
};
diff --git a/modules/i3.nix b/modules/i3.nix
index 2bab3c2d..90b99814 100644
--- a/modules/i3.nix
+++ b/modules/i3.nix
@@ -34,7 +34,7 @@
arandr # screen layout manager
dex # autostart applications
xbindkeys # bind keys to commands
- xorg.xbacklight # control screen brightness
+ xorg.xbacklight # control screen brightness, the same as light
xorg.xdpyinfo # get screen information
sysstat # get system information
];
diff --git a/modules/system.nix b/modules/system.nix
index a8c5fe31..48becbf4 100644
--- a/modules/system.nix
+++ b/modules/system.nix
@@ -26,6 +26,7 @@
services.printing.enable = true;
+ # all fonts are linked to /nix/var/nix/profiles/system/sw/share/X11/fonts
fonts = {
# use fonts specified by user rather than default ones
enableDefaultFonts = false;
@@ -48,6 +49,9 @@
"Iosevka"
];})
+ (pkgs.callPackage ../fonts/icomoon-feather-icon-font.nix { })
+ (pkgs.callPackage ../fonts/archcraft-icon-font.nix { })
+
];
# user defined fonts
@@ -112,6 +116,14 @@
xz
zstd
+ (python3.withPackages(ps: with ps; [
+ ipython
+ pandas
+ requests
+ pyquery
+ ]))
+ conda
+
# video/audio tools
libva-utils
nvtop
@@ -127,6 +139,7 @@
neofetch
xfce.thunar # xfce4's file manager
nnn # terminal file manager
+ xdg-user-dirs
];
@@ -171,7 +184,7 @@
users.users.ryan = {
isNormalUser = true;
description = "ryan";
- extraGroups = [ "networkmanager" "wheel" "docker" "wireshark" ];
+ extraGroups = [ "users" "networkmanager" "wheel" "docker" "wireshark" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJx3Sk20pLL1b2PPKZey2oTyioODrErq83xG78YpFBoj admin@ryan-MBP"
];