Skip to content

Commit d513ee8

Browse files
committed
Added draggability
1 parent 565e7b3 commit d513ee8

29 files changed

+202
-62
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
The theme features:
1414

15+
- Draggable windows!
1516
- Multi-monitor support!
1617
- Multi-language support!
1718
- Custom time and date formats!

aur/.SRCINFO

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pkgbase = web-greeter-theme-shikai
22
pkgdesc = Modern lightdm webkit2 theme
3-
pkgver = 1.2.1
4-
pkgrel = 3
3+
pkgver = 1.3.0
4+
pkgrel = 4
55
url = https://github.com/TheWisker/Shikai
66
arch = any
77
license = GPL

aur/PKGBUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Maintainer: Wisker <TheWisker@protonmail.com>
22
pkgname=web-greeter-theme-shikai
33
pkgbase=web-greeter-theme-shikai
4-
pkgver=1.2.1
5-
pkgrel=3
4+
pkgver=1.3.0
5+
pkgrel=4
66
pkgdesc="Modern lightdm webkit2 theme"
77
arch=('any')
88
url="https://github.com/TheWisker/Shikai"

dist/index.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/monitor.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

+24-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shikai",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "Modern lightdm webkit2 theme",
55
"keywords": [
66
"lightdm",
@@ -56,6 +56,7 @@
5656
"react": "^18.2.0",
5757
"react-color": "^2.19.3",
5858
"react-dom": "^18.2.0",
59+
"react-draggable": "^4.4.5",
5960
"react-dropdown": "^1.11.0",
6061
"react-redux": "^8.0.5",
6162
"redux": "^4.2.1"

src/assets/drag.svg

+1
Loading

src/css/_bars.scss

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
&:nth-last-child(1) {
2828
width: 35px;
29+
padding: 0 8px;
2930
min-width: 35px;
3031

3132
svg {
@@ -117,6 +118,7 @@
117118

118119
input[type="text"] {margin: 0 0 0 15px;}
119120
}
121+
120122
.colorsbar {
121123
@include general.flex-center;
122124
margin: 0 0 15px 0;
@@ -131,7 +133,7 @@
131133

132134
.text {
133135
color: #A0A0A0;
134-
font-size: 0.9em;
136+
font-size: 0.8em;
135137
margin: 0 0 10px 0;
136138
text-align: center;
137139
}

src/css/_objects.scss

+29
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.notification {
44
@include general.font;
55
@include general.flex-center;
6+
67
height: 50px; width: 40%;
78
transition: opacity ease-in 500ms;
89
border: 5px solid #e6e6e6;
@@ -40,6 +41,34 @@
4041
&:active {opacity: 0.55;}
4142
}
4243

44+
#settings_handle, #login_handle {
45+
display: flex;
46+
padding: 0 8px;
47+
cursor: pointer;
48+
align-items: center;
49+
justify-content: center;
50+
51+
svg {
52+
opacity: 0.4;
53+
height: 25px;
54+
width: 25px;
55+
56+
&:hover {opacity: 0.6}
57+
&:active {opacity: 1}
58+
}
59+
}
60+
61+
62+
#settings_handle {
63+
height: 100%;
64+
background-color: rgba(40, 40, 40, 0.8);
65+
}
66+
67+
#login_handle {
68+
position: absolute;
69+
right: 1px; top: 10px;
70+
}
71+
4372
.logo {
4473
@include general.flex;
4574
@include general.square;

src/css/_windows.scss

+28-18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ $login_height: 500px;
1616
z-index: 100;
1717
}
1818

19+
#settingroot .react-draggable {
20+
top: 0;
21+
bottom: 0;
22+
z-index: 2;
23+
height: 100%;
24+
position: absolute;
25+
}
26+
1927
.settingwindow {
2028
@include general.flex(column);
2129

@@ -24,36 +32,38 @@ $login_height: 500px;
2432
z-index: 2;
2533
height: 100%;
2634
min-height: 0;
35+
overflow: hidden;
2736
position: absolute;
28-
transition: left 400ms;
29-
width: $settings_width;
30-
left: -#{$settings_width};
31-
border-radius: 0 16px 16px 0;
37+
border-radius: 25px;
38+
transition: transform 400ms, border-radius 500ms;
39+
width: $settings_width; left: 0;
3240
}
3341

34-
.settingwindow.active {
35-
left: 0;
36-
}
42+
.settingwindow.origin_left {border-radius: 0 25px 25px 0 !important;}
43+
.settingwindow.origin_right {border-radius: 25px 0 0 25px !important;}
3744

3845
.loginwindow {
3946
@include general.flex;
4047

4148
top: 50%;
4249
left: 50%;
4350
z-index: 1;
44-
overflow: hidden;
4551
position: absolute;
46-
border-radius: 16px;
4752
width: $login_width;
4853
height: $login_height;
49-
transition: transform cubic-bezier(.47,1.64,.41,.8) 700ms, translate cubic-bezier(.47,1.64,.41,.8) 700ms, scale cubic-bezier(.47,1.64,.41,.8) 1000ms, opacity cubic-bezier(.47,1.64,.41,.8) 1500ms;
54+
transition: transform cubic-bezier(0.65, 1.75, 0.62, 0.68) 1200ms, translate cubic-bezier(0.65, 1.75, 0.62, 0.68) 1200ms, scale cubic-bezier(0.65, 1.75, 0.62, 0.68) 1000ms, opacity cubic-bezier(.47,1.64,.41,.8) 1500ms;
5055
margin: -#{math.div($login_height, 2)} 0 0 -#{math.div($login_width, 2)};
51-
}
5256

53-
/*
54-
margin: -22.5vh 0 0 -22.5vw;
55-
width: 45%;
56-
height: 45%;
57-
min-width: 850px;
58-
min-height: 500px;
59-
*/
57+
& > div {
58+
@include general.flex;
59+
width: 100%; height: 100%;
60+
61+
& > div {
62+
@include general.flex;
63+
width: 100%; height: 100%;
64+
transition: border-radius 500ms;
65+
border-radius: 18px;
66+
overflow: hidden;
67+
}
68+
}
69+
}

src/js/Components/LoginWindow/Sidebar/Options.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class Option extends React.Component {
3030
class Options extends React.Component {
3131
render() {
3232
let array = [];
33-
console.log(this.props.lang)
3433
options.filter((option) => {return this.props.commands[option.text]}).forEach((option, i) => {array[i] = <Option text={data.get(this.props.lang, "commands.names." + option.text)} func={option.func} icon={<option.icon/>} color={this.props.color} key={option.text}/>});
3534
return (<div className="commandbar">{array}</div>);
3635
}

src/js/Components/LoginWindow/Userbar/index.jsx

+5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ import Session from "./Session";
99
import Switch from "./Switch";
1010
import Date from "./Date";
1111

12+
import Drag from "../../../../assets/drag.svg";
13+
1214
class Userbar extends React.Component {
1315
componentDidMount() {document.getElementById("password").focus();}
1416

1517
render() {
1618
return (<div className={"userbar " + cxs({background: `linear-gradient(${this.props.background.top} 0%, ${this.props.background.bottom} 100%)`})}>
19+
<div id="login_handle" onDoubleClick={() => {this.props.action()}}>
20+
<Drag/>
21+
</div>
1722
<Avatar/>
1823
<Username/>
1924
<form className="expand" onSubmit={(e) => {e.preventDefault()}}>
+35-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
11
import React from "react";
2+
import Draggable from "react-draggable";
23

34
import Sidebar from "./Sidebar";
45
import Userbar from "./Userbar";
56

6-
export default () => {
7-
return (<React.Fragment>
8-
<Sidebar/>
9-
<Userbar/>
10-
</React.Fragment>);
7+
const window_height = 500;
8+
const window_width = 850;
9+
10+
export default class LoginWindow extends React.Component {
11+
constructor(props) {
12+
super(props);
13+
if (!localStorage.getItem("LoginDrag")) {localStorage.setItem("LoginDrag", JSON.stringify({x: 0, y: 0}))}
14+
this.state = {data: JSON.parse(localStorage.getItem("LoginDrag"))};
15+
this.dragEvent = this.dragEvent.bind(this);
16+
this.dragStop = this.dragStop.bind(this);
17+
}
18+
19+
dragEvent(_, _data) {this.setState({data: {x: _data.x, y: _data.y}});}
20+
21+
dragStop(_, data) {localStorage.setItem("LoginDrag", JSON.stringify({x: data.x, y: data.y}));}
22+
//{left: ((screen.availWidth/2) - (window_width/2)), right: ((screen.availWidth/2) + (window_width)), top: (screen.availHeight/2) - (window_height/2), bottom: (screen.availHeight/2) + (window_height)}
23+
render() { //disabled={!this.props.active}
24+
//if (this.state.data.x == 0) {classes.push("origin_left");}
25+
//if (this.state.data.x == screen.availWidth - window_width) {classes.push("origin_right");}
26+
//let t = (this.props.active) ? null : ("translate(" + (((this.state.data.x + (window_width/2)) <= (screen.availWidth/2)) ? (-(this.state.data.x + window_width)) : (screen.availWidth - this.state.data.x)) + "px, 0px)");
27+
let bounds = {left: -((screen.availWidth/2) - (window_width/2)), right: ((screen.availWidth/2) - (window_width/2)), top: -((screen.availHeight/2) - (window_height/2)), bottom: ((screen.availHeight/2) - (window_height/2))};
28+
return (<Draggable axis="both" handle="#login_handle" bounds={bounds} position={this.state.data} onDrag={this.dragEvent} onStop={this.dragStop}>
29+
<div id="login_drag">
30+
<div style={{borderTopLeftRadius: (this.state.data.x == bounds.left || this.state.data.y == bounds.top) ? "0px" : null, borderTopRightRadius: (this.state.data.x == bounds.right || this.state.data.y == bounds.top) ? "0px" : null, borderBottomLeftRadius: (this.state.data.x == bounds.left || this.state.data.y == bounds.bottom) ? "0px" : null, borderBottomRightRadius: (this.state.data.x == bounds.right || this.state.data.y == bounds.bottom) ? "0px" : null}}>
31+
<Sidebar/>
32+
<Userbar action={() => {
33+
document.getElementById("login_drag").style.transition = "transform 400ms";
34+
this.dragEvent(null, {x: 0, y: 0}); this.dragStop(null, {x: 0, y: 0});
35+
setTimeout(() => {document.getElementById("login_drag").style.transition = "";}, 400);
36+
}}/>
37+
</div>
38+
</div>
39+
</Draggable>);
40+
}
1141
}

src/js/Components/SettingsWindow/Sectionbar/index.jsx

+4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import React from "react";
22
import {connect} from "react-redux";
33

4+
import Drag from "../../../../assets/drag.svg";
45
import Image from "../../../../assets/close.svg";
56

67
import {data} from "../../../../lang";
78

89
class Sectionbar extends React.Component {
910
render() {
1011
return (<div className="sectionbar">
12+
<div id="settings_handle" onDoubleClick={() => {this.props.reset()}}>
13+
<Drag/>
14+
</div>
1115
<div className="text button" onClick={this.props.action}>{data.get(this.props.lang, "settings.behaviour.name")}</div>
1216
<div className="text button" onClick={() => this.props.action("style")}>{data.get(this.props.lang, "settings.style.name")}</div>
1317
<div className="text button" onClick={() => this.props.action("themes")}>{data.get(this.props.lang, "settings.themes.name")}</div>

src/js/Components/SettingsWindow/Sections/Inputs/Textarea.jsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ export default class Textarea extends React.Component {
88
}
99

1010
update(event) {
11-
this.setState({value: event.target.value.slice(0, -1)});
12-
this.props.action(event.target.value.slice(0, -1));
11+
let inx = (event.target.value.slice(-1) == ";") ? -1 : -2;
12+
this.setState({value: event.target.value.slice(0, inx)});
13+
this.props.action(event.target.value.slice(0, inx));
1314
event.preventDefault();
1415
}
1516

src/js/Components/SettingsWindow/Sections/Style.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {data} from "../../../../lang";
99
class Style extends React.Component {
1010
render() {
1111
return (<React.Fragment>
12-
<div className="scroll" style={{paddingBottom: "25px"}}>
12+
<div style={{paddingBottom: "25px"}}>
1313
<div className="section">
1414
<div className="text title">{data.get(this.props.lang, "settings.style.sections.main.name")}</div>
1515
<Logo/>

0 commit comments

Comments
 (0)