diff --git a/mango/kanshi/config b/mango/kanshi/config new file mode 100644 index 0000000..ff5b1d6 --- /dev/null +++ b/mango/kanshi/config @@ -0,0 +1,17 @@ +output eDP-1 { + mode 2256x1504 + scale 1.250000 +} +profile laptop { + output eDP-1 enable position 0,0 +} + +profile home { + output "ASUSTek COMPUTER INC VG30VQL1A *" { + enable + mode 2560x1080 + scale 1 + position 0,0 + } + output eDP-1 enable position 2560,0 +} diff --git a/mango/mango/autostart.sh b/mango/mango/autostart.sh index 62902de..ce7c8b3 100755 --- a/mango/mango/autostart.sh +++ b/mango/mango/autostart.sh @@ -9,10 +9,12 @@ swww clear 000000 sleep 0.1 swww img ~/pictures/flower.jpg --transition-type fade --transition-duration 1 & -dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=wlroots - -export WAYLAND_DISPLAY=wayland-1 +export WAYLAND_DISPLAY=${WAYLAND_DISPLAY:-wayland-1} export XDG_CURRENT_DESKTOP=wlroots + +dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=wlroots +/usr/lib/xdg-desktop-portal & + export DISPLAY=:0 wl-clip-persist --clipboard regular --reconnect-tries 0 & @@ -22,3 +24,6 @@ gsettings set org.gnome.desktop.interface gtk-theme 'tokyonight-dark' gsettings set org.gnome.desktop.interface icon-theme 'catppuccin-mocha' gsettings set org.gnome.desktop.interface font-name 'Geist 11' +fcitx5 -d + +kanshi & diff --git a/mango/mango/brightness.py b/mango/mango/brightness.py new file mode 100755 index 0000000..821c99d --- /dev/null +++ b/mango/mango/brightness.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +from pathlib import Path +import sys + + +class AMDVideo: + _brightness_filepath: Path = Path("/sys/class/backlight/amdgpu_bl1/brightness") + _max_brightness_filepath: Path = Path("/sys/class/backlight/amdgpu_bl1/max_brightness") + + brightness: int|None + max_brightness: int|None + + def __init__(self): + self.brightness = self._get_file_int_value(self._brightness_filepath) + self.max_brightness = self._get_file_int_value(self._max_brightness_filepath) + + def _get_file_int_value(self, filepath: Path) -> int: + with filepath.open("r", encoding="utf-8") as f: + return int(f.read().strip()) + + def _update_file_value(self, filepath: Path, value) -> None: + with filepath.open("w+") as f: + f.write(str(value)) + + def increase_brightness(self, inc_by: int|None = None): + if not self.max_brightness: + print(f"error: max_brightness file not found {self._max_brightness_filepath}") + return + if not self.brightness: + print(f"error: brightness file not found {self._brightness_filepath}") + return + + if not inc_by: + inc_by = int(self.max_brightness / 15) + + new_val = self.brightness + inc_by + if new_val > self.max_brightness: + new_val = self.max_brightness + + self._update_file_value(self._brightness_filepath, new_val) + + def decrease_brightness(self, dec_by: int|None = None): + if not self.max_brightness: + return + if not self.brightness: + return + + if not dec_by: + dec_by = int(self.max_brightness / 15) + + new_val = self.brightness - dec_by + lowest_brightness = int(self.max_brightness * 0.05) + if new_val < lowest_brightness: + new_val = lowest_brightness + + self._update_file_value(self._brightness_filepath, new_val) + + def print_status(self): + brightness = self._get_file_int_value(self._brightness_filepath) + print(f"brightness: {brightness}") + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("need argument +/-") + exit(1) + a = AMDVideo() + if sys.argv[1] == "+": + a.increase_brightness() + if sys.argv[1] == "-": + a.decrease_brightness() + if sys.argv[1] == "status": + a.print_status() + +# +# command = "" +# +# result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) diff --git a/mango/mango/config.conf b/mango/mango/config.conf index ce3f8c7..901ef1c 100644 --- a/mango/mango/config.conf +++ b/mango/mango/config.conf @@ -1,26 +1,25 @@ # More option see https://github.com/DreamMaoMao/mango/wiki/ # misc env -env=QT_QPA_PLATFORMTHEME,gtk3 env=XCURSOR_SIZE,24 env=GTK_THEME,tokyonight-dark +env=QT_STYLE_OVERRIDE,gtk3 # fcitx5 im env=GTK_IM_MODULE,fcitx env=QT_IM_MODULE,fcitx -env=SDL_IM_MODULE,fcitx env=XMODIFIERS,@im=fcitx -env=GLFW_IM_MODULE,ibus +env=INPUT_METHOD,fcitx +env=SDL_IM_MODULE,fcitx +env=GLFW_IM_MODULE,fcitx # scale factor about qt (herr is 1.4) -env=QT_QPA_PLATFORMTHEME,qt5ct +env=QT_QPA_PLATFORMTHEME,gtk3 env=QT_AUTO_SCREEN_SCALE_FACTOR,1.25 env=QT_QPA_PLATFORM,Wayland;xcb env=QT_WAYLAND_FORCE_DPI,140 # Window effect -blur=0 -blur_layer=0 blur_optimized=1 blur_params_num_passes = 2 blur_params_radius = 5 @@ -48,7 +47,7 @@ unfocused_opacity=1.0 animations=1 layer_animations=1 animation_type_open=slide -animation_type_close=slide +animation_type_close=fade animation_fade_in=1 animation_fade_out=1 tag_animation_direction=1 @@ -59,7 +58,7 @@ fadeout_begin_opacity=0.8 animation_duration_move=200 animation_duration_open=300 animation_duration_tag=350 -animation_duration_close=500 +animation_duration_close=400 animation_duration_focus=0 animation_curve_open=0.46,1.0,0.29,1 animation_curve_move=0.46,1.0,0.29,1 @@ -78,10 +77,13 @@ scroller_proportion_preset=0.5,0.8,1.0 # Master-Stack Layout Setting new_is_master=1 -default_mfact=0.55 default_nmaster=1 smartgaps=0 +## default size of new window +default_mfact=0.5 + + # Overview Setting hotarea_size=10 enable_hotarea=1 @@ -161,19 +163,29 @@ tagrule=id:9,layout_name:tile # reload config bind=SUPER,r,reload_config -# menu and terminal -bind=SUPER,Return,spawn,ghostty -bind=SUPER,d,spawn,rofi-run -bind=SUPER,e,spawn,thunar - +# utility bind=SUPER+alt,p,spawn,ss-region +bind=SUPER,Return,spawn,ghostty +bind=SUPER,e,spawn,thunar +bind=none,XF86AudioRaiseVolume,spawn,wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ +bind=none,XF86AudioLowerVolume,spawn,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- +bind=none,XF86AudioMute,spawn,wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle +bind=none,XF86AudioMicMute,spawn,wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle +bind=none,XF86MonBrightnessUp,spawn,python ~/.config/mango/brightness.py + +bind=none,XF86MonBrightnessDown,spawn,python ~/.config/mango/brightness.py - + +# rofi +bind=SUPER+SHIFT,p,spawn,rofi-power-manager.sh +bind=SUPER,d,spawn,rofi-app-manager.sh # exit bind=SUPER,m,quit bind=SUPER+SHIFT,q,killclient, +# misc + # switch window focus -bind=SUPER,Tab,focusstack,next +# bind=SUPER,Tab,focusstack,next bind=ALT,Left,focusdir,left bind=ALT,Right,focusdir,right bind=ALT,Up,focusdir,up @@ -192,10 +204,12 @@ bind=SUPER,t,togglefloating, bind=ALT,a,togglemaximizescreen, bind=ALT,f,togglefullscreen, bind=ALT+SHIFT,f,togglefakefullscreen, -bind=SUPER,i,minimized, bind=SUPER,o,toggleoverlay, + +# scratchpad, use super+t to restore it +bind=SUPER,i,minimized, bind=SUPER+SHIFT,I,restore_minimized -bind=ALT,z,toggle_scratchpad +bind=SUPER,s,toggle_scratchpad # scroller layout bind=ALT,e,set_proportion,1.0 @@ -204,6 +218,8 @@ bind=ALT,x,switch_proportion_preset, # switch layout bind=SUPER,n,switch_layout +bind=SUPER,comma,setlayout,tile +bind=SUPER,period,setlayout,scroller # tag switch bind=SUPER,Left,viewtoleft,0 @@ -227,7 +243,7 @@ bind=Ctrl,9,view,9,0 bind=Alt,1,tag,1,0 bind=Alt,2,tag,2,0 bind=Alt,3,tag,3,0 -bind=Alt,4,tag,4,0 +bind=Alt,4,tag,..0 bind=Alt,5,tag,5,0 bind=Alt,6,tag,6,0 bind=Alt,7,tag,7,0 @@ -235,8 +251,8 @@ bind=Alt,8,tag,8,0 bind=Alt,9,tag,9,0 # monitor switch -bind=alt+shift,Left,focusmon,left -bind=alt+shift,Right,focusmon,right +# bind=alt+shift,Left,focusmon,left +# bind=alt+shift,Right,focusmon,right bind=ALT+SHIFT,Left,tagmon,left bind=ALT+SHIFT,Right,tagmon,right @@ -271,15 +287,22 @@ axisbind=SUPER,DOWN,viewtoright_have_client # layer rule +# you can use mmsg -e to get the last open layer name layerrule=animation_type_open:zoom,layer_name:rofi layerrule=animation_type_close:zoom,layer_name:rofi +# no blur slurp select layer +layerrule=noblur:1,layer_name:selection +# layerrule=noblur:0,layer_name:rofi blur=1 +blur_layer=1 blur_params_num_passes=3 blur_params_radius=4 -windowrule=blur,class:ghostty +windowrule=blur:1,class:ghostty +# windowrule=blur:1,title:rofi windowrule=opacity:0.9,class:ghostty exec-once=waybar exec-once=init-screen-scale +exec-once=init-lockscreen diff --git a/mango/mangoinstall b/mango/mangoinstall index b97ca18..32d3f7f 100644 --- a/mango/mangoinstall +++ b/mango/mangoinstall @@ -1,5 +1,5 @@ # general packages -sudo pacman -S swaybg wl-clipboard wl-clip-persist cliphist slurp grim satty mako neovim firefox ghostty fastfetch xdg-desktop-portal-wlr libnotify unzip bat rsync exa ripgrep bash-completion jq otf-font-awesome thunar +sudo pacman -S swaybg wl-clipboard wl-clip-persist cliphist slurp grim satty mako neovim firefox ghostty fastfetch xdg-desktop-portal-wlr xdg-desktop-portal-gtk libnotify unzip bat rsync exa ripgrep bash-completion jq otf-font-awesome thunar less fd mpv btop # fix locale # double check /etc/locale.gen for en_US.UTF-8 @@ -60,10 +60,13 @@ yay -S gtk-engine-murrine # fonts # add to ~/.local/share/fonts/*.ttf # https://github.com/vercel/geist-font/releases +yay -S ttf-nerd-fonts-symbols fc-cache -fv # monitor management +# use wlr-randr to set kanshi settings when getting monitor name yay -S wdisplays wlr-randr +sudo pacman -S kanshi # bluetooth sudo pacman -S bluez bluez-utils blueman pipewire-bluetooth @@ -77,3 +80,44 @@ sudo systemctl enable --now bluetooth.service sudo pacman -S swww # if pyenv installed: PATH="/usr/bin:$PATH" yay -S waypaper yay -S waypaper + +# power/state management +yay -S wlogout + +# lock screen +sudo pacman -S swayidle +yay -S swaylock-effects-git +# create dir and this file: /etc/systemd/logind.conf.d/laptop-lid.conf +# add this: +# [Login] +# HandleLidSwitch=hibernate +# HandleLidSwitchExternalPower=hibernate +# reboot pc + + +# icons +# https://www.gnome-look.org/p/1715570 +# files -> catppuccin-mocha-alt2 +# move to ~/.local/share/icons +# gtk-update-icon-cache ~/.local/share/icons/catppuccin-mocha-icons + + +# terminal fzf +sudo pacman -S fzf +# bashrc +# eval "$(fzf --bash)" + +# screensharing +# first packages should contain xdg wlr and gtk for screensharing +# validate its running with these commands: +# systemctl --user status xdg-desktop-portal-wlr +# journalctl --user -u xdg-desktop-portal-wlr -f +# next add this to: ~/.config/xdg-desktop-portal/portals.conf +[preferred] +default=gtk +org.freedesktop.impl.portal.ScreenCast=wlr +org.freedesktop.impl.portal.Screenshot=wlr +# restart + +# waybar debug +waybar -l debug diff --git a/mango/update.sh b/mango/update.sh new file mode 100755 index 0000000..f55ace7 --- /dev/null +++ b/mango/update.sh @@ -0,0 +1,5 @@ +#!/bin/bash +cp -r ~/.config/mango/* ./mango +cp -r ~/.config/waybar/* ./waybar +cp -r ~/.config/kanshi/* ./kanshi +cp -r ~/.config/xdg-desktop-portal/* ./xdg-desktop-portal diff --git a/mango/waybar/config.jsonc b/mango/waybar/config.jsonc new file mode 100644 index 0000000..5b48812 --- /dev/null +++ b/mango/waybar/config.jsonc @@ -0,0 +1,71 @@ +{ + "layer": "top", + "position": "top", + "width": "auto", + "height": 36, + "modules-left": ["ext/workspaces"], + "modules-center": ["clock"], + "modules-right": ["bluetooth", "wireplumber", "network", "cpu", "memory", "battery", "custom/power"], + + "custom/power": { + "format-icons": [""], + "format": "{icon}", + "tooltip": false, + "on-click": "~/.local/bin/rofi-power-manager.sh" + }, + "ext/workspaces": { + "disable-scroll": true, + "all-outputs": false, + "on-click": "activate", + "format": "{name}" + }, + "cpu": { + "format-icons": [""], + "format": "{usage}% {icon}", + "tooltip": false + }, + "memory": { + "format-icons": [""], + "format": "{}% {icon}" + }, + "network": { + "max-length": 10, + "format-wifi": "{essid} ", + "format-ethernet": "{ipaddr}/{cidr} ", + "tooltip-format": "{ifname} via {gwaddr} ", + "format-linked": "{ifname} (No IP) ", + "format-disconnected": "Disconnected ⚠", + "on-click": "ghostty -e nmtui & disown" + // "format-alt": "{ifname}: {ipaddr}/{cidr}", + }, + "clock": { + "format": "{:%b %d - %H:%M}", + "tooltip": false + }, + "bluetooth": { + "format": "", + "format-disabled": "󰂲", + "tooltip": false, + "on-click": "blueman-manager" + }, + "wireplumber": { + "format": "{volume}% {icon}", + "format-icons": { + "default": ["", "", ""] + }, + "format-muted": "", + "on-click": "pavucontrol" + }, + "battery": { + "states": { + // "good": 95, + "warning": 30, + "critical": 15 + }, + "format": "{capacity}% {icon}", + "format-full": "{capacity}% {icon}", + "format-charging": "{capacity}% ", + "format-alt": "{time} {icon}", + "format-icons": ["", "", "", "", ""] + } +} diff --git a/mango/waybar/style.css b/mango/waybar/style.css new file mode 100644 index 0000000..d673da6 --- /dev/null +++ b/mango/waybar/style.css @@ -0,0 +1,72 @@ +* { + font-family: "Geist", sans-serif; + min-height: 0; +} + +window#waybar { + background: rgba(33, 28, 46, 0.7); + color: rgb(205, 214, 244); +} +window#waybar > box.horizontal:dir(ltr) { + margin-top: 6px; + margin-bottom: 6px; + margin-left: 12px; + margin-right: 16px; +} + +#workspaces button { + font-family: "Octal", monospace; + font-weight: bold; + font-size: 12px; + padding: 0 6px; + margin: 0 3px; + background:rgba(137, 180, 250, 0.15); + color: rgba(208, 181, 210, 0.65); + border: none; +} + +#workspaces button.focused, +#workspaces button.active { + color: rgb(30, 30, 46); + background:rgb(180, 190, 254); + padding: 0 12px; +} + +#workspaces button:hover { + background: rgba(255, 255, 255, 0.1); +} + +#clock { + padding: 0 15px; + background: rgba(137, 180, 250, 0.15); + border-radius: 10px; +} + +label#wireplumber, +label#bluetooth, +label#network, +label#battery, +label#cpu, +label#custom-power, +label#memory { + padding: 0 9px; + border-radius: 10px; + margin: 0 3px; +} + +label#custom-power { + margin-right: 0; + padding-right: 0; +} + +label#wireplumber, +label#bluetooth, +label#network { + background:rgba(137, 180, 250, 0.15); +} + +label#battery, +label#cpu, +label#memory { + background: rgba(208, 181, 210, 0.15); +} diff --git a/mango/xdg-desktop-portal/portals.conf b/mango/xdg-desktop-portal/portals.conf new file mode 100644 index 0000000..8c3959a --- /dev/null +++ b/mango/xdg-desktop-portal/portals.conf @@ -0,0 +1,4 @@ +[preferred] +default=gtk +org.freedesktop.impl.portal.ScreenCast=wlr +org.freedesktop.impl.portal.Screenshot=wlr