From 284e43f33f9954f33299bd139b791e2ac0ab1ae8 Mon Sep 17 00:00:00 2001 From: NNB Date: Thu, 21 Apr 2022 09:36:35 +0700 Subject: [PATCH] Look back to BerryWM for the last time (for REAL) --- home.nix | 286 +++++++++++-------------------------------------------- 1 file changed, 57 insertions(+), 229 deletions(-) diff --git a/home.nix b/home.nix index 10ef8cd..346c3bc 100644 --- a/home.nix +++ b/home.nix @@ -3,15 +3,16 @@ { imports = [ ./tty.nix ]; - programs.bash.profileExtra = "[ $(tty) = '/dev/tty1' ] && exec startx $(which awesome)"; # To use TTY as login manager. + programs.bash.profileExtra = "[ $(tty) = '/dev/tty1' ] && exec startx $(which berry)"; # To use TTY as login manager. home.packages = with pkgs; [ - awesome nur.repos.nnb.bmono sarasa-gothic - nextcloud-client blender godot bottles - retroarch multimc osu-lazer + berry xdotool nur.repos.nnb.bmono sarasa-gothic blender godot + (pkgs.writeShellScriptBin "icat" "kitty +kitten icat $@") + ( # TODO rofi -dmenu -auto-select -matching prefix -format "i" + pkgs.writeShellScriptBin "menu4all" "rofi -show drun" + ) ]; - xdg.dataFile."fonts/nix-fonts".source = ../.nix-profile/share/fonts; xsession = { enable = true; @@ -28,237 +29,62 @@ iconTheme = { package = pkgs.papirus-icon-theme; name = "Papirus-Dark"; }; }; + xdg.configFile."berry/autostart".text = '' + #!/bin/sh - xdg.configFile."awesome/rc.lua".text = '' - pcall(require, "luarocks.loader") - local gears = require("gears") - local awful = require("awful") - require("awful.autofocus") - local wibox = require("wibox") - local beautiful = require("beautiful") - local naughty = require("naughty") - local menubar = require("menubar") - - if awesome.startup_errors then - naughty.notify( - { - preset = naughty.config.presets.critical, - title = "Oops, there were errors during startup!", - text = awesome.startup_errors - } - ) - end - - do - local in_error = false - awesome.connect_signal( - "debug::error", - function(err) - if in_error then - return - end - in_error = true - - naughty.notify( - { - preset = naughty.config.presets.critical, - title = "Oops, an error happened!", - text = tostring(err) - } - ) - in_error = false - end - ) - end - - beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua") - - modkey = "Mod4" - - awful.layout.layouts = {awful.layout.suit.floating} - - - local function set_wallpaper(s) - if beautiful.wallpaper then - gears.wallpaper.maximized("${builtins.fetchurl "https://i.imgur.com/dHbVnhz.png"}", s, true) - end - end - - screen.connect_signal("property::geometry", set_wallpaper) - - awful.screen.connect_for_each_screen( - function(s) - set_wallpaper(s) - - awful.tag({"1"}, s, awful.layout.layouts[1]) - - s.mytaglist = - awful.widget.taglist { - screen = s, - filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons - } - end - ) - - - globalkeys = gears.table.join( - awful.key( - {modkey}, - "Tab", - function() - awful.client.focus.byidx(1) - end, - {description = "focus next by index", group = "client"} - ), - awful.key( - {modkey, "Shift"}, - "Tab", - function() - awful.client.focus.byidx(-1) - end, - {description = "focus previous by index", group = "client"} - ), - awful.key({modkey}, "q", awesome.quit, {description = "quit awesome", group = "awesome"}), - awful.key( - {modkey}, - "p", - function() - menubar.show() - end, - {description = "show the menubar", group = "launcher"} - ) - ) - root.keys(globalkeys) - - clientkeys = gears.table.join( - awful.key( - {modkey}, - "Up", - function(c) - c.fullscreen = not c.fullscreen - c:raise() - end, - {description = "toggle fullscreen", group = "client"} - ), - awful.key( - {modkey}, - "Down", - function(c) - c:kill() - end, - {description = "close", group = "client"} - ) - ) - - clientbuttons = gears.table.join( - awful.button( - {}, - 1, - function(c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - end - ), - awful.button( - {modkey}, - 1, - function(c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - awful.mouse.client.resize(c) - end - ) - ) + berryc edge_gap 0 0 0 0 + berryc border_width 8 + berryc inner_border_width 0 + berryc title_height 32 + berryc set_font Bmono-10 + berryc focus_color FFFFFF + berryc unfocus_color FFFFFF + berryc inner_focus_color 5890F8 + berryc inner_unfocus_color 525866 + berryc text_focus_color 171726 + berryc text_unfocus_color 171726 - awful.rules.rules = { - { - rule = {}, - properties = { - border_width = beautiful.border_width, - border_color = beautiful.border_normal, - focus = awful.client.focus.filter, - raise = true, - keys = clientkeys, - buttons = clientbuttons, - screen = awful.screen.preferred, - placement = awful.placement.no_overlap + awful.placement.no_offscreen - } - }, - { - rule_any = { type = { "normal" } }, - properties = { fullscreen = true } - }, - { - rule_any = { type = { "normal", "dialog" } }, - properties = { titlebars_enabled = true } - } - } + berryc edge_lock false + berryc move_mask Mod3 # To disable + berryc resize_mask Mod4 - client.connect_signal( - "manage", - function(c) - if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then - awful.placement.no_offscreen(c) - end - end - ) - - client.connect_signal( - "request::titlebars", - function(c) - local buttons = - gears.table.join( - awful.button( - {}, - 1, - function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.move(c) - end - ), - awful.button( - {}, - 3, - function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.resize(c) - end - ) - ) + ${pkgs.picom}/bin/picom --shadow --shadow-exclude "_NET_FRAME_EXTENTS@:c" --shadow-exclude "class_g = 'Firefox' && argb" & + ${pkgs.xwallpaper}/bin/xwallpaper --tile ${builtins.fetchurl "https://i.imgur.com/dHbVnhz.png"} & - awful.titlebar(c):setup { - { - awful.titlebar.widget.iconwidget(c), - buttons = buttons, - layout = wibox.layout.fixed.horizontal - }, - { - { - align = "center", - widget = awful.titlebar.widget.titlewidget(c) - }, - buttons = buttons, - layout = wibox.layout.flex.horizontal - }, - { - awful.titlebar.widget.closebutton(c), - layout = wibox.layout.fixed.horizontal() - }, - layout = wibox.layout.align.horizontal - } - end - ) + ${pkgs.xcape}/bin/xcape -e "Super_L=Super_L|minus" + sxhkd & + fcitx5 & ''; + services.sxhkd = { + enable = true; + keybindings = { + "~button{1,2,3}" = "berryc pointer_focus"; + "XF86Audio{Mute,RaiseVolume,LowerVolume}" = "amixer set Master {toggle,5%+,5%-}"; + "XF86MonBrightness{Up,Down}" = "${pkgs.brightnessctl}/bin/brightnessctl set 5%{+,-}"; + "{_,ctrl} + Print" = "${pkgs.maim}/bin/maim {_,--select} | tee $(date +%Y-%m-%d_%H-%M-%S_%N).png" + + "| ${pkgs.xclip}/bin/xclip -selection clipboard -target image/png"; + "super + minus" = "menu4all"; + + # Will be remove + "super + {_,ctrl} + Escape" = "{systemctl suspend,berryc quit}"; + "super + {Tab,Down,Up,Left,Right}" = "berryc {cycle_focus,window_close,fullscreen,snap_left,snap_right}"; + }; + }; i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ unstable.fcitx5-unikey ]; }; home.sessionVariables.GLFW_IM_MODULE = "ibus"; # To make Kitty use Fcitx5 (some how). - - programs = { + rofi = { + enable = true; + font = "Bmono 12"; + # TODO theme = builtins.fetchurl ""; + }; + kitty = { enable = true; font = { name = "Bmono"; size = 10; }; @@ -267,7 +93,7 @@ firefox = { enable = true; - extensions = with pkgs.nur.repos.rycee.firefox-addons; [ ublock-origin bitwarden ]; + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ ublock-origin ]; profiles."NNB" = { userChrome = "#window-controls { display: none !important; }"; settings = { @@ -275,19 +101,16 @@ "browser.uiCustomization.state" = '' { "placements": { - "widget-overflow-fixed-list": [ "_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action", "ublock0_raymondhill_net-browser-action" ], + "widget-overflow-fixed-list": [ "ublock0_raymondhill_net-browser-action" ], "nav-bar": [ "back-button", "forward-button", "stop-reload-button", "urlbar-container", "downloads-button" ], "toolbar-menubar": [ "menubar-items" ], "TabsToolbar": [ "tabbrowser-tabs", "new-tab-button", "alltabs-button" ], "PersonalToolbar": [ "import-button", "personal-bookmarks" ] }, - "seen": [ - "developer-button", "ublock0_raymondhill_net-browser-action", - "_446900e4-71c2-419f-a6a7-df9c091e268b_-browser-action", "_af37054b-3ace-46a2-ac59-709e4412bec6_-browser-action" - ], + "seen": [ "developer-button", "ublock0_raymondhill_net-browser-action" ], "dirtyAreaCache": [ "nav-bar", "PersonalToolbar", "toolbar-menubar", "TabsToolbar", "widget-overflow-fixed-list" ], "currentVersion": 17, - "newElementCount": 5 + "newElementCount": 3 } ''; "browser.download.autohideButton" = false; @@ -319,4 +142,9 @@ }; home.sessionVariables.MOZ_USE_XINPUT2 = "1"; # Support precise scrolling in Firefox. + + xdg.userDirs = { # Prevent Firefox from create these directories. + desktop = "$HOME"; + download = "$HOME"; + }; }