Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
added bar location changer + fixed bugs
Browse files Browse the repository at this point in the history
c00l ep1c gamEr momentzz
  • Loading branch information
skver0 committed Dec 26, 2018
1 parent d87b5fb commit 41f0fb4
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 45 additions & 10 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace x1
{
Expand Down Expand Up @@ -92,18 +93,35 @@ public Main()
bool helpdialog = false;
PowerStatus battery = SystemInformation.PowerStatus;
Help help = new Help();

string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);

private void Main_Load(object sender, EventArgs e)
{


SetProcessDPIAware();
spotifytrack.Anchor = AnchorStyles.Right;
seperator.Anchor = AnchorStyles.Right;
btry.Anchor = AnchorStyles.Right;
time.Anchor = AnchorStyles.Right;
panel_StuffHere.Anchor = AnchorStyles.Right;

Width = Screen.PrimaryScreen.Bounds.Width;
if (File.Exists(appdata + "/x1left"))
{
Width = 62;
spotifytrack.Anchor = AnchorStyles.Right;
seperator.Anchor = AnchorStyles.Right;
btry.Anchor = AnchorStyles.Right;
time.Anchor = AnchorStyles.Right;
panel_StuffHere.Anchor = AnchorStyles.Right;

Height = Screen.PrimaryScreen.Bounds.Height;
}
else
{
spotifytrack.Anchor = AnchorStyles.Right;
seperator.Anchor = AnchorStyles.Right;
btry.Anchor = AnchorStyles.Right;
time.Anchor = AnchorStyles.Right;
panel_StuffHere.Anchor = AnchorStyles.Right;

Width = Screen.PrimaryScreen.Bounds.Width;
}

t1.Start();

Expand Down Expand Up @@ -183,8 +201,25 @@ bool IsOnDesktop()
#region haha im epic
private void t1_Tick(object sender, EventArgs e)
{
var ScreenHeight = Screen.PrimaryScreen.Bounds.Height;
Location = new Point(0, ScreenHeight - 40);
if (File.Exists(appdata + "/x1left"))
{
// idfk how to do it its hard man please make a pull request thanks
Location = new Point(0, 0);
}

if (File.Exists(appdata + "/x1top"))
{
Location = new Point(0, 0);
}
else
{
if (!File.Exists(appdata + "/x1left"))
{
var ScreenHeight = Screen.PrimaryScreen.Bounds.Height;
Location = new Point(0, ScreenHeight - 40);
}
}


Rectangle window = new Rectangle();
Rectangle edited = new Rectangle();
Expand All @@ -199,7 +234,7 @@ private void t1_Tick(object sender, EventArgs e)
//label1.Text = Convert.ToString(GetDesktopWindow());

//this is so fucking retarded that i dont even know why it doesnt work only if i add a retarded bool that checks every process this is anoying. install gentoo

if (edited.Height >= Screen.PrimaryScreen.Bounds.Height && edited.Width >= Screen.PrimaryScreen.Bounds.Width && GetActiveWindowTitle() != "" && GetForegroundWindow() != null && GetForegroundWindow() != GetShellWindow() && GetForegroundWindow() != GetDesktopWindow() && !IsOnDesktop())
{
Hide();
Expand Down
69 changes: 64 additions & 5 deletions help.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace x1
{
Expand All @@ -16,5 +17,66 @@ public Help()
{
InitializeComponent();
}
string appdata = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
//tfw you are too lazy to code a left sided bar
try
{
if (checkBox1.Checked)
{
if (!checkBox2.Checked)
File.Create(appdata + "/x1left");
}
else
{
if (!checkBox2.Checked)
File.Delete(appdata + "/x1left");
}
}
catch (Exception ex)
{
}
}

private void Help_Load(object sender, EventArgs e)
{
try
{
if (File.Exists(appdata + "/x1left"))
{
checkBox1.Checked = true;
}

if (File.Exists(appdata + "/x1top"))
{
checkBox2.Checked = true;
}
}
catch (Exception ex)
{
}

}

private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
try
{
if (checkBox2.Checked)
{
if (!checkBox1.Checked)
File.Create(appdata + "/x1top");
}
else
{
if (!checkBox1.Checked)
File.Delete(appdata + "/x1top");
}
}
catch (Exception ex)
{
}
}
}
}

0 comments on commit 41f0fb4

Please sign in to comment.