diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf new file mode 100644 index 0000000..e5e2b7d --- /dev/null +++ b/hypr/hyprland.conf @@ -0,0 +1,384 @@ + +# +# Please note not all available settings / options are set here. +# For a full list, see the wiki +# + + +monitor=,preferred,auto,auto +monitor=HDMI-A-1, 1920x1080@74.973000, 0x0, 1 +monitor=DVI-D-1, 1920x1080, 1920x0, 1 + +workspace=HDMI-A-1,1 +workspace=HDMI-A-1,2 +workspace=HDMI-A-1,3 +workspace=DVI-D-1,4 +workspace=DVI-D-1,5 +workspace=DVI-D-1,6 +workspace=DVI-D-1,7 +workspace=DVI-D-1,8 +workspace=DVI-D-1,9 +workspace=DVI-D-1,10 + +# wsbind=1,HDMI-A-1 +# wsbind=2,HDMI-A-1 +# wsbind=3,HDMI-A-1 +# wsbind=4,DVI-D-1 +# wsbind=5,DVI-D-1 +# wsbind=6,DVI-D-1 +# wsbind=7,DVI-D-1 +# wsbind=8,DVI-D-1 +# wsbind=9,DVI-D-1 +# wsbind=10,DVI-D-1 + +# autostart +exec-once = hyprpaper & wl-paste --watch cliphist store & easyeffects --gapplication-service & mako & sh ~/Applications/aw.sh & blueman & qbittorrent & kdeconnect-cli & morgen --hidden +#exec-once = sh ~/.config/hypr/nuke-screenshare.sh +exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + + +# Slow app launch fix +exec-once = systemctl --user import-environment & +exec-once = hash dbus-update-activation-environment 2>/dev/null & +exec-once = dbus-update-activation-environment --systemd & + +# Some default env vars. +env = XCURSOR_SIZE,21 +env = wayland,x11 +env = QT_QPA_PLATFORM,wayland;xcb +env = CLUTTER_BACKEND,wayland +env = QT_QPA_PLATFORMTHEME,qt5ct +env = MOZ_ENABLE_WAYLAND,1 + +env = LIBVA_DRIVER_NAME,nvidia +env = XDG_SESSION_TYPE,wayland +env = GBM_BACKEND,nvidia-drm +env = __GLX_VENDOR_LIBRARY_NAME,nvidia +env = WLR_NO_HARDWARE_CURSORS,1 + +env = GTK_THEME,Adwaita:dark + +### Idle configuration +# +exec-once = swayidle -w \ + timeout 300 'swaylock -f -c 000000' \ + before-sleep 'swaylock -f -c 000000' + +# Source a file (multi-file configs) +# source = ~/.config/hypr/myColors.conf + +### Input configuration +# +input { + kb_layout = tr + kb_variant = + kb_model = + kb_options = caps:escape + kb_rules = + repeat_rate = 70 + repeat_delay = 500 + numlock_by_default = true + + follow_mouse = 1 + + touchpad { + natural_scroll = no + } + + sensitivity = 0 # -1.0 - 1.0, 0 means no modification. +} + +general { + gaps_in = 3 + gaps_out = 5 + border_size = 3 + col.active_border = rgba(ff5e81ac) + #col.inactive_border = rgba(66333333) + col.inactive_border = rgba(595959aa) + + layout = dwindle # master|dwindle + + apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse) +} + +decoration { + multisample_edges = true + active_opacity = 1.0 + inactive_opacity = 0.98 + fullscreen_opacity = 1.0 + + rounding = 4 + blur = yes + blur_size = 15 + blur_passes = 2 # more passes = more resource intensive. + blur_new_optimizations = true + blur_xray = true + + drop_shadow = false + shadow_range = 4 + shadow_render_power = 3 + shadow_ignore_window = true + + dim_inactive = false + blur_ignore_opacity = false + col.shadow = rgba(1a1a1aee) +} + +# Blur for waybar +#blurls = waybar + +animations { + enabled = yes + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = overshot, 0.13, 0.99, 0.29, 1.1 + + bezier = overshot, 0.13, 0.99, 0.29, 1.1 + animation = windows, 1, 4, overshot, slide + animation = windowsOut, 1, 5, default, popin 80% + animation = border, 1, 5, default + animation = fade, 1, 8, default + animation = workspaces, 1, 6, overshot, slide +} + +# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more +dwindle { + no_gaps_when_only = false + force_split = 0 + special_scale_factor = 0.8 + split_width_multiplier = 1.0 + use_active_for_splits = true + pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = yes +} + +# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more +master { + no_gaps_when_only = false + new_is_master = true + special_scale_factor = 0.8 +} + +misc { + #disable_autoreload = true + disable_hyprland_logo = true + always_follow_on_dnd = true + layers_hog_keyboard_focus = true + animate_manual_resizes = false + enable_swallow = true + swallow_regex = + focus_on_activate = true + vfr = 1 +} + +gestures { + workspace_swipe = true + workspace_swipe_fingers = 4 + workspace_swipe_distance = 250 + workspace_swipe_invert = true + workspace_swipe_min_speed_to_force = 15 + workspace_swipe_cancel_ratio = 0.5 + workspace_swipe_create_new = false +} + +# Binds +$mainMod = SUPER +# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more +bind = $mainMod, Return, exec, konsole +bind = $mainMod, W, exec, firefox +bind = $mainMod_SHIFT, Q, killactive, +bind = $mainMod, M, exit, +bind = $mainMod_SHIFT, Return, exec, dolphin +bind = CTRL_SHIFT, Return, exec, ksysguard +bind = $mainMod, Space, togglefloating, +bind = $mainMod_SHIFT, D, togglegroup, +#bind = $mainMod, D, changegroupactive, +bind = $mainMod, F, fullscreen, +bind = $mainMod_SHIFT, F, exec, rofi -show drun -show-icons +bind = ALT, D, exec, sh ~/.config/hypr/rofi-web-search.sh + +bind = $mainMod_SHIFT, right, movewindow, mon:r +bind = $mainMod_SHIFT, left, movewindow, mon:l +bind = $mainMod_SHIFT, up, movewindow, mon:u +bind = $mainMod_SHIFT, down, movewindow, mon:d +bind = $mainMod, right, moveintogroup, r +bind = $mainMod, left, moveintogroup, l +bind = $mainMod, up, moveintogroup, u +bind = $mainMod, down, moveintogroup, d + +# shutdown +bind = CTRL_ALT, X, exec, wlogout + +# color picker +bind = CTRL_ALT, A, exec, hyprpicker -a + +# screenshot +bind = $mainMod_SHIFT, X, exec, grimblast --notify copysave area /home/yusuf/Pictures/Screenshots/$(date +"%d-%m-%H-%M-%S").png + +# ocr text +bind = ALT_SHIFT, S, exec, grim -g "$(slurp)" - | tesseract - stdout -l eng+tur+rus+kor | wl-copy + +# emoji picker +bind = $ALT_SHIFT, X, exec, rofi -modi emoji -show emoji + +# clipboard +bind = $mainMod, v, exec, cliphist list | rofi -dmenu | cliphist decode | wl-copy + +# scratchpad +bind = SUPER_SHIFT, S, movetoworkspace, special +bind = SUPER, S, togglespecialworkspace + +bind = $mainMod, Y, pin +#bind = $mainMod, P, pseudo, # dwindle +bind = $mainMod, J, togglesplit, # dwindle +bind = $mainMod, Tab, changegroupactive, f +bind = $mainMod SHIFT, G,exec,hyprctl --batch "keyword general:gaps_out 5;keyword general:gaps_in 3" +bind = $mainMod , G,exec,hyprctl --batch "keyword general:gaps_out 0;keyword general:gaps_in 0" + + +bind=,XF86AudioLowerVolume,exec,pamixer -ud 3 && pamixer --get-volume > /tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob +bind=,XF86AudioRaiseVolume,exec,pamixer -ui 3 && pamixer --get-volume > /tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob +# mute sound +bind=,XF86AudioMute,exec,amixer sset Master toggle | sed -En '/\[on\]/ s/.*\[([0-9]+)%\].*/\1/ p; /\[off\]/ s/.*/0/p' | head -1 > /tmp/$HYPRLAND_INSTANCE_SIGNATURE.wob + +bind=,XF86AudioPlay,exec, playerctl play-pause +bind=,XF86AudioNext,exec, playerctl next +bind=,XF86AudioPrev,exec, playerctl previous + + +bind = $mainMod, L, exec, swaylock-fancy -e -K -p 10 -f Hack-Regular + +bind = $mainMod, O, exec, killall -SIGUSR1 .waybar-wrapped + +# 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 +bind = $mainMod, period, workspace, e+1 +bind = $mainMod, comma, workspace,e-1 + +bind = $mainMod, minus, movetoworkspace,special +bind = $mainMod, equal, togglespecialworkspace + +bind = $mainMod SHIFT,left ,movewindow, l +bind = $mainMod SHIFT,right ,movewindow, r +bind = $mainMod SHIFT,up ,movewindow, u +bind = $mainMod SHIFT,down ,movewindow, d + +# Move active window to a workspace with mainMod + CTRL + [0-9] +bind = $mainMod CTRL, 1, movetoworkspace, 1 +bind = $mainMod CTRL, 2, movetoworkspace, 2 +bind = $mainMod CTRL, 3, movetoworkspace, 3 +bind = $mainMod CTRL, 4, movetoworkspace, 4 +bind = $mainMod CTRL, 5, movetoworkspace, 5 +bind = $mainMod CTRL, 6, movetoworkspace, 6 +bind = $mainMod CTRL, 7, movetoworkspace, 7 +bind = $mainMod CTRL, 8, movetoworkspace, 8 +bind = $mainMod CTRL, 9, movetoworkspace, 9 +bind = $mainMod CTRL, 0, movetoworkspace, 10 +bind = $mainMod CTRL, left, movetoworkspace, -1 +bind = $mainMod CTRL, right, movetoworkspace, +1 + +# same as above, but doesnt switch to the workspace +bind = $mainMod SHIFT, 1, movetoworkspacesilent, 1 +bind = $mainMod SHIFT, 2, movetoworkspacesilent, 2 +bind = $mainMod SHIFT, 3, movetoworkspacesilent, 3 +bind = $mainMod SHIFT, 4, movetoworkspacesilent, 4 +bind = $mainMod SHIFT, 5, movetoworkspacesilent, 5 +bind = $mainMod SHIFT, 6, movetoworkspacesilent, 6 +bind = $mainMod SHIFT, 7, movetoworkspacesilent, 7 +bind = $mainMod SHIFT, 8, movetoworkspacesilent, 8 +bind = $mainMod SHIFT, 9, movetoworkspacesilent, 9 +bind = $mainMod SHIFT, 0, movetoworkspacesilent, 10 + +binds { + workspace_back_and_forth = 1 + allow_workspace_cycles = 1 +} +bind = $mainMod,slash,workspace,previous + +bind = $mainMod,R,submap,resize +submap = resize +binde =,right,resizeactive,15 0 +binde =,left,resizeactive,-15 0 +binde =,up,resizeactive,0 -15 +binde =,down,resizeactive,0 15 +binde =,l,resizeactive,15 0 +binde =,h,resizeactive,-15 0 +binde =,k,resizeactive,0 -15 +binde =,j,resizeactive,0 15 +bind =,escape,submap,reset +submap = reset + +bind=CTRL SHIFT, left, resizeactive,-15 0 +bind=CTRL SHIFT, right, resizeactive,15 0 +bind=CTRL SHIFT, up, resizeactive,0 -15 +bind=CTRL SHIFT, down, resizeactive,0 15 +bind=CTRL SHIFT, l, resizeactive, 15 0 +bind=CTRL SHIFT, h, resizeactive,-15 0 +bind=CTRL SHIFT, k, resizeactive, 0 -15 +bind=CTRL SHIFT, j, resizeactive, 0 15 + +# Move/resize windows with mainMod + LMB/RMB and dragging +bindm = $mainMod, mouse:272, movewindow +bindm = $mainMod, mouse:273, resizewindow + +#------------# +# auto start # +#------------# +exec-once = waybar & +exec-once = mako & +exec-once = nm-applet --indicator & +exec-once = /usr/lib/polkit-kde-authentication-agent-1 & + +# Float Necessary Windows +windowrule=float,Rofi +windowrule=float,io.github.diegoivanme.flowtime +windowrule=float,pavucontrol +windowrulev2 = float,class:^()$,title:^(Picture in picture)$ +windowrulev2 = float,class:^(brave)$,title:^(Save File)$ +windowrulev2 = float,class:^(brave)$,title:^(Open File)$ +windowrulev2 = float,class:^(LibreWolf)$,title:^(Picture-in-Picture)$ +windowrulev2 = float,class:^(blueman-manager)$ +windowrulev2 = float,class:^(xdg-desktop-portal-gtk)$ +windowrulev2 = float,class:^(org.kde.polkit-kde-authentication-agent-1)$ +windowrulev2 = float,class:^(cachyos-hello)$ + +#---------------# +# windows rules # +#---------------# +#`hyprctl clients` get class、title... +windowrule=float,title:^(Picture-in-Picture)$ +windowrule=size 960 540,title:^(Picture-in-Picture)$ +windowrule=move 25%-,title:^(Picture-in-Picture)$ +windowrule=float,mpv +windowrule=move 25%-,mpv +windowrule=size 960 540,mpv +windowrule=noblur,^(waybar)$ +windowrule=float,^(org.gnome.Characters)$ +windowrule=float,^(it.mijorus.smile)$ +windowrule=float,^(fr.romainvigier.zap)$ +windowrule=float,^(feeling_finder)$ +windowrule=float,^(org.kde.polkit-kde-authentication-agent-1)$ +windowrulev2 = float,class:^(Steam)$,title:^(Friends List)$ +windowrulev2 = float,class:^(Steam)$,title:^(Steam - News)$ +windowrulev2 = float,class:^(cachybrowser)$,title:^(Cachy Browser — Sharing Indicator)$ +windowrulev2 = float,class:^(firefox)$,title:^(Firefox — Sharing Indicator)$ +windowrulev2 = float,class:^(librewolf)$,title:^(LibreWolf — Sharing Indicator)$ +windowrulev2 = float,class:^(org.kde.kdenlive)$,title:^(Clip Problems — Kdenlive)$ +windowrulev2 = float,class:^(org.kde.kdenlive)$,title:^(kdenlive)$ +windowrulev2 = float,class:^(com.obsproject.Studio)$,title:^(Missing Files)$ diff --git a/hypr/hyprpaper.conf b/hypr/hyprpaper.conf new file mode 100644 index 0000000..6887614 --- /dev/null +++ b/hypr/hyprpaper.conf @@ -0,0 +1,4 @@ +preload = /home/yusuf/Pictures/Screenshots/wallpapers/55vunvY.png +preload = /home/yusuf/Pictures/Screenshots/wallpapers/alena-aenami-horizon-1k.jpg +wallpaper = HDMI-A-1,/home/yusuf/Pictures/Screenshots/wallpapers/55vunvY.png +wallpaper = DVI-D-1,/home/yusuf/Pictures/Screenshots/wallpapers/alena-aenami-horizon-1k.jpg diff --git a/hypr/nuke-screenshare.sh b/hypr/nuke-screenshare.sh new file mode 100755 index 0000000..8f692bf --- /dev/null +++ b/hypr/nuke-screenshare.sh @@ -0,0 +1,8 @@ +#!/bin/bash +sleep 1 +killall xdg-desktop-portal-hyprland +killall xdg-desktop-portal-wlr +killall xdg-desktop-portal +/usr/lib/xdg-desktop-portal-hyprland & +sleep 2 +/usr/lib/xdg-desktop-portal & diff --git a/hypr/rofi-web-search.sh b/hypr/rofi-web-search.sh new file mode 100644 index 0000000..3e4c035 --- /dev/null +++ b/hypr/rofi-web-search.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash + +# ----------------------------------------------------------------------------- +# Info: +# author: Miroslav Vidovic +# file: web-search.sh +# created: 24.02.2017.-08:59:54 +# revision: --- +# version: 1.0 +# ----------------------------------------------------------------------------- +# Requirements: +# rofi +# Description: +# Use rofi to search the web. +# Usage: +# web-search.sh +# ----------------------------------------------------------------------------- +# Script: + +declare -A URLS + +URLS=( + ["farside"]="https://farside.link/whoogle/search?q=" + ["youtube"]="https://www.youtube.com/results?search_query=" + ["duckduckgo"]="https://www.duckduckgo.com/?q=" + ["imdb"]="http://www.imdb.com/find?ref_=nv_sr_fn&q=" + ["google"]="https://www.google.com/search?q=" + ["github"]="https://github.com/search?q=" + ["seslisözlük"]="https://www.seslisozluk.net/" + ["wikipedia (en)"]="https://en.wikipedia.org/w/index.php?search=" + ["wikipedia (tr)"]="https://tr.wikipedia.org/w/index.php?search=" + ["youtube music"]="https://music.youtube.com/search?q=" + ["chordify"]="https://chordify.net/search/" + ["ultimate guitar tab"]="https://www.ultimate-guitar.com/search.php?search_type=title&value=" +) + +# List for rofi +gen_list() { + for i in "${!URLS[@]}" + do + echo "$i" + done +} + +main() { + # Pass the list to rofi + platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Search > " ) + + if [[ -n "$platform" ]]; then + query=$( (echo ) | rofi -dmenu -matching fuzzy -location 0 -p "Query > " ) + + if [[ -n "$query" ]]; then + url=${URLS[$platform]}$query + xdg-open "$url" + else + exit + fi + + else + exit + fi +} + +main + +exit 0 diff --git a/waybar/config b/waybar/config new file mode 100644 index 0000000..7c8f744 --- /dev/null +++ b/waybar/config @@ -0,0 +1,299 @@ +{ + // ------------------------------------------------------------------------- + // Global configuration + // ------------------------------------------------------------------------- + + "layer": "top", + + "position": "top", + + //"height": 20, + + "margin-left": 10, + "margin-bottom": 0, + "margin-right": 10, + + "spacing": 5, // Gaps between modules (4px) + + "modules-left": [ + //"custom/rofi", + "wlr/workspaces", + //"temperature", + //"idle_inhibitor", + //"mpd" + "custom/media" + ], + "modules-center": [ + "clock#date", + "custom/weather" + ], + "modules-right": [ + "backlight", + //"custom/storage", + "memory", + "cpu", + "network", + //"battery", + "pulseaudio", + //"custom/screenshot_t", + "tray" + //"custom/power" + ], + + + // ------------------------------------------------------------------------- + // Modules + // ------------------------------------------------------------------------- + + "custom/sp1": { + "format": " | ", + "tooltip": false + }, + "custom/sp2": { + "format": " |", + "tooltip": false + }, + + + "custom/rofi": { + "format": "", + "tooltip": false, + "on-click-right": "nwg-drawer", + "on-click": "wofi -show run", + "on-click-middle": "pkill -9 wofi" + }, + "custom/screenshot_t":{ + "format":"", + "on-click": "~/.config/hypr/scripts/screenshot_full", + "on-click-right":"~/.config/hypr/scripts/screenshot_area" + }, + + "clock#1": { + "format": " {:%a}", + "tooltip": false, + "on-click": "gsimplecal" + }, + "clock#2": { + "format": " {:%d-%h-%Y}", + "tooltip": false, + "on-click": "gsimplecal" + }, + "clock#3": { + "format": " {:%H:%M:%S %p}", + "tooltip": false, + "on-click": "gsimplecal" + }, + + "temperature": { + // "thermal-zone": 1, + "interval": 4, + //"hwmon-path": "/sys/class/hwmon/hwmon3/temp1_input", + "critical-threshold": 80, + // "format-critical": " {temperatureC}°C", + "format-critical": " {temperatureC}°C", + "format": "{icon} {temperatureC}°C", + "format-icons": ["", "", ""], + "max-length": 7, + "min-length": 7, + "on-click": "xsensors" + }, + + "memory": { + "interval": 10, + "format": "☰ {used:0.2f} / {total:0.0f} GB", + "on-click": "alacritty -e btop" + }, + + "battery": { + "interval": 2, + "states": { + "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{icon} {capacity}%", + "format-charging": " {capacity}%", + "format-plugged": " {capacity}%", + "format-icons": [ + "", + "", + "", + "", + "" + ] + }, + "network": { + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": "⬇{bandwidthDownBytes} ⬆{bandwidthUpBytes}", + "interval": 1, + "format-linked": "{ifname} (No IP) ", + "format": "", + "format-disconnected": "", + "format-alt": "{ifname}: {ipaddr}/{cidr}", + "on-click": "wl-copy $(ip address show up scope global | grep inet | head -n1 | cut -d/ -f 1 | tr -d [:space:] | cut -c5-)", + "tooltip-format": " {bandwidthUpBits}  {bandwidthDownBits}\n{ifname}\n{ipaddr}/{cidr}\n", + "tooltip-format-wifi": " {essid} {frequency}MHz\nStrength: {signaldBm}dBm ({signalStrength}%)\nIP: {ipaddr}/{cidr}\n {bandwidthUpBits}  {bandwidthDownBits}", + "min-length": 17, + "max-length": 17 + }, + "custom/storage": { + "format": " {}", + "format-alt": "{percentage}% ", + "format-alt-click": "click-right", + "return-type": "json", + "interval": 60, + "exec": "~/.config/waybar/modules/storage.sh" + }, + "backlight": { + "device": "intel_backlight", + "format": "{icon} {percent}%", + "format-alt": "{percent}% {icon}", + "format-alt-click": "click-right", + //"format-icons": ["", ""], + "format-icons": ["", ""], + "on-scroll-down": "brightnessctl s 5%-", + "on-scroll-up": "brightnessctl s +5%" + }, + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + }, + "tooltip": "true" + }, + "custom/weather": { + "format": "{}", + "format-alt": "{alt}: {}", + "format-alt-click": "click-right", + "interval": 3600, + "exec": "curl -s 'https://wttr.in/Istanbul?format=1'", + //"return-type": "json", + //"exec": "~/.config/waybar/modules/weather.sh", + "exec-if": "ping wttr.in -c1" + }, + "custom/pacman": { + "format": "􏆲 {}", + "interval": 3600, // every hour + "exec": "checkupdates | wc -l", // # of updates + "exec-if": "exit 0", // always run; consider advanced run conditions + "on-click": "alacritty -e 'paru'; pkill -SIGRTMIN+8 waybar", // update system + "signal": 8, + "max-length": 5, + "min-length": 3 + }, + + "custom/media": { + "format": "{icon} {}", + "return-type": "json", + "max-length": 40, + "format-icons": { + "spotify": "", + "default": "🎜" + }, + "escape": true, + "exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder + // "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name + }, + + "custom/power": { + "format": "", + "tooltip": false, + "on-click": "wlogout" + }, + + "clock": { + "format": " {:%H:%M  %e %b}", + "tooltip-format": "{:%Y %B}\n{calendar}", + "today-format": "{}" + }, + + "clock#date": { + "format": "{:%H:%M  %e %b}", // Icon: calendar-alt + //"format": "{:%I:%M %p %A %b %d}", + "tooltip-format": "{:%Y %B}\n{calendar}", + "today-format": "{}" + }, + + "cpu": { + "interval": 1, + //"format": " {}%", // Icon: microchip + "format": " {max_frequency}GHz | {usage}%", + "max-length": 15, + "min-length": 15 + }, + + "mpd": { + "max-length": 25, + "format": " {title}", + "format-paused": " {title}", + "format-stopped": "", + "format-disconnected": "", + "on-click": "mpc --quiet toggle", + "on-click-right": "mpc update; mpc ls | mpc add", + "on-click-middle": "alacritty -e ncmpcpp", + "on-scroll-up": "mpc --quiet prev", + "on-scroll-down": "mpc --quiet next", + "smooth-scrolling-threshold": 5, + "tooltip-format": "{title} - {artist} ({elapsedTime:%M:%S}/{totalTime:%H:%M:%S})" + }, + + "custom/title": { + "format": "{}", + "interval": 0, + "return-type": "json", + //"max-length": 35, + "tooltip": false + }, + + "custom/title#name": { + "format": "{}", + "interval": 0, + "return-type": "json", + + "max-length": 35, + "exec": "$HOME/.scripts/title" + }, + + /*"custom/keyboard": { + "format": " {}", + "interval": 1, + "exec": "$HOME/.config/waybar/get_kbdlayout.sh" + },*/ + + "wlr/workspaces": { + "on-click": "activate", + "format": "{icon}" + }, + + "pulseaudio": { + "scroll-step": 3, // %, can be a float + "format": "{icon} {volume}% {format_source}", + "format-bluetooth": "{volume}% {icon} {format_source}", + "format-bluetooth-muted": " {icon} {format_source}", + "format-muted": " {format_source}", + "ignored-sinks": ["Easy Effects Sink"], + "max-volume": 150, + //"format-source": "{volume}% ", + //"format-source-muted": "", + "format-source": "", + "format-source-muted": "", + "format-icons": { + //"headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + // "default": ["", "", ""] + }, + "on-click": "pavucontrol", + "on-click-middle": "pulseaudio-control --node-blacklist 'alsa_output.platform-snd_aloop.0.analog-stereo' next-node", + "on-click-right": "pactl set-source-mute @DEFAULT_SOURCE@ toggle" + }, + + "tray": { + "icon-size": 15, + "spacing": 5 + } +} diff --git a/waybar/mediaplayer.py b/waybar/mediaplayer.py new file mode 100755 index 0000000..03dbdeb --- /dev/null +++ b/waybar/mediaplayer.py @@ -0,0 +1,128 @@ +#!/usr/bin/env python3 +import argparse +import logging +import sys +import signal +import gi +import json +gi.require_version('Playerctl', '2.0') +from gi.repository import Playerctl, GLib + +logger = logging.getLogger(__name__) + + +def write_output(text, player): + logger.info('Writing output') + + output = {'text': text, + 'class': 'custom-' + player.props.player_name, + 'alt': player.props.player_name} + + sys.stdout.write(json.dumps(output) + '\n') + sys.stdout.flush() + + +def on_play(player, status, manager): + logger.info('Received new playback status') + on_metadata(player, player.props.metadata, manager) + + +def on_metadata(player, metadata, manager): + logger.info('Received new metadata') + track_info = '' + + if player.props.player_name == 'spotify' and \ + 'mpris:trackid' in metadata.keys() and \ + ':ad:' in player.props.metadata['mpris:trackid']: + track_info = 'AD PLAYING' + elif player.get_artist() != '' and player.get_title() != '': + track_info = '{artist} - {title}'.format(artist=player.get_artist(), + title=player.get_title()) + else: + track_info = player.get_title() + + if player.props.status != 'Playing' and track_info: + track_info = ' ' + track_info + write_output(track_info, player) + + +def on_player_appeared(manager, player, selected_player=None): + if player is not None and (selected_player is None or player.name == selected_player): + init_player(manager, player) + else: + logger.debug("New player appeared, but it's not the selected player, skipping") + + +def on_player_vanished(manager, player): + logger.info('Player has vanished') + sys.stdout.write('\n') + sys.stdout.flush() + + +def init_player(manager, name): + logger.debug('Initialize player: {player}'.format(player=name.name)) + player = Playerctl.Player.new_from_name(name) + player.connect('playback-status', on_play, manager) + player.connect('metadata', on_metadata, manager) + manager.manage_player(player) + on_metadata(player, player.props.metadata, manager) + + +def signal_handler(sig, frame): + logger.debug('Received signal to stop, exiting') + sys.stdout.write('\n') + sys.stdout.flush() + # loop.quit() + sys.exit(0) + + +def parse_arguments(): + parser = argparse.ArgumentParser() + + # Increase verbosity with every occurance of -v + parser.add_argument('-v', '--verbose', action='count', default=0) + + # Define for which player we're listening + parser.add_argument('--player') + + return parser.parse_args() + + +def main(): + arguments = parse_arguments() + + # Initialize logging + logging.basicConfig(stream=sys.stderr, level=logging.DEBUG, + format='%(name)s %(levelname)s %(message)s') + + # Logging is set by default to WARN and higher. + # With every occurrence of -v it's lowered by one + logger.setLevel(max((3 - arguments.verbose) * 10, 0)) + + # Log the sent command line arguments + logger.debug('Arguments received {}'.format(vars(arguments))) + + manager = Playerctl.PlayerManager() + loop = GLib.MainLoop() + + manager.connect('name-appeared', lambda *args: on_player_appeared(*args, arguments.player)) + manager.connect('player-vanished', on_player_vanished) + + signal.signal(signal.SIGINT, signal_handler) + signal.signal(signal.SIGTERM, signal_handler) + + for player in manager.props.player_names: + if arguments.player is not None and arguments.player != player.name: + logger.debug('{player} is not the filtered player, skipping it' + .format(player=player.name) + ) + continue + + init_player(manager, player) + + loop.run() + + +if __name__ == '__main__': + main() + diff --git a/waybar/modules/mail.py b/waybar/modules/mail.py new file mode 100755 index 0000000..31958f7 --- /dev/null +++ b/waybar/modules/mail.py @@ -0,0 +1,43 @@ +#!/usr/bin/python + +import os +import imaplib + +import mailsecrets + +def getmails(username, password, server): + imap = imaplib.IMAP4_SSL(server, 993) + imap.login(username, password) + imap.select('INBOX') + ustatus, uresponse = imap.uid('search', None, 'UNSEEN') + if ustatus == 'OK': + unread_msg_nums = uresponse[0].split() + else: + unread_msg_nums = [] + + fstatus, fresponse = imap.uid('search', None, 'FLAGGED') + if fstatus == 'OK': + flagged_msg_nums = fresponse[0].split() + else: + flagged_msg_nums = [] + + return [len(unread_msg_nums), len(flagged_msg_nums)] + +ping = os.system("ping " + mailsecrets.server + " -c1 > /dev/null 2>&1") +if ping == 0: + mails = getmails(mailsecrets.username, mailsecrets.password, mailsecrets.server) + text = '' + alt = '' + + if mails[0] > 0: + text = alt = str(mails[0]) + if mails[1] > 0: + alt = str(mails[1]) + "  " + alt + else: + exit(1) + + print('{"text":"' + text + '", "alt": "' + alt + '"}') + +else: + exit(1) + diff --git a/waybar/modules/spotify.sh b/waybar/modules/spotify.sh new file mode 100755 index 0000000..1d13620 --- /dev/null +++ b/waybar/modules/spotify.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +class=$(playerctl metadata --player=spotify --format '{{lc(status)}}') +icon="" + +if [[ $class == "playing" ]]; then + info=$(playerctl metadata --player=spotify --format '{{artist}} - {{title}}') + if [[ ${#info} > 40 ]]; then + info=$(echo $info | cut -c1-40)"..." + fi + text=$info" "$icon +elif [[ $class == "paused" ]]; then + text=$icon +elif [[ $class == "stopped" ]]; then + text="" +fi + +echo -e "{\"text\":\""$text"\", \"class\":\""$class"\"}" + diff --git a/waybar/modules/storage.sh b/waybar/modules/storage.sh new file mode 100755 index 0000000..90cc3dc --- /dev/null +++ b/waybar/modules/storage.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +mount="/" +warning=20 +critical=10 + +df -h -P -l "$mount" | awk -v warning=$warning -v critical=$critical ' +/\/.*/ { + text=$4 + tooltip="Filesystem: "$1"\rSize: "$2"\rUsed: "$3"\rAvail: "$4"\rUse%: "$5"\rMounted on: "$6 + use=$5 + exit 0 +} +END { + class="" + gsub(/%$/,"",use) + if ((100 - use) < critical) { + class="critical" + } else if ((100 - use) < warning) { + class="warning" + } + print "{\"text\":\""text"\", \"percentage\":"use",\"tooltip\":\""tooltip"\", \"class\":\""class"\"}" +} +' + diff --git a/waybar/modules/weather.sh b/waybar/modules/weather.sh new file mode 100755 index 0000000..2ddeee2 --- /dev/null +++ b/waybar/modules/weather.sh @@ -0,0 +1,80 @@ +#!/bin/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/waybar/style.css b/waybar/style.css new file mode 100644 index 0000000..5683892 --- /dev/null +++ b/waybar/style.css @@ -0,0 +1,308 @@ +* { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: JetBrainsMono Nerd Font; + font-size: 11px; + font-weight: 900; + margin: 0; + padding: 0; + transition-property: background-color; + transition-duration: 0.5s; +} + + +/* Reset all styles */ +* { + border: none; + border-radius: 3px; + min-height: 0; + margin: 0.2em 0.3em 0.2em 0.3em; +} + +/* The whole bar */ +#waybar { + /*background: @bg;*/ + background-color: transparent; + /*color: @light;*/ + color: #ffffff; + transition-property: background-color; + transition-duration: 0.5s; + /*border-top: 8px transparent;*/ + border-radius: 0px; + margin: 0px 0px; +} + +window#waybar.hidden { + opacity: 0.2; +} + +#workspaces button { + padding: 0 0px; + color: #7984a4; + background-color: transparent; + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -3px transparent; + /* Avoid rounded borders under each workspace name */ + border: none; + border-radius: 0; +} + +#workspaces button.focused { + background-color: transparent; +} +#workspace button.hover { + background-color: transparent; +} +#workspaces button.active { + color: #fff; +} + +#workspaces button.urgent { + background-color: #eb4d4b; +} + +#window { + /* border-radius: 20px; */ + /* padding-left: 10px; */ + /* padding-right: 10px; */ + color: #64727d; +} + +/* Each module */ +#clock, +#battery, +#cpu, +#memory, +#disk, +#temperature, +#backlight, +#network, +#pulseaudio, +#custom-media, +#custom-screenshot_t, +#tray, +#mode, +#idle_inhibitor, +#mpd, +#bluetooth, +#custom-hyprPicker, +#custom-power-menu, +#custom-spotify, +#custom-weather, +#custom-weather.severe, +#custom-weather.sunnyDay, +#custom-weather.clearNight, +#custom-weather.cloudyFoggyDay, +#custom-weather.cloudyFoggyNight, +#custom-weather.rainyDay, +#custom-weather.rainyNight, +#custom-weather.showyIcyDay, +#custom-weather.snowyIcyNight, +#custom-weather.default { + padding: 0px 15px; + color: #e5e5e5; + /* color: #bf616a; */ + border-radius: 20px; + background-color: #1e1e1e; +} + +#window, +#workspaces { + border-radius: 20px; + padding: 0px 10px; + background-color: #1e1e1e; +} + +#cpu { + color: #fb958b; + background-color: #1e1e1e; +} + +#memory { + color: #ebcb8b; + background-color: #1e1e1e; +} + +#custom-power-menu { + border-radius: 9.5px; + background-color: #1b242b; + border-radius: 7.5px; + padding: 0 0px; +} + +#custom-launcher { + background-color: #1b242b; + color: #6a92d7; + border-radius: 7.5px; + padding: 0 0px; +} + +#custom-weather.severe { + color: #eb937d; +} + +#custom-weather.sunnyDay { + color: #c2ca76; +} + +#custom-weather.clearNight { + color: #cad3f5; +} + +#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; +} + +/* If workspaces is the leftmost module, omit left margin */ +.modules-left > widget:first-child > #workspaces { + margin-left: 0; +} + +/* If workspaces is the rightmost module, omit right margin */ +.modules-right > widget:last-child > #workspaces { + margin-right: 0; +} + +#pulseaudio { + color: #7d9bba; +} + +#backlight { + /* color: #EBCB8B; */ + color: #8fbcbb; +} + +#clock { + color: #c8d2e0; + /* background-color: #14141e; */ +} + +#battery { + color: #c0caf5; + /* background-color: #90b1b1; */ +} + +#battery.charging, +#battery.full, +#battery.plugged { + color: #26a65b; + /* background-color: #26a65b; */ +} + +@keyframes blink { + to { + background-color: rgba(30, 34, 42, 0.5); + color: #abb2bf; + } +} + +#battery.critical:not(.charging) { + color: #f53c3c; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; +} + +label:focus { + background-color: #000000; +} + +#disk { + background-color: #964b00; +} + +#bluetooth { + color: #707d9d; +} + +#bluetooth.disconnected { + color: #f53c3c; +} + +#network { + color: #b48ead; +} + +#network.disconnected { + color: #f53c3c; +} + +#custom-media { + background-color: #66cc99; + color: #2a5c45; + min-width: 100px; +} + +#custom-media.custom-spotify { + background-color: #66cc99; +} + +#custom-media.custom-vlc { + background-color: #ffa000; +} + +#temperature { + background-color: #f0932b; +} + +#temperature.critical { + background-color: #eb4d4b; +} + +#tray > .passive { + -gtk-icon-effect: dim; +} + +#tray > .needs-attention { + -gtk-icon-effect: highlight; + background-color: #eb4d4b; +} + +#idle_inhibitor { + background-color: #2d3436; +} + +#idle_inhibitor.activated { + background-color: #ecf0f1; + color: #2d3436; +} + +#language { + background: #00b093; + color: #740864; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state { + background: #97e1ad; + color: #000000; + padding: 0 0px; + margin: 0 5px; + min-width: 16px; +} + +#keyboard-state > label { + padding: 0 0px; +} + +#keyboard-state > label.locked { + background: rgba(0, 0, 0, 0.2); +} diff --git a/waybar/waybar.sh b/waybar/waybar.sh new file mode 100755 index 0000000..720620c --- /dev/null +++ b/waybar/waybar.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +# Terminate already running bar instances +killall -q waybar + +# Wait until the processes have been shut down +while pgrep -x waybar >/dev/null; do sleep 1; done + +# Launch main +waybar