sway stuff

This commit is contained in:
2024-06-02 20:54:00 +01:00
parent aeed8760b8
commit 5929600955
2 changed files with 74 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
#!/bin/sh
function move {
CURR_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '. | map(select(.focused == true)) | .[0].name')
@@ -8,6 +10,7 @@ function move {
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} + 1)
;;
"prev")
[ ${CURR_WORKSPACE} -eq 1 ] && exit 0
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} - 1)
;;
esac
@@ -16,8 +19,30 @@ function move {
swaymsg "workspace ${NEW_WORKSPACE}"
}
function focus {
CURR_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '. | map(select(.focused == true)) | .[0].name')
echo $CURR_WORKSPACE
case $1 in
"next")
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} + 1)
;;
"prev")
[ ${CURR_WORKSPACE} -eq 1 ] && exit 0
NEW_WORKSPACE=$(expr ${CURR_WORKSPACE} - 1)
;;
esac
swaymsg "workspace ${NEW_WORKSPACE}"
}
case $1 in
"move")
move $2
;;
"focus")
focus $2
;;
esac

View File

@@ -31,6 +31,51 @@ in {
wayland.windowManager.sway = {
enable = true;
config = {
bars = [
{
mode = "dock";
hiddenState = "hide";
position = "bottom";
workspaceButtons = true;
workspaceNumbers = true;
statusCommand = "${pkgs.i3status}/bin/i3status";
fonts = {
names = ["monospace"];
size = 12.0;
};
trayOutput = "primary";
colors = {
background = "#000000";
statusline = "#ffffff";
separator = "#666666";
focusedWorkspace = {
border = "#4c7899";
background = "#285577";
text = "#ffffff";
};
activeWorkspace = {
border = "#333333";
background = "#5f676a";
text = "#ffffff";
};
inactiveWorkspace = {
border = "#333333";
background = "#222222";
text = "#888888";
};
urgentWorkspace = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
bindingMode = {
border = "#2f343a";
background = "#900000";
text = "#ffffff";
};
};
}
];
input = {
"*" = {
xkb_layout = "gb";
@@ -57,11 +102,11 @@ in {
"${mod}+Down" = "movewindow down";
"${mod}+Right" = "movewindow right";
"${mod}+Shift+h" = "swayutils move prev";
"${mod}+Shift+l" = "swayutils move next";
"${mod}+Shift+h" = "exec ${config.home.homeDirectory}/bin/swayutils move prev";
"${mod}+Shift+l" = "exec ${config.home.homeDirectory}/bin/swayutils move next";
"${mod}+Control+h" = "workspace prev";
"${mod}+Control+l" = "workspace next";
"${mod}+Control+h" = "exec ${config.home.homeDirectory}/bin/swayutils focus prev";
"${mod}+Control+l" = "exec ${config.home.homeDirectory}/bin/swayutils focus next";
"${hyper}+y" = "move left";
"${hyper}+o" = "move right";