diff --git a/configuration.nix b/configuration.nix index ba1a8bb..66a9d7b 100644 --- a/configuration.nix +++ b/configuration.nix @@ -133,8 +133,6 @@ seahorse libgnome-keyring - acpid - # For setting the necessary permissions for gnome.nautilus. lxqt.lxqt-policykit # provides a default authentication client for policykit ]; @@ -185,13 +183,6 @@ # Disable powerbutton => for use with eww services.logind.extraConfig = ''HandlePowerKey=ignore''; - services.acpid.enable = true; - environment.etc = { - "acpi/events/power".text = '' - event=button/power.* - action=/home/elias/eww/scripts/powermenu.sh - ''; - }; # Set stateVersion. Leave it as set. system.stateVersion = "23.11"; diff --git a/flake.lock b/flake.lock index c040ca1..ab08123 100644 --- a/flake.lock +++ b/flake.lock @@ -243,11 +243,11 @@ ] }, "locked": { - "lastModified": 1746177088, - "narHash": "sha256-hmHKl4meWr6ryzqQAwRD3+3Ihfb/Y/0CbK+WnE+oa6Q=", + "lastModified": 1746243165, + "narHash": "sha256-DQycVmlyLQNLjLJ/FzpokVmbxGQ8HjQQ4zN4nyq2vII=", "owner": "nix-community", "repo": "home-manager", - "rev": "f045bd46b73c3b0ed4e46cdb6036b3d5823d7dee", + "rev": "c0962eeeabfb8127713f859ec8a5f0e86dead0f2", "type": "github" }, "original": { @@ -269,11 +269,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1746168726, - "narHash": "sha256-ZkgW3U37lTwzqUo2rfko+utld5ChnYWDunJ2hAcJOQo=", + "lastModified": 1746256223, + "narHash": "sha256-a97mwMJcE0cYGfwB5N5v+Ey+by1poGTc/fsrd47Fom8=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "d4e6959d82e9e9dc609dcbf7a29fd293fad9c912", + "rev": "02ec02529a5d602a9e9d273531d776d160fae182", "type": "github" }, "original": { @@ -285,11 +285,11 @@ "neovim-src": { "flake": false, "locked": { - "lastModified": 1746141998, - "narHash": "sha256-CYxer9cRvlMySr76epuh5Ub3ryyDV94yVwDC1M/MPvw=", + "lastModified": 1746214751, + "narHash": "sha256-FlGgG3A9oJwGP0YTWU2Nw9fwdnqPMapjx3twonu0Vkg=", "owner": "neovim", "repo": "neovim", - "rev": "ce8b755a86c10496a81675c49b3bc9a42c79d80f", + "rev": "5a2edc483dff93cc94847b6950713d80a51087c0", "type": "github" }, "original": { @@ -360,10 +360,12 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 0, - "narHash": "sha256-y3h3NLnzRSiUkYpnfvnS669zWZLoqqI6NprtLQ+5dck=", - "path": "/nix/store/s8b6phy15mzjvx56vjdd1rdd8hr07qw5-source", - "type": "path" + "lastModified": 1746206129, + "narHash": "sha256-JA4DynBKhY7t4DdJZTuomRLAiXFDUgCGGwxgt+XGiik=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9a7caecf30a0494c88b7daeeed29244cd9a52e7d", + "type": "github" }, "original": { "id": "nixpkgs", @@ -377,11 +379,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1746175988, - "narHash": "sha256-Zcq3UcnsZis/3bAevz2yBWP5hp6LBGIsoO+dIAPqy+o=", + "lastModified": 1746267210, + "narHash": "sha256-bwvvkCXoy88F9xJZoXhRU6QLQyijyVFcORA+MJ7TrY4=", "owner": "nix-community", "repo": "NUR", - "rev": "68db141101c20602e175a53b290bc6064e83bf30", + "rev": "e42236846f62fda1479b1c7a3a709bca8f60e3c0", "type": "github" }, "original": { @@ -474,11 +476,11 @@ ] }, "locked": { - "lastModified": 1745929750, - "narHash": "sha256-k5ELLpTwRP/OElcLpNaFWLNf8GRDq4/eHBmFy06gGko=", + "lastModified": 1746216483, + "narHash": "sha256-4h3s1L/kKqt3gMDcVfN8/4v2jqHrgLIe4qok4ApH5x4=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "82bf32e541b30080d94e46af13d46da0708609ea", + "rev": "29ec5026372e0dec56f890e50dbe4f45930320fd", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0e846c9..5c83cba 100644 --- a/flake.nix +++ b/flake.nix @@ -46,10 +46,6 @@ users.elias = import ./home/default-laptop.nix; }; nixpkgs.overlays = [ - (final: prev: { - xmobar = final.haskellPackages.callPackage - ./home/programs/xmonad/src/xmobar/default.nix { }; - }) inputs.neovim-nightly-overlay.overlays.default inputs.wpaperd.overlays.default inputs.nur.overlays.default @@ -74,10 +70,6 @@ users.elias = import ./home/default-desktop.nix; }; nixpkgs.overlays = [ - (final: prev: { - xmobar = final.haskellPackages.callPackage - ./home/programs/xmonad/src/xmobar/default.nix { }; - }) inputs.neovim-nightly-overlay.overlays.default inputs.wpaperd.overlays.default inputs.nur.overlays.default diff --git a/home/programs/eww/src/scripts/battery_class.sh b/home/programs/eww/src/scripts/battery_class.sh index 15b84d4..9934839 100755 --- a/home/programs/eww/src/scripts/battery_class.sh +++ b/home/programs/eww/src/scripts/battery_class.sh @@ -1,9 +1,9 @@ bat=$(cat /sys/class/power_supply/BAT0/capacity) -stat=$(cat /sys/class/power_supply/BAT0/status) +stat=$(cat /sys/class/power_supply/AC/online) class="batteryFull" -if [[ $stat == "Charging" ]]; then +if [[ $stat == 1 ]]; then class="batteryCharging" elif [[ $bat -le 10 ]]; then class="batteryEmpty" diff --git a/home/programs/eww/src/scripts/battery_icon.sh b/home/programs/eww/src/scripts/battery_icon.sh index e20569e..3fc1097 100755 --- a/home/programs/eww/src/scripts/battery_icon.sh +++ b/home/programs/eww/src/scripts/battery_icon.sh @@ -1,9 +1,9 @@ bat=$(cat /sys/class/power_supply/BAT0/capacity) -stat=$(cat /sys/class/power_supply/BAT0/status) +stat=$(cat /sys/class/power_supply/AC/online) icon="" -if [[ $stat == "Charging" ]]; then +if [[ $stat == 1 ]]; then icon="" elif [[ $bat -le 10 ]]; then icon="" diff --git a/home/programs/eww/src/scripts/powermenu.sh b/home/programs/eww/src/scripts/powermenu.sh index 903b334..23b552f 100755 --- a/home/programs/eww/src/scripts/powermenu.sh +++ b/home/programs/eww/src/scripts/powermenu.sh @@ -1,5 +1,9 @@ WINDOW_NAME="power" -if eww windows | grep -q "$WINDOW_NAME"; then + +echo "Power button pressed" >>/tmp/acpi_log.txt + +# Check if the window is already open +if eww active-windows | grep -q "$WINDOW_NAME"; then eww close "$WINDOW_NAME" else eww open "$WINDOW_NAME" diff --git a/home/programs/xmonad/src/xmobar/Plugins/Audio.hs b/home/programs/xmonad/src/xmobar/Plugins/Audio.hs deleted file mode 100644 index ebd20b0..0000000 --- a/home/programs/xmonad/src/xmobar/Plugins/Audio.hs +++ /dev/null @@ -1,33 +0,0 @@ -module Plugins.Audio where - -import Xmobar -import System.Process -import Control.Concurrent - -data Audio = Audio Int deriving (Read, Show) - -instance Exec Audio where - alias (Audio _) = "audio" - start (Audio r) cb = if r > 0 then go cb r else go cb 1000 - where - go :: (String -> IO ()) -> Int -> IO () - go cb r = do - response <- readProcess "/bin/sh" ["-c", "pulseaudio-ctl full-status"] "" - let list = [w | w <- words (init response)] - audio (head list) (list !! 1) (last list) cb - threadDelay r - go cb r - -audio :: String -> String -> String -> (String -> IO ()) -> IO () -audio vol speaker mic cb - | speaker == "yes" = chooseMic vol "#f38ba8" "\xf466" mic cb - | elem vol [show i | i <- [0..49]] = chooseMic vol "#a6e3a1" "\xf027" mic cb - | otherwise = chooseMic vol "#a6e3a1" "\xf028" mic cb - | otherwise = formatAudio vol "a" "c" "d" "e" cb - where - chooseMic :: String -> String -> String -> String -> (String -> IO ()) -> IO () - chooseMic vol speakerC speakerI mic cb - | mic == "yes" = formatAudio vol speakerC speakerI "#f38ba8" "\xf036d" cb - | otherwise = formatAudio vol speakerC speakerI "#a6e3a1" "\xf036c" cb - formatAudio :: String -> String -> String -> String -> String -> (String -> IO ()) -> IO () - formatAudio vol speakerC speakerI micC micI cb = cb ("" ++ speakerI ++ " " ++ vol ++ "% " ++ micI ++ "") diff --git a/home/programs/xmonad/src/xmobar/default.nix b/home/programs/xmonad/src/xmobar/default.nix deleted file mode 100644 index 83b117d..0000000 --- a/home/programs/xmonad/src/xmobar/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ pkgs ? import { } }: -with pkgs; -haskellPackages.mkDerivation { - pname = "xmobar"; - version = "0.1.0.0"; - src = ./.; - isLibrary = false; - isExecutable = true; - executableHaskellDepends = with haskellPackages; [ base xmobar ]; - license = "unknown"; - hydraPlatforms = lib.platforms.none; -} - diff --git a/home/programs/xmonad/src/xmobar/xmobar-custom.cabal b/home/programs/xmonad/src/xmobar/xmobar-custom.cabal deleted file mode 100644 index b96b13c..0000000 --- a/home/programs/xmonad/src/xmobar/xmobar-custom.cabal +++ /dev/null @@ -1,54 +0,0 @@ -cabal-version: 3.0 --- The cabal-version field refers to the version of the .cabal specification, --- and can be different from the cabal-install (the tool) version and the --- Cabal (the library) version you are using. As such, the Cabal (the library) --- version used must be equal or greater than the version stated in this field. --- Starting from the specification version 2.2, the cabal-version field must be --- the first thing in the cabal file. - --- Initial package description 'xmobar-custom' generated by --- 'cabal init'. For further documentation, see: --- http://haskell.org/cabal/users-guide/ --- --- The name of the package. -name: xmobar-custom - --- The package version. --- See the Haskell package versioning policy (PVP) for standards --- guiding when and how versions should be incremented. --- https://pvp.haskell.org --- PVP summary: +-+------- breaking API changes --- | | +----- non-breaking API additions --- | | | +--- code changes with no API change -version: 0.1.0.0 - --- The package author(s). -author: einfischy - --- An email address to which users can send suggestions, bug reports, and patches. -maintainer: accounts.codeberg@kstn.in - --- A copyright notice. --- copyright: -build-type: Simple - -common warnings - ghc-options: -Wall -threaded - -executable xmobar - -- Import common warning flags. - import: warnings - - -- .hs or .lhs file containing the Main module. - main-is: xmobar.hs - - -- Other library packages from which modules are imported. - build-depends: base >= 4.11.0 && < 4.20, - xmobar ^>=0.48 - - -- Directories containing source files. - hs-source-dirs: . - - -- Base language which the package is written in. - default-language: Haskell2010 - diff --git a/home/programs/xmonad/src/xmobar/xmobar.hs b/home/programs/xmonad/src/xmobar/xmobar.hs deleted file mode 100644 index 06ba80a..0000000 --- a/home/programs/xmonad/src/xmobar/xmobar.hs +++ /dev/null @@ -1,138 +0,0 @@ -import Xmobar ---import Plugins.Audio ---import Xmobar.Run.Exec ---import Xmobar (Command(ComX)) ---import GHC.Real (Integral(rem)) - - -config :: Config -config = - defaultConfig - { font = "Fira Code 10" - , position = TopH 25 - , borderColor = "#11111b" - , border = FullB - , borderWidth = 2 - , bgColor = "#1e1e2e" - , fgColor = "#f5e0dc" - , commands = - [ - --Run $ Audio 10 - Run $ Com "/bin/sh" ["-c", "Status=$(pulseaudio-ctl full-status); Volume=$(cut -d ' ' -f 1 <<<$Status); Mute=$(cut -d ' ' -f 2 <<<$Status); Microphone=$(cut -d ' ' -f 3 <<<$Status); SpeakerColor=\"#a6e3a1\"; MicColor=\"#a6e3a1\"; if [[ $Mute == \"yes\" ]]; then Symbol=\"\xf466\"; SpeakerColor=\"#f38ba8\"; elif [[ $Volume -le 100 ]]; then Symbol=\"\xf027\"; elseSymbol=\"\xf028\"; fi; if [[ $Microphone == \"yes\" ]]; then MicOut=\"\xf036d\"; MicColor=\"#f38ba8\"; else MicOut=\"\xf036c\"; fi; Volume=$(( Volume/2 )); echo \"$Symbol $Volume% $MicOut\""] "audio" 10 - --Run $ Com "/bin/sh" ["-c", "Status=$(pulseaudio-ctl full-status); - -- Volume=$(cut -d ' ' -f 1 <<<$Status); - -- Mute=$(cut -d ' ' -f 2 <<<$Status); - -- Microphone=$(cut -d ' ' -f 3 <<<$Status); - -- SpeakerColor=\"#a6e3a1\"; - -- MicColor=\"#a6e3a1\"; - -- if [[ $Mute == \"yes\" ]]; - -- then - -- Symbol=\"\xf466\"; - -- SpeakerColor=\"#f38ba8\"; - -- elif [[ $Volume -le 50 ]]; - -- then - -- Symbol=\"\xf027\"; - -- else Symbol=\"\xf028\"; - -- fi; - -- - -- if [[ $Microphone == \"yes\" ]]; - -- then - -- MicOut=\"\xf036d\"; - -- MicColor=\"#f38ba8\"; - -- else MicOut=\"\xf036c\"; - -- fi;xmobar.Run not found - -- - -- echo \"$Symbol $Volume% $MicOut\""] "audio" 10 - --Run $ Audio - --[ - -- "--template", "> % >" - -- , "" "" - --] 10 - -- Run $ Audio "#f38ba8" "#a6e3a1" "\xf466" "\xf027" "\xf027" "\xf036d" "\xf036c" 10 - --Run $ Audio "\xf017 %a %d.%m.%y %H:%M" "date" 300 - , Run $ Com "/bin/sh" ["-c", "echo \"\xf00e0 $(xbacklight -get)%\""] "backlight" 10 - , Run $ Cpu - [ - "--template", "\xf085 %" - , "--Low","3" - , "--High","50" - , "--low","#f5e0dc" - , "--normal","#f5e0dc" - , "--high","#f38ba8" - ] 50 - , Run $ Memory - [ - "-t","\xF2DB %" - ,"-H","80" - ,"-L","10" - ,"-l","#f5e0dc" - ,"-n","#f5e0dc" - ,"-h","#f38ba8" - ] 50 - , Run $ Date "\xf017 %a %d.%m.%y %H:%M" "date" 300 - , Run $ DynNetwork - [ - "-t","\xf063 \xf062 " - ,"-H","200" - ,"-L","10" - ,"-h","#f5e0dc" - ,"-l","#f5e0dc" - ,"-n","#f38ba8" - ] 50 - , Run $ BatteryP [ "BAT0" ] - [ - "--template" , "\xf240 " - , "--Low" , "10" -- units: % - , "--High" , "80" -- units: % - , "--low" , "#f38ba8" - , "--normal" , "#f5e0dc" - , "--high" , "#a6e3a1" - , "--" -- battery specific options - -- discharging status - , "-o" , "% ()" - -- AC "on" status - , "-O" , "% (Charging)" - -- charged status - , "-i" , "Charged" - ] 50 - , Run XMonadLog - ] - , sepChar = "%" - , alignSep = "}{" - , template = "%XMonadLog% }{ %audio% | %backlight% | %cpu% | %memory% | %battery% | %dynnetwork% | %date% " - } - ---instance Exec Audio where --- alias (Audio _ _ ) = "audio" --- start (Audio a r) = startAudio a r --- where --- startAudio :: [String] -> Int -> (String -> IO ()) -> IO () --- startAudio = - --Run $ Com "/bin/sh" ["-c", "Status=$(pulseaudio-ctl full-status); - -- Volume=$(cut -d ' ' -f 1 <<<$Status); - -- Mute=$(cut -d ' ' -f 2 <<<$Status); - -- Microphone=$(cut -d ' ' -f 3 <<<$Status); - -- SpeakerColor=\"#a6e3a1\"; - -- MicColor=\"#a6e3a1\"; - -- if [[ $Mute == \"yes\" ]]; - -- then - -- Symbol=\"\xf466\"; - -- SpeakerColor=\"#f38ba8\"; - -- elif [[ $Volume -le 50 ]]; - -- then - -- Symbol=\"\xf027\"; - -- else Symbol=\"\xf028\"; - -- fi; - -- - -- if [[ $Microphone == \"yes\" ]]; - -- then - -- MicOut=\"\xf036d\"; - -- MicColor=\"#f38ba8\"; - -- else MicOut=\"\xf036c\"; - -- fi; - -- - -- echo \"$Symbol $Volume% $MicOut\""] "audio" 10 - -main :: IO () -main = xmobar config - diff --git a/home/programs/xmonad/src/xmonad.hs b/home/programs/xmonad/src/xmonad.hs index a3654b8..971c5d7 100644 --- a/home/programs/xmonad/src/xmonad.hs +++ b/home/programs/xmonad/src/xmonad.hs @@ -59,6 +59,8 @@ myKeys = , ("", spawn "pactl set-sink-volume @DEFAULT_SINK@ +10%") , ("", spawn "pactl set-sink-volume @DEFAULT_SINK@ -10%") , ("", spawn "pactl set-source-mute @DEFAULT_SOURCE@ toggle") + , -- Powerbutton + ("", spawn "/home/$USER/.config/eww/scripts/powermenu.sh") ] -- `removeKeysP` [ "M-S-q" ]