Skip to content

Commit

Permalink
Improved autolock functionality, relocated styles
Browse files Browse the repository at this point in the history
- Adjusted autolock behavior for a smoother transition to the lock screen
- Relocated lock screen, login screen, and launcher styles to the styles directory
- Updated default lock behavior to use loginctl

Signed-off-by: Kajus Naujokaitis <[email protected]>
  • Loading branch information
kajusnau authored and brianmcgillion committed Oct 23, 2024
1 parent 0396a4f commit a0dd094
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 71 deletions.
3 changes: 1 addition & 2 deletions modules/desktop/graphics/ewwbar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ let

cfg = config.ghaf.graphics.labwc;
audio-ctrl = pkgs.callPackage ../../../packages/audio-ctrl { };
gtklockStyle = pkgs.callPackage ./styles/gtk-lock.nix { };

launcher-icon = "${pkgs.ghaf-artwork}/icons/launcher.svg";

Expand Down Expand Up @@ -593,7 +592,7 @@ in
:class "power-menu-button"
:icon "${lock-icon}"
:title "Lock"
:onclick "${eww-popup}/bin/eww-popup power-menu & ${pkgs.gtklock}/bin/gtklock -s ${gtklockStyle} &")))
:onclick "${eww-popup}/bin/eww-popup power-menu & loginctl lock-session &")))
;; Quick Settings Buttons ;;
(defwidget settings_buttons []
Expand Down
46 changes: 2 additions & 44 deletions modules/desktop/graphics/ghaf-launcher.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }:
let
drawerCSS = pkgs.writeTextDir "nwg-drawer/drawer.css" ''
/* Example configuration from: https://github.com/nwg-piotr/nwg-drawer/blob/main/drawer.css */
window {
background-color: #121212;
color: #fff;
}
/* search entry */
entry {
background-color: rgba (43, 43, 43, 1);
border: 1px solid rgba(46, 46, 46, 1);
}
entry:focus {
box-shadow: none;
border: 1px solid rgba(223, 92, 55, 1);
}
button, image {
background: none;
border: none;
box-shadow: none;
}
button:hover {
background-color: rgba (255, 255, 255, 0.06);
}
/* in case you wanted to give category buttons a different look */
#category-button {
margin: 0 10px 0 10px;
}
#pinned-box {
padding-bottom: 5px;
border-bottom: 1px dotted gray;
}
#files-box {
padding: 5px;
border: 1px dotted gray;
border-radius: 15px;
}
'';
drawerCSS = pkgs.callPackage ./styles/launcher-style.nix { };
in
pkgs.writeShellApplication {
name = "ghaf-launcher";
Expand All @@ -63,6 +21,6 @@ pkgs.writeShellApplication {
rm -rf "$HOME/.config/nwg-drawer"
#ln -s "${drawerCSS}/nwg-drawer" "$HOME/.config/"
nwg-drawer -r -nofs -nocats -s ${drawerCSS}/nwg-drawer/drawer.css
nwg-drawer -r -nofs -nocats -s ${drawerCSS}
'';
}
13 changes: 10 additions & 3 deletions modules/desktop/graphics/labwc.config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let

audio-ctrl = pkgs.callPackage ../../../packages/audio-ctrl { };
ghaf-screenshot = pkgs.callPackage ../../../packages/ghaf-screenshot { };
gtklockStyle = pkgs.callPackage ./styles/gtk-lock.nix { };
gtklockStyle = pkgs.callPackage ./styles/lock-style.nix { };
lockCmd = "${pkgs.gtklock}/bin/gtklock -s ${gtklockStyle}";
ghaf-launcher = pkgs.callPackage ./ghaf-launcher.nix { inherit config pkgs; };
autostart = pkgs.writeShellApplication {
Expand Down Expand Up @@ -68,7 +68,7 @@ let
<keyboard>
<default />
<keybind key="W-l">
<action name="Execute" command="${lockCmd}" />
<action name="Execute" command="loginctl lock-session" />
</keybind>
${lib.optionalString config.ghaf.profiles.debug.enable ''
<keybind key="Print">
Expand Down Expand Up @@ -265,7 +265,14 @@ in
Type = "simple";
ExecStart = ''
${pkgs.swayidle}/bin/swayidle -w timeout ${builtins.toString cfg.autolock.duration} \
'${pkgs.chayang}/bin/chayang && ${lockCmd}'
# Start dimming for 3.5 seconds in the background
'${pkgs.chayang}/bin/chayang -d 3.5 & CHAYANG_PID=$!; \
sleep 3; \
# If chayang is still running (i.e., user hasn't interrupted),
# proceed with locking
if kill -0 $CHAYANG_PID 2>/dev/null; then \
loginctl lock-session; \
fi'
'';
};
partOf = [ "ghaf-session.target" ];
Expand Down
23 changes: 2 additions & 21 deletions modules/desktop/graphics/login-manager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,8 @@
}:
let
cfg = config.ghaf.graphics.login-manager;
gtkgreetStyle = pkgs.writeText "gtkgreet.css" ''
window {
background: rgba(18, 18, 18, 1);
color: #fff;
}
button {
box-shadow: none;
border-radius: 5px;
border: 1px solid rgba(255, 255, 255, 0.09);
background: rgba(255, 255, 255, 0.06);
}
entry {
background-color: rgba (43, 43, 43, 1);
border: 1px solid rgba(46, 46, 46, 1);
color: #eee;
}
entry:focus {
box-shadow: none;
border: 1px solid rgba(223, 92, 55, 1);
}
'';

gtkgreetStyle = pkgs.callPackage ./styles/login-style.nix { };
in
{
options.ghaf.graphics.login-manager = {
Expand Down
51 changes: 51 additions & 0 deletions modules/desktop/graphics/styles/launcher-style.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0

# Ghaf app launcher style
{
pkgs,
...
}:
pkgs.writeText "ghaf-launcher.css" ''
/* Example configuration from: https://github.com/nwg-piotr/nwg-drawer/blob/main/drawer.css */
window {
background-color: #121212;
color: #fff;
}
/* search entry */
entry {
background-color: rgba (43, 43, 43, 1);
border: 1px solid rgba(46, 46, 46, 1);
}
entry:focus {
box-shadow: none;
border: 1px solid rgba(223, 92, 55, 1);
}
button, image {
background: none;
border: none;
box-shadow: none;
}
button:hover {
background-color: rgba (255, 255, 255, 0.06);
}
/* in case you wanted to give category buttons a different look */
#category-button {
margin: 0 10px 0 10px;
}
#pinned-box {
padding-bottom: 5px;
border-bottom: 1px dotted gray;
}
#files-box {
padding: 5px;
border: 1px dotted gray;
border-radius: 15px;
}
''
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0

# Ghaf lock screen style
{
pkgs,
...
}:
pkgs.writeText "gtklock.css" ''
pkgs.writeText "ghaf-lock.css" ''
window {
background: rgba(18, 18, 18, 1);
color: #fff;
Expand Down
29 changes: 29 additions & 0 deletions modules/desktop/graphics/styles/login-style.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2022-2024 TII (SSRC) and the Ghaf contributors
# SPDX-License-Identifier: Apache-2.0

# Ghaf login screen style
{
pkgs,
...
}:
pkgs.writeText "ghaf-login.css" ''
window {
background: rgba(18, 18, 18, 1);
color: #fff;
}
button {
box-shadow: none;
border-radius: 5px;
border: 1px solid rgba(255, 255, 255, 0.09);
background: rgba(255, 255, 255, 0.06);
}
entry {
background-color: rgba (43, 43, 43, 1);
border: 1px solid rgba(46, 46, 46, 1);
color: #eee;
}
entry:focus {
box-shadow: none;
border: 1px solid rgba(223, 92, 55, 1);
}
''

0 comments on commit a0dd094

Please sign in to comment.